summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--www/firefox/Makefile10
-rw-r--r--www/firefox/PLIST126
-rw-r--r--www/firefox/distinfo73
-rw-r--r--www/firefox/mozilla-common.mk9
-rw-r--r--www/firefox/patches/patch-aa60
-rw-r--r--www/firefox/patches/patch-as82
-rw-r--r--www/firefox/patches/patch-config_Makefile.in12
-rw-r--r--www/firefox/patches/patch-config_baseconfig.mk8
-rw-r--r--www/firefox/patches/patch-config_stl-headers12
-rw-r--r--www/firefox/patches/patch-config_system-headers32
-rw-r--r--www/firefox/patches/patch-ipc_chromium_src_base_file__util.h13
-rw-r--r--www/firefox/patches/patch-ipc_chromium_src_base_file__util__posix.cc35
-rw-r--r--www/firefox/patches/patch-js__src__vm__SPSProfiler.cpp14
-rw-r--r--www/firefox/patches/patch-js_src_Makefile.in50
-rw-r--r--www/firefox/patches/patch-js_src_config_Makefile.in12
-rw-r--r--www/firefox/patches/patch-js_src_config_system-headers32
-rw-r--r--www/firefox/patches/patch-js_src_gdb_Makefile.in15
-rw-r--r--www/firefox/patches/patch-js_src_jsapi-tests_Makefile.in15
-rw-r--r--www/firefox/patches/patch-js_src_shell_Makefile.in14
-rw-r--r--www/firefox/patches/patch-js_src_vm_ObjectImpl-inl.h31
-rw-r--r--www/firefox/patches/patch-media_mtransport_objs.mk22
-rw-r--r--www/firefox/patches/patch-media_mtransport_test_Makefile.in20
-rw-r--r--www/firefox/patches/patch-media_mtransport_third__party_nICEr_nicer.gyp33
-rw-r--r--www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_stun_addrs.c32
-rw-r--r--www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_stun_stun.h20
-rw-r--r--www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_util_mbslen.c78
-rw-r--r--www/firefox/patches/patch-media_mtransport_third__party_nrappkit_nrappkit.gyp32
-rw-r--r--www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_log_r__log.c12
-rw-r--r--www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h6
-rw-r--r--www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_util_util.c12
-rw-r--r--www/firefox/patches/patch-media_webrtc_signaling_signaling.gyp47
-rw-r--r--www/firefox/patches/patch-media_webrtc_signaling_src_sipcc_cpr_darwin_cpr__darwin__ipc.c20
-rw-r--r--www/firefox/patches/patch-media_webrtc_signaling_test_Makefile.in15
-rw-r--r--www/firefox/patches/patch-media_webrtc_trunk_build_build__config.h41
-rw-r--r--www/firefox/patches/patch-media_webrtc_trunk_tools_gyp_pylib_gyp_generator_mozmake.py55
-rw-r--r--www/firefox/patches/patch-media_webrtc_trunk_webrtc_build_common.gypi10
-rw-r--r--www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_audio__device_audio__device__impl.cc71
-rw-r--r--www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_audio__device_test_audio__device__test__api.cc31
-rw-r--r--www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture__factory.cc15
-rw-r--r--www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_clock.cc31
-rw-r--r--www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_condition__variable.cc13
-rw-r--r--www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp3402
-rw-r--r--www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_thread__posix.cc39
-rw-r--r--www/firefox/patches/patch-mfbt_Atomics.h13
-rw-r--r--www/firefox/patches/patch-modules_libpref_src_init_all.js13
-rw-r--r--www/firefox/patches/patch-netwerk_wifi_moz.build10
-rw-r--r--www/firefox/patches/patch-toolkit_library_Makefile.in17
-rw-r--r--www/firefox/patches/patch-toolkit_toolkit.mozbuild12
-rw-r--r--www/firefox/patches/patch-xpcom_base_nsMemoryInfoDumper.cpp31
-rw-r--r--www/firefox/patches/patch-xpcom_base_nsMemoryReporterManager.cpp106
-rw-r--r--www/firefox/patches/patch-xpcom_ds_moz.build10
51 files changed, 3828 insertions, 1096 deletions
diff --git a/www/firefox/Makefile b/www/firefox/Makefile
index b19c070b94d..6300c9b1906 100644
--- a/www/firefox/Makefile
+++ b/www/firefox/Makefile
@@ -1,12 +1,11 @@
-# $NetBSD: Makefile,v 1.147 2013/11/25 12:00:48 wiz Exp $
+# $NetBSD: Makefile,v 1.148 2013/12/15 13:54:37 ryoon Exp $
FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
-MOZ_BRANCH= 25.0.1
+MOZ_BRANCH= 26.0
MOZ_BRANCH_MINOR=
DISTNAME= firefox-${FIREFOX_VER}.source
PKGNAME= firefox-${MOZ_BRANCH}${MOZ_BRANCH_MINOR:S/b/beta/:S/esr//}
-PKGREVISION= 1
CATEGORIES= www
MASTER_SITES= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
#MASTER_SITES+= ${MASTER_SITE_MOZILLA_ALL:=firefox/releases/${FIREFOX_VER}/source/}
@@ -23,6 +22,8 @@ MOZILLA_DIR= # empty
# Note: when updating remember to conditionalise about-background.png in PLIST
# XXX Firefox 21.0's firefox/xulrunner separation is not working.
+#CONFIGURE_ARGS+= --with-libxul-sdk
+#CONFIGURE_ARGS+= --with-system-libxul
CONFIGURE_ARGS+= --enable-application=browser
# workround for link of libxul.so etc.
@@ -54,7 +55,7 @@ CHECK_INTERPRETER_SKIP+=lib/firefox-sdk/sdk/bin/xpidl.py
CHECK_INTERPRETER_SKIP+=lib/firefox-sdk/sdk/bin/xpt.py
MOZILLA=firefox
-MOZILLA_ICON= ${WRKSRC}/dist/firefox/browser/chrome/icons/default/default48.png
+MOZILLA_ICON= ${WRKSRC}/${OBJDIR}/dist/firefox/browser/chrome/icons/default/default48.png
.if !empty(PKG_OPTIONS:Mofficial-mozilla-branding)
MOZILLA_NAME= Firefox
.else
@@ -68,6 +69,7 @@ SUBST_FILES.sys-dic= extensions/spellcheck/hunspell/src/mozHunspell.cpp
SUBST_VARS.sys-dic= PREFIX
pre-configure:
+ cd ${WRKSRC} && mkdir ${OBJDIR}
cd ${WRKSRC} && autoconf
cd ${WRKSRC}/js/src && autoconf
# XXX Makefile is broken? When libxul is provided from devel/xulrunner,
diff --git a/www/firefox/PLIST b/www/firefox/PLIST
index f3f3d128561..d24434d357a 100644
--- a/www/firefox/PLIST
+++ b/www/firefox/PLIST
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.75 2013/11/02 22:57:55 ryoon Exp $
+@comment $NetBSD: PLIST,v 1.76 2013/12/15 13:54:37 ryoon Exp $
bin/firefox
lib/firefox/application.ini
lib/firefox/browser/blocklist.xml
@@ -26,6 +26,7 @@ lib/firefox/browser/chrome/browser/content/browser/aboutRobots.xhtml
lib/firefox/browser/chrome/browser/content/browser/aboutSessionRestore.js
lib/firefox/browser/chrome/browser/content/browser/aboutSessionRestore.xhtml
lib/firefox/browser/chrome/browser/content/browser/aboutSocialError.xhtml
+lib/firefox/browser/chrome/browser/content/browser/aboutTabCrashed.xhtml
lib/firefox/browser/chrome/browser/content/browser/aboutWelcomeBack.xhtml
lib/firefox/browser/chrome/browser/content/browser/abouthealthreport/abouthealth.css
lib/firefox/browser/chrome/browser/content/browser/abouthealthreport/abouthealth.js
@@ -72,6 +73,17 @@ lib/firefox/browser/chrome/browser/content/browser/chatWindow.xul
lib/firefox/browser/chrome/browser/content/browser/content-sessionStore.js
lib/firefox/browser/chrome/browser/content/browser/content.js
lib/firefox/browser/chrome/browser/content/browser/devtools/NetworkPanel.xhtml
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/connection-footer.js
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/connection-footer.xhtml
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/device.js
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/device.xhtml
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/help.xhtml
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/index.js
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/index.xul
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/projects.js
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/projects.xhtml
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/template.js
+lib/firefox/browser/chrome/browser/content/browser/devtools/app-manager/utils.js
lib/firefox/browser/chrome/browser/content/browser/devtools/cleopatra.html
lib/firefox/browser/chrome/browser/content/browser/devtools/commandline.css
lib/firefox/browser/chrome/browser/content/browser/devtools/commandlineoutput.xhtml
@@ -227,8 +239,6 @@ lib/firefox/browser/chrome/browser/content/browser/preferences/in-content/securi
lib/firefox/browser/chrome/browser/content/browser/preferences/in-content/security.xul
lib/firefox/browser/chrome/browser/content/browser/preferences/in-content/sync.js
lib/firefox/browser/chrome/browser/content/browser/preferences/in-content/sync.xul
-lib/firefox/browser/chrome/browser/content/browser/preferences/in-content/tabs.js
-lib/firefox/browser/chrome/browser/content/browser/preferences/in-content/tabs.xul
lib/firefox/browser/chrome/browser/content/browser/preferences/languages.js
lib/firefox/browser/chrome/browser/content/browser/preferences/languages.xul
lib/firefox/browser/chrome/browser/content/browser/preferences/main.js
@@ -263,6 +273,7 @@ lib/firefox/browser/chrome/browser/content/browser/search/searchbarBindings.css
lib/firefox/browser/chrome/browser/content/browser/setDesktopBackground.js
lib/firefox/browser/chrome/browser/content/browser/setDesktopBackground.xul
lib/firefox/browser/chrome/browser/content/browser/socialchat.xml
+lib/firefox/browser/chrome/browser/content/browser/socialmarks.xml
lib/firefox/browser/chrome/browser/content/browser/sync/aboutSyncTabs-bindings.xml
lib/firefox/browser/chrome/browser/content/browser/sync/aboutSyncTabs.css
lib/firefox/browser/chrome/browser/content/browser/sync/aboutSyncTabs.js
@@ -310,11 +321,24 @@ lib/firefox/browser/chrome/browser/skin/classic/browser/aboutSessionRestore-wind
lib/firefox/browser/chrome/browser/skin/classic/browser/aboutSessionRestore.css
lib/firefox/browser/chrome/browser/skin/classic/browser/aboutSocialError.css
lib/firefox/browser/chrome/browser/skin/classic/browser/aboutSyncTabs.css
+lib/firefox/browser/chrome/browser/skin/classic/browser/aboutTabCrashed.css
lib/firefox/browser/chrome/browser/skin/classic/browser/aboutWelcomeBack.css
lib/firefox/browser/chrome/browser/skin/classic/browser/actionicon-tab.png
lib/firefox/browser/chrome/browser/skin/classic/browser/browser.css
lib/firefox/browser/chrome/browser/skin/classic/browser/click-to-play-warning-stripes.png
lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/alerticon-warning.png
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/connection-footer.css
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/device.css
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/error.svg
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/help.css
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/index-icons.svg
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/index.css
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/noise.png
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/plus.svg
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/projects.css
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/remove.svg
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/rocket.svg
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/app-manager/warning.svg
lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/arrow-e.png
lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/background-noise-toolbar.png
lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/blackBoxMessageEye.png
@@ -392,6 +416,9 @@ lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/responsive-back
lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/responsive-horizontal-resizer.png
lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/responsive-se-resizer.png
lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/responsive-vertical-resizer.png
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/responsiveui-rotate.png
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/responsiveui-screenshot.png
+lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/responsiveui-touch.png
lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/ruleview.css
lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/scratchpad.css
lib/firefox/browser/chrome/browser/skin/classic/browser/devtools/splitview.css
@@ -436,6 +463,7 @@ lib/firefox/browser/chrome/browser/skin/classic/browser/fullscreen-darknoise.png
lib/firefox/browser/chrome/browser/skin/classic/browser/identity-icons-generic.png
lib/firefox/browser/chrome/browser/skin/classic/browser/identity-icons-https-ev.png
lib/firefox/browser/chrome/browser/skin/classic/browser/identity-icons-https-mixed-active.png
+lib/firefox/browser/chrome/browser/skin/classic/browser/identity-icons-https-mixed-display.png
lib/firefox/browser/chrome/browser/skin/classic/browser/identity-icons-https.png
lib/firefox/browser/chrome/browser/skin/classic/browser/identity.png
lib/firefox/browser/chrome/browser/skin/classic/browser/mixed-content-blocked-16.png
@@ -538,6 +566,8 @@ lib/firefox/browser/chrome/en-US/locale/browser/baseMenuOverlay.dtd
lib/firefox/browser/chrome/en-US/locale/browser/browser.dtd
lib/firefox/browser/chrome/en-US/locale/browser/browser.properties
lib/firefox/browser/chrome/en-US/locale/browser/devtools/VariablesView.dtd
+lib/firefox/browser/chrome/en-US/locale/browser/devtools/app-manager.dtd
+lib/firefox/browser/chrome/en-US/locale/browser/devtools/app-manager.properties
lib/firefox/browser/chrome/en-US/locale/browser/devtools/appcacheutils.properties
lib/firefox/browser/chrome/en-US/locale/browser/devtools/connection-screen.dtd
lib/firefox/browser/chrome/en-US/locale/browser/devtools/connection-screen.properties
@@ -641,7 +671,9 @@ lib/firefox/browser/chrome/pdfjs/README.mozilla
lib/firefox/browser/chrome/pdfjs/components/PdfRedirector.js
lib/firefox/browser/chrome/pdfjs/components/PdfStreamConverter.js
lib/firefox/browser/chrome/pdfjs/content/PdfJs.jsm
+lib/firefox/browser/chrome/pdfjs/content/PdfJsTelemetry.jsm
lib/firefox/browser/chrome/pdfjs/content/build/pdf.js
+lib/firefox/browser/chrome/pdfjs/content/build/pdf.worker.js
lib/firefox/browser/chrome/pdfjs/content/network.js
lib/firefox/browser/chrome/pdfjs/content/web/debugger.js
lib/firefox/browser/chrome/pdfjs/content/web/images/annotation-check.svg
@@ -658,6 +690,10 @@ lib/firefox/browser/chrome/pdfjs/content/web/images/findbarButton-previous-rtl.p
lib/firefox/browser/chrome/pdfjs/content/web/images/findbarButton-previous.png
lib/firefox/browser/chrome/pdfjs/content/web/images/loading-icon.gif
lib/firefox/browser/chrome/pdfjs/content/web/images/loading-small.png
+lib/firefox/browser/chrome/pdfjs/content/web/images/secondaryToolbarButton-firstPage.png
+lib/firefox/browser/chrome/pdfjs/content/web/images/secondaryToolbarButton-lastPage.png
+lib/firefox/browser/chrome/pdfjs/content/web/images/secondaryToolbarButton-rotateCcw.png
+lib/firefox/browser/chrome/pdfjs/content/web/images/secondaryToolbarButton-rotateCw.png
lib/firefox/browser/chrome/pdfjs/content/web/images/shadow.png
lib/firefox/browser/chrome/pdfjs/content/web/images/texture.png
lib/firefox/browser/chrome/pdfjs/content/web/images/toolbarButton-bookmark.png
@@ -671,6 +707,7 @@ lib/firefox/browser/chrome/pdfjs/content/web/images/toolbarButton-pageUp.png
lib/firefox/browser/chrome/pdfjs/content/web/images/toolbarButton-presentationMode.png
lib/firefox/browser/chrome/pdfjs/content/web/images/toolbarButton-print.png
lib/firefox/browser/chrome/pdfjs/content/web/images/toolbarButton-search.png
+lib/firefox/browser/chrome/pdfjs/content/web/images/toolbarButton-secondaryToolbarToggle.png
lib/firefox/browser/chrome/pdfjs/content/web/images/toolbarButton-sidebarToggle.png
lib/firefox/browser/chrome/pdfjs/content/web/images/toolbarButton-viewOutline.png
lib/firefox/browser/chrome/pdfjs/content/web/images/toolbarButton-viewThumbnail.png
@@ -713,10 +750,12 @@ lib/firefox/browser/defaults/profile/prefs.js
lib/firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/icon.png
lib/firefox/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf
lib/firefox/browser/icons/mozicon128.png
-lib/firefox/browser/modules/AboutHomeUtils.jsm
+lib/firefox/browser/modules/AboutHome.jsm
lib/firefox/browser/modules/BrowserNewTabPreloader.jsm
+lib/firefox/browser/modules/ContentClick.jsm
lib/firefox/browser/modules/DownloadsCommon.jsm
lib/firefox/browser/modules/DownloadsLogger.jsm
+lib/firefox/browser/modules/DownloadsTaskbar.jsm
lib/firefox/browser/modules/MigrationUtils.jsm
lib/firefox/browser/modules/NetworkPrioritizer.jsm
lib/firefox/browser/modules/PlacesUIUtils.jsm
@@ -725,6 +764,7 @@ lib/firefox/browser/modules/SharedFrame.jsm
lib/firefox/browser/modules/SignInToWebsite.jsm
lib/firefox/browser/modules/SitePermissions.jsm
lib/firefox/browser/modules/Social.jsm
+lib/firefox/browser/modules/TabCrashReporter.jsm
lib/firefox/browser/modules/devtools/AppCacheUtils.jsm
lib/firefox/browser/modules/devtools/BreadcrumbsWidget.jsm
lib/firefox/browser/modules/devtools/BuiltinCommands.jsm
@@ -736,13 +776,10 @@ lib/firefox/browser/modules/devtools/CmdScratchpad.jsm
lib/firefox/browser/modules/devtools/CmdTilt.jsm
lib/firefox/browser/modules/devtools/Commands.jsm
lib/firefox/browser/modules/devtools/DOMHelpers.jsm
-lib/firefox/browser/modules/devtools/DebuggerPanel.jsm
lib/firefox/browser/modules/devtools/DebuggerProcess.jsm
lib/firefox/browser/modules/devtools/DeveloperToolbar.jsm
lib/firefox/browser/modules/devtools/FloatingScrollbars.jsm
lib/firefox/browser/modules/devtools/Jsbeautify.jsm
-lib/firefox/browser/modules/devtools/LayoutHelpers.jsm
-lib/firefox/browser/modules/devtools/NetMonitorPanel.jsm
lib/firefox/browser/modules/devtools/Parser.jsm
lib/firefox/browser/modules/devtools/SideMenuWidget.jsm
lib/firefox/browser/modules/devtools/SplitView.jsm
@@ -754,6 +791,14 @@ lib/firefox/browser/modules/devtools/StyleSheetEditor.jsm
lib/firefox/browser/modules/devtools/VariablesView.jsm
lib/firefox/browser/modules/devtools/VariablesViewController.jsm
lib/firefox/browser/modules/devtools/ViewHelpers.jsm
+lib/firefox/browser/modules/devtools/app-manager/app-projects.js
+lib/firefox/browser/modules/devtools/app-manager/app-validator.js
+lib/firefox/browser/modules/devtools/app-manager/builtin-adb-store.js
+lib/firefox/browser/modules/devtools/app-manager/connection-store.js
+lib/firefox/browser/modules/devtools/app-manager/device-store.js
+lib/firefox/browser/modules/devtools/app-manager/simulators-store.js
+lib/firefox/browser/modules/devtools/app-manager/webapps-store.js
+lib/firefox/browser/modules/devtools/debugger/debugger-panel.js
lib/firefox/browser/modules/devtools/framework/sidebar.js
lib/firefox/browser/modules/devtools/framework/target.js
lib/firefox/browser/modules/devtools/framework/toolbox-hosts.js
@@ -768,6 +813,7 @@ lib/firefox/browser/modules/devtools/inspector/selection.js
lib/firefox/browser/modules/devtools/inspector/selector-search.js
lib/firefox/browser/modules/devtools/main.js
lib/firefox/browser/modules/devtools/markupview/markup-view.js
+lib/firefox/browser/modules/devtools/netmonitor/netmonitor-panel.js
lib/firefox/browser/modules/devtools/profiler/cleopatra.js
lib/firefox/browser/modules/devtools/profiler/commands.js
lib/firefox/browser/modules/devtools/profiler/consts.js
@@ -778,13 +824,13 @@ lib/firefox/browser/modules/devtools/responsivedesign.jsm
lib/firefox/browser/modules/devtools/scratchpad-manager.jsm
lib/firefox/browser/modules/devtools/shared/autocomplete-popup.js
lib/firefox/browser/modules/devtools/shared/event-emitter.js
+lib/firefox/browser/modules/devtools/shared/helpers.js
lib/firefox/browser/modules/devtools/shared/inplace-editor.js
lib/firefox/browser/modules/devtools/shared/observable-object.js
lib/firefox/browser/modules/devtools/shared/telemetry.js
lib/firefox/browser/modules/devtools/shared/theme-switching.js
lib/firefox/browser/modules/devtools/shared/undo.js
lib/firefox/browser/modules/devtools/styleinspector/computed-view.js
-lib/firefox/browser/modules/devtools/styleinspector/css-logic.js
lib/firefox/browser/modules/devtools/styleinspector/rule-view.js
lib/firefox/browser/modules/devtools/styleinspector/style-inspector.js
lib/firefox/browser/modules/devtools/tilt/TiltWorkerCrafter.js
@@ -804,7 +850,9 @@ lib/firefox/browser/modules/distribution.js
lib/firefox/browser/modules/offlineAppCache.jsm
lib/firefox/browser/modules/openLocationLastURL.jsm
lib/firefox/browser/modules/sessionstore/DocumentUtils.jsm
+lib/firefox/browser/modules/sessionstore/SessionCookies.jsm
lib/firefox/browser/modules/sessionstore/SessionMigration.jsm
+lib/firefox/browser/modules/sessionstore/SessionSaver.jsm
lib/firefox/browser/modules/sessionstore/SessionStorage.jsm
lib/firefox/browser/modules/sessionstore/SessionStore.jsm
lib/firefox/browser/modules/sessionstore/SessionWorker.js
@@ -844,6 +892,7 @@ lib/firefox/chrome/en-US/locale/en-US/global-region/region.properties
lib/firefox/chrome/en-US/locale/en-US/global/AccessFu.properties
lib/firefox/chrome/en-US/locale/en-US/global/about.dtd
lib/firefox/chrome/en-US/locale/en-US/global/aboutAbout.dtd
+lib/firefox/chrome/en-US/locale/en-US/global/aboutNetworking.dtd
lib/firefox/chrome/en-US/locale/en-US/global/aboutRights.dtd
lib/firefox/chrome/en-US/locale/en-US/global/aboutSupport.dtd
lib/firefox/chrome/en-US/locale/en-US/global/aboutSupport.properties
@@ -986,6 +1035,7 @@ lib/firefox/chrome/marionette/content/SpecialPowersObserverAPI.js
lib/firefox/chrome/marionette/content/atoms.js
lib/firefox/chrome/marionette/content/marionette-common.js
lib/firefox/chrome/marionette/content/marionette-elements.js
+lib/firefox/chrome/marionette/content/marionette-frame-manager.js
lib/firefox/chrome/marionette/content/marionette-listener.js
lib/firefox/chrome/marionette/content/marionette-sendkeys.js
lib/firefox/chrome/marionette/content/marionette-server.js
@@ -1024,7 +1074,6 @@ lib/firefox/chrome/pippki/content/pippki/downloadcert.xul
lib/firefox/chrome/pippki/content/pippki/editcacert.xul
lib/firefox/chrome/pippki/content/pippki/editcerts.js
lib/firefox/chrome/pippki/content/pippki/editemailcert.xul
-lib/firefox/chrome/pippki/content/pippki/editsslcert.xul
lib/firefox/chrome/pippki/content/pippki/escrowWarn.js
lib/firefox/chrome/pippki/content/pippki/escrowWarn.xul
lib/firefox/chrome/pippki/content/pippki/exceptionDialog.js
@@ -1053,9 +1102,12 @@ lib/firefox/chrome/toolkit/content/global/BrowserElementPanning.js
lib/firefox/chrome/toolkit/content/global/XPCNativeWrapper.js
lib/firefox/chrome/toolkit/content/global/about.xhtml
lib/firefox/chrome/toolkit/content/global/aboutAbout.xhtml
+lib/firefox/chrome/toolkit/content/global/aboutCompartments.xhtml
lib/firefox/chrome/toolkit/content/global/aboutMemory.css
lib/firefox/chrome/toolkit/content/global/aboutMemory.js
lib/firefox/chrome/toolkit/content/global/aboutMemory.xhtml
+lib/firefox/chrome/toolkit/content/global/aboutNetworking.js
+lib/firefox/chrome/toolkit/content/global/aboutNetworking.xhtml
lib/firefox/chrome/toolkit/content/global/aboutRights-unbranded.xhtml
lib/firefox/chrome/toolkit/content/global/aboutRights.xhtml
lib/firefox/chrome/toolkit/content/global/aboutSupport.js
@@ -1065,6 +1117,7 @@ lib/firefox/chrome/toolkit/content/global/aboutTelemetry.js
lib/firefox/chrome/toolkit/content/global/aboutTelemetry.xhtml
lib/firefox/chrome/toolkit/content/global/accessibility/AccessFu.css
lib/firefox/chrome/toolkit/content/global/accessibility/content-script.js
+lib/firefox/chrome/toolkit/content/global/accessibility/tick.wav
lib/firefox/chrome/toolkit/content/global/alerts/alert.css
lib/firefox/chrome/toolkit/content/global/alerts/alert.js
lib/firefox/chrome/toolkit/content/global/alerts/alert.xul
@@ -1173,6 +1226,7 @@ lib/firefox/chrome/toolkit/content/global/resetProfile.css
lib/firefox/chrome/toolkit/content/global/resetProfile.js
lib/firefox/chrome/toolkit/content/global/resetProfile.xul
lib/firefox/chrome/toolkit/content/global/resetProfileProgress.xul
+lib/firefox/chrome/toolkit/content/global/select-child.js
lib/firefox/chrome/toolkit/content/global/selectDialog.js
lib/firefox/chrome/toolkit/content/global/selectDialog.xul
lib/firefox/chrome/toolkit/content/global/strres.js
@@ -1468,6 +1522,7 @@ lib/firefox/chrome/toolkit/skin/classic/global/tree/sort-dsc.png
lib/firefox/chrome/toolkit/skin/classic/global/tree/twisty-clsd.png
lib/firefox/chrome/toolkit/skin/classic/global/tree/twisty-open.png
lib/firefox/chrome/toolkit/skin/classic/global/wizard.css
+lib/firefox/chrome/toolkit/skin/classic/mozapps/aboutNetworking.css
lib/firefox/chrome/toolkit/skin/classic/mozapps/downloads/downloadButtons.png
lib/firefox/chrome/toolkit/skin/classic/mozapps/downloads/downloadIcon.png
lib/firefox/chrome/toolkit/skin/classic/mozapps/downloads/downloads.css
@@ -1553,9 +1608,11 @@ lib/firefox/components/DataReportingService.js
lib/firefox/components/DownloadLegacy.js
lib/firefox/components/FeedProcessor.js
lib/firefox/components/FormHistoryStartup.js
+lib/firefox/components/MozKeyboard.js
lib/firefox/components/NetworkGeolocationProvider.js
lib/firefox/components/PageThumbsProtocol.js
lib/firefox/components/PermissionSettings.js
+lib/firefox/components/PhoneNumberService.js
lib/firefox/components/PlacesCategoriesStarter.js
lib/firefox/components/Push.js
lib/firefox/components/PushServiceLauncher.js
@@ -1607,8 +1664,6 @@ lib/firefox/components/nsSearchService.js
lib/firefox/components/nsSearchSuggestions.js
lib/firefox/components/nsTaggingService.js
lib/firefox/components/nsURLFormatter.js
-lib/firefox/components/nsUpdateService.js
-lib/firefox/components/nsUpdateServiceStub.js
lib/firefox/components/nsUpdateTimerManager.js
lib/firefox/components/nsUrlClassifierHashCompleter.js
lib/firefox/components/nsUrlClassifierLib.js
@@ -1663,7 +1718,6 @@ lib/firefox/hyphenation/hyph_sl.dic
lib/firefox/hyphenation/hyph_sv.dic
lib/firefox/hyphenation/hyph_tr.dic
lib/firefox/hyphenation/hyph_uk.dic
-lib/firefox/icons/updater.png
lib/firefox/libmozalloc.so
lib/firefox/libmozjs.so
lib/firefox/libxul.so
@@ -1679,6 +1733,7 @@ lib/firefox/modules/AlarmService.jsm
lib/firefox/modules/AppDownloadManager.jsm
lib/firefox/modules/AppsServiceChild.jsm
lib/firefox/modules/AppsUtils.jsm
+lib/firefox/modules/AsyncShutdown.jsm
lib/firefox/modules/AsyncSpellCheckTestHelper.jsm
lib/firefox/modules/BookmarkHTMLUtils.jsm
lib/firefox/modules/BookmarkJSONUtils.jsm
@@ -1704,6 +1759,7 @@ lib/firefox/modules/DeferredTask.jsm
lib/firefox/modules/Deprecated.jsm
lib/firefox/modules/Dict.jsm
lib/firefox/modules/DownloadCore.jsm
+lib/firefox/modules/DownloadImport.jsm
lib/firefox/modules/DownloadIntegration.jsm
lib/firefox/modules/DownloadLastDir.jsm
lib/firefox/modules/DownloadList.jsm
@@ -1717,6 +1773,7 @@ lib/firefox/modules/FileUtils.jsm
lib/firefox/modules/ForgetAboutSite.jsm
lib/firefox/modules/FormHistory.jsm
lib/firefox/modules/FrameWorker.jsm
+lib/firefox/modules/FrameWorkerContent.js
lib/firefox/modules/FreeSpaceWatcher.jsm
lib/firefox/modules/Geometry.jsm
lib/firefox/modules/HealthReport.jsm
@@ -1724,6 +1781,8 @@ lib/firefox/modules/Http.jsm
lib/firefox/modules/ISO8601DateUtils.jsm
lib/firefox/modules/IndexedDBHelper.jsm
lib/firefox/modules/InlineSpellChecker.jsm
+lib/firefox/modules/InsecurePasswordUtils.jsm
+lib/firefox/modules/Keyboard.jsm
lib/firefox/modules/LightweightThemeConsumer.jsm
lib/firefox/modules/LightweightThemeImageOptimizer.jsm
lib/firefox/modules/LightweightThemeManager.jsm
@@ -1737,6 +1796,7 @@ lib/firefox/modules/NetUtil.jsm
lib/firefox/modules/NewTabUtils.jsm
lib/firefox/modules/ObjectWrapper.jsm
lib/firefox/modules/OfflineCacheInstaller.jsm
+lib/firefox/modules/OperatorApps.jsm
lib/firefox/modules/PageMenu.jsm
lib/firefox/modules/PageThumbs.jsm
lib/firefox/modules/PageThumbsWorker.js
@@ -1747,6 +1807,7 @@ lib/firefox/modules/PermissionsInstaller.jsm
lib/firefox/modules/PermissionsTable.jsm
lib/firefox/modules/PhoneNumber.jsm
lib/firefox/modules/PhoneNumberMetaData.jsm
+lib/firefox/modules/PhoneNumberNormalizer.jsm
lib/firefox/modules/PhoneNumberUtils.jsm
lib/firefox/modules/PlacesBackups.jsm
lib/firefox/modules/PlacesDBUtils.jsm
@@ -1759,19 +1820,27 @@ lib/firefox/modules/PrivateBrowsingUtils.jsm
lib/firefox/modules/Promise.jsm
lib/firefox/modules/PropertyListUtils.jsm
lib/firefox/modules/PushService.jsm
+lib/firefox/modules/RemoteAddonsChild.jsm
+lib/firefox/modules/RemoteAddonsParent.jsm
+lib/firefox/modules/RemoteController.jsm
lib/firefox/modules/RemoteSecurityUI.jsm
+lib/firefox/modules/RemoteWebNavigation.jsm
lib/firefox/modules/RemoteWebProgress.jsm
lib/firefox/modules/ResetProfile.jsm
lib/firefox/modules/SafeBrowsing.jsm
+lib/firefox/modules/SelectContentHelper.jsm
+lib/firefox/modules/SelectParentHelper.jsm
lib/firefox/modules/Services.jsm
lib/firefox/modules/SettingsChangeNotifier.jsm
lib/firefox/modules/SettingsDB.jsm
lib/firefox/modules/SettingsQueue.jsm
+lib/firefox/modules/Sntp.jsm
lib/firefox/modules/SocialService.jsm
lib/firefox/modules/SpellCheckDictionaryBootstrap.js
lib/firefox/modules/Sqlite.jsm
lib/firefox/modules/SystemMessagePermissionsChecker.jsm
lib/firefox/modules/Task.jsm
+lib/firefox/modules/TelemetryFile.jsm
lib/firefox/modules/TelemetryStopwatch.jsm
lib/firefox/modules/TelemetryTimestamps.jsm
lib/firefox/modules/ThirdPartyCookieProbe.jsm
@@ -1779,6 +1848,7 @@ lib/firefox/modules/Timer.jsm
lib/firefox/modules/Troubleshoot.jsm
lib/firefox/modules/UpdateChannel.jsm
lib/firefox/modules/UserAgentOverrides.jsm
+lib/firefox/modules/UserAgentUpdates.jsm
lib/firefox/modules/WebappOSUtils.jsm
lib/firefox/modules/Webapps.jsm
lib/firefox/modules/WebappsInstaller.jsm
@@ -1892,6 +1962,7 @@ lib/firefox/modules/commonjs/sdk/passwords.js
lib/firefox/modules/commonjs/sdk/passwords/utils.js
lib/firefox/modules/commonjs/sdk/places/bookmarks.js
lib/firefox/modules/commonjs/sdk/places/contract.js
+lib/firefox/modules/commonjs/sdk/places/events.js
lib/firefox/modules/commonjs/sdk/places/favicon.js
lib/firefox/modules/commonjs/sdk/places/history.js
lib/firefox/modules/commonjs/sdk/places/host/host-bookmarks.js
@@ -1942,6 +2013,16 @@ lib/firefox/modules/commonjs/sdk/test/runner.js
lib/firefox/modules/commonjs/sdk/test/tmp-file.js
lib/firefox/modules/commonjs/sdk/test/utils.js
lib/firefox/modules/commonjs/sdk/timers.js
+lib/firefox/modules/commonjs/sdk/ui.js
+lib/firefox/modules/commonjs/sdk/ui/button.js
+lib/firefox/modules/commonjs/sdk/ui/button/view.js
+lib/firefox/modules/commonjs/sdk/ui/sidebar.js
+lib/firefox/modules/commonjs/sdk/ui/sidebar/actions.js
+lib/firefox/modules/commonjs/sdk/ui/sidebar/contract.js
+lib/firefox/modules/commonjs/sdk/ui/sidebar/namespace.js
+lib/firefox/modules/commonjs/sdk/ui/sidebar/utils.js
+lib/firefox/modules/commonjs/sdk/ui/sidebar/view.js
+lib/firefox/modules/commonjs/sdk/ui/state.js
lib/firefox/modules/commonjs/sdk/url.js
lib/firefox/modules/commonjs/sdk/url/utils.js
lib/firefox/modules/commonjs/sdk/util/array.js
@@ -1977,14 +2058,23 @@ lib/firefox/modules/debug.js
lib/firefox/modules/devtools/Console.jsm
lib/firefox/modules/devtools/DevToolsUtils.js
lib/firefox/modules/devtools/DevToolsUtils.jsm
+lib/firefox/modules/devtools/Devices.jsm
+lib/firefox/modules/devtools/LayoutHelpers.jsm
lib/firefox/modules/devtools/Loader.jsm
lib/firefox/modules/devtools/Require.jsm
+lib/firefox/modules/devtools/Simulator.jsm
lib/firefox/modules/devtools/SourceMap.jsm
lib/firefox/modules/devtools/Templater.jsm
+lib/firefox/modules/devtools/app-actor-front.js
+lib/firefox/modules/devtools/client/connection-manager.js
lib/firefox/modules/devtools/dbg-client.jsm
lib/firefox/modules/devtools/dbg-server.jsm
+lib/firefox/modules/devtools/escodegen/escodegen.js
+lib/firefox/modules/devtools/escodegen/estraverse.js
+lib/firefox/modules/devtools/escodegen/package.json.js
lib/firefox/modules/devtools/gcli.jsm
lib/firefox/modules/devtools/server/actors/childtab.js
+lib/firefox/modules/devtools/server/actors/device.js
lib/firefox/modules/devtools/server/actors/gcli.js
lib/firefox/modules/devtools/server/actors/inspector.js
lib/firefox/modules/devtools/server/actors/profiler.js
@@ -1992,6 +2082,7 @@ lib/firefox/modules/devtools/server/actors/root.js
lib/firefox/modules/devtools/server/actors/script.js
lib/firefox/modules/devtools/server/actors/string.js
lib/firefox/modules/devtools/server/actors/styleeditor.js
+lib/firefox/modules/devtools/server/actors/styles.js
lib/firefox/modules/devtools/server/actors/tracer.js
lib/firefox/modules/devtools/server/actors/webapps.js
lib/firefox/modules/devtools/server/actors/webbrowser.js
@@ -2000,9 +2091,11 @@ lib/firefox/modules/devtools/server/child.js
lib/firefox/modules/devtools/server/main.js
lib/firefox/modules/devtools/server/protocol.js
lib/firefox/modules/devtools/server/transport.js
+lib/firefox/modules/devtools/styleinspector/css-logic.js
lib/firefox/modules/devtools/toolkit/webconsole/client.js
lib/firefox/modules/devtools/toolkit/webconsole/network-helper.js
lib/firefox/modules/devtools/toolkit/webconsole/utils.js
+lib/firefox/modules/devtools/touch-events.js
lib/firefox/modules/identity/Identity.jsm
lib/firefox/modules/identity/IdentityProvider.jsm
lib/firefox/modules/identity/IdentityStore.jsm
@@ -2046,7 +2139,6 @@ lib/firefox/modules/services-sync/addonutils.js
lib/firefox/modules/services-sync/constants.js
lib/firefox/modules/services-sync/engines.js
lib/firefox/modules/services-sync/engines/addons.js
-lib/firefox/modules/services-sync/engines/apps.js
lib/firefox/modules/services-sync/engines/bookmarks.js
lib/firefox/modules/services-sync/engines/clients.js
lib/firefox/modules/services-sync/engines/forms.js
@@ -2127,25 +2219,23 @@ lib/firefox/res/table-remove-row-active.gif
lib/firefox/res/table-remove-row-hover.gif
lib/firefox/res/table-remove-row.gif
lib/firefox/run-mozilla.sh
-lib/firefox/update-settings.ini
-lib/firefox/update.locale
-lib/firefox/updater
-lib/firefox/updater.ini
lib/firefox/webapprt-stub
lib/firefox/webapprt/chrome.manifest
lib/firefox/webapprt/chrome/chrome.manifest
lib/firefox/webapprt/chrome/en-US/locale/webapprt/webapp.dtd
lib/firefox/webapprt/chrome/en-US/locale/webapprt/webapp.properties
+lib/firefox/webapprt/chrome/webapprt/content/dbg-webapp-actors.js
+lib/firefox/webapprt/chrome/webapprt/content/mochitest-shared.js
lib/firefox/webapprt/chrome/webapprt/content/mochitest.js
lib/firefox/webapprt/chrome/webapprt/content/mochitest.xul
lib/firefox/webapprt/chrome/webapprt/content/webapp.js
lib/firefox/webapprt/chrome/webapprt/content/webapp.xul
lib/firefox/webapprt/components/CommandLineHandler.js
lib/firefox/webapprt/components/ContentPermission.js
-lib/firefox/webapprt/components/ContentPolicy.js
lib/firefox/webapprt/components/DirectoryProvider.js
lib/firefox/webapprt/components/components.manifest
lib/firefox/webapprt/defaults/preferences/prefs.js
+lib/firefox/webapprt/modules/RemoteDebugger.jsm
lib/firefox/webapprt/modules/Startup.jsm
lib/firefox/webapprt/modules/WebappRT.jsm
lib/firefox/webapprt/modules/WebappsHandler.jsm
diff --git a/www/firefox/distinfo b/www/firefox/distinfo
index 4a1a8714e21..2a287106fe8 100644
--- a/www/firefox/distinfo
+++ b/www/firefox/distinfo
@@ -1,13 +1,13 @@
-$NetBSD: distinfo,v 1.126 2013/11/29 13:00:32 joerg Exp $
+$NetBSD: distinfo,v 1.127 2013/12/15 13:54:37 ryoon Exp $
-SHA1 (firefox-25.0.1.source.tar.bz2) = 592ebd242c4839ef0e18707a7e959d8bed2a98f3
-RMD160 (firefox-25.0.1.source.tar.bz2) = a1868d0299f6670b7fd8d7b92af7006ecefbc891
-Size (firefox-25.0.1.source.tar.bz2) = 127526415 bytes
-SHA1 (patch-aa) = c52746ff141b6de211380b848b174c22ba7909c4
+SHA1 (firefox-26.0.source.tar.bz2) = f7c6642d6f62aea8d4eced48dd27aba0634edcd5
+RMD160 (firefox-26.0.source.tar.bz2) = cb791da22377519db44164bedd64254dc839e2b8
+Size (firefox-26.0.source.tar.bz2) = 127526380 bytes
+SHA1 (patch-aa) = e510bfad9f4d2950e5751d2a8d15971dcad75fb0
SHA1 (patch-ak) = 971ddb1f12b14bcee604c9d7e72da5e7bf47d9be
SHA1 (patch-al) = 553c6042a98e4b381a46eec50c02cff349d88bd2
SHA1 (patch-ao) = 3c777c8caf7f951a711c79612c08cee2cd338a57
-SHA1 (patch-as) = 783257cf77fced036afb14c5132c1f051d951a22
+SHA1 (patch-as) = 62be47c27d74dedf70f048b3ac3ce99a2b4f7b3c
SHA1 (patch-bf) = 75c971043e9f693203d6bd670b2c20c4952a7756
SHA1 (patch-bg) = d6c02294765265d9e85cf49c22320d88573c2e25
SHA1 (patch-bi) = 3dd927d93431afe000cd4a45b4d9920e63158a85
@@ -17,12 +17,10 @@ SHA1 (patch-browser_locales_en-US_chrome_browser-region_region.properties) = 284
SHA1 (patch-browser_locales_en-US_searchplugins_duckduckgo.xml) = 69eca52185ac868e95041b5d87611ee32c2b6330
SHA1 (patch-browser_locales_en-US_searchplugins_list.txt) = a6677b3a195b6c956858326e4e7474441823a47f
SHA1 (patch-build_autoconf_nss.m4) = bf65db126705a3a1ba294418b9380683ea401fc7
-SHA1 (patch-config_Makefile.in) = 57384964be7af2a65443534dfd18729c3ae951ec
-SHA1 (patch-config_baseconfig.mk) = 1b47c82736d3c38e34b507138cf91268f4bc9e82
-SHA1 (patch-config_stl-headers) = 281b242ca27506e20d755a471e97c2f9404a1182
+SHA1 (patch-config_baseconfig.mk) = 9056301a239b7a927ee06a8f53702aece9780dc4
SHA1 (patch-config_stl__wrappers_ios) = 00d723e2f2f252485350ede5833f0bb84c1235c1
SHA1 (patch-config_stl__wrappers_ostream) = 7be7fe36704ffbdc070a113b46b4f391a598206b
-SHA1 (patch-config_system-headers) = e2cb02f654b562091931ee3bdaaf9b36da8c137c
+SHA1 (patch-config_system-headers) = b091819a932f86a19f98ea71787447c9899138c6
SHA1 (patch-config_system__wrappers_unwind.h) = b3bdac0710179b9c8f8eabd824216d0114504491
SHA1 (patch-dom_plugins_ipc_PluginModuleChild.cpp) = 69b0a51d733cd52e7d200052362e0faf4ec918f1
SHA1 (patch-dom_plugins_ipc_PluginModuleChild.h) = 0a7f3167e939822013ae6195406657453578453e
@@ -38,8 +36,8 @@ SHA1 (patch-ipc_chromium_Makefile.in) = 61ada3484c1ec0c07ee537aa7dd32e2c8411c10f
SHA1 (patch-ipc_chromium_chromium-config.mk) = 6eab1cb974a5a8550e9ea8f9290a9cec8e2aa133
SHA1 (patch-ipc_chromium_src_base_base__paths.h) = 7bc83577a9678542db4dff7dda19d751ff6d78c1
SHA1 (patch-ipc_chromium_src_base_debug__util__posix.cc) = 677f0b5ccdcde7a8551f2d07d2a472361a5da03f
-SHA1 (patch-ipc_chromium_src_base_file__util.h) = 2bfc4b8f14cf5290f98902f11c9638cf71575655
-SHA1 (patch-ipc_chromium_src_base_file__util__posix.cc) = 4d183855d7932ad6f526649dc3671b72cbfbb195
+SHA1 (patch-ipc_chromium_src_base_file__util.h) = 9d6d074b1692c6b4e722bfac8d67c66040a6fa76
+SHA1 (patch-ipc_chromium_src_base_file__util__posix.cc) = 43645104f62ecd6e1aa4b17078d6719e5eda8896
SHA1 (patch-ipc_chromium_src_base_file__version__info.h) = 4096226b2586863a4106bfb5cfadd95bffb9d717
SHA1 (patch-ipc_chromium_src_base_message__pump__libevent.cc) = 12f3e063cf3fef23f0e3e0fdba5d5a4c1fc32af3
SHA1 (patch-ipc_chromium_src_base_platform__thread.h) = e6d7ac39a8b2a1b232638f7671e8530acfed0b97
@@ -53,63 +51,40 @@ SHA1 (patch-ipc_chromium_src_chrome_common_transport__dib.h) = 7af18973c005d7b14
SHA1 (patch-ipc_glue_AsyncChannel.cpp) = 0185791ada8e903943bcd245376486315b1c6515
SHA1 (patch-ipc_glue_GeckoChildProcessHost.cpp) = fe9ac2d0af8dd4757c93f50e6f74a31697f7e23c
SHA1 (patch-ipc_ipdl_ipdl_lower.py) = 4025c0a4e149d9b2087331e10b342734fa77a905
-SHA1 (patch-js__src__vm__SPSProfiler.cpp) = d0d70a7ce56d865f00d572b0435b80acfdbab3e0
-SHA1 (patch-js_src_Makefile.in) = 484207dc19a58e29827a8268c372011979aa6e44
-SHA1 (patch-js_src_config_Makefile.in) = 5639c71af8b1b6777e730fce52c913a5469f2efe
-SHA1 (patch-js_src_config_system-headers) = 896d774b05eef343f2eada877ccaca474b5aeb27
+SHA1 (patch-js__src__vm__SPSProfiler.cpp) = ac6da8a477cd0a768a513462b7bc3b871fd280f1
+SHA1 (patch-js_src_Makefile.in) = 2a3a52ec33b37b9df2047bfb35537689cca3ebb2
+SHA1 (patch-js_src_config_system-headers) = 405921c2638f6bf37f33b7d6b162addbfb162dea
SHA1 (patch-js_src_ctypes_CTypes.h) = a168d70707b0d09b6ff52141b5ceebf69caa1f90
SHA1 (patch-js_src_frontend_ParseMaps.cpp) = c00117d79b78904bc50a1d664a8fc0e4e339bfbc
-SHA1 (patch-js_src_gdb_Makefile.in) = 5719a69750412e63a7772ed8bf9e8c5fa8df03ca
SHA1 (patch-js_src_jit_AsmJSSignalHandlers.cpp) = ff58ca55fe39aef1310a72490472e522aae77956
-SHA1 (patch-js_src_jsapi-tests_Makefile.in) = cc204028b25f9c25f0d421305393ce166fb4cd58
SHA1 (patch-js_src_jscompartment.h) = 33708bc67f1c05f776dbb9c048ddf91f0eea25ca
SHA1 (patch-js_src_jsmath.cpp) = 7d4993ae91e9b5e6820358165603819aefb586f9
-SHA1 (patch-js_src_shell_Makefile.in) = de91bbe75d12ef4885a49284240f9b2600afc6d0
-SHA1 (patch-js_src_vm_ObjectImpl-inl.h) = 6d7a47f52935e854f914106055b5ec4c93c9741d
SHA1 (patch-mb) = 24daa34185852f4f865bcd42041fc1cb693d9fe7
SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = 5ef0de0ac875334e959ff0d4bfa43a2e5ab087b9
SHA1 (patch-media_libpng_pngpriv.h) = 945ef0be0ac2ddbb0153376add1231f2a63b5699
SHA1 (patch-media_libsoundtouch_src_cpu__detect__x86.cpp) = 061b46d1ee33c055a5b39e6b20f47b80bcde0c86
-SHA1 (patch-media_mtransport_objs.mk) = 1877b73706451bc9ff5254ab32d5e2edb9f36883
-SHA1 (patch-media_mtransport_test_Makefile.in) = 9d2364f2bfd0f5fbafb6d0204f98ae0df4e5664c
-SHA1 (patch-media_mtransport_third__party_nICEr_nicer.gyp) = 3ed56a7c9ea61f5910a7d608a1bd404b9ce58344
-SHA1 (patch-media_mtransport_third__party_nICEr_src_stun_addrs.c) = 10ce1dfb8af55d07ebfd9a10cee2626af48a089e
-SHA1 (patch-media_mtransport_third__party_nICEr_src_stun_stun.h) = 90eb67c93dabf4d84bf3df521f1d53aa874d3050
-SHA1 (patch-media_mtransport_third__party_nICEr_src_util_mbslen.c) = 52f57c4a5ba2708072a83fdfbe1ba27390dd5353
-SHA1 (patch-media_mtransport_third__party_nrappkit_nrappkit.gyp) = 68b7c5a15ff6027baccf18130673670d51d6a724
-SHA1 (patch-media_mtransport_third__party_nrappkit_src_log_r__log.c) = cf0e6c0d9278578f27ec19c4a3af211bec273ba8
-SHA1 (patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h) = 56b35ea317a6c57b523ddc527f2ae3e29e0ff032
-SHA1 (patch-media_mtransport_third__party_nrappkit_src_util_util.c) = 8406228a493c973121f0019138cd7007bfa3340b
-SHA1 (patch-media_webrtc_signaling_signaling.gyp) = 3541d06aeb691032d9e63f9d5a17af555f2ee8dc
-SHA1 (patch-media_webrtc_signaling_src_sipcc_cpr_darwin_cpr__darwin__ipc.c) = c6e604c731e1adecfff5706299b7999e479273e2
-SHA1 (patch-media_webrtc_signaling_test_Makefile.in) = cdc7d5b87a465ba57d2f0523bb26a5cbfdaa03df
-SHA1 (patch-media_webrtc_trunk_build_build__config.h) = 9fef8aab16142bc23426c00d279f0df5322a9170
-SHA1 (patch-media_webrtc_trunk_tools_gyp_pylib_gyp_generator_mozmake.py) = f465afb37d74988764e4dd362911063b3697cfbd
-SHA1 (patch-media_webrtc_trunk_webrtc_build_common.gypi) = a6fffd8b0bc20fea5c462a7d9e894f21fbce4968
-SHA1 (patch-media_webrtc_trunk_webrtc_modules_audio__device_audio__device__impl.cc) = 5de51a8b8a3ba15dac3aeae739b0eeb802b8267e
-SHA1 (patch-media_webrtc_trunk_webrtc_modules_audio__device_test_audio__device__test__api.cc) = e0910c2a7c05ba3c910c6a66f2317cdf346cf707
+SHA1 (patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h) = 056172e54652caa60b6fee26e3073a6da83e734c
+SHA1 (patch-media_webrtc_signaling_signaling.gyp) = ed52bb96a7ba6d7126b09871fe5ac81983cefdc1
+SHA1 (patch-media_webrtc_signaling_test_Makefile.in) = 7b05fe304cde8adbaa46ff8960978f96848541b6
+SHA1 (patch-media_webrtc_trunk_webrtc_build_common.gypi) = ac7250e37f30353af0a7789b7234f3bc56a3ecd7
SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc) = a7dd28746ea1c839e03c00f40985d73dd89dfd72
SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_video__capture__linux.cc) = 076cf414a1a2ee270105a043517bbbb341382f49
SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture.gypi) = 4721f01a89ef353c9b743b3cfefda4877d5283d9
-SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture__factory.cc) = e83b21a561649f7ae262a1c5b04c5d0a560a67c9
-SHA1 (patch-media_webrtc_trunk_webrtc_system__wrappers_source_condition__variable.cc) = f4e7dd4356499589eaad642c875ad0c9e4b4cab5
-SHA1 (patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp) = 853b178ca1b95c6907ca2fc2de9865807661a8f5
-SHA1 (patch-media_webrtc_trunk_webrtc_system__wrappers_source_thread__posix.cc) = cde91cf030a827aca9de8ad31c2e724a183678d1
+SHA1 (patch-media_webrtc_trunk_webrtc_system__wrappers_source_clock.cc) = e170bbb619f90d91781075a5cbdd098de2bed4da
+SHA1 (patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp) = f5af60a298e9e22499f3c743b3e140dbf4a83951
SHA1 (patch-memory_mozalloc_fallible.h) = 8a60151465a07570db9636313f504004d73941d5
SHA1 (patch-memory_mozalloc_mozalloc.cpp) = 802af1da05f60fcf8c206568c2adc396e3bb0e06
SHA1 (patch-memory_mozalloc_mozalloc.h) = f2d9fd333ec28c075dfde8a6ee414b67b7f2cd26
SHA1 (patch-memory_mozalloc_mozalloc__abort.cpp) = 9d9036ddd28c7b8ce37860e0120df2997a3a0c59
-SHA1 (patch-mfbt_Atomics.h) = 1a1df4189cf8da1182baa5c2e9909f9add6d2451
SHA1 (patch-mfbt_Poison.cpp) = b582943c02f57835451c9eecd004c9912d42ce84
SHA1 (patch-modules_libjar_nsZipArchive.cpp) = 6aff0f8ed42575d8ca36a524e12e9a1f7351004a
-SHA1 (patch-modules_libpref_src_init_all.js) = 16764075621da048b6c8a359c32b4fc8be6f7d67
SHA1 (patch-netwerk_sctp_src_netinet6_sctp6__usrreq.c) = 31d49db31b1e130f1b455f883e5b7c606d438771
SHA1 (patch-netwerk_sctp_src_netinet_sctp__os__userspace.h) = b3f94ac0f2bd652371fef22c642b14bf30162998
SHA1 (patch-netwerk_sctp_src_netinet_sctp__usrreq.c) = 421b6e071a9934567ccba337033a42208e6e4bd5
SHA1 (patch-netwerk_sctp_src_user__recv__thread.c) = cf26945441f74c581aeb5a8d7435780f4a48a607
SHA1 (patch-netwerk_sctp_src_user__socket.c) = c0b32ed2888b5845ce2b7646b85af8f0728bc7c3
SHA1 (patch-netwerk_sctp_src_user__socketvar.h) = 1b6e2864916ced693b1ab6c1bbdd80a4ffc4f7e4
-SHA1 (patch-netwerk_wifi_moz.build) = 05da9f5e4abd990c5c5af7b1db08b8682917e1bc
+SHA1 (patch-netwerk_wifi_moz.build) = 5a3e62b0a837f083a3ddae34c78fff9eadc1ea13
SHA1 (patch-netwerk_wifi_nsWifiScannerFreeBSD.cpp) = 9c343bef282192e1ac4b0742f160137d394c21b6
SHA1 (patch-pb) = 97c9b2e4cefd524dc6ba825f71c3da2a761aa1f4
SHA1 (patch-pc) = 8b2baa88f0983a2fef4f801cf6b1ae425f6c813a
@@ -118,9 +93,9 @@ SHA1 (patch-security_manager_ssl_src_JARSignatureVerification.cpp) = e9749dfeb0d
SHA1 (patch-security_manager_ssl_src_nsNSSComponent.cpp) = c4c96b7d3cb0c5dbcfe3820fd52421eec2592452
SHA1 (patch-toolkit_components_osfile_modules_osfile__unix__back.jsm) = de61b5ceaaea270bd298582c648704f4e68bebff
SHA1 (patch-toolkit_components_osfile_modules_osfile__unix__front.jsm) = b05a21e1ecad8de6cd8057d2a3ee76167293cde2
-SHA1 (patch-toolkit_library_Makefile.in) = 0c91d647f0f3a4653d39f11c9d8fd63611235932
+SHA1 (patch-toolkit_library_Makefile.in) = ae402e135d77aa3431cfe25d5f4f5fe39ff803c1
SHA1 (patch-toolkit_mozapps_update_updater_updater.cpp) = 6936e5408fc7f0110768f3fc8f27506c0e7879fa
-SHA1 (patch-toolkit_toolkit.mozbuild) = 07e87d977cee59c0f5a5d14a8d41dc2a4230c01e
+SHA1 (patch-toolkit_toolkit.mozbuild) = 0993d50cc02c2b421e6de087dfb0a9cb30562c6b
SHA1 (patch-toolkit_xre_Makefile.in) = 6ad65fa2fd026888cc8345e184daf2a070ea4885
SHA1 (patch-toolkit_xre_nsEmbedFunctions.cpp) = 6ee6fba04a3ecc6596f8aed67f752a1075901fa8
SHA1 (patch-xb) = 30eea880b40cee45d1235d3292fead4b5a54bbaa
@@ -134,9 +109,11 @@ SHA1 (patch-xl) = e7dbe631e8d1fcee48054c0cb8ff01169cfcb744
SHA1 (patch-xm) = 81e02e410c00175cbb98c646dda90c7adf199657
SHA1 (patch-xn) = c042e39d93706934ec03c78be3dc6e224ac62c0e
SHA1 (patch-xo) = aae6107dcfaf731bd3e9962d953fb8701fc5f163
+SHA1 (patch-xpcom_base_nsMemoryInfoDumper.cpp) = 245508dc7ad64eb1dc514caf6e85904d440742ca
+SHA1 (patch-xpcom_base_nsMemoryReporterManager.cpp) = 5d5db3251ebaec748c293ea342da89b8ba036ae3
SHA1 (patch-xpcom_base_nsStackWalk.cpp) = b763f5f3505efbedf51a9544a03d0501d86138b1
SHA1 (patch-xpcom_ds_TimeStamp.h) = a1fb060f91720eb330f102b28d9373bbdbe96e30
-SHA1 (patch-xpcom_ds_moz.build) = 71c9043966d54b6987fe2695ce9b06b176d2e365
+SHA1 (patch-xpcom_ds_moz.build) = a8c3726f5f5e700b92b5ac0950d2ef09ea9f7612
SHA1 (patch-xpcom_reflect_xptcall_src_md_unix_moz.build) = f3ca91e095866843989be25224ec6974dcd06674
SHA1 (patch-xpcom_reflect_xptcall_src_md_unix_xptcinvoke__gcc__x86__unix.cpp) = 8cd42915cd32756b55894a773a1e6d7c012b4467
SHA1 (patch-xpcom_reflect_xptcall_src_md_unix_xptcstubs__gcc__x86__unix.cpp) = e9e336817c172187f3e15ddf539a8a2176e3e952
diff --git a/www/firefox/mozilla-common.mk b/www/firefox/mozilla-common.mk
index dfe05d1b37f..e722786d4f4 100644
--- a/www/firefox/mozilla-common.mk
+++ b/www/firefox/mozilla-common.mk
@@ -1,4 +1,4 @@
-# $NetBSD: mozilla-common.mk,v 1.21 2013/11/21 15:24:38 ryoon Exp $
+# $NetBSD: mozilla-common.mk,v 1.22 2013/12/15 13:54:37 ryoon Exp $
#
# common Makefile fragment for mozilla packages based on gecko 2.0.
#
@@ -71,6 +71,7 @@ CONFIGURE_ARGS+= --enable-shared-js
CONFIGURE_ARGS+= --with-system-ply
CONFIGURE_ARGS+= --disable-icf
CONFIGURE_ARGS+= --disable-necko-wifi
+CONFIGURE_ARGS+= --disable-updater
SUBST_CLASSES+= fix-paths
SUBST_STAGE.fix-paths= pre-configure
@@ -101,6 +102,12 @@ SUBST_MESSAGE.python= Fixing path to python.
SUBST_FILES.python+= media/webrtc/trunk/build/common.gypi
SUBST_SED.python+= -e 's,<!(python,<!(${PYTHONBIN},'
+# Build outside ${WRKSRC}
+# Try to conflict with config/makefiles/xpidl/Makefile.in
+OBJDIR= ../build
+CONFIGURE_DIRS= ${OBJDIR}
+CONFIGURE_SCRIPT= ../mozilla-release/configure
+
PLIST_VARS+= sps vorbis tremor glskia throwwrapper
.include "../../mk/endian.mk"
diff --git a/www/firefox/patches/patch-aa b/www/firefox/patches/patch-aa
index 5569c823137..2ae2ca530c9 100644
--- a/www/firefox/patches/patch-aa
+++ b/www/firefox/patches/patch-aa
@@ -1,8 +1,8 @@
-$NetBSD: patch-aa,v 1.17 2013/11/04 05:43:57 ryoon Exp $
+$NetBSD: patch-aa,v 1.18 2013/12/15 13:54:37 ryoon Exp $
---- configure.in.orig 2013-10-25 22:27:10.000000000 +0000
+--- configure.in.orig 2013-12-05 16:07:23.000000000 +0000
+++ configure.in
-@@ -2819,6 +2819,7 @@ EOF
+@@ -2752,6 +2752,7 @@ EOF
#pragma GCC visibility push(hidden)
#pragma GCC visibility push(default)
#include <string.h>
@@ -10,7 +10,7 @@ $NetBSD: patch-aa,v 1.17 2013/11/04 05:43:57 ryoon Exp $
#pragma GCC visibility pop
__attribute__ ((visibility ("default"))) void Func() {
-@@ -2827,7 +2828,7 @@ __attribute__ ((visibility ("default")))
+@@ -2760,7 +2761,7 @@ __attribute__ ((visibility ("default")))
}
EOF
ac_cv_have_visibility_builtin_bug=no
@@ -19,7 +19,7 @@ $NetBSD: patch-aa,v 1.17 2013/11/04 05:43:57 ryoon Exp $
ac_cv_have_visibility_builtin_bug=yes
else
if test `grep -c "@PLT" conftest.S` = 0; then
-@@ -3283,14 +3284,22 @@ fi
+@@ -3216,14 +3217,22 @@ fi
AC_CACHE_CHECK(
[for res_ninit()],
ac_cv_func_res_ninit,
@@ -45,7 +45,7 @@ $NetBSD: patch-aa,v 1.17 2013/11/04 05:43:57 ryoon Exp $
[ac_cv_func_res_ninit=no])
])
-@@ -3941,6 +3950,14 @@ if test -n "$YASM"; then
+@@ -3874,6 +3883,14 @@ if test -n "$YASM"; then
_YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
fi
@@ -60,7 +60,7 @@ $NetBSD: patch-aa,v 1.17 2013/11/04 05:43:57 ryoon Exp $
if test -z "$SKIP_LIBRARY_CHECKS"; then
dnl system JPEG support
dnl ========================================================
-@@ -3968,11 +3985,7 @@ if test "$MOZ_NATIVE_JPEG" = 1; then
+@@ -3901,11 +3918,7 @@ if test "$MOZ_NATIVE_JPEG" = 1; then
#include <jpeglib.h> ],
[ #if JPEG_LIB_VERSION < $MOZJPEG
#error "Insufficient JPEG library version ($MOZJPEG required)."
@@ -73,8 +73,8 @@ $NetBSD: patch-aa,v 1.17 2013/11/04 05:43:57 ryoon Exp $
MOZ_NATIVE_JPEG=1,
AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
fi
-@@ -4113,6 +4126,22 @@ if test -n "$MOZ_NATIVE_FFI"; then
- fi
+@@ -4062,6 +4075,22 @@ fi
+ AC_SUBST(MOZ_NATIVE_ICU)
dnl ========================================================
+dnl system icu support
@@ -96,26 +96,20 @@ $NetBSD: patch-aa,v 1.17 2013/11/04 05:43:57 ryoon Exp $
dnl Java SDK support
dnl ========================================================
-@@ -5256,7 +5285,7 @@ dnl --enable-webrtc to override. Can di
- dnl the master list above.
- if test -n "$MOZ_WEBRTC"; then
- case "$target" in
-- *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*)
-+ *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
- dnl Leave enabled
- ;;
- *)
-@@ -5312,6 +5341,9 @@ if test -n "$MOZ_WEBRTC"; then
+@@ -5281,6 +5310,12 @@ if test -n "$MOZ_WEBRTC"; then
MOZ_VP8_ENCODER=1
MOZ_VP8_ERROR_CONCEALMENT=1
+ dnl with libv4l2 we can support more cameras
+ PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2)
+
++ dnl with libv4l2 we can support more cameras
++ PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2)
++
dnl enable once Signaling lands
MOZ_WEBRTC_SIGNALING=1
AC_DEFINE(MOZ_WEBRTC_SIGNALING)
-@@ -5338,15 +5370,18 @@ AC_SUBST(MOZ_SRTP)
+@@ -5307,15 +5342,18 @@ AC_SUBST(MOZ_SRTP)
dnl Use integers over floats for audio on B2G and Android, because audio
dnl backends for those platforms don't support floats.
@@ -137,7 +131,7 @@ $NetBSD: patch-aa,v 1.17 2013/11/04 05:43:57 ryoon Exp $
dnl ========================================================
dnl = Disable Speech API code
-@@ -8402,7 +8437,7 @@ case "$OS_TARGET" in
+@@ -8276,7 +8314,7 @@ case "$OS_TARGET" in
NECKO_WIFI=1
fi
;;
@@ -146,7 +140,7 @@ $NetBSD: patch-aa,v 1.17 2013/11/04 05:43:57 ryoon Exp $
NECKO_WIFI=1
;;
Linux)
-@@ -9124,6 +9159,10 @@ if test -n "$INTEL_ARCHITECTURE"; then
+@@ -9005,6 +9043,14 @@ if test -n "$INTEL_ARCHITECTURE"; then
fi
fi
@@ -154,24 +148,10 @@ $NetBSD: patch-aa,v 1.17 2013/11/04 05:43:57 ryoon Exp $
+ EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D use_libv4l2=1"
+fi
+
++if test -n "$MOZ_LIBV4L2_LIBS"; then
++ EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D use_libv4l2=1"
++fi
++
if test -n "$MOZ_WEBRTC"; then
AC_MSG_RESULT("generating WebRTC Makefiles...")
-@@ -9419,15 +9458,14 @@ dist=$MOZ_BUILD_ROOT/dist
- ac_configure_args="$_SUBDIR_CONFIG_ARGS"
- ac_configure_args="$ac_configure_args --enable-threadsafe"
- # Switch to "$MOZ_BUILD_APP" != "browser" when enabling for desktop builds.
--if test "A" = "A"; then
-+#if test "A" = "A"; then
- # The Internationalization API isn't on by default except in standalone JS
- # engine builds. Bugs to enable it in the browser:
- #
- # Desktop: bug 853301
- # Android: bug 864843
- # B2G: bug 866301
-- ac_configure_args="$ac_configure_args --disable-intl-api"
--fi
-+#fi
- if test "$BUILD_CTYPES"; then
- # Build js-ctypes on the platforms we can.
- ac_configure_args="$ac_configure_args --enable-ctypes"
diff --git a/www/firefox/patches/patch-as b/www/firefox/patches/patch-as
index 76cdac01789..a7392d09a80 100644
--- a/www/firefox/patches/patch-as
+++ b/www/firefox/patches/patch-as
@@ -1,10 +1,10 @@
-$NetBSD: patch-as,v 1.5 2013/11/02 22:57:55 ryoon Exp $
+$NetBSD: patch-as,v 1.6 2013/12/15 13:54:37 ryoon Exp $
Treat DragonFly like FreeBSD.
---- js/src/configure.in.orig 2013-10-25 22:27:22.000000000 +0000
+--- js/src/configure.in.orig 2013-12-05 16:07:35.000000000 +0000
+++ js/src/configure.in
-@@ -2347,6 +2347,7 @@ EOF
+@@ -2290,6 +2290,7 @@ EOF
#pragma GCC visibility push(hidden)
#pragma GCC visibility push(default)
#include <string.h>
@@ -12,7 +12,7 @@ Treat DragonFly like FreeBSD.
#pragma GCC visibility pop
__attribute__ ((visibility ("default"))) void Func() {
-@@ -2355,7 +2356,7 @@ __attribute__ ((visibility ("default")))
+@@ -2298,7 +2299,7 @@ __attribute__ ((visibility ("default")))
}
EOF
ac_cv_have_visibility_builtin_bug=no
@@ -21,7 +21,7 @@ Treat DragonFly like FreeBSD.
ac_cv_have_visibility_builtin_bug=yes
else
if test `grep -c "@PLT" conftest.S` = 0; then
-@@ -2572,7 +2573,7 @@ then
+@@ -2515,7 +2516,7 @@ then
fi
case "$target" in
@@ -30,7 +30,7 @@ Treat DragonFly like FreeBSD.
AC_DEFINE(_REENTRANT)
AC_DEFINE(_THREAD_SAFE)
dnl -pthread links in -lpthread, so don't specify it explicitly.
-@@ -2657,14 +2658,22 @@ fi
+@@ -2600,14 +2601,22 @@ fi
AC_CACHE_CHECK(
[for res_ninit()],
ac_cv_func_res_ninit,
@@ -56,7 +56,7 @@ Treat DragonFly like FreeBSD.
[ac_cv_func_res_ninit=no])
])
-@@ -3361,7 +3370,7 @@ if test "$MOZ_MEMORY"; then
+@@ -3316,7 +3325,7 @@ if test "$MOZ_MEMORY"; then
*-darwin*)
AC_DEFINE(MOZ_MEMORY_DARWIN)
;;
@@ -65,9 +65,9 @@ Treat DragonFly like FreeBSD.
AC_DEFINE(MOZ_MEMORY_BSD)
;;
*-android*|*-linuxandroid*)
-@@ -4246,6 +4255,16 @@ fi
+@@ -4339,6 +4348,16 @@ fi
dnl ========================================================
- dnl ECMAScript Internationalization API Support (uses ICU)
+ dnl JavaScript shell
dnl ========================================================
+ICU_LIB_NAMES=
+MOZ_NATIVE_ICU=
@@ -80,65 +80,5 @@ Treat DragonFly like FreeBSD.
+ PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1)
+fi
- ENABLE_INTL_API=1
- MOZ_ARG_DISABLE_BOOL(intl-api,
-@@ -4255,37 +4274,36 @@ MOZ_ARG_DISABLE_BOOL(intl-api,
- dnl Settings for the implementation of the ECMAScript Internationalization API
- if test -n "$ENABLE_INTL_API"; then
- AC_DEFINE(ENABLE_INTL_API)
-- # We build ICU as a static library.
-- AC_DEFINE(U_STATIC_IMPLEMENTATION)
--
-- case "$OS_TARGET" in
-- WINNT)
-- ICU_LIB_NAMES="icuin icuuc icudt"
-- ;;
-- Darwin|Linux)
-- ICU_LIB_NAMES="icui18n icuuc icudata"
-- ;;
-- *)
-- AC_MSG_ERROR([ECMAScript Internationalization API is not yet supported on this platform])
-- esac
-
-- ICU_LIBS='$(call EXPAND_LIBNAME_PATH,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/lib)'
--else
-- ICU_LIB_NAMES=
-- ICU_LIBS=
-+ if test -z "$MOZ_NATIVE_ICU"; then
-+ case "$OS_TARGET" in
-+ WINNT)
-+ ICU_LIB_NAMES="icuin icuuc icudt"
-+ ;;
-+ Darwin|Linux)
-+ ICU_LIB_NAMES="icui18n icuuc icudata"
-+ ;;
-+ *)
-+ AC_MSG_ERROR([ECMAScript Internationalization API is not yet supported on this platform])
-+ esac
-+ MOZ_ICU_LIBS='$(call EXPAND_LIBNAME_PATH,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/lib)'
-+ fi
- fi
-
- AC_SUBST(ENABLE_INTL_API)
- AC_SUBST(ICU_LIB_NAMES)
--AC_SUBST(ICU_LIBS)
-+AC_SUBST(MOZ_ICU_LIBS)
-+AC_SUBST(MOZ_NATIVE_ICU)
-
--dnl Source files that use ICU should have control over which parts of the ICU
--dnl namespace they want to use.
--AC_DEFINE(U_USING_ICU_NAMESPACE,0)
-+dnl Settings for ICU
-+if test -n "$ENABLE_INTL_API" -a -z "$MOZ_NATIVE_ICU"; then
-+ dnl We build ICU as a static library.
-+ AC_DEFINE(U_STATIC_IMPLEMENTATION)
-
-+ dnl Source files that use ICU should have control over which parts of the ICU
-+ dnl namespace they want to use.
-+ AC_DEFINE(U_USING_ICU_NAMESPACE,0)
-
--dnl Settings for ICU
--if test -n "$ENABLE_INTL_API" ; then
- # Set ICU compile options
- ICU_CPPFLAGS=""
- # don't use icu namespace automatically in client code
+ AC_HAVE_FUNCS(setlocale)
+ AC_HAVE_FUNCS(localeconv)
diff --git a/www/firefox/patches/patch-config_Makefile.in b/www/firefox/patches/patch-config_Makefile.in
deleted file mode 100644
index b9ed3992add..00000000000
--- a/www/firefox/patches/patch-config_Makefile.in
+++ /dev/null
@@ -1,12 +0,0 @@
-$NetBSD: patch-config_Makefile.in,v 1.1 2013/09/19 12:37:49 ryoon Exp $
-
---- config/Makefile.in.orig 2013-09-10 03:43:23.000000000 +0000
-+++ config/Makefile.in
-@@ -102,6 +102,7 @@ export:: $(export-preqs)
- -DMOZ_NATIVE_JPEG=$(MOZ_NATIVE_JPEG) \
- -DMOZ_NATIVE_LIBEVENT=$(MOZ_NATIVE_LIBEVENT) \
- -DMOZ_NATIVE_LIBVPX=$(MOZ_NATIVE_LIBVPX) \
-+ -DMOZ_NATIVE_ICU=$(MOZ_NATIVE_ICU) \
- $(srcdir)/system-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers
- $(INSTALL) system_wrappers $(DIST)
-
diff --git a/www/firefox/patches/patch-config_baseconfig.mk b/www/firefox/patches/patch-config_baseconfig.mk
index 3c87d3f6bc7..123dcb2f71c 100644
--- a/www/firefox/patches/patch-config_baseconfig.mk
+++ b/www/firefox/patches/patch-config_baseconfig.mk
@@ -1,10 +1,8 @@
-$NetBSD: patch-config_baseconfig.mk,v 1.2 2013/08/07 12:17:54 ryoon Exp $
+$NetBSD: patch-config_baseconfig.mk,v 1.3 2013/12/15 13:54:37 ryoon Exp $
---- config/baseconfig.mk.orig 2013-01-04 23:44:28.000000000 +0000
+--- config/baseconfig.mk.orig 2013-12-05 16:07:23.000000000 +0000
+++ config/baseconfig.mk
-@@ -1,9 +1,9 @@
- INCLUDED_AUTOCONF_MK = 1
-
+@@ -1,7 +1,7 @@
-includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
-installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
diff --git a/www/firefox/patches/patch-config_stl-headers b/www/firefox/patches/patch-config_stl-headers
deleted file mode 100644
index c5101f8a240..00000000000
--- a/www/firefox/patches/patch-config_stl-headers
+++ /dev/null
@@ -1,12 +0,0 @@
-$NetBSD: patch-config_stl-headers,v 1.1 2013/11/02 22:57:55 ryoon Exp $
-
---- config/stl-headers.orig 2013-10-25 22:27:10.000000000 +0000
-+++ config/stl-headers
-@@ -21,6 +21,7 @@ algorithm
- atomic
- deque
- ios
-+iosfwd
- iostream
- iterator
- limits
diff --git a/www/firefox/patches/patch-config_system-headers b/www/firefox/patches/patch-config_system-headers
index 146ec7cce2d..a442d3339b4 100644
--- a/www/firefox/patches/patch-config_system-headers
+++ b/www/firefox/patches/patch-config_system-headers
@@ -1,27 +1,9 @@
-$NetBSD: patch-config_system-headers,v 1.3 2013/11/02 22:57:55 ryoon Exp $
+$NetBSD: patch-config_system-headers,v 1.4 2013/12/15 13:54:37 ryoon Exp $
---- config/system-headers.orig 2013-10-25 22:27:10.000000000 +0000
+--- config/system-headers.orig 2013-12-05 16:07:23.000000000 +0000
+++ config/system-headers
-@@ -469,6 +469,7 @@ IOKit/IOMessage.h
- IOKit/pwr_mgt/IOPMLib.h
- iomanip
- ios
-+iosfwd
- iostream
- iostream.h
- iterator
-@@ -1132,3 +1133,14 @@ kvm.h
- spawn.h
- err.h
- xlocale.h
-+#if MOZ_NATIVE_ICU==1
-+unicode/locid.h
-+unicode/numsys.h
-+unicode/ucal.h
-+unicode/ucol.h
-+unicode/udat.h
-+unicode/udatpg.h
-+unicode/uenum.h
-+unicode/unum.h
-+unicode/ustring.h
-+#endif
+@@ -1144,3 +1144,4 @@ unicode/unum.h
+ unicode/ustring.h
+ unicode/utypes.h
+ #endif
++libutil.h
diff --git a/www/firefox/patches/patch-ipc_chromium_src_base_file__util.h b/www/firefox/patches/patch-ipc_chromium_src_base_file__util.h
index 5d1f1c5f7ce..eaeb6e1f196 100644
--- a/www/firefox/patches/patch-ipc_chromium_src_base_file__util.h
+++ b/www/firefox/patches/patch-ipc_chromium_src_base_file__util.h
@@ -1,6 +1,6 @@
-$NetBSD: patch-ipc_chromium_src_base_file__util.h,v 1.1 2013/07/17 11:00:13 jperkin Exp $
+$NetBSD: patch-ipc_chromium_src_base_file__util.h,v 1.2 2013/12/15 13:54:37 ryoon Exp $
---- ipc/chromium/src/base/file_util.h.orig 2013-05-11 19:19:32.000000000 +0000
+--- ipc/chromium/src/base/file_util.h.orig 2013-12-05 16:07:35.000000000 +0000
+++ ipc/chromium/src/base/file_util.h
@@ -16,7 +16,9 @@
#include <sys/stat.h>
@@ -12,12 +12,3 @@ $NetBSD: patch-ipc_chromium_src_base_file__util.h,v 1.1 2013/07/17 11:00:13 jper
#include <sys/stat.h>
#endif
-@@ -466,7 +468,7 @@ class FileEnumerator {
- #if defined(OS_WIN)
- WIN32_FIND_DATA find_data_;
- HANDLE find_handle_;
--#elif defined(ANDROID)
-+#elif defined(ANDROID) || defined(OS_SOLARIS)
- void *fts_;
- #elif defined(OS_POSIX)
- FTS* fts_;
diff --git a/www/firefox/patches/patch-ipc_chromium_src_base_file__util__posix.cc b/www/firefox/patches/patch-ipc_chromium_src_base_file__util__posix.cc
index ca987ad3c6c..b134852c85d 100644
--- a/www/firefox/patches/patch-ipc_chromium_src_base_file__util__posix.cc
+++ b/www/firefox/patches/patch-ipc_chromium_src_base_file__util__posix.cc
@@ -1,6 +1,6 @@
-$NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.1 2013/07/17 11:00:13 jperkin Exp $
+$NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.2 2013/12/15 13:54:37 ryoon Exp $
---- ipc/chromium/src/base/file_util_posix.cc.orig 2013-05-11 19:19:32.000000000 +0000
+--- ipc/chromium/src/base/file_util_posix.cc.orig 2013-12-05 16:07:35.000000000 +0000
+++ ipc/chromium/src/base/file_util_posix.cc
@@ -8,7 +8,7 @@
#include <errno.h>
@@ -11,7 +11,7 @@ $NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.1 2013/07/17 11:00
#include <fts.h>
#endif
#include <libgen.h>
-@@ -121,7 +121,7 @@ bool Delete(const FilePath& path, bool r
+@@ -67,7 +67,7 @@ bool Delete(const FilePath& path, bool r
if (!recursive)
return (rmdir(path_str) == 0);
@@ -20,7 +20,7 @@ $NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.1 2013/07/17 11:00
// XXX Need ftsless impl for bionic
return false;
#else
-@@ -194,7 +194,7 @@ bool CopyDirectory(const FilePath& from_
+@@ -140,7 +140,7 @@ bool CopyDirectory(const FilePath& from_
return false;
}
@@ -29,30 +29,3 @@ $NetBSD: patch-ipc_chromium_src_base_file__util__posix.cc,v 1.1 2013/07/17 11:00
// XXX Need ftsless impl for bionic
return false;
#else
-@@ -613,7 +613,7 @@ FileEnumerator::FileEnumerator(const Fil
- }
-
- FileEnumerator::~FileEnumerator() {
--#ifndef ANDROID
-+#if !defined(ANDROID) && !defined(OS_SOLARIS)
- if (fts_)
- fts_close(fts_);
- #endif
-@@ -625,7 +625,7 @@ void FileEnumerator::GetFindInfo(FindInf
- if (!is_in_find_op_)
- return;
-
--#ifndef ANDROID
-+#if !defined(ANDROID) && !defined(OS_SOLARIS)
- memcpy(&(info->stat), fts_ent_->fts_statp, sizeof(info->stat));
- info->filename.assign(fts_ent_->fts_name);
- #endif
-@@ -636,7 +636,7 @@ void FileEnumerator::GetFindInfo(FindInf
- // large directories with many files this can be quite deep.
- // TODO(erikkay) - get rid of this recursive pattern
- FilePath FileEnumerator::Next() {
--#ifdef ANDROID
-+#if defined(ANDROID) || defined(OS_SOLARIS)
- return FilePath();
- #else
- if (!is_in_find_op_) {
diff --git a/www/firefox/patches/patch-js__src__vm__SPSProfiler.cpp b/www/firefox/patches/patch-js__src__vm__SPSProfiler.cpp
index ca13b0fdba9..08107c131d0 100644
--- a/www/firefox/patches/patch-js__src__vm__SPSProfiler.cpp
+++ b/www/firefox/patches/patch-js__src__vm__SPSProfiler.cpp
@@ -1,12 +1,20 @@
-$NetBSD: patch-js__src__vm__SPSProfiler.cpp,v 1.3 2013/11/02 22:57:55 ryoon Exp $
+$NetBSD: patch-js__src__vm__SPSProfiler.cpp,v 1.4 2013/12/15 13:54:37 ryoon Exp $
Unclear fallout from our version of bug 840242, attachment v1: some architectures
fail to link if we do not add the inlines here - might be compiler/arch specific.
---- js/src/vm/SPSProfiler.cpp.orig 2013-10-25 22:27:26.000000000 +0000
+--- js/src/vm/SPSProfiler.cpp.orig 2013-12-05 16:07:40.000000000 +0000
+++ js/src/vm/SPSProfiler.cpp
-@@ -10,6 +10,7 @@
+@@ -4,12 +4,15 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
++#include "jscntxtinlines.h"
++
+ #include "vm/SPSProfiler.h"
+
+ #include "mozilla/DebugOnly.h"
#include "jsnum.h"
#include "jsscript.h"
diff --git a/www/firefox/patches/patch-js_src_Makefile.in b/www/firefox/patches/patch-js_src_Makefile.in
index dafa925bd9d..1b66be2ac9e 100644
--- a/www/firefox/patches/patch-js_src_Makefile.in
+++ b/www/firefox/patches/patch-js_src_Makefile.in
@@ -1,52 +1,8 @@
-$NetBSD: patch-js_src_Makefile.in,v 1.3 2013/11/02 22:57:55 ryoon Exp $
+$NetBSD: patch-js_src_Makefile.in,v 1.4 2013/12/15 13:54:37 ryoon Exp $
---- js/src/Makefile.in.orig 2013-10-25 22:27:22.000000000 +0000
+--- js/src/Makefile.in.orig 2013-12-05 16:07:35.000000000 +0000
+++ js/src/Makefile.in
-@@ -232,10 +232,14 @@ endif
- # ICU headers need to be available whether we build with the complete
- # Internationalization API or not - ICU stubs rely on them.
-
-+ifdef MOZ_NATIVE_ICU
-+LOCAL_INCLUDES += $(MOZ_ICU_CFLAGS)
-+else
- LOCAL_INCLUDES += \
- -I$(topsrcdir)/../../intl/icu/source/common \
- -I$(topsrcdir)/../../intl/icu/source/i18n \
- $(NULL)
-+endif
-
- ifdef ENABLE_INTL_API
-
-@@ -255,6 +259,7 @@ else
- ICU_MAKE = $(MAKE)
- endif
-
-+ifndef MOZ_NATIVE_ICU
- # - Build ICU as part of the "export" target, so things get built
- # in the right order.
- # - ICU requires GNU make according to its readme.html. pymake can't be used
-@@ -269,6 +274,7 @@ export::
-
- distclean clean::
- $(call SUBMAKE,$@,intl/icu)
-+endif
-
- endif
-
-@@ -394,7 +400,11 @@ ifneq (,$(MOZ_ZLIB_LIBS)$(MOZ_GLUE_LDFLA
- DEFINES += -DUSE_ZLIB
- endif
-
--SHARED_LIBRARY_LIBS += $(ICU_LIBS)
-+ifdef MOZ_NATIVE_ICU
-+EXTRA_DSO_LDOPTS += $(MOZ_ICU_LIBS)
-+else
-+SHARED_LIBRARY_LIBS += $(MOZ_ICU_LIBS)
-+endif
-
- # Prevent floating point errors caused by VC++ optimizations
- ifdef _MSC_VER
-@@ -453,6 +463,13 @@ EXTRA_LIBS += -lposix4 -ldl -lnsl -lsock
+@@ -467,6 +467,13 @@ EXTRA_LIBS += -lposix4 -ldl -lnsl -lsock
endif
endif
diff --git a/www/firefox/patches/patch-js_src_config_Makefile.in b/www/firefox/patches/patch-js_src_config_Makefile.in
deleted file mode 100644
index 66326718401..00000000000
--- a/www/firefox/patches/patch-js_src_config_Makefile.in
+++ /dev/null
@@ -1,12 +0,0 @@
-$NetBSD: patch-js_src_config_Makefile.in,v 1.1 2013/09/19 12:37:50 ryoon Exp $
-
---- js/src/config/Makefile.in.orig 2013-09-10 03:43:34.000000000 +0000
-+++ js/src/config/Makefile.in
-@@ -59,6 +59,7 @@ export:: \
- $(call mkdir_deps,system_wrappers_js) \
- $(NULL)
- $(PYTHON) $(srcdir)/Preprocessor.py $(DEFINES) $(ACDEFINES) \
-+ -DMOZ_NATIVE_ICU=$(MOZ_NATIVE_ICU) \
- $(srcdir)/system-headers | $(PERL) $(srcdir)/make-system-wrappers.pl system_wrappers_js
- $(INSTALL) system_wrappers_js $(DIST)
-
diff --git a/www/firefox/patches/patch-js_src_config_system-headers b/www/firefox/patches/patch-js_src_config_system-headers
index c6205f506dc..90ee34ad9a0 100644
--- a/www/firefox/patches/patch-js_src_config_system-headers
+++ b/www/firefox/patches/patch-js_src_config_system-headers
@@ -1,27 +1,9 @@
-$NetBSD: patch-js_src_config_system-headers,v 1.3 2013/11/02 22:57:55 ryoon Exp $
+$NetBSD: patch-js_src_config_system-headers,v 1.4 2013/12/15 13:54:37 ryoon Exp $
---- js/src/config/system-headers.orig 2013-10-25 22:27:22.000000000 +0000
+--- js/src/config/system-headers.orig 2013-12-05 16:07:35.000000000 +0000
+++ js/src/config/system-headers
-@@ -469,6 +469,7 @@ IOKit/IOMessage.h
- IOKit/pwr_mgt/IOPMLib.h
- iomanip
- ios
-+iosfwd
- iostream
- iostream.h
- iterator
-@@ -1132,3 +1133,14 @@ kvm.h
- spawn.h
- err.h
- xlocale.h
-+#if MOZ_NATIVE_ICU==1
-+unicode/locid.h
-+unicode/numsys.h
-+unicode/ucal.h
-+unicode/ucol.h
-+unicode/udat.h
-+unicode/udatpg.h
-+unicode/uenum.h
-+unicode/unum.h
-+unicode/ustring.h
-+#endif
+@@ -1144,3 +1144,4 @@ unicode/unum.h
+ unicode/ustring.h
+ unicode/utypes.h
+ #endif
++libutil.h
diff --git a/www/firefox/patches/patch-js_src_gdb_Makefile.in b/www/firefox/patches/patch-js_src_gdb_Makefile.in
deleted file mode 100644
index f8764982c74..00000000000
--- a/www/firefox/patches/patch-js_src_gdb_Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-js_src_gdb_Makefile.in,v 1.1 2013/09/19 12:37:50 ryoon Exp $
-
---- js/src/gdb/Makefile.in.orig 2013-09-10 03:43:34.000000000 +0000
-+++ js/src/gdb/Makefile.in
-@@ -19,6 +19,10 @@ LIBS = $(DEPTH)/$(LIB_PREFIX)js_static.$
-
- LOCAL_INCLUDES += -I$(topsrcdir) -I..
-
-+ifdef MOZ_NATIVE_ICU
-+EXTRA_LIBS += $(MOZ_ICU_LIBS)
-+endif
-+
- EXTRA_LIBS += $(MOZ_FFI_LIBS)
-
- # Place a GDB Python auto-load file next to the gdb-tests executable, both
diff --git a/www/firefox/patches/patch-js_src_jsapi-tests_Makefile.in b/www/firefox/patches/patch-js_src_jsapi-tests_Makefile.in
deleted file mode 100644
index 8641f21303e..00000000000
--- a/www/firefox/patches/patch-js_src_jsapi-tests_Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-js_src_jsapi-tests_Makefile.in,v 1.1 2013/09/19 12:37:50 ryoon Exp $
-
---- js/src/jsapi-tests/Makefile.in.orig 2013-09-10 03:43:36.000000000 +0000
-+++ js/src/jsapi-tests/Makefile.in
-@@ -20,6 +20,10 @@ LIBS = $(DEPTH)/$(LIB_PREFIX)js_sta
-
- LOCAL_INCLUDES += -I$(topsrcdir) -I..
-
-+ifdef MOZ_NATIVE_ICU
-+EXTRA_LIBS += $(MOZ_ICU_LIBS)
-+endif
-+
- EXTRA_LIBS += $(MOZ_FFI_LIBS)
-
- ifdef QEMU_EXE
diff --git a/www/firefox/patches/patch-js_src_shell_Makefile.in b/www/firefox/patches/patch-js_src_shell_Makefile.in
deleted file mode 100644
index 10b79138224..00000000000
--- a/www/firefox/patches/patch-js_src_shell_Makefile.in
+++ /dev/null
@@ -1,14 +0,0 @@
-$NetBSD: patch-js_src_shell_Makefile.in,v 1.1 2013/09/19 12:37:50 ryoon Exp $
-
---- js/src/shell/Makefile.in.orig 2013-09-10 03:43:36.000000000 +0000
-+++ js/src/shell/Makefile.in
-@@ -27,6 +27,9 @@ LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS
- ifdef MOZ_NATIVE_FFI
- EXTRA_LIBS += $(MOZ_FFI_LIBS)
- endif
-+ifdef MOZ_NATIVE_ICU
-+EXTRA_LIBS += $(MOZ_ICU_LIBS)
-+endif
-
- LOCAL_INCLUDES += -I$(topsrcdir) -I..
-
diff --git a/www/firefox/patches/patch-js_src_vm_ObjectImpl-inl.h b/www/firefox/patches/patch-js_src_vm_ObjectImpl-inl.h
deleted file mode 100644
index a7b7d5f3bf9..00000000000
--- a/www/firefox/patches/patch-js_src_vm_ObjectImpl-inl.h
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD: patch-js_src_vm_ObjectImpl-inl.h,v 1.4 2013/09/19 12:37:50 ryoon Exp $
-
---- js/src/vm/ObjectImpl-inl.h.orig 2013-09-10 03:43:39.000000000 +0000
-+++ js/src/vm/ObjectImpl-inl.h
-@@ -364,7 +364,7 @@ js::ObjectImpl::zone() const
- js::ObjectImpl::readBarrier(ObjectImpl *obj)
- {
- #ifdef JSGC_INCREMENTAL
-- Zone *zone = obj->zone();
-+ JS::Zone *zone = obj->zone();
- if (zone->needsBarrier()) {
- MOZ_ASSERT(!zone->rt->isHeapMajorCollecting());
- JSObject *tmp = obj->asObjectPtr();
-@@ -378,7 +378,7 @@ inline void
- js::ObjectImpl::privateWriteBarrierPre(void **old)
- {
- #ifdef JSGC_INCREMENTAL
-- Zone *zone = this->zone();
-+ JS::Zone *zone = this->zone();
- if (zone->needsBarrier()) {
- if (*old && getClass()->trace)
- getClass()->trace(zone->barrierTracer(), this->asObjectPtr());
-@@ -405,7 +405,7 @@ js::ObjectImpl::writeBarrierPre(ObjectIm
- if (IsNullTaggedPointer(obj) || !obj->runtime()->needsBarrier())
- return;
-
-- Zone *zone = obj->zone();
-+ JS::Zone *zone = obj->zone();
- if (zone->needsBarrier()) {
- MOZ_ASSERT(!zone->rt->isHeapMajorCollecting());
- JSObject *tmp = obj->asObjectPtr();
diff --git a/www/firefox/patches/patch-media_mtransport_objs.mk b/www/firefox/patches/patch-media_mtransport_objs.mk
deleted file mode 100644
index 8ee0f622ae1..00000000000
--- a/www/firefox/patches/patch-media_mtransport_objs.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-$NetBSD: patch-media_mtransport_objs.mk,v 1.1 2013/05/23 13:12:13 ryoon Exp $
-
---- media/mtransport/objs.mk.orig 2013-05-11 19:19:43.000000000 +0000
-+++ media/mtransport/objs.mk
-@@ -23,12 +23,16 @@ LOCAL_INCLUDES += \
- -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/event \
- $(NULL)
-
--ifeq ($(OS_TARGET), Darwin)
-+ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
- LOCAL_INCLUDES += \
- -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include \
- -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/generic/include \
- $(NULL)
-+ifeq ($(OS_TARGET), Darwin)
- DEFINES += -DDARWIN
-+else
-+DEFINES += -DBSD
-+endif
- endif
-
- ifeq ($(OS_TARGET), Linux)
diff --git a/www/firefox/patches/patch-media_mtransport_test_Makefile.in b/www/firefox/patches/patch-media_mtransport_test_Makefile.in
deleted file mode 100644
index acdbf5f27e3..00000000000
--- a/www/firefox/patches/patch-media_mtransport_test_Makefile.in
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD: patch-media_mtransport_test_Makefile.in,v 1.1 2013/05/23 13:12:13 ryoon Exp $
-
---- media/mtransport/test/Makefile.in.orig 2013-05-11 19:19:43.000000000 +0000
-+++ media/mtransport/test/Makefile.in
-@@ -78,12 +78,14 @@ endif
- endif
- endif
-
--ifeq ($(OS_TARGET), Darwin)
-+ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
- LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include
-+ifeq ($(OS_TARGET), Darwin)
- DEFINES += \
- -DGTEST_USE_OWN_TR1_TUPLE=1 \
- $(NULL)
- endif
-+endif
-
- ifeq ($(OS_TARGET), Linux)
- LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include
diff --git a/www/firefox/patches/patch-media_mtransport_third__party_nICEr_nicer.gyp b/www/firefox/patches/patch-media_mtransport_third__party_nICEr_nicer.gyp
deleted file mode 100644
index 6e950d8b102..00000000000
--- a/www/firefox/patches/patch-media_mtransport_third__party_nICEr_nicer.gyp
+++ /dev/null
@@ -1,33 +0,0 @@
-$NetBSD: patch-media_mtransport_third__party_nICEr_nicer.gyp,v 1.1 2013/05/23 13:12:13 ryoon Exp $
-
---- media/mtransport/third_party/nICEr/nicer.gyp.orig 2013-05-11 19:19:43.000000000 +0000
-+++ media/mtransport/third_party/nICEr/nicer.gyp
-@@ -129,8 +129,19 @@
- ],
-
- 'conditions' : [
-- ## Mac
-+ ## Mac and BSDs
- [ 'OS == "mac"', {
-+ 'defines' : [
-+ 'DARWIN',
-+ 'HAVE_XLOCALE',
-+ ],
-+ }],
-+ [ 'os_bsd == 1', {
-+ 'defines' : [
-+ 'BSD',
-+ ],
-+ }],
-+ [ 'OS == "mac" or os_bsd == 1', {
- 'cflags_mozilla': [
- '-Wall',
- '-Wno-parentheses',
-@@ -138,7 +149,6 @@
- '-Wmissing-prototypes',
- ],
- 'defines' : [
-- 'DARWIN',
- 'HAVE_LIBM=1',
- 'HAVE_STRDUP=1',
- 'HAVE_STRLCPY=1',
diff --git a/www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_stun_addrs.c b/www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_stun_addrs.c
deleted file mode 100644
index 4a2090bd1a6..00000000000
--- a/www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_stun_addrs.c
+++ /dev/null
@@ -1,32 +0,0 @@
-$NetBSD: patch-media_mtransport_third__party_nICEr_src_stun_addrs.c,v 1.4 2013/11/02 22:57:55 ryoon Exp $
-
---- media/mtransport/third_party/nICEr/src/stun/addrs.c.orig 2013-10-25 22:27:33.000000000 +0000
-+++ media/mtransport/third_party/nICEr/src/stun/addrs.c
-@@ -55,7 +55,9 @@ static char *RCSSTRING __UNUSED__="$Id:
- #endif
- #include <net/if.h>
- #ifndef LINUX
-+#if !defined(__OpenBSD__) && !defined(__NetBSD__)
- #include <net/if_var.h>
-+#endif
- #include <net/if_dl.h>
- #include <net/if_types.h>
- #include <sys/sockio.h>
-@@ -80,7 +82,7 @@ static char *RCSSTRING __UNUSED__="$Id:
-
-
-
--#ifdef DARWIN
-+#if defined(BSD) || defined(DARWIN)
- /*
- * Copyright (c) 1983, 1993
- * The Regents of the University of California. All rights reserved.
-@@ -695,7 +697,7 @@ nr_stun_get_addrs(nr_transport_addr addr
- int _status=0;
- int i;
-
--#ifdef DARWIN
-+#if defined(BSD) || defined(DARWIN)
- _status = stun_get_mib_addrs(addrs, maxaddrs, count);
- #elif defined(WIN32)
- _status = stun_get_win32_addrs(addrs, maxaddrs, count);
diff --git a/www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_stun_stun.h b/www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_stun_stun.h
deleted file mode 100644
index 006222856eb..00000000000
--- a/www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_stun_stun.h
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD: patch-media_mtransport_third__party_nICEr_src_stun_stun.h,v 1.1 2013/05/23 13:12:13 ryoon Exp $
-
---- media/mtransport/third_party/nICEr/src/stun/stun.h.orig 2013-05-11 19:19:43.000000000 +0000
-+++ media/mtransport/third_party/nICEr/src/stun/stun.h
-@@ -41,11 +41,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- #include <sys/socket.h>
- #include <net/if.h>
- #ifndef LINUX
-+#if !defined(__OpenBSD__) && !defined(__NetBSD__)
- #include <net/if_var.h>
-+#endif
- #include <net/if_dl.h>
- #include <net/if_types.h>
- #endif
-+#ifndef BSD
- #include <net/route.h>
-+#endif
- #include <netinet/in.h>
- #ifndef LINUX
- #include <netinet/in_var.h>
diff --git a/www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_util_mbslen.c b/www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_util_mbslen.c
deleted file mode 100644
index 2b6111024aa..00000000000
--- a/www/firefox/patches/patch-media_mtransport_third__party_nICEr_src_util_mbslen.c
+++ /dev/null
@@ -1,78 +0,0 @@
-$NetBSD: patch-media_mtransport_third__party_nICEr_src_util_mbslen.c,v 1.2 2013/06/26 11:32:12 ryoon Exp $
-
---- media/mtransport/third_party/nICEr/src/util/mbslen.c.orig 2013-06-17 22:13:19.000000000 +0000
-+++ media/mtransport/third_party/nICEr/src/util/mbslen.c
-@@ -43,9 +43,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- #include <locale.h>
- #include <stdlib.h>
- #include <wchar.h>
--#ifdef DARWIN
-+
-+#ifdef __FreeBSD__
-+#include <osreldate.h>
-+# if __FreeBSD_version > 900505
-+# define HAVE_XLOCALE
-+# endif
-+#endif
-+
-+#ifdef HAVE_XLOCALE
- #include <xlocale.h>
--#endif /* DARWIN */
-+#endif /* HAVE_XLOCALE */
-
- #include "nr_api.h"
- #include "mbslen.h"
-@@ -54,10 +62,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- int
- mbslen(const char *s, size_t *ncharsp)
- {
--#ifdef DARWIN
-+#ifdef HAVE_XLOCALE
- static locale_t loc = 0;
- static int initialized = 0;
--#endif /* DARWIN */
-+#endif /* HAVE_XLOCALE */
- #ifdef WIN32
- char *my_locale=0;
- unsigned int i;
-@@ -67,7 +75,7 @@ mbslen(const char *s, size_t *ncharsp)
- int nchars;
- mbstate_t mbs;
-
--#ifdef DARWIN
-+#ifdef HAVE_XLOCALE
- if (! initialized) {
- initialized = 1;
- loc = newlocale(LC_CTYPE_MASK, "UTF-8", LC_GLOBAL_LOCALE);
-@@ -76,7 +84,7 @@ mbslen(const char *s, size_t *ncharsp)
- if (loc == 0) {
- /* unable to create the UTF-8 locale */
- assert(loc != 0); /* should never happen */
--#endif /* DARWIN */
-+#endif /* HAVE_XLOCALE */
-
- #ifdef WIN32
- if (!setlocale(LC_CTYPE, 0))
-@@ -99,18 +107,18 @@ mbslen(const char *s, size_t *ncharsp)
- ABORT(R_NOT_FOUND);
- #endif
-
--#ifdef DARWIN
-+#ifdef HAVE_XLOCALE
- }
--#endif /* DARWIN */
-+#endif /* HAVE_XLOCALE */
-
- memset(&mbs, 0, sizeof(mbs));
- nchars = 0;
-
--#ifdef DARWIN
-+#ifdef HAVE_XLOCALE
- while (*s != '\0' && (nbytes = mbrlen_l(s, strlen(s), &mbs, loc)) != 0)
- #else
- while (*s != '\0' && (nbytes = mbrlen(s, strlen(s), &mbs)) != 0)
--#endif /* DARWIN */
-+#endif /* HAVE_XLOCALE */
- {
- if (nbytes == (size_t)-1) /* should never happen */ {
- ABORT(R_INTERNAL);
diff --git a/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_nrappkit.gyp b/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_nrappkit.gyp
deleted file mode 100644
index d7050e2f012..00000000000
--- a/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_nrappkit.gyp
+++ /dev/null
@@ -1,32 +0,0 @@
-$NetBSD: patch-media_mtransport_third__party_nrappkit_nrappkit.gyp,v 1.1 2013/05/23 13:12:13 ryoon Exp $
-
---- media/mtransport/third_party/nrappkit/nrappkit.gyp.orig 2013-05-11 19:19:43.000000000 +0000
-+++ media/mtransport/third_party/nrappkit/nrappkit.gyp
-@@ -147,8 +147,18 @@
- ],
-
- 'conditions' : [
-- ## Mac
-+ ## Mac and BSDs
- [ 'OS == "mac"', {
-+ 'defines' : [
-+ 'DARWIN',
-+ ],
-+ }],
-+ [ 'os_bsd == 1', {
-+ 'defines' : [
-+ 'BSD',
-+ ],
-+ }],
-+ [ 'OS == "mac" or os_bsd == 1', {
- 'cflags_mozilla': [
- '-Wall',
- '-Wno-parentheses',
-@@ -156,7 +166,6 @@
- '-Wmissing-prototypes',
- ],
- 'defines' : [
-- 'DARWIN',
- 'HAVE_LIBM=1',
- 'HAVE_STRDUP=1',
- 'HAVE_STRLCPY=1',
diff --git a/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_log_r__log.c b/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_log_r__log.c
deleted file mode 100644
index 9b800e7abaa..00000000000
--- a/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_log_r__log.c
+++ /dev/null
@@ -1,12 +0,0 @@
-$NetBSD: patch-media_mtransport_third__party_nrappkit_src_log_r__log.c,v 1.1 2013/05/23 13:12:13 ryoon Exp $
-
---- media/mtransport/third_party/nrappkit/src/log/r_log.c.orig 2013-05-11 19:19:43.000000000 +0000
-+++ media/mtransport/third_party/nrappkit/src/log/r_log.c
-@@ -48,6 +48,7 @@ static char *RCSSTRING __UNUSED__ ="$Id:
- #include "hex.h"
-
- #include <string.h>
-+#include <errno.h>
- #ifndef _MSC_VER
- #include <strings.h>
- #include <syslog.h>
diff --git a/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h b/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h
index 516a684fb73..44ad2214e73 100644
--- a/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h
+++ b/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h
@@ -1,6 +1,6 @@
-$NetBSD: patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h,v 1.2 2013/11/02 22:57:55 ryoon Exp $
+$NetBSD: patch-media_mtransport_third__party_nrappkit_src_port_generic_include_sys_queue.h,v 1.3 2013/12/15 13:54:37 ryoon Exp $
---- media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h.orig 2013-10-25 22:27:34.000000000 +0000
+--- media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h.orig 2013-12-05 16:07:48.000000000 +0000
+++ media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h
@@ -30,12 +30,15 @@
* $FreeBSD: src/sys/sys/queue.h,v 1.58 2004/04/07 04:19:49 imp Exp $
@@ -12,7 +12,7 @@ $NetBSD: patch-media_mtransport_third__party_nrappkit_src_port_generic_include_s
+#elif !defined(_SYS_QUEUE_H_)
#define _SYS_QUEUE_H_
--#ifndef DARWIN
+-#if !defined(__FreeBSD__) && !defined(DARWIN)
#include <stddef.h>
-#define __offsetof offsetof
+
diff --git a/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_util_util.c b/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_util_util.c
deleted file mode 100644
index 2ebeb042481..00000000000
--- a/www/firefox/patches/patch-media_mtransport_third__party_nrappkit_src_util_util.c
+++ /dev/null
@@ -1,12 +0,0 @@
-$NetBSD: patch-media_mtransport_third__party_nrappkit_src_util_util.c,v 1.1 2013/05/23 13:12:13 ryoon Exp $
-
---- media/mtransport/third_party/nrappkit/src/util/util.c.orig 2013-05-11 19:19:43.000000000 +0000
-+++ media/mtransport/third_party/nrappkit/src/util/util.c
-@@ -45,6 +45,7 @@ static char *RCSSTRING __UNUSED__ ="$Id:
- #include <dirent.h>
- #endif
- #include <string.h>
-+#include <errno.h>
- #include <ctype.h>
- #include <sys/stat.h>
- #ifdef OPENSSL
diff --git a/www/firefox/patches/patch-media_webrtc_signaling_signaling.gyp b/www/firefox/patches/patch-media_webrtc_signaling_signaling.gyp
index cd06229f6ff..cc9afe29906 100644
--- a/www/firefox/patches/patch-media_webrtc_signaling_signaling.gyp
+++ b/www/firefox/patches/patch-media_webrtc_signaling_signaling.gyp
@@ -1,8 +1,8 @@
-$NetBSD: patch-media_webrtc_signaling_signaling.gyp,v 1.1 2013/05/23 13:12:13 ryoon Exp $
+$NetBSD: patch-media_webrtc_signaling_signaling.gyp,v 1.2 2013/12/15 13:54:37 ryoon Exp $
---- media/webrtc/signaling/signaling.gyp.orig 2013-05-11 19:19:44.000000000 +0000
+--- media/webrtc/signaling/signaling.gyp.orig 2013-12-05 16:07:48.000000000 +0000
+++ media/webrtc/signaling/signaling.gyp
-@@ -217,6 +217,19 @@
+@@ -244,6 +244,19 @@
'cflags_mozilla': [
],
}],
@@ -22,28 +22,19 @@ $NetBSD: patch-media_webrtc_signaling_signaling.gyp,v 1.1 2013/05/23 13:12:13 ry
['OS=="mac"', {
'include_dirs': [
],
-@@ -752,7 +765,7 @@
- ],
-
- }],
-- ['OS=="mac"', {
-+ ['OS=="mac" or os_bsd==1', {
-
- 'include_dirs': [
- ],
-@@ -797,14 +810,13 @@
-
- 'defines' : [
- 'SIP_OS_OSX',
-- '_POSIX_SOURCE',
-+ # using BSD extensions, leave _POSIX_SOURCE undefined
- 'CPR_MEMORY_LITTLE_ENDIAN',
- 'NO_SOCKET_POLLING',
- 'USE_TIMER_SELECT_BASED',
- 'FULL_BUILD',
- 'STUBBED_OUT',
- 'USE_PRINTF',
-- '_DARWIN_C_SOURCE',
- 'NO_NSPR_10_SUPPORT',
- ],
-
+@@ -823,14 +836,13 @@
+ ['OS=="mac"', {
+ 'defines' : [
+ 'SIP_OS_OSX',
+- '_POSIX_SOURCE',
++ # using BSD extensions, leave _POSIX_SOURCE undefined
+ 'CPR_MEMORY_LITTLE_ENDIAN',
+ 'NO_SOCKET_POLLING',
+ 'USE_TIMER_SELECT_BASED',
+ 'FULL_BUILD',
+ 'STUBBED_OUT',
+ 'USE_PRINTF',
+- '_DARWIN_C_SOURCE',
+ 'NO_NSPR_10_SUPPORT',
+ ],
+ }],
diff --git a/www/firefox/patches/patch-media_webrtc_signaling_src_sipcc_cpr_darwin_cpr__darwin__ipc.c b/www/firefox/patches/patch-media_webrtc_signaling_src_sipcc_cpr_darwin_cpr__darwin__ipc.c
deleted file mode 100644
index 2f73da756b1..00000000000
--- a/www/firefox/patches/patch-media_webrtc_signaling_src_sipcc_cpr_darwin_cpr__darwin__ipc.c
+++ /dev/null
@@ -1,20 +0,0 @@
-$NetBSD: patch-media_webrtc_signaling_src_sipcc_cpr_darwin_cpr__darwin__ipc.c,v 1.1 2013/05/23 13:12:13 ryoon Exp $
-
---- media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c.orig 2013-05-11 19:19:44.000000000 +0000
-+++ media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c
-@@ -322,11 +322,15 @@ cprGetMessage (cprMsgQueue_t msgQueue, b
- cpr_msgq_node_t *node;
- struct timespec timeout;
- struct timeval tv;
-+#ifndef __APPLE__
-+ struct timezone tz;
-+#else
- // On the iPhone, there is a DarwinAlias problem with "timezone"
- struct _timezone {
- int tz_minuteswest; /* of Greenwich */
- int tz_dsttime; /* type of dst correction to apply */
- } tz;
-+#endif
-
- /* Initialize ppUserData */
- if (ppUserData) {
diff --git a/www/firefox/patches/patch-media_webrtc_signaling_test_Makefile.in b/www/firefox/patches/patch-media_webrtc_signaling_test_Makefile.in
index 9b7fc1727a3..769e719cb3d 100644
--- a/www/firefox/patches/patch-media_webrtc_signaling_test_Makefile.in
+++ b/www/firefox/patches/patch-media_webrtc_signaling_test_Makefile.in
@@ -1,8 +1,8 @@
-$NetBSD: patch-media_webrtc_signaling_test_Makefile.in,v 1.1 2013/05/23 13:12:13 ryoon Exp $
+$NetBSD: patch-media_webrtc_signaling_test_Makefile.in,v 1.2 2013/12/15 13:54:37 ryoon Exp $
---- media/webrtc/signaling/test/Makefile.in.orig 2013-05-11 19:19:44.000000000 +0000
+--- media/webrtc/signaling/test/Makefile.in.orig 2013-12-05 16:07:48.000000000 +0000
+++ media/webrtc/signaling/test/Makefile.in
-@@ -17,6 +17,7 @@ LIBS = \
+@@ -7,6 +7,7 @@ LIBS = \
$(NSPR_LIBS) \
$(NSS_LIBS) \
$(REALTIME_LIBS) \
@@ -10,12 +10,3 @@ $NetBSD: patch-media_webrtc_signaling_test_Makefile.in,v 1.1 2013/05/23 13:12:13
$(DEPTH)/xpcom/glue/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(DEPTH)/media/mtransport/standalone/$(LIB_PREFIX)mtransport_s.$(LIB_SUFFIX) \
$(DEPTH)/media/webrtc/signalingtest/signaling_ecc/$(LIB_PREFIX)ecc.$(LIB_SUFFIX) \
-@@ -86,7 +87,7 @@ LIBS += \
- $(NULL)
- endif
-
--ifeq ($(OS_TARGET),Linux)
-+ifneq (,$(filter Linux DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET)))
- LIBS += \
- $(MOZ_CAIRO_OSLIBS) \
- $(NULL)
diff --git a/www/firefox/patches/patch-media_webrtc_trunk_build_build__config.h b/www/firefox/patches/patch-media_webrtc_trunk_build_build__config.h
deleted file mode 100644
index cd0b219886d..00000000000
--- a/www/firefox/patches/patch-media_webrtc_trunk_build_build__config.h
+++ /dev/null
@@ -1,41 +0,0 @@
-$NetBSD: patch-media_webrtc_trunk_build_build__config.h,v 1.1 2013/09/19 12:37:50 ryoon Exp $
-
---- media/webrtc/trunk/build/build_config.h.orig 2013-09-10 03:43:46.000000000 +0000
-+++ media/webrtc/trunk/build/build_config.h
-@@ -37,9 +37,15 @@
- #elif defined(_WIN32)
- #define OS_WIN 1
- #define TOOLKIT_VIEWS 1
--#elif defined(__FreeBSD__)
-+#elif defined(__DragonFly__)
-+#define OS_DRAGONFLY 1
-+#define TOOLKIT_GTK
-+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
- #define OS_FREEBSD 1
- #define TOOLKIT_GTK
-+#elif defined(__NetBSD__)
-+#define OS_NETBSD 1
-+#define TOOLKIT_GTK
- #elif defined(__OpenBSD__)
- #define OS_OPENBSD 1
- #define TOOLKIT_GTK
-@@ -56,15 +62,15 @@
-
- // For access to standard BSD features, use OS_BSD instead of a
- // more specific macro.
--#if defined(OS_FREEBSD) || defined(OS_OPENBSD)
-+#if defined(OS_DRAGONFLY) || defined(OS_FREEBSD) \
-+ || defined(OS_NETBSD) || defined(OS_OPENBSD)
- #define OS_BSD 1
- #endif
-
- // For access to standard POSIXish features, use OS_POSIX instead of a
- // more specific macro.
--#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
-- defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) || \
-- defined(OS_NACL)
-+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_BSD) || \
-+ defined(OS_SOLARIS) || defined(OS_ANDROID) || defined(OS_NACL)
- #define OS_POSIX 1
- #endif
-
diff --git a/www/firefox/patches/patch-media_webrtc_trunk_tools_gyp_pylib_gyp_generator_mozmake.py b/www/firefox/patches/patch-media_webrtc_trunk_tools_gyp_pylib_gyp_generator_mozmake.py
deleted file mode 100644
index 35ea3978d4d..00000000000
--- a/www/firefox/patches/patch-media_webrtc_trunk_tools_gyp_pylib_gyp_generator_mozmake.py
+++ /dev/null
@@ -1,55 +0,0 @@
-$NetBSD: patch-media_webrtc_trunk_tools_gyp_pylib_gyp_generator_mozmake.py,v 1.1 2013/05/23 13:12:13 ryoon Exp $
-
---- media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py.orig 2013-05-11 19:19:44.000000000 +0000
-+++ media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
-@@ -9,6 +9,7 @@ import collections
- import gyp
- import gyp.common
- import sys
-+import platform
- import os
- import re
- import shlex
-@@ -111,20 +112,34 @@ def ensure_directory_exists(path):
-
- def GetFlavor(params):
- """Returns |params.flavor| if it's set, the system's default flavor else."""
-+ system = platform.system().lower()
- flavors = {
-- 'win32': 'win',
-- 'darwin': 'mac',
-- 'sunos5': 'solaris',
-- 'freebsd7': 'freebsd',
-- 'freebsd8': 'freebsd',
-+ 'microsoft': 'win',
-+ 'windows' : 'win',
-+ 'darwin' : 'mac',
-+ 'sunos' : 'solaris',
-+ 'dragonfly': 'bsd',
-+ 'freebsd' : 'bsd',
-+ 'netbsd' : 'bsd',
-+ 'openbsd' : 'bsd',
- }
-- flavor = flavors.get(sys.platform, 'linux')
-- return params.get('flavor', flavor)
-+
-+ if 'flavor' in params:
-+ return params['flavor']
-+ if system.startswith('cygwin'):
-+ return 'win'
-+ if system in flavors:
-+ return flavors[system]
-+
-+ return 'linux'
-
-
- def CalculateVariables(default_variables, params):
-+ flavor = GetFlavor(params)
-+ if flavor == 'bsd':
-+ flavor = platform.system().lower()
- generator_flags = params.get('generator_flags', {})
-- default_variables['OS'] = generator_flags.get('os', GetFlavor(params))
-+ default_variables['OS'] = generator_flags.get('os', flavor)
-
-
- def CalculateGeneratorInputInfo(params):
diff --git a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_build_common.gypi b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_build_common.gypi
index 5ff449f0d21..e62334b2b00 100644
--- a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_build_common.gypi
+++ b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_build_common.gypi
@@ -1,9 +1,9 @@
-$NetBSD: patch-media_webrtc_trunk_webrtc_build_common.gypi,v 1.3 2013/09/19 12:37:50 ryoon Exp $
+$NetBSD: patch-media_webrtc_trunk_webrtc_build_common.gypi,v 1.4 2013/12/15 13:54:37 ryoon Exp $
---- media/webrtc/trunk/webrtc/build/common.gypi.orig 2013-09-10 03:43:47.000000000 +0000
+--- media/webrtc/trunk/webrtc/build/common.gypi.orig 2013-12-05 16:07:49.000000000 +0000
+++ media/webrtc/trunk/webrtc/build/common.gypi
-@@ -71,9 +71,9 @@
- 'enable_data_logging%': 0,
+@@ -78,9 +78,9 @@
+ 'enable_protobuf%': 1,
# Disable these to not build components which can be externally provided.
- 'build_libjpeg%': 1,
@@ -14,7 +14,7 @@ $NetBSD: patch-media_webrtc_trunk_webrtc_build_common.gypi,v 1.3 2013/09/19 12:3
# Enable to use the Mozilla internal settings.
'build_with_mozilla%': 0,
-@@ -238,7 +238,7 @@
+@@ -241,7 +241,7 @@
}],
['OS=="dragonfly" or OS=="netbsd"', {
'defines': [
diff --git a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_audio__device_audio__device__impl.cc b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_audio__device_audio__device__impl.cc
deleted file mode 100644
index bae0d588ec8..00000000000
--- a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_audio__device_audio__device__impl.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-$NetBSD: patch-media_webrtc_trunk_webrtc_modules_audio__device_audio__device__impl.cc,v 1.1 2013/09/19 12:37:50 ryoon Exp $
-
---- media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc.orig 2013-09-10 03:43:47.000000000 +0000
-+++ media/webrtc/trunk/webrtc/modules/audio_device/audio_device_impl.cc
-@@ -16,7 +16,9 @@
- #include <assert.h>
- #include <string.h>
-
--#if defined(_WIN32)
-+#if defined(WEBRTC_DUMMY_AUDIO_BUILD)
-+// do not include platform specific headers
-+#elif defined(_WIN32)
- #include "audio_device_utility_win.h"
- #include "audio_device_wave_win.h"
- #if defined(WEBRTC_WINDOWS_CORE_AUDIO_BUILD)
-@@ -32,14 +34,8 @@
- #include <stdlib.h>
- #include "audio_device_utility_android.h"
- #include "audio_device_jni_android.h"
--#elif defined(WEBRTC_LINUX)
-+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
- #include "audio_device_utility_linux.h"
-- #if defined(LINUX_ALSA)
-- #include "audio_device_alsa_linux.h"
-- #endif
-- #if defined(LINUX_PULSE)
-- #include "audio_device_pulse_linux.h"
-- #endif
- #elif defined(WEBRTC_IOS)
- #include "audio_device_utility_ios.h"
- #include "audio_device_ios.h"
-@@ -47,6 +43,12 @@
- #include "audio_device_utility_mac.h"
- #include "audio_device_mac.h"
- #endif
-+#if defined(LINUX_ALSA)
-+ #include "audio_device_alsa_linux.h"
-+#endif
-+#if defined(LINUX_PULSE)
-+ #include "audio_device_pulse_linux.h"
-+#endif
- #include "audio_device_dummy.h"
- #include "audio_device_utility_dummy.h"
- #include "critical_section_wrapper.h"
-@@ -161,7 +163,7 @@ WebRtc_Word32 AudioDeviceModuleImpl::Che
- #elif defined(WEBRTC_ANDROID)
- platform = kPlatformAndroid;
- WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is ANDROID");
--#elif defined(WEBRTC_LINUX)
-+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
- platform = kPlatformLinux;
- WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "current platform is LINUX");
- #elif defined(WEBRTC_IOS)
-@@ -301,7 +303,7 @@ WebRtc_Word32 AudioDeviceModuleImpl::Cre
-
- // Create the *Linux* implementation of the Audio Device
- //
--#elif defined(WEBRTC_LINUX)
-+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
- if ((audioLayer == kLinuxPulseAudio) || (audioLayer == kPlatformDefaultAudio))
- {
- #if defined(LINUX_PULSE)
-@@ -347,7 +349,7 @@ WebRtc_Word32 AudioDeviceModuleImpl::Cre
- //
- ptrAudioDeviceUtility = new AudioDeviceUtilityLinux(Id());
- }
--#endif // #if defined(WEBRTC_LINUX)
-+#endif // #if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
-
- // Create the *iPhone* implementation of the Audio Device
- //
diff --git a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_audio__device_test_audio__device__test__api.cc b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_audio__device_test_audio__device__test__api.cc
deleted file mode 100644
index 7f61db73b72..00000000000
--- a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_audio__device_test_audio__device__test__api.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-$NetBSD: patch-media_webrtc_trunk_webrtc_modules_audio__device_test_audio__device__test__api.cc,v 1.2 2013/11/02 22:57:55 ryoon Exp $
-
---- media/webrtc/trunk/webrtc/modules/audio_device/test/audio_device_test_api.cc.orig 2013-10-25 22:27:35.000000000 +0000
-+++ media/webrtc/trunk/webrtc/modules/audio_device/test/audio_device_test_api.cc
-@@ -196,7 +196,7 @@ class AudioDeviceAPITest: public testing
- // Create default implementation instance
- EXPECT_TRUE((audio_device_ = AudioDeviceModuleImpl::Create(
- kId, AudioDeviceModule::kPlatformDefaultAudio)) != NULL);
--#elif defined(WEBRTC_LINUX)
-+#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD)
- EXPECT_TRUE((audio_device_ = AudioDeviceModuleImpl::Create(
- kId, AudioDeviceModule::kWindowsWaveAudio)) == NULL);
- EXPECT_TRUE((audio_device_ = AudioDeviceModuleImpl::Create(
-@@ -1689,7 +1689,7 @@ TEST_F(AudioDeviceAPITest, CPULoad) {
-
- // TODO(kjellander): Fix flakiness causing failures on Windows.
- // TODO(phoglund): Fix flakiness causing failures on Linux.
--#if !defined(_WIN32) && !defined(WEBRTC_LINUX)
-+#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD)
- TEST_F(AudioDeviceAPITest, StartAndStopRawOutputFileRecording) {
- // NOTE: this API is better tested in a functional test
- CheckInitialPlayoutStates();
-@@ -1758,7 +1758,7 @@ TEST_F(AudioDeviceAPITest, StartAndStopR
- // - size of raw_input_not_recording.pcm shall be 0
- // - size of raw_input_not_recording.pcm shall be > 0
- }
--#endif // !WIN32 && !WEBRTC_LINUX
-+#endif // !WIN32 && !WEBRTC_LINUX && !defined(WEBRTC_BSD)
-
- TEST_F(AudioDeviceAPITest, RecordingSampleRate) {
- uint32_t sampleRate(0);
diff --git a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture__factory.cc b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture__factory.cc
deleted file mode 100644
index 827b195229a..00000000000
--- a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture__factory.cc
+++ /dev/null
@@ -1,15 +0,0 @@
-$NetBSD: patch-media_webrtc_trunk_webrtc_modules_video__capture_video__capture__factory.cc,v 1.1 2013/06/26 11:32:12 ryoon Exp $
-
---- media/webrtc/trunk/webrtc/modules/video_capture/video_capture_factory.cc.orig 2013-06-17 22:13:20.000000000 +0000
-+++ media/webrtc/trunk/webrtc/modules/video_capture/video_capture_factory.cc
-@@ -8,8 +8,10 @@
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-+_Pragma("GCC visibility push(default)")
- #include "video_capture_factory.h"
- #include "video_capture_impl.h"
-+_Pragma("GCC visibility pop")
-
- namespace webrtc
- {
diff --git a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_clock.cc b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_clock.cc
new file mode 100644
index 00000000000..dc80266fd9a
--- /dev/null
+++ b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_clock.cc
@@ -0,0 +1,31 @@
+$NetBSD: patch-media_webrtc_trunk_webrtc_system__wrappers_source_clock.cc,v 1.1 2013/12/15 13:54:37 ryoon Exp $
+
+--- media/webrtc/trunk/webrtc/system_wrappers/source/clock.cc.orig 2013-12-05 16:07:50.000000000 +0000
++++ media/webrtc/trunk/webrtc/system_wrappers/source/clock.cc
+@@ -15,7 +15,7 @@
+ #include <Windows.h>
+ #include <WinSock.h>
+ #include <MMSystem.h>
+-#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
++#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC))
+ #include <sys/time.h>
+ #include <time.h>
+ #endif
+@@ -209,7 +209,7 @@ class WindowsRealTimeClock : public Real
+ WindowsHelpTimer* _helpTimer;
+ };
+
+-#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
++#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC))
+ class UnixRealTimeClock : public RealTimeClock {
+ public:
+ UnixRealTimeClock() {}
+@@ -240,7 +240,7 @@ Clock* Clock::GetRealTimeClock() {
+ #if defined(_WIN32)
+ static WindowsRealTimeClock clock(&global_help_timer);
+ return &clock;
+-#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC)
++#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC))
+ static UnixRealTimeClock clock;
+ return &clock;
+ #else
diff --git a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_condition__variable.cc b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_condition__variable.cc
deleted file mode 100644
index 31f9285773a..00000000000
--- a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_condition__variable.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-media_webrtc_trunk_webrtc_system__wrappers_source_condition__variable.cc,v 1.3 2013/11/02 22:57:55 ryoon Exp $
-
---- media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable.cc.orig 2013-10-25 22:27:35.000000000 +0000
-+++ media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable.cc
-@@ -17,6 +17,8 @@
- #elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC)
- #include <pthread.h>
- #include "webrtc/system_wrappers/source/condition_variable_posix.h"
-+#else
-+#include <stddef.h> // for NULL
- #endif
-
- namespace webrtc {
diff --git a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp
index a6cd0624dd1..22060e66c1f 100644
--- a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp
+++ b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp
@@ -1,18 +1,3388 @@
-$NetBSD: patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp,v 1.1 2013/05/23 13:12:13 ryoon Exp $
+$NetBSD: patch-media_webrtc_trunk_webrtc_system__wrappers_source_spreadsortlib_spreadsort.hpp,v 1.2 2013/12/15 13:54:37 ryoon Exp $
---- media/webrtc/trunk/webrtc/system_wrappers/source/spreadsortlib/spreadsort.hpp.orig 2013-05-11 19:19:46.000000000 +0000
+--- media/webrtc/trunk/webrtc/system_wrappers/source/spreadsortlib/spreadsort.hpp.orig 2013-12-05 16:07:50.000000000 +0000
+++ media/webrtc/trunk/webrtc/system_wrappers/source/spreadsortlib/spreadsort.hpp
-@@ -21,6 +21,13 @@ Scott McMurray
- #include "constants.hpp"
- #include <cstring>
-
-+#ifdef __FreeBSD__
-+# include <osreldate.h>
-+# if __FreeBSD_version < 900506
-+# define getchar boost_getchar
-+# endif
-+#endif
-+
- namespace boost {
- namespace detail {
- //This only works on unsigned data types
+@@ -1,1688 +1,1695 @@
+-//Templated spread_sort library
+-
+-// Copyright Steven J. Ross 2001 - 2009.
+-// Distributed under the Boost Software License, Version 1.0.
+-// (See accompanying file LICENSE_1_0.txt or copy at
+-// http://www.boost.org/LICENSE_1_0.txt)
+-
+-// See http://www.boost.org/ for updates, documentation, and revision history.
+-
+-/*
+-Some improvements suggested by:
+-Phil Endecott and Frank Gennari
+-Cygwin fix provided by:
+-Scott McMurray
+-*/
+-
+-#ifndef BOOST_SPREAD_SORT_H
+-#define BOOST_SPREAD_SORT_H
+-#include <algorithm>
+-#include <cstring>
+-#include <vector>
+-#include "webrtc/system_wrappers/source/spreadsortlib/constants.hpp"
+-
+-namespace boost {
+- namespace detail {
+- //This only works on unsigned data types
+- template <typename T>
+- inline unsigned
+- rough_log_2_size(const T& input)
+- {
+- unsigned result = 0;
+- //The && is necessary on some compilers to avoid infinite loops; it doesn't significantly impair performance
+- while((input >> result) && (result < (8*sizeof(T)))) ++result;
+- return result;
+- }
+-
+- //Gets the maximum size which we'll call spread_sort on to control worst-case performance
+- //Maintains both a minimum size to recurse and a check of distribution size versus count
+- //This is called for a set of bins, instead of bin-by-bin, to avoid performance overhead
+- inline size_t
+- get_max_count(unsigned log_range, size_t count)
+- {
+- unsigned divisor = rough_log_2_size(count);
+- //Making sure the divisor is positive
+- if(divisor > LOG_MEAN_BIN_SIZE)
+- divisor -= LOG_MEAN_BIN_SIZE;
+- else
+- divisor = 1;
+- unsigned relative_width = (LOG_CONST * log_range)/((divisor > MAX_SPLITS) ? MAX_SPLITS : divisor);
+- //Don't try to bitshift more than the size of an element
+- if((8*sizeof(size_t)) <= relative_width)
+- relative_width = (8*sizeof(size_t)) - 1;
+- return (size_t)1 << ((relative_width < (LOG_MEAN_BIN_SIZE + LOG_MIN_SPLIT_COUNT)) ?
+- (LOG_MEAN_BIN_SIZE + LOG_MIN_SPLIT_COUNT) : relative_width);
+- }
+-
+- //Find the minimum and maximum using <
+- template <class RandomAccessIter>
+- inline void
+- find_extremes(RandomAccessIter current, RandomAccessIter last, RandomAccessIter & max, RandomAccessIter & min)
+- {
+- min = max = current;
+- //Start from the second item, as max and min are initialized to the first
+- while(++current < last) {
+- if(*max < *current)
+- max = current;
+- else if(*current < *min)
+- min = current;
+- }
+- }
+-
+- //Uses a user-defined comparison operator to find minimum and maximum
+- template <class RandomAccessIter, class compare>
+- inline void
+- find_extremes(RandomAccessIter current, RandomAccessIter last, RandomAccessIter & max, RandomAccessIter & min, compare comp)
+- {
+- min = max = current;
+- while(++current < last) {
+- if(comp(*max, *current))
+- max = current;
+- else if(comp(*current, *min))
+- min = current;
+- }
+- }
+-
+- //Gets a non-negative right bit shift to operate as a logarithmic divisor
+- inline int
+- get_log_divisor(size_t count, unsigned log_range)
+- {
+- int log_divisor;
+- //If we can finish in one iteration without exceeding either (2 to the MAX_SPLITS) or n bins, do so
+- if((log_divisor = log_range - rough_log_2_size(count)) <= 0 && log_range < MAX_SPLITS)
+- log_divisor = 0;
+- else {
+- //otherwise divide the data into an optimized number of pieces
+- log_divisor += LOG_MEAN_BIN_SIZE;
+- if(log_divisor < 0)
+- log_divisor = 0;
+- //Cannot exceed MAX_SPLITS or cache misses slow down bin lookups dramatically
+- if((log_range - log_divisor) > MAX_SPLITS)
+- log_divisor = log_range - MAX_SPLITS;
+- }
+- return log_divisor;
+- }
+-
+- template <class RandomAccessIter>
+- inline RandomAccessIter *
+- size_bins(std::vector<size_t> &bin_sizes, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset, unsigned &cache_end, unsigned bin_count)
+- {
+- //Assure space for the size of each bin, followed by initializing sizes
+- if(bin_count > bin_sizes.size())
+- bin_sizes.resize(bin_count);
+- for(size_t u = 0; u < bin_count; u++)
+- bin_sizes[u] = 0;
+- //Make sure there is space for the bins
+- cache_end = cache_offset + bin_count;
+- if(cache_end > bin_cache.size())
+- bin_cache.resize(cache_end);
+- return &(bin_cache[cache_offset]);
+- }
+-
+- //Implementation for recursive integer sorting
+- template <class RandomAccessIter, class div_type, class data_type>
+- inline void
+- spread_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
+- , std::vector<size_t> &bin_sizes)
+- {
+- //This step is roughly 10% of runtime, but it helps avoid worst-case behavior and improve behavior with real data
+- //If you know the maximum and minimum ahead of time, you can pass those values in and skip this step for the first iteration
+- RandomAccessIter max, min;
+- find_extremes(first, last, max, min);
+- //max and min will be the same (the first item) iff all values are equivalent
+- if(max == min)
+- return;
+- RandomAccessIter * target_bin;
+- unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(*max >> 0) - (*min >> 0)));
+- div_type div_min = *min >> log_divisor;
+- div_type div_max = *max >> log_divisor;
+- unsigned bin_count = div_max - div_min + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
+-
+- //Calculating the size of each bin; this takes roughly 10% of runtime
+- for (RandomAccessIter current = first; current != last;)
+- bin_sizes[(*(current++) >> log_divisor) - div_min]++;
+- //Assign the bin positions
+- bins[0] = first;
+- for(unsigned u = 0; u < bin_count - 1; u++)
+- bins[u + 1] = bins[u] + bin_sizes[u];
+-
+- //Swap into place
+- //This dominates runtime, mostly in the swap and bin lookups
+- RandomAccessIter nextbinstart = first;
+- for(unsigned u = 0; u < bin_count - 1; ++u) {
+- RandomAccessIter * local_bin = bins + u;
+- nextbinstart += bin_sizes[u];
+- //Iterating over each element in this bin
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //Swapping elements in current into place until the correct element has been swapped in
+- for(target_bin = (bins + ((*current >> log_divisor) - div_min)); target_bin != local_bin;
+- target_bin = bins + ((*current >> log_divisor) - div_min)) {
+- //3-way swap; this is about 1% faster than a 2-way swap with integers
+- //The main advantage is less copies are involved per item put in the correct place
+- data_type tmp;
+- RandomAccessIter b = (*target_bin)++;
+- RandomAccessIter * b_bin = bins + ((*b >> log_divisor) - div_min);
+- if (b_bin != local_bin) {
+- RandomAccessIter c = (*b_bin)++;
+- tmp = *c;
+- *c = *b;
+- }
+- else
+- tmp = *b;
+- *b = *current;
+- *current = tmp;
+- }
+- }
+- *local_bin = nextbinstart;
+- }
+- bins[bin_count - 1] = last;
+-
+- //If we've bucketsorted, the array is sorted and we should skip recursion
+- if(!log_divisor)
+- return;
+-
+- //Recursing; log_divisor is the remaining range
+- size_t max_count = get_max_count(log_divisor, last - first);
+- RandomAccessIter lastPos = first;
+- for(unsigned u = cache_offset; u < cache_end; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- //don't sort unless there are at least two items to compare
+- if(count < 2)
+- continue;
+- //using std::sort if its worst-case is better
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[u]);
+- else
+- spread_sort_rec<RandomAccessIter, div_type, data_type>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes);
+- }
+- }
+-
+- //Generic bitshift-based 3-way swapping code
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift>
+- inline void inner_swap_loop(RandomAccessIter * bins, const RandomAccessIter & nextbinstart, unsigned ii, right_shift &shift
+- , const unsigned log_divisor, const div_type div_min)
+- {
+- RandomAccessIter * local_bin = bins + ii;
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- for(RandomAccessIter * target_bin = (bins + (shift(*current, log_divisor) - div_min)); target_bin != local_bin;
+- target_bin = bins + (shift(*current, log_divisor) - div_min)) {
+- data_type tmp;
+- RandomAccessIter b = (*target_bin)++;
+- RandomAccessIter * b_bin = bins + (shift(*b, log_divisor) - div_min);
+- //Three-way swap; if the item to be swapped doesn't belong in the current bin, swap it to where it belongs
+- if (b_bin != local_bin) {
+- RandomAccessIter c = (*b_bin)++;
+- tmp = *c;
+- *c = *b;
+- }
+- //Note: we could increment current once the swap is done in this case, but that seems to impair performance
+- else
+- tmp = *b;
+- *b = *current;
+- *current = tmp;
+- }
+- }
+- *local_bin = nextbinstart;
+- }
+-
+- //Standard swapping wrapper for ascending values
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift>
+- inline void swap_loop(RandomAccessIter * bins, RandomAccessIter & nextbinstart, unsigned ii, right_shift &shift
+- , const std::vector<size_t> &bin_sizes, const unsigned log_divisor, const div_type div_min)
+- {
+- nextbinstart += bin_sizes[ii];
+- inner_swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, ii, shift, log_divisor, div_min);
+- }
+-
+- //Functor implementation for recursive sorting
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift, class compare>
+- inline void
+- spread_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
+- , std::vector<size_t> &bin_sizes, right_shift shift, compare comp)
+- {
+- RandomAccessIter max, min;
+- find_extremes(first, last, max, min, comp);
+- if(max == min)
+- return;
+- unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(shift(*max, 0)) - (shift(*min, 0))));
+- div_type div_min = shift(*min, log_divisor);
+- div_type div_max = shift(*max, log_divisor);
+- unsigned bin_count = div_max - div_min + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
+-
+- //Calculating the size of each bin
+- for (RandomAccessIter current = first; current != last;)
+- bin_sizes[shift(*(current++), log_divisor) - div_min]++;
+- bins[0] = first;
+- for(unsigned u = 0; u < bin_count - 1; u++)
+- bins[u + 1] = bins[u] + bin_sizes[u];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- for(unsigned u = 0; u < bin_count - 1; ++u)
+- swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, u, shift, bin_sizes, log_divisor, div_min);
+- bins[bin_count - 1] = last;
+-
+- //If we've bucketsorted, the array is sorted and we should skip recursion
+- if(!log_divisor)
+- return;
+-
+- //Recursing
+- size_t max_count = get_max_count(log_divisor, last - first);
+- RandomAccessIter lastPos = first;
+- for(unsigned u = cache_offset; u < cache_end; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[u], comp);
+- else
+- spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift, compare>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes, shift, comp);
+- }
+- }
+-
+- //Functor implementation for recursive sorting with only Shift overridden
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift>
+- inline void
+- spread_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
+- , std::vector<size_t> &bin_sizes, right_shift shift)
+- {
+- RandomAccessIter max, min;
+- find_extremes(first, last, max, min);
+- if(max == min)
+- return;
+- unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(shift(*max, 0)) - (shift(*min, 0))));
+- div_type div_min = shift(*min, log_divisor);
+- div_type div_max = shift(*max, log_divisor);
+- unsigned bin_count = div_max - div_min + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
+-
+- //Calculating the size of each bin
+- for (RandomAccessIter current = first; current != last;)
+- bin_sizes[shift(*(current++), log_divisor) - div_min]++;
+- bins[0] = first;
+- for(unsigned u = 0; u < bin_count - 1; u++)
+- bins[u + 1] = bins[u] + bin_sizes[u];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- for(unsigned ii = 0; ii < bin_count - 1; ++ii)
+- swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, ii, shift, bin_sizes, log_divisor, div_min);
+- bins[bin_count - 1] = last;
+-
+- //If we've bucketsorted, the array is sorted and we should skip recursion
+- if(!log_divisor)
+- return;
+-
+- //Recursing
+- size_t max_count = get_max_count(log_divisor, last - first);
+- RandomAccessIter lastPos = first;
+- for(unsigned u = cache_offset; u < cache_end; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[u]);
+- else
+- spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes, shift);
+- }
+- }
+-
+- //Holds the bin vector and makes the initial recursive call
+- template <class RandomAccessIter, class div_type, class data_type>
+- inline void
+- spread_sort(RandomAccessIter first, RandomAccessIter last, div_type, data_type)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- spread_sort_rec<RandomAccessIter, div_type, data_type>(first, last, bin_cache, 0, bin_sizes);
+- }
+-
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift, class compare>
+- inline void
+- spread_sort(RandomAccessIter first, RandomAccessIter last, div_type, data_type, right_shift shift, compare comp)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift, compare>(first, last, bin_cache, 0, bin_sizes, shift, comp);
+- }
+-
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift>
+- inline void
+- spread_sort(RandomAccessIter first, RandomAccessIter last, div_type, data_type, right_shift shift)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(first, last, bin_cache, 0, bin_sizes, shift);
+- }
+- }
+-
+- //Top-level sorting call for integers
+- template <class RandomAccessIter>
+- inline void integer_sort(RandomAccessIter first, RandomAccessIter last)
+- {
+- //Don't sort if it's too small to optimize
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last);
+- else
+- detail::spread_sort(first, last, *first >> 0, *first);
+- }
+-
+- //integer_sort with functors
+- template <class RandomAccessIter, class right_shift, class compare>
+- inline void integer_sort(RandomAccessIter first, RandomAccessIter last,
+- right_shift shift, compare comp) {
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last, comp);
+- else
+- detail::spread_sort(first, last, shift(*first, 0), *first, shift, comp);
+- }
+-
+- //integer_sort with right_shift functor
+- template <class RandomAccessIter, class right_shift>
+- inline void integer_sort(RandomAccessIter first, RandomAccessIter last,
+- right_shift shift) {
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last);
+- else
+- detail::spread_sort(first, last, shift(*first, 0), *first, shift);
+- }
+-
+- //------------------------------------------------------ float_sort source --------------------------------------
+- //Casts a RandomAccessIter to the specified data type
+- template<class cast_type, class RandomAccessIter>
+- inline cast_type
+- cast_float_iter(const RandomAccessIter & floatiter)
+- {
+- cast_type result;
+- std::memcpy(&result, &(*floatiter), sizeof(cast_type));
+- return result;
+- }
+-
+- //Casts a data element to the specified datinner_float_a type
+- template<class data_type, class cast_type>
+- inline cast_type
+- mem_cast(const data_type & data)
+- {
+- cast_type result;
+- std::memcpy(&result, &data, sizeof(cast_type));
+- return result;
+- }
+-
+- namespace detail {
+- template <class RandomAccessIter, class div_type, class right_shift>
+- inline void
+- find_extremes(RandomAccessIter current, RandomAccessIter last, div_type & max, div_type & min, right_shift shift)
+- {
+- min = max = shift(*current, 0);
+- while(++current < last) {
+- div_type value = shift(*current, 0);
+- if(max < value)
+- max = value;
+- else if(value < min)
+- min = value;
+- }
+- }
+-
+- //Specialized swap loops for floating-point casting
+- template <class RandomAccessIter, class div_type, class data_type>
+- inline void inner_float_swap_loop(RandomAccessIter * bins, const RandomAccessIter & nextbinstart, unsigned ii
+- , const unsigned log_divisor, const div_type div_min)
+- {
+- RandomAccessIter * local_bin = bins + ii;
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- for(RandomAccessIter * target_bin = (bins + ((cast_float_iter<div_type, RandomAccessIter>(current) >> log_divisor) - div_min)); target_bin != local_bin;
+- target_bin = bins + ((cast_float_iter<div_type, RandomAccessIter>(current) >> log_divisor) - div_min)) {
+- data_type tmp;
+- RandomAccessIter b = (*target_bin)++;
+- RandomAccessIter * b_bin = bins + ((cast_float_iter<div_type, RandomAccessIter>(b) >> log_divisor) - div_min);
+- //Three-way swap; if the item to be swapped doesn't belong in the current bin, swap it to where it belongs
+- if (b_bin != local_bin) {
+- RandomAccessIter c = (*b_bin)++;
+- tmp = *c;
+- *c = *b;
+- }
+- else
+- tmp = *b;
+- *b = *current;
+- *current = tmp;
+- }
+- }
+- *local_bin = nextbinstart;
+- }
+-
+- template <class RandomAccessIter, class div_type, class data_type>
+- inline void float_swap_loop(RandomAccessIter * bins, RandomAccessIter & nextbinstart, unsigned ii
+- , const std::vector<size_t> &bin_sizes, const unsigned log_divisor, const div_type div_min)
+- {
+- nextbinstart += bin_sizes[ii];
+- inner_float_swap_loop<RandomAccessIter, div_type, data_type>(bins, nextbinstart, ii, log_divisor, div_min);
+- }
+-
+- template <class RandomAccessIter, class cast_type>
+- inline void
+- find_extremes(RandomAccessIter current, RandomAccessIter last, cast_type & max, cast_type & min)
+- {
+- min = max = cast_float_iter<cast_type, RandomAccessIter>(current);
+- while(++current < last) {
+- cast_type value = cast_float_iter<cast_type, RandomAccessIter>(current);
+- if(max < value)
+- max = value;
+- else if(value < min)
+- min = value;
+- }
+- }
+-
+- //Special-case sorting of positive floats with casting instead of a right_shift
+- template <class RandomAccessIter, class div_type, class data_type>
+- inline void
+- positive_float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
+- , std::vector<size_t> &bin_sizes)
+- {
+- div_type max, min;
+- find_extremes(first, last, max, min);
+- if(max == min)
+- return;
+- unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
+- div_type div_min = min >> log_divisor;
+- div_type div_max = max >> log_divisor;
+- unsigned bin_count = div_max - div_min + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
+-
+- //Calculating the size of each bin
+- for (RandomAccessIter current = first; current != last;)
+- bin_sizes[(cast_float_iter<div_type, RandomAccessIter>(current++) >> log_divisor) - div_min]++;
+- bins[0] = first;
+- for(unsigned u = 0; u < bin_count - 1; u++)
+- bins[u + 1] = bins[u] + bin_sizes[u];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- for(unsigned u = 0; u < bin_count - 1; ++u)
+- float_swap_loop<RandomAccessIter, div_type, data_type>(bins, nextbinstart, u, bin_sizes, log_divisor, div_min);
+- bins[bin_count - 1] = last;
+-
+- //Return if we've completed bucketsorting
+- if(!log_divisor)
+- return;
+-
+- //Recursing
+- size_t max_count = get_max_count(log_divisor, last - first);
+- RandomAccessIter lastPos = first;
+- for(unsigned u = cache_offset; u < cache_end; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[u]);
+- else
+- positive_float_sort_rec<RandomAccessIter, div_type, data_type>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes);
+- }
+- }
+-
+- //Sorting negative_ float_s
+- //Note that bins are iterated in reverse order because max_neg_float = min_neg_int
+- template <class RandomAccessIter, class div_type, class data_type>
+- inline void
+- negative_float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
+- , std::vector<size_t> &bin_sizes)
+- {
+- div_type max, min;
+- find_extremes(first, last, max, min);
+- if(max == min)
+- return;
+- unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
+- div_type div_min = min >> log_divisor;
+- div_type div_max = max >> log_divisor;
+- unsigned bin_count = div_max - div_min + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
+-
+- //Calculating the size of each bin
+- for (RandomAccessIter current = first; current != last;)
+- bin_sizes[(cast_float_iter<div_type, RandomAccessIter>(current++) >> log_divisor) - div_min]++;
+- bins[bin_count - 1] = first;
+- for(int ii = bin_count - 2; ii >= 0; --ii)
+- bins[ii] = bins[ii + 1] + bin_sizes[ii + 1];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- //The last bin will always have the correct elements in it
+- for(int ii = bin_count - 1; ii > 0; --ii)
+- float_swap_loop<RandomAccessIter, div_type, data_type>(bins, nextbinstart, ii, bin_sizes, log_divisor, div_min);
+- //Since we don't process the last bin, we need to update its end position
+- bin_cache[cache_offset] = last;
+-
+- //Return if we've completed bucketsorting
+- if(!log_divisor)
+- return;
+-
+- //Recursing
+- size_t max_count = get_max_count(log_divisor, last - first);
+- RandomAccessIter lastPos = first;
+- for(int ii = cache_end - 1; ii >= (int)cache_offset; lastPos = bin_cache[ii], --ii) {
+- size_t count = bin_cache[ii] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[ii]);
+- else
+- negative_float_sort_rec<RandomAccessIter, div_type, data_type>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes);
+- }
+- }
+-
+- //Sorting negative_ float_s
+- //Note that bins are iterated in reverse order because max_neg_float = min_neg_int
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift>
+- inline void
+- negative_float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
+- , std::vector<size_t> &bin_sizes, right_shift shift)
+- {
+- div_type max, min;
+- find_extremes(first, last, max, min, shift);
+- if(max == min)
+- return;
+- unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
+- div_type div_min = min >> log_divisor;
+- div_type div_max = max >> log_divisor;
+- unsigned bin_count = div_max - div_min + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
+-
+- //Calculating the size of each bin
+- for (RandomAccessIter current = first; current != last;)
+- bin_sizes[shift(*(current++), log_divisor) - div_min]++;
+- bins[bin_count - 1] = first;
+- for(int ii = bin_count - 2; ii >= 0; --ii)
+- bins[ii] = bins[ii + 1] + bin_sizes[ii + 1];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- //The last bin will always have the correct elements in it
+- for(int ii = bin_count - 1; ii > 0; --ii)
+- swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, ii, shift, bin_sizes, log_divisor, div_min);
+- //Since we don't process the last bin, we need to update its end position
+- bin_cache[cache_offset] = last;
+-
+- //Return if we've completed bucketsorting
+- if(!log_divisor)
+- return;
+-
+- //Recursing
+- size_t max_count = get_max_count(log_divisor, last - first);
+- RandomAccessIter lastPos = first;
+- for(int ii = cache_end - 1; ii >= (int)cache_offset; lastPos = bin_cache[ii], --ii) {
+- size_t count = bin_cache[ii] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[ii]);
+- else
+- negative_float_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes, shift);
+- }
+- }
+-
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift, class compare>
+- inline void
+- negative_float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
+- , std::vector<size_t> &bin_sizes, right_shift shift, compare comp)
+- {
+- div_type max, min;
+- find_extremes(first, last, max, min, shift);
+- if(max == min)
+- return;
+- unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
+- div_type div_min = min >> log_divisor;
+- div_type div_max = max >> log_divisor;
+- unsigned bin_count = div_max - div_min + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
+-
+- //Calculating the size of each bin
+- for (RandomAccessIter current = first; current != last;)
+- bin_sizes[shift(*(current++), log_divisor) - div_min]++;
+- bins[bin_count - 1] = first;
+- for(int ii = bin_count - 2; ii >= 0; --ii)
+- bins[ii] = bins[ii + 1] + bin_sizes[ii + 1];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- //The last bin will always have the correct elements in it
+- for(int ii = bin_count - 1; ii > 0; --ii)
+- swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, ii, shift, bin_sizes, log_divisor, div_min);
+- //Since we don't process the last bin, we need to update its end position
+- bin_cache[cache_offset] = last;
+-
+- //Return if we've completed bucketsorting
+- if(!log_divisor)
+- return;
+-
+- //Recursing
+- size_t max_count = get_max_count(log_divisor, last - first);
+- RandomAccessIter lastPos = first;
+- for(int ii = cache_end - 1; ii >= (int)cache_offset; lastPos = bin_cache[ii], --ii) {
+- size_t count = bin_cache[ii] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[ii], comp);
+- else
+- negative_float_sort_rec<RandomAccessIter, div_type, data_type, right_shift, compare>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes, shift, comp);
+- }
+- }
+-
+- //Casting special-case for floating-point sorting
+- template <class RandomAccessIter, class div_type, class data_type>
+- inline void
+- float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
+- , std::vector<size_t> &bin_sizes)
+- {
+- div_type max, min;
+- find_extremes(first, last, max, min);
+- if(max == min)
+- return;
+- unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
+- div_type div_min = min >> log_divisor;
+- div_type div_max = max >> log_divisor;
+- unsigned bin_count = div_max - div_min + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
+-
+- //Calculating the size of each bin
+- for (RandomAccessIter current = first; current != last;)
+- bin_sizes[(cast_float_iter<div_type, RandomAccessIter>(current++) >> log_divisor) - div_min]++;
+- //The index of the first positive bin
+- div_type first_positive = (div_min < 0) ? -div_min : 0;
+- //Resetting if all bins are negative
+- if(cache_offset + first_positive > cache_end)
+- first_positive = cache_end - cache_offset;
+- //Reversing the order of the negative bins
+- //Note that because of the negative/positive ordering direction flip
+- //We can not depend upon bin order and positions matching up
+- //so bin_sizes must be reused to contain the end of the bin
+- if(first_positive > 0) {
+- bins[first_positive - 1] = first;
+- for(int ii = first_positive - 2; ii >= 0; --ii) {
+- bins[ii] = first + bin_sizes[ii + 1];
+- bin_sizes[ii] += bin_sizes[ii + 1];
+- }
+- //Handling positives following negatives
+- if((unsigned)first_positive < bin_count) {
+- bins[first_positive] = first + bin_sizes[0];
+- bin_sizes[first_positive] += bin_sizes[0];
+- }
+- }
+- else
+- bins[0] = first;
+- for(unsigned u = first_positive; u < bin_count - 1; u++) {
+- bins[u + 1] = first + bin_sizes[u];
+- bin_sizes[u + 1] += bin_sizes[u];
+- }
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- for(unsigned u = 0; u < bin_count; ++u) {
+- nextbinstart = first + bin_sizes[u];
+- inner_float_swap_loop<RandomAccessIter, div_type, data_type>(bins, nextbinstart, u, log_divisor, div_min);
+- }
+-
+- if(!log_divisor)
+- return;
+-
+- //Handling negative values first
+- size_t max_count = get_max_count(log_divisor, last - first);
+- RandomAccessIter lastPos = first;
+- for(int ii = cache_offset + first_positive - 1; ii >= (int)cache_offset ; lastPos = bin_cache[ii--]) {
+- size_t count = bin_cache[ii] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[ii]);
+- //sort negative values using reversed-bin spread_sort
+- else
+- negative_float_sort_rec<RandomAccessIter, div_type, data_type>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes);
+- }
+-
+- for(unsigned u = cache_offset + first_positive; u < cache_end; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[u]);
+- //sort positive values using normal spread_sort
+- else
+- positive_float_sort_rec<RandomAccessIter, div_type, data_type>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes);
+- }
+- }
+-
+- //Functor implementation for recursive sorting
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift>
+- inline void
+- float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
+- , std::vector<size_t> &bin_sizes, right_shift shift)
+- {
+- div_type max, min;
+- find_extremes(first, last, max, min, shift);
+- if(max == min)
+- return;
+- unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
+- div_type div_min = min >> log_divisor;
+- div_type div_max = max >> log_divisor;
+- unsigned bin_count = div_max - div_min + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
+-
+- //Calculating the size of each bin
+- for (RandomAccessIter current = first; current != last;)
+- bin_sizes[shift(*(current++), log_divisor) - div_min]++;
+- //The index of the first positive bin
+- div_type first_positive = (div_min < 0) ? -div_min : 0;
+- //Resetting if all bins are negative
+- if(cache_offset + first_positive > cache_end)
+- first_positive = cache_end - cache_offset;
+- //Reversing the order of the negative bins
+- //Note that because of the negative/positive ordering direction flip
+- //We can not depend upon bin order and positions matching up
+- //so bin_sizes must be reused to contain the end of the bin
+- if(first_positive > 0) {
+- bins[first_positive - 1] = first;
+- for(int ii = first_positive - 2; ii >= 0; --ii) {
+- bins[ii] = first + bin_sizes[ii + 1];
+- bin_sizes[ii] += bin_sizes[ii + 1];
+- }
+- //Handling positives following negatives
+- if((unsigned)first_positive < bin_count) {
+- bins[first_positive] = first + bin_sizes[0];
+- bin_sizes[first_positive] += bin_sizes[0];
+- }
+- }
+- else
+- bins[0] = first;
+- for(unsigned u = first_positive; u < bin_count - 1; u++) {
+- bins[u + 1] = first + bin_sizes[u];
+- bin_sizes[u + 1] += bin_sizes[u];
+- }
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- for(unsigned u = 0; u < bin_count; ++u) {
+- nextbinstart = first + bin_sizes[u];
+- inner_swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, u, shift, log_divisor, div_min);
+- }
+-
+- //Return if we've completed bucketsorting
+- if(!log_divisor)
+- return;
+-
+- //Handling negative values first
+- size_t max_count = get_max_count(log_divisor, last - first);
+- RandomAccessIter lastPos = first;
+- for(int ii = cache_offset + first_positive - 1; ii >= (int)cache_offset ; lastPos = bin_cache[ii--]) {
+- size_t count = bin_cache[ii] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[ii]);
+- //sort negative values using reversed-bin spread_sort
+- else
+- negative_float_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes, shift);
+- }
+-
+- for(unsigned u = cache_offset + first_positive; u < cache_end; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[u]);
+- //sort positive values using normal spread_sort
+- else
+- spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes, shift);
+- }
+- }
+-
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift, class compare>
+- inline void
+- float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
+- , std::vector<size_t> &bin_sizes, right_shift shift, compare comp)
+- {
+- div_type max, min;
+- find_extremes(first, last, max, min, shift);
+- if(max == min)
+- return;
+- unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
+- div_type div_min = min >> log_divisor;
+- div_type div_max = max >> log_divisor;
+- unsigned bin_count = div_max - div_min + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
+-
+- //Calculating the size of each bin
+- for (RandomAccessIter current = first; current != last;)
+- bin_sizes[shift(*(current++), log_divisor) - div_min]++;
+- //The index of the first positive bin
+- div_type first_positive = (div_min < 0) ? -div_min : 0;
+- //Resetting if all bins are negative
+- if(cache_offset + first_positive > cache_end)
+- first_positive = cache_end - cache_offset;
+- //Reversing the order of the negative bins
+- //Note that because of the negative/positive ordering direction flip
+- //We can not depend upon bin order and positions matching up
+- //so bin_sizes must be reused to contain the end of the bin
+- if(first_positive > 0) {
+- bins[first_positive - 1] = first;
+- for(int ii = first_positive - 2; ii >= 0; --ii) {
+- bins[ii] = first + bin_sizes[ii + 1];
+- bin_sizes[ii] += bin_sizes[ii + 1];
+- }
+- //Handling positives following negatives
+- if((unsigned)first_positive < bin_count) {
+- bins[first_positive] = first + bin_sizes[0];
+- bin_sizes[first_positive] += bin_sizes[0];
+- }
+- }
+- else
+- bins[0] = first;
+- for(unsigned u = first_positive; u < bin_count - 1; u++) {
+- bins[u + 1] = first + bin_sizes[u];
+- bin_sizes[u + 1] += bin_sizes[u];
+- }
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- for(unsigned u = 0; u < bin_count; ++u) {
+- nextbinstart = first + bin_sizes[u];
+- inner_swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, u, shift, log_divisor, div_min);
+- }
+-
+- //Return if we've completed bucketsorting
+- if(!log_divisor)
+- return;
+-
+- //Handling negative values first
+- size_t max_count = get_max_count(log_divisor, last - first);
+- RandomAccessIter lastPos = first;
+- for(int ii = cache_offset + first_positive - 1; ii >= (int)cache_offset ; lastPos = bin_cache[ii--]) {
+- size_t count = bin_cache[ii] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[ii]);
+- //sort negative values using reversed-bin spread_sort
+- else
+- negative_float_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes, shift, comp);
+- }
+-
+- for(unsigned u = cache_offset + first_positive; u < cache_end; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- if(count < 2)
+- continue;
+- if(count < max_count)
+- std::sort(lastPos, bin_cache[u]);
+- //sort positive values using normal spread_sort
+- else
+- spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes, shift, comp);
+- }
+- }
+-
+- template <class RandomAccessIter, class cast_type, class data_type>
+- inline void
+- float_Sort(RandomAccessIter first, RandomAccessIter last, cast_type, data_type)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- float_sort_rec<RandomAccessIter, cast_type, data_type>(first, last, bin_cache, 0, bin_sizes);
+- }
+-
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift>
+- inline void
+- float_Sort(RandomAccessIter first, RandomAccessIter last, div_type, data_type, right_shift shift)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- float_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(first, last, bin_cache, 0, bin_sizes, shift);
+- }
+-
+- template <class RandomAccessIter, class div_type, class data_type, class right_shift, class compare>
+- inline void
+- float_Sort(RandomAccessIter first, RandomAccessIter last, div_type, data_type, right_shift shift, compare comp)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- float_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(first, last, bin_cache, 0, bin_sizes, shift, comp);
+- }
+- }
+-
+- //float_sort with casting
+- //The cast_type must be equal in size to the data type, and must be a signed integer
+- template <class RandomAccessIter, class cast_type>
+- inline void float_sort_cast(RandomAccessIter first, RandomAccessIter last, cast_type cVal)
+- {
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last);
+- else
+- detail::float_Sort(first, last, cVal, *first);
+- }
+-
+- //float_sort with casting to an int
+- //Only use this with IEEE floating-point numbers
+- template <class RandomAccessIter>
+- inline void float_sort_cast_to_int(RandomAccessIter first, RandomAccessIter last)
+- {
+- int cVal = 0;
+- float_sort_cast(first, last, cVal);
+- }
+-
+- //float_sort with functors
+- template <class RandomAccessIter, class right_shift>
+- inline void float_sort(RandomAccessIter first, RandomAccessIter last, right_shift shift)
+- {
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last);
+- else
+- detail::float_Sort(first, last, shift(*first, 0), *first, shift);
+- }
+-
+- template <class RandomAccessIter, class right_shift, class compare>
+- inline void float_sort(RandomAccessIter first, RandomAccessIter last, right_shift shift, compare comp)
+- {
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last, comp);
+- else
+- detail::float_Sort(first, last, shift(*first, 0), *first, shift, comp);
+- }
+-
+- //------------------------------------------------- string_sort source ---------------------------------------------
+- namespace detail {
+- //Offsetting on identical characters. This function works a character at a time for optimal worst-case performance.
+- template<class RandomAccessIter>
+- inline void
+- update_offset(RandomAccessIter first, RandomAccessIter finish, unsigned &char_offset)
+- {
+- unsigned nextOffset = char_offset;
+- bool done = false;
+- while(!done) {
+- RandomAccessIter curr = first;
+- do {
+- //ignore empties, but if the nextOffset would exceed the length or not match, exit; we've found the last matching character
+- if((*curr).size() > char_offset && ((*curr).size() <= (nextOffset + 1) || (*curr)[nextOffset] != (*first)[nextOffset])) {
+- done = true;
+- break;
+- }
+- } while(++curr != finish);
+- if(!done)
+- ++nextOffset;
+- }
+- char_offset = nextOffset;
+- }
+-
+- //Offsetting on identical characters. This function works a character at a time for optimal worst-case performance.
+- template<class RandomAccessIter, class get_char, class get_length>
+- inline void
+- update_offset(RandomAccessIter first, RandomAccessIter finish, unsigned &char_offset, get_char getchar, get_length length)
+- {
+- unsigned nextOffset = char_offset;
+- bool done = false;
+- while(!done) {
+- RandomAccessIter curr = first;
+- do {
+- //ignore empties, but if the nextOffset would exceed the length or not match, exit; we've found the last matching character
+- if(length(*curr) > char_offset && (length(*curr) <= (nextOffset + 1) || getchar((*curr), nextOffset) != getchar((*first), nextOffset))) {
+- done = true;
+- break;
+- }
+- } while(++curr != finish);
+- if(!done)
+- ++nextOffset;
+- }
+- char_offset = nextOffset;
+- }
+-
+- //A comparison functor for strings that assumes they are identical up to char_offset
+- template<class data_type, class unsignedchar_type>
+- struct offset_lessthan {
+- offset_lessthan(unsigned char_offset) : fchar_offset(char_offset){}
+- inline bool operator()(const data_type &x, const data_type &y) const
+- {
+- unsigned minSize = std::min(x.size(), y.size());
+- for(unsigned u = fchar_offset; u < minSize; ++u) {
+- if(static_cast<unsignedchar_type>(x[u]) < static_cast<unsignedchar_type>(y[u]))
+- return true;
+- else if(static_cast<unsignedchar_type>(y[u]) < static_cast<unsignedchar_type>(x[u]))
+- return false;
+- }
+- return x.size() < y.size();
+- }
+- unsigned fchar_offset;
+- };
+-
+- //A comparison functor for strings that assumes they are identical up to char_offset
+- template<class data_type, class unsignedchar_type>
+- struct offset_greaterthan {
+- offset_greaterthan(unsigned char_offset) : fchar_offset(char_offset){}
+- inline bool operator()(const data_type &x, const data_type &y) const
+- {
+- unsigned minSize = std::min(x.size(), y.size());
+- for(unsigned u = fchar_offset; u < minSize; ++u) {
+- if(static_cast<unsignedchar_type>(x[u]) > static_cast<unsignedchar_type>(y[u]))
+- return true;
+- else if(static_cast<unsignedchar_type>(y[u]) > static_cast<unsignedchar_type>(x[u]))
+- return false;
+- }
+- return x.size() > y.size();
+- }
+- unsigned fchar_offset;
+- };
+-
+- //A comparison functor for strings that assumes they are identical up to char_offset
+- template<class data_type, class get_char, class get_length>
+- struct offset_char_lessthan {
+- offset_char_lessthan(unsigned char_offset) : fchar_offset(char_offset){}
+- inline bool operator()(const data_type &x, const data_type &y) const
+- {
+- unsigned minSize = std::min(length(x), length(y));
+- for(unsigned u = fchar_offset; u < minSize; ++u) {
+- if(getchar(x, u) < getchar(y, u))
+- return true;
+- else if(getchar(y, u) < getchar(x, u))
+- return false;
+- }
+- return length(x) < length(y);
+- }
+- unsigned fchar_offset;
+- get_char getchar;
+- get_length length;
+- };
+-
+- //String sorting recursive implementation
+- template <class RandomAccessIter, class data_type, class unsignedchar_type>
+- inline void
+- string_sort_rec(RandomAccessIter first, RandomAccessIter last, unsigned char_offset, std::vector<RandomAccessIter> &bin_cache
+- , unsigned cache_offset, std::vector<size_t> &bin_sizes)
+- {
+- //This section is not strictly necessary, but makes handling of long identical substrings much faster, with a mild average performance impact.
+- //Iterate to the end of the empties. If all empty, return
+- while((*first).size() <= char_offset) {
+- if(++first == last)
+- return;
+- }
+- RandomAccessIter finish = last - 1;
+- //Getting the last non-empty
+- for(;(*finish).size() <= char_offset; --finish) { }
+- ++finish;
+- //Offsetting on identical characters. This section works a character at a time for optimal worst-case performance.
+- update_offset(first, finish, char_offset);
+-
+- const unsigned bin_count = (1 << (sizeof(unsignedchar_type)*8));
+- //Equal worst-case between radix and comparison-based is when bin_count = n*log(n).
+- const unsigned max_size = bin_count;
+- const unsigned membin_count = bin_count + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, membin_count) + 1;
+-
+- //Calculating the size of each bin; this takes roughly 10% of runtime
+- for (RandomAccessIter current = first; current != last; ++current) {
+- if((*current).size() <= char_offset) {
+- bin_sizes[0]++;
+- }
+- else
+- bin_sizes[static_cast<unsignedchar_type>((*current)[char_offset]) + 1]++;
+- }
+- //Assign the bin positions
+- bin_cache[cache_offset] = first;
+- for(unsigned u = 0; u < membin_count - 1; u++)
+- bin_cache[cache_offset + u + 1] = bin_cache[cache_offset + u] + bin_sizes[u];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- //handling empty bins
+- RandomAccessIter * local_bin = &(bin_cache[cache_offset]);
+- nextbinstart += bin_sizes[0];
+- RandomAccessIter * target_bin;
+- //Iterating over each element in the bin of empties
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //empties belong in this bin
+- while((*current).size() > char_offset) {
+- target_bin = bins + static_cast<unsignedchar_type>((*current)[char_offset]);
+- iter_swap(current, (*target_bin)++);
+- }
+- }
+- *local_bin = nextbinstart;
+- //iterate backwards to find the last bin with elements in it; this saves iterations in multiple loops
+- unsigned last_bin = bin_count - 1;
+- for(; last_bin && !bin_sizes[last_bin + 1]; --last_bin) { }
+- //This dominates runtime, mostly in the swap and bin lookups
+- for(unsigned u = 0; u < last_bin; ++u) {
+- local_bin = bins + u;
+- nextbinstart += bin_sizes[u + 1];
+- //Iterating over each element in this bin
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //Swapping elements in current into place until the correct element has been swapped in
+- for(target_bin = bins + static_cast<unsignedchar_type>((*current)[char_offset]); target_bin != local_bin;
+- target_bin = bins + static_cast<unsignedchar_type>((*current)[char_offset]))
+- iter_swap(current, (*target_bin)++);
+- }
+- *local_bin = nextbinstart;
+- }
+- bins[last_bin] = last;
+- //Recursing
+- RandomAccessIter lastPos = bin_cache[cache_offset];
+- //Skip this loop for empties
+- for(unsigned u = cache_offset + 1; u < cache_offset + last_bin + 2; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- //don't sort unless there are at least two items to compare
+- if(count < 2)
+- continue;
+- //using std::sort if its worst-case is better
+- if(count < max_size)
+- std::sort(lastPos, bin_cache[u], offset_lessthan<data_type, unsignedchar_type>(char_offset + 1));
+- else
+- string_sort_rec<RandomAccessIter, data_type, unsignedchar_type>(lastPos, bin_cache[u], char_offset + 1, bin_cache, cache_end, bin_sizes);
+- }
+- }
+-
+- //Sorts strings in reverse order, with empties at the end
+- template <class RandomAccessIter, class data_type, class unsignedchar_type>
+- inline void
+- reverse_string_sort_rec(RandomAccessIter first, RandomAccessIter last, unsigned char_offset, std::vector<RandomAccessIter> &bin_cache
+- , unsigned cache_offset, std::vector<size_t> &bin_sizes)
+- {
+- //This section is not strictly necessary, but makes handling of long identical substrings much faster, with a mild average performance impact.
+- RandomAccessIter curr = first;
+- //Iterate to the end of the empties. If all empty, return
+- while((*curr).size() <= char_offset) {
+- if(++curr == last)
+- return;
+- }
+- //Getting the last non-empty
+- while((*(--last)).size() <= char_offset) { }
+- ++last;
+- //Offsetting on identical characters. This section works a character at a time for optimal worst-case performance.
+- update_offset(curr, last, char_offset);
+- RandomAccessIter * target_bin;
+-
+- const unsigned bin_count = (1 << (sizeof(unsignedchar_type)*8));
+- //Equal worst-case between radix and comparison-based is when bin_count = n*log(n).
+- const unsigned max_size = bin_count;
+- const unsigned membin_count = bin_count + 1;
+- const unsigned max_bin = bin_count - 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, membin_count);
+- RandomAccessIter * end_bin = &(bin_cache[cache_offset + max_bin]);
+-
+- //Calculating the size of each bin; this takes roughly 10% of runtime
+- for (RandomAccessIter current = first; current != last; ++current) {
+- if((*current).size() <= char_offset) {
+- bin_sizes[bin_count]++;
+- }
+- else
+- bin_sizes[max_bin - static_cast<unsignedchar_type>((*current)[char_offset])]++;
+- }
+- //Assign the bin positions
+- bin_cache[cache_offset] = first;
+- for(unsigned u = 0; u < membin_count - 1; u++)
+- bin_cache[cache_offset + u + 1] = bin_cache[cache_offset + u] + bin_sizes[u];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = last;
+- //handling empty bins
+- RandomAccessIter * local_bin = &(bin_cache[cache_offset + bin_count]);
+- RandomAccessIter lastFull = *local_bin;
+- //Iterating over each element in the bin of empties
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //empties belong in this bin
+- while((*current).size() > char_offset) {
+- target_bin = end_bin - static_cast<unsignedchar_type>((*current)[char_offset]);
+- iter_swap(current, (*target_bin)++);
+- }
+- }
+- *local_bin = nextbinstart;
+- nextbinstart = first;
+- //iterate backwards to find the last bin with elements in it; this saves iterations in multiple loops
+- unsigned last_bin = max_bin;
+- for(; last_bin && !bin_sizes[last_bin]; --last_bin) { }
+- //This dominates runtime, mostly in the swap and bin lookups
+- for(unsigned u = 0; u < last_bin; ++u) {
+- local_bin = bins + u;
+- nextbinstart += bin_sizes[u];
+- //Iterating over each element in this bin
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //Swapping elements in current into place until the correct element has been swapped in
+- for(target_bin = end_bin - static_cast<unsignedchar_type>((*current)[char_offset]); target_bin != local_bin;
+- target_bin = end_bin - static_cast<unsignedchar_type>((*current)[char_offset]))
+- iter_swap(current, (*target_bin)++);
+- }
+- *local_bin = nextbinstart;
+- }
+- bins[last_bin] = lastFull;
+- //Recursing
+- RandomAccessIter lastPos = first;
+- //Skip this loop for empties
+- for(unsigned u = cache_offset; u <= cache_offset + last_bin; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- //don't sort unless there are at least two items to compare
+- if(count < 2)
+- continue;
+- //using std::sort if its worst-case is better
+- if(count < max_size)
+- std::sort(lastPos, bin_cache[u], offset_greaterthan<data_type, unsignedchar_type>(char_offset + 1));
+- else
+- reverse_string_sort_rec<RandomAccessIter, data_type, unsignedchar_type>(lastPos, bin_cache[u], char_offset + 1, bin_cache, cache_end, bin_sizes);
+- }
+- }
+-
+- //String sorting recursive implementation
+- template <class RandomAccessIter, class data_type, class unsignedchar_type, class get_char, class get_length>
+- inline void
+- string_sort_rec(RandomAccessIter first, RandomAccessIter last, unsigned char_offset, std::vector<RandomAccessIter> &bin_cache
+- , unsigned cache_offset, std::vector<size_t> &bin_sizes, get_char getchar, get_length length)
+- {
+- //This section is not strictly necessary, but makes handling of long identical substrings much faster, with a mild average performance impact.
+- //Iterate to the end of the empties. If all empty, return
+- while(length(*first) <= char_offset) {
+- if(++first == last)
+- return;
+- }
+- RandomAccessIter finish = last - 1;
+- //Getting the last non-empty
+- for(;length(*finish) <= char_offset; --finish) { }
+- ++finish;
+- update_offset(first, finish, char_offset, getchar, length);
+-
+- const unsigned bin_count = (1 << (sizeof(unsignedchar_type)*8));
+- //Equal worst-case between radix and comparison-based is when bin_count = n*log(n).
+- const unsigned max_size = bin_count;
+- const unsigned membin_count = bin_count + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, membin_count) + 1;
+-
+- //Calculating the size of each bin; this takes roughly 10% of runtime
+- for (RandomAccessIter current = first; current != last; ++current) {
+- if(length(*current) <= char_offset) {
+- bin_sizes[0]++;
+- }
+- else
+- bin_sizes[getchar((*current), char_offset) + 1]++;
+- }
+- //Assign the bin positions
+- bin_cache[cache_offset] = first;
+- for(unsigned u = 0; u < membin_count - 1; u++)
+- bin_cache[cache_offset + u + 1] = bin_cache[cache_offset + u] + bin_sizes[u];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- //handling empty bins
+- RandomAccessIter * local_bin = &(bin_cache[cache_offset]);
+- nextbinstart += bin_sizes[0];
+- RandomAccessIter * target_bin;
+- //Iterating over each element in the bin of empties
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //empties belong in this bin
+- while(length(*current) > char_offset) {
+- target_bin = bins + getchar((*current), char_offset);
+- iter_swap(current, (*target_bin)++);
+- }
+- }
+- *local_bin = nextbinstart;
+- //iterate backwards to find the last bin with elements in it; this saves iterations in multiple loops
+- unsigned last_bin = bin_count - 1;
+- for(; last_bin && !bin_sizes[last_bin + 1]; --last_bin) { }
+- //This dominates runtime, mostly in the swap and bin lookups
+- for(unsigned ii = 0; ii < last_bin; ++ii) {
+- local_bin = bins + ii;
+- nextbinstart += bin_sizes[ii + 1];
+- //Iterating over each element in this bin
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //Swapping elements in current into place until the correct element has been swapped in
+- for(target_bin = bins + getchar((*current), char_offset); target_bin != local_bin;
+- target_bin = bins + getchar((*current), char_offset))
+- iter_swap(current, (*target_bin)++);
+- }
+- *local_bin = nextbinstart;
+- }
+- bins[last_bin] = last;
+-
+- //Recursing
+- RandomAccessIter lastPos = bin_cache[cache_offset];
+- //Skip this loop for empties
+- for(unsigned u = cache_offset + 1; u < cache_offset + last_bin + 2; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- //don't sort unless there are at least two items to compare
+- if(count < 2)
+- continue;
+- //using std::sort if its worst-case is better
+- if(count < max_size)
+- std::sort(lastPos, bin_cache[u], offset_char_lessthan<data_type, get_char, get_length>(char_offset + 1));
+- else
+- string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length>(lastPos, bin_cache[u], char_offset + 1, bin_cache, cache_end, bin_sizes, getchar, length);
+- }
+- }
+-
+- //String sorting recursive implementation
+- template <class RandomAccessIter, class data_type, class unsignedchar_type, class get_char, class get_length, class compare>
+- inline void
+- string_sort_rec(RandomAccessIter first, RandomAccessIter last, unsigned char_offset, std::vector<RandomAccessIter> &bin_cache
+- , unsigned cache_offset, std::vector<size_t> &bin_sizes, get_char getchar, get_length length, compare comp)
+- {
+- //This section is not strictly necessary, but makes handling of long identical substrings much faster, with a mild average performance impact.
+- //Iterate to the end of the empties. If all empty, return
+- while(length(*first) <= char_offset) {
+- if(++first == last)
+- return;
+- }
+- RandomAccessIter finish = last - 1;
+- //Getting the last non-empty
+- for(;length(*finish) <= char_offset; --finish) { }
+- ++finish;
+- update_offset(first, finish, char_offset, getchar, length);
+-
+- const unsigned bin_count = (1 << (sizeof(unsignedchar_type)*8));
+- //Equal worst-case between radix and comparison-based is when bin_count = n*log(n).
+- const unsigned max_size = bin_count;
+- const unsigned membin_count = bin_count + 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, membin_count) + 1;
+-
+- //Calculating the size of each bin; this takes roughly 10% of runtime
+- for (RandomAccessIter current = first; current != last; ++current) {
+- if(length(*current) <= char_offset) {
+- bin_sizes[0]++;
+- }
+- else
+- bin_sizes[getchar((*current), char_offset) + 1]++;
+- }
+- //Assign the bin positions
+- bin_cache[cache_offset] = first;
+- for(unsigned u = 0; u < membin_count - 1; u++)
+- bin_cache[cache_offset + u + 1] = bin_cache[cache_offset + u] + bin_sizes[u];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = first;
+- //handling empty bins
+- RandomAccessIter * local_bin = &(bin_cache[cache_offset]);
+- nextbinstart += bin_sizes[0];
+- RandomAccessIter * target_bin;
+- //Iterating over each element in the bin of empties
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //empties belong in this bin
+- while(length(*current) > char_offset) {
+- target_bin = bins + getchar((*current), char_offset);
+- iter_swap(current, (*target_bin)++);
+- }
+- }
+- *local_bin = nextbinstart;
+- //iterate backwards to find the last bin with elements in it; this saves iterations in multiple loops
+- unsigned last_bin = bin_count - 1;
+- for(; last_bin && !bin_sizes[last_bin + 1]; --last_bin) { }
+- //This dominates runtime, mostly in the swap and bin lookups
+- for(unsigned u = 0; u < last_bin; ++u) {
+- local_bin = bins + u;
+- nextbinstart += bin_sizes[u + 1];
+- //Iterating over each element in this bin
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //Swapping elements in current into place until the correct element has been swapped in
+- for(target_bin = bins + getchar((*current), char_offset); target_bin != local_bin;
+- target_bin = bins + getchar((*current), char_offset))
+- iter_swap(current, (*target_bin)++);
+- }
+- *local_bin = nextbinstart;
+- }
+- bins[last_bin] = last;
+-
+- //Recursing
+- RandomAccessIter lastPos = bin_cache[cache_offset];
+- //Skip this loop for empties
+- for(unsigned u = cache_offset + 1; u < cache_offset + last_bin + 2; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- //don't sort unless there are at least two items to compare
+- if(count < 2)
+- continue;
+- //using std::sort if its worst-case is better
+- if(count < max_size)
+- std::sort(lastPos, bin_cache[u], comp);
+- else
+- string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length, compare>(lastPos
+- , bin_cache[u], char_offset + 1, bin_cache, cache_end, bin_sizes, getchar, length, comp);
+- }
+- }
+-
+- //Sorts strings in reverse order, with empties at the end
+- template <class RandomAccessIter, class data_type, class unsignedchar_type, class get_char, class get_length, class compare>
+- inline void
+- reverse_string_sort_rec(RandomAccessIter first, RandomAccessIter last, unsigned char_offset, std::vector<RandomAccessIter> &bin_cache
+- , unsigned cache_offset, std::vector<size_t> &bin_sizes, get_char getchar, get_length length, compare comp)
+- {
+- //This section is not strictly necessary, but makes handling of long identical substrings much faster, with a mild average performance impact.
+- RandomAccessIter curr = first;
+- //Iterate to the end of the empties. If all empty, return
+- while(length(*curr) <= char_offset) {
+- if(++curr == last)
+- return;
+- }
+- //Getting the last non-empty
+- while(length(*(--last)) <= char_offset) { }
+- ++last;
+- //Offsetting on identical characters. This section works a character at a time for optimal worst-case performance.
+- update_offset(first, last, char_offset, getchar, length);
+-
+- const unsigned bin_count = (1 << (sizeof(unsignedchar_type)*8));
+- //Equal worst-case between radix and comparison-based is when bin_count = n*log(n).
+- const unsigned max_size = bin_count;
+- const unsigned membin_count = bin_count + 1;
+- const unsigned max_bin = bin_count - 1;
+- unsigned cache_end;
+- RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, membin_count);
+- RandomAccessIter *end_bin = &(bin_cache[cache_offset + max_bin]);
+-
+- //Calculating the size of each bin; this takes roughly 10% of runtime
+- for (RandomAccessIter current = first; current != last; ++current) {
+- if(length(*current) <= char_offset) {
+- bin_sizes[bin_count]++;
+- }
+- else
+- bin_sizes[max_bin - getchar((*current), char_offset)]++;
+- }
+- //Assign the bin positions
+- bin_cache[cache_offset] = first;
+- for(unsigned u = 0; u < membin_count - 1; u++)
+- bin_cache[cache_offset + u + 1] = bin_cache[cache_offset + u] + bin_sizes[u];
+-
+- //Swap into place
+- RandomAccessIter nextbinstart = last;
+- //handling empty bins
+- RandomAccessIter * local_bin = &(bin_cache[cache_offset + bin_count]);
+- RandomAccessIter lastFull = *local_bin;
+- RandomAccessIter * target_bin;
+- //Iterating over each element in the bin of empties
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //empties belong in this bin
+- while(length(*current) > char_offset) {
+- target_bin = end_bin - getchar((*current), char_offset);
+- iter_swap(current, (*target_bin)++);
+- }
+- }
+- *local_bin = nextbinstart;
+- nextbinstart = first;
+- //iterate backwards to find the last bin with elements in it; this saves iterations in multiple loops
+- unsigned last_bin = max_bin;
+- for(; last_bin && !bin_sizes[last_bin]; --last_bin) { }
+- //This dominates runtime, mostly in the swap and bin lookups
+- for(unsigned u = 0; u < last_bin; ++u) {
+- local_bin = bins + u;
+- nextbinstart += bin_sizes[u];
+- //Iterating over each element in this bin
+- for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
+- //Swapping elements in current into place until the correct element has been swapped in
+- for(target_bin = end_bin - getchar((*current), char_offset); target_bin != local_bin;
+- target_bin = end_bin - getchar((*current), char_offset))
+- iter_swap(current, (*target_bin)++);
+- }
+- *local_bin = nextbinstart;
+- }
+- bins[last_bin] = lastFull;
+- //Recursing
+- RandomAccessIter lastPos = first;
+- //Skip this loop for empties
+- for(unsigned u = cache_offset; u <= cache_offset + last_bin; lastPos = bin_cache[u], ++u) {
+- size_t count = bin_cache[u] - lastPos;
+- //don't sort unless there are at least two items to compare
+- if(count < 2)
+- continue;
+- //using std::sort if its worst-case is better
+- if(count < max_size)
+- std::sort(lastPos, bin_cache[u], comp);
+- else
+- reverse_string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length, compare>(lastPos
+- , bin_cache[u], char_offset + 1, bin_cache, cache_end, bin_sizes, getchar, length, comp);
+- }
+- }
+-
+- //Holds the bin vector and makes the initial recursive call
+- template <class RandomAccessIter, class data_type, class unsignedchar_type>
+- inline void
+- string_sort(RandomAccessIter first, RandomAccessIter last, data_type, unsignedchar_type)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- string_sort_rec<RandomAccessIter, data_type, unsignedchar_type>(first, last, 0, bin_cache, 0, bin_sizes);
+- }
+-
+- //Holds the bin vector and makes the initial recursive call
+- template <class RandomAccessIter, class data_type, class unsignedchar_type>
+- inline void
+- reverse_string_sort(RandomAccessIter first, RandomAccessIter last, data_type, unsignedchar_type)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- reverse_string_sort_rec<RandomAccessIter, data_type, unsignedchar_type>(first, last, 0, bin_cache, 0, bin_sizes);
+- }
+-
+- //Holds the bin vector and makes the initial recursive call
+- template <class RandomAccessIter, class get_char, class get_length, class data_type, class unsignedchar_type>
+- inline void
+- string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length, data_type, unsignedchar_type)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length>(first, last, 0, bin_cache, 0, bin_sizes, getchar, length);
+- }
+-
+- //Holds the bin vector and makes the initial recursive call
+- template <class RandomAccessIter, class get_char, class get_length, class compare, class data_type, class unsignedchar_type>
+- inline void
+- string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length, compare comp, data_type, unsignedchar_type)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length, compare>(first, last, 0, bin_cache, 0, bin_sizes, getchar, length, comp);
+- }
+-
+- //Holds the bin vector and makes the initial recursive call
+- template <class RandomAccessIter, class get_char, class get_length, class compare, class data_type, class unsignedchar_type>
+- inline void
+- reverse_string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length, compare comp, data_type, unsignedchar_type)
+- {
+- std::vector<size_t> bin_sizes;
+- std::vector<RandomAccessIter> bin_cache;
+- reverse_string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length, compare>(first, last, 0, bin_cache, 0, bin_sizes, getchar, length, comp);
+- }
+- }
+-
+- //Allows character-type overloads
+- template <class RandomAccessIter, class unsignedchar_type>
+- inline void string_sort(RandomAccessIter first, RandomAccessIter last, unsignedchar_type unused)
+- {
+- //Don't sort if it's too small to optimize
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last);
+- else
+- detail::string_sort(first, last, *first, unused);
+- }
+-
+- //Top-level sorting call; wraps using default of unsigned char
+- template <class RandomAccessIter>
+- inline void string_sort(RandomAccessIter first, RandomAccessIter last)
+- {
+- unsigned char unused = '\0';
+- string_sort(first, last, unused);
+- }
+-
+- //Allows character-type overloads
+- template <class RandomAccessIter, class compare, class unsignedchar_type>
+- inline void reverse_string_sort(RandomAccessIter first, RandomAccessIter last, compare comp, unsignedchar_type unused)
+- {
+- //Don't sort if it's too small to optimize
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last, comp);
+- else
+- detail::reverse_string_sort(first, last, *first, unused);
+- }
+-
+- //Top-level sorting call; wraps using default of unsigned char
+- template <class RandomAccessIter, class compare>
+- inline void reverse_string_sort(RandomAccessIter first, RandomAccessIter last, compare comp)
+- {
+- unsigned char unused = '\0';
+- reverse_string_sort(first, last, comp, unused);
+- }
+-
+- template <class RandomAccessIter, class get_char, class get_length>
+- inline void string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length)
+- {
+- //Don't sort if it's too small to optimize
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last);
+- else {
+- //skipping past empties at the beginning, which allows us to get the character type
+- //.empty() is not used so as not to require a user declaration of it
+- while(!length(*first)) {
+- if(++first == last)
+- return;
+- }
+- detail::string_sort(first, last, getchar, length, *first, getchar((*first), 0));
+- }
+- }
+-
+- template <class RandomAccessIter, class get_char, class get_length, class compare>
+- inline void string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length, compare comp)
+- {
+- //Don't sort if it's too small to optimize
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last, comp);
+- else {
+- //skipping past empties at the beginning, which allows us to get the character type
+- //.empty() is not used so as not to require a user declaration of it
+- while(!length(*first)) {
+- if(++first == last)
+- return;
+- }
+- detail::string_sort(first, last, getchar, length, comp, *first, getchar((*first), 0));
+- }
+- }
+-
+- template <class RandomAccessIter, class get_char, class get_length, class compare>
+- inline void reverse_string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length, compare comp)
+- {
+- //Don't sort if it's too small to optimize
+- if(last - first < detail::MIN_SORT_SIZE)
+- std::sort(first, last, comp);
+- else {
+- //skipping past empties at the beginning, which allows us to get the character type
+- //.empty() is not used so as not to require a user declaration of it
+- while(!length(*(--last))) {
+- //Note: if there is just one non-empty, and it's at the beginning, then it's already in sorted order
+- if(first == last)
+- return;
+- }
+- //making last just after the end of the non-empty part of the array
+- ++last;
+- detail::reverse_string_sort(first, last, getchar, length, comp, *first, getchar((*first), 0));
+- }
+- }
+-}
+-
+-#endif
++//Templated spread_sort library
++
++// Copyright Steven J. Ross 2001 - 2009.
++// Distributed under the Boost Software License, Version 1.0.
++// (See accompanying file LICENSE_1_0.txt or copy at
++// http://www.boost.org/LICENSE_1_0.txt)
++
++// See http://www.boost.org/ for updates, documentation, and revision history.
++
++/*
++Some improvements suggested by:
++Phil Endecott and Frank Gennari
++Cygwin fix provided by:
++Scott McMurray
++*/
++
++#ifndef BOOST_SPREAD_SORT_H
++#define BOOST_SPREAD_SORT_H
++#include <algorithm>
++#include <cstring>
++#include <vector>
++#include "webrtc/system_wrappers/source/spreadsortlib/constants.hpp"
++
++#ifdef __FreeBSD__
++# include <osreldate.h>
++# if __FreeBSD_version < 900506
++# define getchar boost_getchar
++# endif
++#endif
++
++namespace boost {
++ namespace detail {
++ //This only works on unsigned data types
++ template <typename T>
++ inline unsigned
++ rough_log_2_size(const T& input)
++ {
++ unsigned result = 0;
++ //The && is necessary on some compilers to avoid infinite loops; it doesn't significantly impair performance
++ while((input >> result) && (result < (8*sizeof(T)))) ++result;
++ return result;
++ }
++
++ //Gets the maximum size which we'll call spread_sort on to control worst-case performance
++ //Maintains both a minimum size to recurse and a check of distribution size versus count
++ //This is called for a set of bins, instead of bin-by-bin, to avoid performance overhead
++ inline size_t
++ get_max_count(unsigned log_range, size_t count)
++ {
++ unsigned divisor = rough_log_2_size(count);
++ //Making sure the divisor is positive
++ if(divisor > LOG_MEAN_BIN_SIZE)
++ divisor -= LOG_MEAN_BIN_SIZE;
++ else
++ divisor = 1;
++ unsigned relative_width = (LOG_CONST * log_range)/((divisor > MAX_SPLITS) ? MAX_SPLITS : divisor);
++ //Don't try to bitshift more than the size of an element
++ if((8*sizeof(size_t)) <= relative_width)
++ relative_width = (8*sizeof(size_t)) - 1;
++ return (size_t)1 << ((relative_width < (LOG_MEAN_BIN_SIZE + LOG_MIN_SPLIT_COUNT)) ?
++ (LOG_MEAN_BIN_SIZE + LOG_MIN_SPLIT_COUNT) : relative_width);
++ }
++
++ //Find the minimum and maximum using <
++ template <class RandomAccessIter>
++ inline void
++ find_extremes(RandomAccessIter current, RandomAccessIter last, RandomAccessIter & max, RandomAccessIter & min)
++ {
++ min = max = current;
++ //Start from the second item, as max and min are initialized to the first
++ while(++current < last) {
++ if(*max < *current)
++ max = current;
++ else if(*current < *min)
++ min = current;
++ }
++ }
++
++ //Uses a user-defined comparison operator to find minimum and maximum
++ template <class RandomAccessIter, class compare>
++ inline void
++ find_extremes(RandomAccessIter current, RandomAccessIter last, RandomAccessIter & max, RandomAccessIter & min, compare comp)
++ {
++ min = max = current;
++ while(++current < last) {
++ if(comp(*max, *current))
++ max = current;
++ else if(comp(*current, *min))
++ min = current;
++ }
++ }
++
++ //Gets a non-negative right bit shift to operate as a logarithmic divisor
++ inline int
++ get_log_divisor(size_t count, unsigned log_range)
++ {
++ int log_divisor;
++ //If we can finish in one iteration without exceeding either (2 to the MAX_SPLITS) or n bins, do so
++ if((log_divisor = log_range - rough_log_2_size(count)) <= 0 && log_range < MAX_SPLITS)
++ log_divisor = 0;
++ else {
++ //otherwise divide the data into an optimized number of pieces
++ log_divisor += LOG_MEAN_BIN_SIZE;
++ if(log_divisor < 0)
++ log_divisor = 0;
++ //Cannot exceed MAX_SPLITS or cache misses slow down bin lookups dramatically
++ if((log_range - log_divisor) > MAX_SPLITS)
++ log_divisor = log_range - MAX_SPLITS;
++ }
++ return log_divisor;
++ }
++
++ template <class RandomAccessIter>
++ inline RandomAccessIter *
++ size_bins(std::vector<size_t> &bin_sizes, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset, unsigned &cache_end, unsigned bin_count)
++ {
++ //Assure space for the size of each bin, followed by initializing sizes
++ if(bin_count > bin_sizes.size())
++ bin_sizes.resize(bin_count);
++ for(size_t u = 0; u < bin_count; u++)
++ bin_sizes[u] = 0;
++ //Make sure there is space for the bins
++ cache_end = cache_offset + bin_count;
++ if(cache_end > bin_cache.size())
++ bin_cache.resize(cache_end);
++ return &(bin_cache[cache_offset]);
++ }
++
++ //Implementation for recursive integer sorting
++ template <class RandomAccessIter, class div_type, class data_type>
++ inline void
++ spread_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
++ , std::vector<size_t> &bin_sizes)
++ {
++ //This step is roughly 10% of runtime, but it helps avoid worst-case behavior and improve behavior with real data
++ //If you know the maximum and minimum ahead of time, you can pass those values in and skip this step for the first iteration
++ RandomAccessIter max, min;
++ find_extremes(first, last, max, min);
++ //max and min will be the same (the first item) iff all values are equivalent
++ if(max == min)
++ return;
++ RandomAccessIter * target_bin;
++ unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(*max >> 0) - (*min >> 0)));
++ div_type div_min = *min >> log_divisor;
++ div_type div_max = *max >> log_divisor;
++ unsigned bin_count = div_max - div_min + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
++
++ //Calculating the size of each bin; this takes roughly 10% of runtime
++ for (RandomAccessIter current = first; current != last;)
++ bin_sizes[(*(current++) >> log_divisor) - div_min]++;
++ //Assign the bin positions
++ bins[0] = first;
++ for(unsigned u = 0; u < bin_count - 1; u++)
++ bins[u + 1] = bins[u] + bin_sizes[u];
++
++ //Swap into place
++ //This dominates runtime, mostly in the swap and bin lookups
++ RandomAccessIter nextbinstart = first;
++ for(unsigned u = 0; u < bin_count - 1; ++u) {
++ RandomAccessIter * local_bin = bins + u;
++ nextbinstart += bin_sizes[u];
++ //Iterating over each element in this bin
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //Swapping elements in current into place until the correct element has been swapped in
++ for(target_bin = (bins + ((*current >> log_divisor) - div_min)); target_bin != local_bin;
++ target_bin = bins + ((*current >> log_divisor) - div_min)) {
++ //3-way swap; this is about 1% faster than a 2-way swap with integers
++ //The main advantage is less copies are involved per item put in the correct place
++ data_type tmp;
++ RandomAccessIter b = (*target_bin)++;
++ RandomAccessIter * b_bin = bins + ((*b >> log_divisor) - div_min);
++ if (b_bin != local_bin) {
++ RandomAccessIter c = (*b_bin)++;
++ tmp = *c;
++ *c = *b;
++ }
++ else
++ tmp = *b;
++ *b = *current;
++ *current = tmp;
++ }
++ }
++ *local_bin = nextbinstart;
++ }
++ bins[bin_count - 1] = last;
++
++ //If we've bucketsorted, the array is sorted and we should skip recursion
++ if(!log_divisor)
++ return;
++
++ //Recursing; log_divisor is the remaining range
++ size_t max_count = get_max_count(log_divisor, last - first);
++ RandomAccessIter lastPos = first;
++ for(unsigned u = cache_offset; u < cache_end; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ //don't sort unless there are at least two items to compare
++ if(count < 2)
++ continue;
++ //using std::sort if its worst-case is better
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[u]);
++ else
++ spread_sort_rec<RandomAccessIter, div_type, data_type>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes);
++ }
++ }
++
++ //Generic bitshift-based 3-way swapping code
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift>
++ inline void inner_swap_loop(RandomAccessIter * bins, const RandomAccessIter & nextbinstart, unsigned ii, right_shift &shift
++ , const unsigned log_divisor, const div_type div_min)
++ {
++ RandomAccessIter * local_bin = bins + ii;
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ for(RandomAccessIter * target_bin = (bins + (shift(*current, log_divisor) - div_min)); target_bin != local_bin;
++ target_bin = bins + (shift(*current, log_divisor) - div_min)) {
++ data_type tmp;
++ RandomAccessIter b = (*target_bin)++;
++ RandomAccessIter * b_bin = bins + (shift(*b, log_divisor) - div_min);
++ //Three-way swap; if the item to be swapped doesn't belong in the current bin, swap it to where it belongs
++ if (b_bin != local_bin) {
++ RandomAccessIter c = (*b_bin)++;
++ tmp = *c;
++ *c = *b;
++ }
++ //Note: we could increment current once the swap is done in this case, but that seems to impair performance
++ else
++ tmp = *b;
++ *b = *current;
++ *current = tmp;
++ }
++ }
++ *local_bin = nextbinstart;
++ }
++
++ //Standard swapping wrapper for ascending values
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift>
++ inline void swap_loop(RandomAccessIter * bins, RandomAccessIter & nextbinstart, unsigned ii, right_shift &shift
++ , const std::vector<size_t> &bin_sizes, const unsigned log_divisor, const div_type div_min)
++ {
++ nextbinstart += bin_sizes[ii];
++ inner_swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, ii, shift, log_divisor, div_min);
++ }
++
++ //Functor implementation for recursive sorting
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift, class compare>
++ inline void
++ spread_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
++ , std::vector<size_t> &bin_sizes, right_shift shift, compare comp)
++ {
++ RandomAccessIter max, min;
++ find_extremes(first, last, max, min, comp);
++ if(max == min)
++ return;
++ unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(shift(*max, 0)) - (shift(*min, 0))));
++ div_type div_min = shift(*min, log_divisor);
++ div_type div_max = shift(*max, log_divisor);
++ unsigned bin_count = div_max - div_min + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
++
++ //Calculating the size of each bin
++ for (RandomAccessIter current = first; current != last;)
++ bin_sizes[shift(*(current++), log_divisor) - div_min]++;
++ bins[0] = first;
++ for(unsigned u = 0; u < bin_count - 1; u++)
++ bins[u + 1] = bins[u] + bin_sizes[u];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ for(unsigned u = 0; u < bin_count - 1; ++u)
++ swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, u, shift, bin_sizes, log_divisor, div_min);
++ bins[bin_count - 1] = last;
++
++ //If we've bucketsorted, the array is sorted and we should skip recursion
++ if(!log_divisor)
++ return;
++
++ //Recursing
++ size_t max_count = get_max_count(log_divisor, last - first);
++ RandomAccessIter lastPos = first;
++ for(unsigned u = cache_offset; u < cache_end; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[u], comp);
++ else
++ spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift, compare>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes, shift, comp);
++ }
++ }
++
++ //Functor implementation for recursive sorting with only Shift overridden
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift>
++ inline void
++ spread_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
++ , std::vector<size_t> &bin_sizes, right_shift shift)
++ {
++ RandomAccessIter max, min;
++ find_extremes(first, last, max, min);
++ if(max == min)
++ return;
++ unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(shift(*max, 0)) - (shift(*min, 0))));
++ div_type div_min = shift(*min, log_divisor);
++ div_type div_max = shift(*max, log_divisor);
++ unsigned bin_count = div_max - div_min + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
++
++ //Calculating the size of each bin
++ for (RandomAccessIter current = first; current != last;)
++ bin_sizes[shift(*(current++), log_divisor) - div_min]++;
++ bins[0] = first;
++ for(unsigned u = 0; u < bin_count - 1; u++)
++ bins[u + 1] = bins[u] + bin_sizes[u];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ for(unsigned ii = 0; ii < bin_count - 1; ++ii)
++ swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, ii, shift, bin_sizes, log_divisor, div_min);
++ bins[bin_count - 1] = last;
++
++ //If we've bucketsorted, the array is sorted and we should skip recursion
++ if(!log_divisor)
++ return;
++
++ //Recursing
++ size_t max_count = get_max_count(log_divisor, last - first);
++ RandomAccessIter lastPos = first;
++ for(unsigned u = cache_offset; u < cache_end; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[u]);
++ else
++ spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes, shift);
++ }
++ }
++
++ //Holds the bin vector and makes the initial recursive call
++ template <class RandomAccessIter, class div_type, class data_type>
++ inline void
++ spread_sort(RandomAccessIter first, RandomAccessIter last, div_type, data_type)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ spread_sort_rec<RandomAccessIter, div_type, data_type>(first, last, bin_cache, 0, bin_sizes);
++ }
++
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift, class compare>
++ inline void
++ spread_sort(RandomAccessIter first, RandomAccessIter last, div_type, data_type, right_shift shift, compare comp)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift, compare>(first, last, bin_cache, 0, bin_sizes, shift, comp);
++ }
++
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift>
++ inline void
++ spread_sort(RandomAccessIter first, RandomAccessIter last, div_type, data_type, right_shift shift)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(first, last, bin_cache, 0, bin_sizes, shift);
++ }
++ }
++
++ //Top-level sorting call for integers
++ template <class RandomAccessIter>
++ inline void integer_sort(RandomAccessIter first, RandomAccessIter last)
++ {
++ //Don't sort if it's too small to optimize
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last);
++ else
++ detail::spread_sort(first, last, *first >> 0, *first);
++ }
++
++ //integer_sort with functors
++ template <class RandomAccessIter, class right_shift, class compare>
++ inline void integer_sort(RandomAccessIter first, RandomAccessIter last,
++ right_shift shift, compare comp) {
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last, comp);
++ else
++ detail::spread_sort(first, last, shift(*first, 0), *first, shift, comp);
++ }
++
++ //integer_sort with right_shift functor
++ template <class RandomAccessIter, class right_shift>
++ inline void integer_sort(RandomAccessIter first, RandomAccessIter last,
++ right_shift shift) {
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last);
++ else
++ detail::spread_sort(first, last, shift(*first, 0), *first, shift);
++ }
++
++ //------------------------------------------------------ float_sort source --------------------------------------
++ //Casts a RandomAccessIter to the specified data type
++ template<class cast_type, class RandomAccessIter>
++ inline cast_type
++ cast_float_iter(const RandomAccessIter & floatiter)
++ {
++ cast_type result;
++ std::memcpy(&result, &(*floatiter), sizeof(cast_type));
++ return result;
++ }
++
++ //Casts a data element to the specified datinner_float_a type
++ template<class data_type, class cast_type>
++ inline cast_type
++ mem_cast(const data_type & data)
++ {
++ cast_type result;
++ std::memcpy(&result, &data, sizeof(cast_type));
++ return result;
++ }
++
++ namespace detail {
++ template <class RandomAccessIter, class div_type, class right_shift>
++ inline void
++ find_extremes(RandomAccessIter current, RandomAccessIter last, div_type & max, div_type & min, right_shift shift)
++ {
++ min = max = shift(*current, 0);
++ while(++current < last) {
++ div_type value = shift(*current, 0);
++ if(max < value)
++ max = value;
++ else if(value < min)
++ min = value;
++ }
++ }
++
++ //Specialized swap loops for floating-point casting
++ template <class RandomAccessIter, class div_type, class data_type>
++ inline void inner_float_swap_loop(RandomAccessIter * bins, const RandomAccessIter & nextbinstart, unsigned ii
++ , const unsigned log_divisor, const div_type div_min)
++ {
++ RandomAccessIter * local_bin = bins + ii;
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ for(RandomAccessIter * target_bin = (bins + ((cast_float_iter<div_type, RandomAccessIter>(current) >> log_divisor) - div_min)); target_bin != local_bin;
++ target_bin = bins + ((cast_float_iter<div_type, RandomAccessIter>(current) >> log_divisor) - div_min)) {
++ data_type tmp;
++ RandomAccessIter b = (*target_bin)++;
++ RandomAccessIter * b_bin = bins + ((cast_float_iter<div_type, RandomAccessIter>(b) >> log_divisor) - div_min);
++ //Three-way swap; if the item to be swapped doesn't belong in the current bin, swap it to where it belongs
++ if (b_bin != local_bin) {
++ RandomAccessIter c = (*b_bin)++;
++ tmp = *c;
++ *c = *b;
++ }
++ else
++ tmp = *b;
++ *b = *current;
++ *current = tmp;
++ }
++ }
++ *local_bin = nextbinstart;
++ }
++
++ template <class RandomAccessIter, class div_type, class data_type>
++ inline void float_swap_loop(RandomAccessIter * bins, RandomAccessIter & nextbinstart, unsigned ii
++ , const std::vector<size_t> &bin_sizes, const unsigned log_divisor, const div_type div_min)
++ {
++ nextbinstart += bin_sizes[ii];
++ inner_float_swap_loop<RandomAccessIter, div_type, data_type>(bins, nextbinstart, ii, log_divisor, div_min);
++ }
++
++ template <class RandomAccessIter, class cast_type>
++ inline void
++ find_extremes(RandomAccessIter current, RandomAccessIter last, cast_type & max, cast_type & min)
++ {
++ min = max = cast_float_iter<cast_type, RandomAccessIter>(current);
++ while(++current < last) {
++ cast_type value = cast_float_iter<cast_type, RandomAccessIter>(current);
++ if(max < value)
++ max = value;
++ else if(value < min)
++ min = value;
++ }
++ }
++
++ //Special-case sorting of positive floats with casting instead of a right_shift
++ template <class RandomAccessIter, class div_type, class data_type>
++ inline void
++ positive_float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
++ , std::vector<size_t> &bin_sizes)
++ {
++ div_type max, min;
++ find_extremes(first, last, max, min);
++ if(max == min)
++ return;
++ unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
++ div_type div_min = min >> log_divisor;
++ div_type div_max = max >> log_divisor;
++ unsigned bin_count = div_max - div_min + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
++
++ //Calculating the size of each bin
++ for (RandomAccessIter current = first; current != last;)
++ bin_sizes[(cast_float_iter<div_type, RandomAccessIter>(current++) >> log_divisor) - div_min]++;
++ bins[0] = first;
++ for(unsigned u = 0; u < bin_count - 1; u++)
++ bins[u + 1] = bins[u] + bin_sizes[u];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ for(unsigned u = 0; u < bin_count - 1; ++u)
++ float_swap_loop<RandomAccessIter, div_type, data_type>(bins, nextbinstart, u, bin_sizes, log_divisor, div_min);
++ bins[bin_count - 1] = last;
++
++ //Return if we've completed bucketsorting
++ if(!log_divisor)
++ return;
++
++ //Recursing
++ size_t max_count = get_max_count(log_divisor, last - first);
++ RandomAccessIter lastPos = first;
++ for(unsigned u = cache_offset; u < cache_end; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[u]);
++ else
++ positive_float_sort_rec<RandomAccessIter, div_type, data_type>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes);
++ }
++ }
++
++ //Sorting negative_ float_s
++ //Note that bins are iterated in reverse order because max_neg_float = min_neg_int
++ template <class RandomAccessIter, class div_type, class data_type>
++ inline void
++ negative_float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
++ , std::vector<size_t> &bin_sizes)
++ {
++ div_type max, min;
++ find_extremes(first, last, max, min);
++ if(max == min)
++ return;
++ unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
++ div_type div_min = min >> log_divisor;
++ div_type div_max = max >> log_divisor;
++ unsigned bin_count = div_max - div_min + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
++
++ //Calculating the size of each bin
++ for (RandomAccessIter current = first; current != last;)
++ bin_sizes[(cast_float_iter<div_type, RandomAccessIter>(current++) >> log_divisor) - div_min]++;
++ bins[bin_count - 1] = first;
++ for(int ii = bin_count - 2; ii >= 0; --ii)
++ bins[ii] = bins[ii + 1] + bin_sizes[ii + 1];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ //The last bin will always have the correct elements in it
++ for(int ii = bin_count - 1; ii > 0; --ii)
++ float_swap_loop<RandomAccessIter, div_type, data_type>(bins, nextbinstart, ii, bin_sizes, log_divisor, div_min);
++ //Since we don't process the last bin, we need to update its end position
++ bin_cache[cache_offset] = last;
++
++ //Return if we've completed bucketsorting
++ if(!log_divisor)
++ return;
++
++ //Recursing
++ size_t max_count = get_max_count(log_divisor, last - first);
++ RandomAccessIter lastPos = first;
++ for(int ii = cache_end - 1; ii >= (int)cache_offset; lastPos = bin_cache[ii], --ii) {
++ size_t count = bin_cache[ii] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[ii]);
++ else
++ negative_float_sort_rec<RandomAccessIter, div_type, data_type>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes);
++ }
++ }
++
++ //Sorting negative_ float_s
++ //Note that bins are iterated in reverse order because max_neg_float = min_neg_int
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift>
++ inline void
++ negative_float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
++ , std::vector<size_t> &bin_sizes, right_shift shift)
++ {
++ div_type max, min;
++ find_extremes(first, last, max, min, shift);
++ if(max == min)
++ return;
++ unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
++ div_type div_min = min >> log_divisor;
++ div_type div_max = max >> log_divisor;
++ unsigned bin_count = div_max - div_min + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
++
++ //Calculating the size of each bin
++ for (RandomAccessIter current = first; current != last;)
++ bin_sizes[shift(*(current++), log_divisor) - div_min]++;
++ bins[bin_count - 1] = first;
++ for(int ii = bin_count - 2; ii >= 0; --ii)
++ bins[ii] = bins[ii + 1] + bin_sizes[ii + 1];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ //The last bin will always have the correct elements in it
++ for(int ii = bin_count - 1; ii > 0; --ii)
++ swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, ii, shift, bin_sizes, log_divisor, div_min);
++ //Since we don't process the last bin, we need to update its end position
++ bin_cache[cache_offset] = last;
++
++ //Return if we've completed bucketsorting
++ if(!log_divisor)
++ return;
++
++ //Recursing
++ size_t max_count = get_max_count(log_divisor, last - first);
++ RandomAccessIter lastPos = first;
++ for(int ii = cache_end - 1; ii >= (int)cache_offset; lastPos = bin_cache[ii], --ii) {
++ size_t count = bin_cache[ii] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[ii]);
++ else
++ negative_float_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes, shift);
++ }
++ }
++
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift, class compare>
++ inline void
++ negative_float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
++ , std::vector<size_t> &bin_sizes, right_shift shift, compare comp)
++ {
++ div_type max, min;
++ find_extremes(first, last, max, min, shift);
++ if(max == min)
++ return;
++ unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
++ div_type div_min = min >> log_divisor;
++ div_type div_max = max >> log_divisor;
++ unsigned bin_count = div_max - div_min + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
++
++ //Calculating the size of each bin
++ for (RandomAccessIter current = first; current != last;)
++ bin_sizes[shift(*(current++), log_divisor) - div_min]++;
++ bins[bin_count - 1] = first;
++ for(int ii = bin_count - 2; ii >= 0; --ii)
++ bins[ii] = bins[ii + 1] + bin_sizes[ii + 1];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ //The last bin will always have the correct elements in it
++ for(int ii = bin_count - 1; ii > 0; --ii)
++ swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, ii, shift, bin_sizes, log_divisor, div_min);
++ //Since we don't process the last bin, we need to update its end position
++ bin_cache[cache_offset] = last;
++
++ //Return if we've completed bucketsorting
++ if(!log_divisor)
++ return;
++
++ //Recursing
++ size_t max_count = get_max_count(log_divisor, last - first);
++ RandomAccessIter lastPos = first;
++ for(int ii = cache_end - 1; ii >= (int)cache_offset; lastPos = bin_cache[ii], --ii) {
++ size_t count = bin_cache[ii] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[ii], comp);
++ else
++ negative_float_sort_rec<RandomAccessIter, div_type, data_type, right_shift, compare>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes, shift, comp);
++ }
++ }
++
++ //Casting special-case for floating-point sorting
++ template <class RandomAccessIter, class div_type, class data_type>
++ inline void
++ float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
++ , std::vector<size_t> &bin_sizes)
++ {
++ div_type max, min;
++ find_extremes(first, last, max, min);
++ if(max == min)
++ return;
++ unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
++ div_type div_min = min >> log_divisor;
++ div_type div_max = max >> log_divisor;
++ unsigned bin_count = div_max - div_min + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
++
++ //Calculating the size of each bin
++ for (RandomAccessIter current = first; current != last;)
++ bin_sizes[(cast_float_iter<div_type, RandomAccessIter>(current++) >> log_divisor) - div_min]++;
++ //The index of the first positive bin
++ div_type first_positive = (div_min < 0) ? -div_min : 0;
++ //Resetting if all bins are negative
++ if(cache_offset + first_positive > cache_end)
++ first_positive = cache_end - cache_offset;
++ //Reversing the order of the negative bins
++ //Note that because of the negative/positive ordering direction flip
++ //We can not depend upon bin order and positions matching up
++ //so bin_sizes must be reused to contain the end of the bin
++ if(first_positive > 0) {
++ bins[first_positive - 1] = first;
++ for(int ii = first_positive - 2; ii >= 0; --ii) {
++ bins[ii] = first + bin_sizes[ii + 1];
++ bin_sizes[ii] += bin_sizes[ii + 1];
++ }
++ //Handling positives following negatives
++ if((unsigned)first_positive < bin_count) {
++ bins[first_positive] = first + bin_sizes[0];
++ bin_sizes[first_positive] += bin_sizes[0];
++ }
++ }
++ else
++ bins[0] = first;
++ for(unsigned u = first_positive; u < bin_count - 1; u++) {
++ bins[u + 1] = first + bin_sizes[u];
++ bin_sizes[u + 1] += bin_sizes[u];
++ }
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ for(unsigned u = 0; u < bin_count; ++u) {
++ nextbinstart = first + bin_sizes[u];
++ inner_float_swap_loop<RandomAccessIter, div_type, data_type>(bins, nextbinstart, u, log_divisor, div_min);
++ }
++
++ if(!log_divisor)
++ return;
++
++ //Handling negative values first
++ size_t max_count = get_max_count(log_divisor, last - first);
++ RandomAccessIter lastPos = first;
++ for(int ii = cache_offset + first_positive - 1; ii >= (int)cache_offset ; lastPos = bin_cache[ii--]) {
++ size_t count = bin_cache[ii] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[ii]);
++ //sort negative values using reversed-bin spread_sort
++ else
++ negative_float_sort_rec<RandomAccessIter, div_type, data_type>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes);
++ }
++
++ for(unsigned u = cache_offset + first_positive; u < cache_end; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[u]);
++ //sort positive values using normal spread_sort
++ else
++ positive_float_sort_rec<RandomAccessIter, div_type, data_type>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes);
++ }
++ }
++
++ //Functor implementation for recursive sorting
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift>
++ inline void
++ float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
++ , std::vector<size_t> &bin_sizes, right_shift shift)
++ {
++ div_type max, min;
++ find_extremes(first, last, max, min, shift);
++ if(max == min)
++ return;
++ unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
++ div_type div_min = min >> log_divisor;
++ div_type div_max = max >> log_divisor;
++ unsigned bin_count = div_max - div_min + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
++
++ //Calculating the size of each bin
++ for (RandomAccessIter current = first; current != last;)
++ bin_sizes[shift(*(current++), log_divisor) - div_min]++;
++ //The index of the first positive bin
++ div_type first_positive = (div_min < 0) ? -div_min : 0;
++ //Resetting if all bins are negative
++ if(cache_offset + first_positive > cache_end)
++ first_positive = cache_end - cache_offset;
++ //Reversing the order of the negative bins
++ //Note that because of the negative/positive ordering direction flip
++ //We can not depend upon bin order and positions matching up
++ //so bin_sizes must be reused to contain the end of the bin
++ if(first_positive > 0) {
++ bins[first_positive - 1] = first;
++ for(int ii = first_positive - 2; ii >= 0; --ii) {
++ bins[ii] = first + bin_sizes[ii + 1];
++ bin_sizes[ii] += bin_sizes[ii + 1];
++ }
++ //Handling positives following negatives
++ if((unsigned)first_positive < bin_count) {
++ bins[first_positive] = first + bin_sizes[0];
++ bin_sizes[first_positive] += bin_sizes[0];
++ }
++ }
++ else
++ bins[0] = first;
++ for(unsigned u = first_positive; u < bin_count - 1; u++) {
++ bins[u + 1] = first + bin_sizes[u];
++ bin_sizes[u + 1] += bin_sizes[u];
++ }
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ for(unsigned u = 0; u < bin_count; ++u) {
++ nextbinstart = first + bin_sizes[u];
++ inner_swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, u, shift, log_divisor, div_min);
++ }
++
++ //Return if we've completed bucketsorting
++ if(!log_divisor)
++ return;
++
++ //Handling negative values first
++ size_t max_count = get_max_count(log_divisor, last - first);
++ RandomAccessIter lastPos = first;
++ for(int ii = cache_offset + first_positive - 1; ii >= (int)cache_offset ; lastPos = bin_cache[ii--]) {
++ size_t count = bin_cache[ii] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[ii]);
++ //sort negative values using reversed-bin spread_sort
++ else
++ negative_float_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes, shift);
++ }
++
++ for(unsigned u = cache_offset + first_positive; u < cache_end; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[u]);
++ //sort positive values using normal spread_sort
++ else
++ spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes, shift);
++ }
++ }
++
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift, class compare>
++ inline void
++ float_sort_rec(RandomAccessIter first, RandomAccessIter last, std::vector<RandomAccessIter> &bin_cache, unsigned cache_offset
++ , std::vector<size_t> &bin_sizes, right_shift shift, compare comp)
++ {
++ div_type max, min;
++ find_extremes(first, last, max, min, shift);
++ if(max == min)
++ return;
++ unsigned log_divisor = get_log_divisor(last - first, rough_log_2_size((size_t)(max) - min));
++ div_type div_min = min >> log_divisor;
++ div_type div_max = max >> log_divisor;
++ unsigned bin_count = div_max - div_min + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, bin_count);
++
++ //Calculating the size of each bin
++ for (RandomAccessIter current = first; current != last;)
++ bin_sizes[shift(*(current++), log_divisor) - div_min]++;
++ //The index of the first positive bin
++ div_type first_positive = (div_min < 0) ? -div_min : 0;
++ //Resetting if all bins are negative
++ if(cache_offset + first_positive > cache_end)
++ first_positive = cache_end - cache_offset;
++ //Reversing the order of the negative bins
++ //Note that because of the negative/positive ordering direction flip
++ //We can not depend upon bin order and positions matching up
++ //so bin_sizes must be reused to contain the end of the bin
++ if(first_positive > 0) {
++ bins[first_positive - 1] = first;
++ for(int ii = first_positive - 2; ii >= 0; --ii) {
++ bins[ii] = first + bin_sizes[ii + 1];
++ bin_sizes[ii] += bin_sizes[ii + 1];
++ }
++ //Handling positives following negatives
++ if((unsigned)first_positive < bin_count) {
++ bins[first_positive] = first + bin_sizes[0];
++ bin_sizes[first_positive] += bin_sizes[0];
++ }
++ }
++ else
++ bins[0] = first;
++ for(unsigned u = first_positive; u < bin_count - 1; u++) {
++ bins[u + 1] = first + bin_sizes[u];
++ bin_sizes[u + 1] += bin_sizes[u];
++ }
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ for(unsigned u = 0; u < bin_count; ++u) {
++ nextbinstart = first + bin_sizes[u];
++ inner_swap_loop<RandomAccessIter, div_type, data_type, right_shift>(bins, nextbinstart, u, shift, log_divisor, div_min);
++ }
++
++ //Return if we've completed bucketsorting
++ if(!log_divisor)
++ return;
++
++ //Handling negative values first
++ size_t max_count = get_max_count(log_divisor, last - first);
++ RandomAccessIter lastPos = first;
++ for(int ii = cache_offset + first_positive - 1; ii >= (int)cache_offset ; lastPos = bin_cache[ii--]) {
++ size_t count = bin_cache[ii] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[ii]);
++ //sort negative values using reversed-bin spread_sort
++ else
++ negative_float_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[ii], bin_cache, cache_end, bin_sizes, shift, comp);
++ }
++
++ for(unsigned u = cache_offset + first_positive; u < cache_end; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ if(count < 2)
++ continue;
++ if(count < max_count)
++ std::sort(lastPos, bin_cache[u]);
++ //sort positive values using normal spread_sort
++ else
++ spread_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(lastPos, bin_cache[u], bin_cache, cache_end, bin_sizes, shift, comp);
++ }
++ }
++
++ template <class RandomAccessIter, class cast_type, class data_type>
++ inline void
++ float_Sort(RandomAccessIter first, RandomAccessIter last, cast_type, data_type)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ float_sort_rec<RandomAccessIter, cast_type, data_type>(first, last, bin_cache, 0, bin_sizes);
++ }
++
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift>
++ inline void
++ float_Sort(RandomAccessIter first, RandomAccessIter last, div_type, data_type, right_shift shift)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ float_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(first, last, bin_cache, 0, bin_sizes, shift);
++ }
++
++ template <class RandomAccessIter, class div_type, class data_type, class right_shift, class compare>
++ inline void
++ float_Sort(RandomAccessIter first, RandomAccessIter last, div_type, data_type, right_shift shift, compare comp)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ float_sort_rec<RandomAccessIter, div_type, data_type, right_shift>(first, last, bin_cache, 0, bin_sizes, shift, comp);
++ }
++ }
++
++ //float_sort with casting
++ //The cast_type must be equal in size to the data type, and must be a signed integer
++ template <class RandomAccessIter, class cast_type>
++ inline void float_sort_cast(RandomAccessIter first, RandomAccessIter last, cast_type cVal)
++ {
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last);
++ else
++ detail::float_Sort(first, last, cVal, *first);
++ }
++
++ //float_sort with casting to an int
++ //Only use this with IEEE floating-point numbers
++ template <class RandomAccessIter>
++ inline void float_sort_cast_to_int(RandomAccessIter first, RandomAccessIter last)
++ {
++ int cVal = 0;
++ float_sort_cast(first, last, cVal);
++ }
++
++ //float_sort with functors
++ template <class RandomAccessIter, class right_shift>
++ inline void float_sort(RandomAccessIter first, RandomAccessIter last, right_shift shift)
++ {
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last);
++ else
++ detail::float_Sort(first, last, shift(*first, 0), *first, shift);
++ }
++
++ template <class RandomAccessIter, class right_shift, class compare>
++ inline void float_sort(RandomAccessIter first, RandomAccessIter last, right_shift shift, compare comp)
++ {
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last, comp);
++ else
++ detail::float_Sort(first, last, shift(*first, 0), *first, shift, comp);
++ }
++
++ //------------------------------------------------- string_sort source ---------------------------------------------
++ namespace detail {
++ //Offsetting on identical characters. This function works a character at a time for optimal worst-case performance.
++ template<class RandomAccessIter>
++ inline void
++ update_offset(RandomAccessIter first, RandomAccessIter finish, unsigned &char_offset)
++ {
++ unsigned nextOffset = char_offset;
++ bool done = false;
++ while(!done) {
++ RandomAccessIter curr = first;
++ do {
++ //ignore empties, but if the nextOffset would exceed the length or not match, exit; we've found the last matching character
++ if((*curr).size() > char_offset && ((*curr).size() <= (nextOffset + 1) || (*curr)[nextOffset] != (*first)[nextOffset])) {
++ done = true;
++ break;
++ }
++ } while(++curr != finish);
++ if(!done)
++ ++nextOffset;
++ }
++ char_offset = nextOffset;
++ }
++
++ //Offsetting on identical characters. This function works a character at a time for optimal worst-case performance.
++ template<class RandomAccessIter, class get_char, class get_length>
++ inline void
++ update_offset(RandomAccessIter first, RandomAccessIter finish, unsigned &char_offset, get_char getchar, get_length length)
++ {
++ unsigned nextOffset = char_offset;
++ bool done = false;
++ while(!done) {
++ RandomAccessIter curr = first;
++ do {
++ //ignore empties, but if the nextOffset would exceed the length or not match, exit; we've found the last matching character
++ if(length(*curr) > char_offset && (length(*curr) <= (nextOffset + 1) || getchar((*curr), nextOffset) != getchar((*first), nextOffset))) {
++ done = true;
++ break;
++ }
++ } while(++curr != finish);
++ if(!done)
++ ++nextOffset;
++ }
++ char_offset = nextOffset;
++ }
++
++ //A comparison functor for strings that assumes they are identical up to char_offset
++ template<class data_type, class unsignedchar_type>
++ struct offset_lessthan {
++ offset_lessthan(unsigned char_offset) : fchar_offset(char_offset){}
++ inline bool operator()(const data_type &x, const data_type &y) const
++ {
++ unsigned minSize = std::min(x.size(), y.size());
++ for(unsigned u = fchar_offset; u < minSize; ++u) {
++ if(static_cast<unsignedchar_type>(x[u]) < static_cast<unsignedchar_type>(y[u]))
++ return true;
++ else if(static_cast<unsignedchar_type>(y[u]) < static_cast<unsignedchar_type>(x[u]))
++ return false;
++ }
++ return x.size() < y.size();
++ }
++ unsigned fchar_offset;
++ };
++
++ //A comparison functor for strings that assumes they are identical up to char_offset
++ template<class data_type, class unsignedchar_type>
++ struct offset_greaterthan {
++ offset_greaterthan(unsigned char_offset) : fchar_offset(char_offset){}
++ inline bool operator()(const data_type &x, const data_type &y) const
++ {
++ unsigned minSize = std::min(x.size(), y.size());
++ for(unsigned u = fchar_offset; u < minSize; ++u) {
++ if(static_cast<unsignedchar_type>(x[u]) > static_cast<unsignedchar_type>(y[u]))
++ return true;
++ else if(static_cast<unsignedchar_type>(y[u]) > static_cast<unsignedchar_type>(x[u]))
++ return false;
++ }
++ return x.size() > y.size();
++ }
++ unsigned fchar_offset;
++ };
++
++ //A comparison functor for strings that assumes they are identical up to char_offset
++ template<class data_type, class get_char, class get_length>
++ struct offset_char_lessthan {
++ offset_char_lessthan(unsigned char_offset) : fchar_offset(char_offset){}
++ inline bool operator()(const data_type &x, const data_type &y) const
++ {
++ unsigned minSize = std::min(length(x), length(y));
++ for(unsigned u = fchar_offset; u < minSize; ++u) {
++ if(getchar(x, u) < getchar(y, u))
++ return true;
++ else if(getchar(y, u) < getchar(x, u))
++ return false;
++ }
++ return length(x) < length(y);
++ }
++ unsigned fchar_offset;
++ get_char getchar;
++ get_length length;
++ };
++
++ //String sorting recursive implementation
++ template <class RandomAccessIter, class data_type, class unsignedchar_type>
++ inline void
++ string_sort_rec(RandomAccessIter first, RandomAccessIter last, unsigned char_offset, std::vector<RandomAccessIter> &bin_cache
++ , unsigned cache_offset, std::vector<size_t> &bin_sizes)
++ {
++ //This section is not strictly necessary, but makes handling of long identical substrings much faster, with a mild average performance impact.
++ //Iterate to the end of the empties. If all empty, return
++ while((*first).size() <= char_offset) {
++ if(++first == last)
++ return;
++ }
++ RandomAccessIter finish = last - 1;
++ //Getting the last non-empty
++ for(;(*finish).size() <= char_offset; --finish) { }
++ ++finish;
++ //Offsetting on identical characters. This section works a character at a time for optimal worst-case performance.
++ update_offset(first, finish, char_offset);
++
++ const unsigned bin_count = (1 << (sizeof(unsignedchar_type)*8));
++ //Equal worst-case between radix and comparison-based is when bin_count = n*log(n).
++ const unsigned max_size = bin_count;
++ const unsigned membin_count = bin_count + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, membin_count) + 1;
++
++ //Calculating the size of each bin; this takes roughly 10% of runtime
++ for (RandomAccessIter current = first; current != last; ++current) {
++ if((*current).size() <= char_offset) {
++ bin_sizes[0]++;
++ }
++ else
++ bin_sizes[static_cast<unsignedchar_type>((*current)[char_offset]) + 1]++;
++ }
++ //Assign the bin positions
++ bin_cache[cache_offset] = first;
++ for(unsigned u = 0; u < membin_count - 1; u++)
++ bin_cache[cache_offset + u + 1] = bin_cache[cache_offset + u] + bin_sizes[u];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ //handling empty bins
++ RandomAccessIter * local_bin = &(bin_cache[cache_offset]);
++ nextbinstart += bin_sizes[0];
++ RandomAccessIter * target_bin;
++ //Iterating over each element in the bin of empties
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //empties belong in this bin
++ while((*current).size() > char_offset) {
++ target_bin = bins + static_cast<unsignedchar_type>((*current)[char_offset]);
++ iter_swap(current, (*target_bin)++);
++ }
++ }
++ *local_bin = nextbinstart;
++ //iterate backwards to find the last bin with elements in it; this saves iterations in multiple loops
++ unsigned last_bin = bin_count - 1;
++ for(; last_bin && !bin_sizes[last_bin + 1]; --last_bin) { }
++ //This dominates runtime, mostly in the swap and bin lookups
++ for(unsigned u = 0; u < last_bin; ++u) {
++ local_bin = bins + u;
++ nextbinstart += bin_sizes[u + 1];
++ //Iterating over each element in this bin
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //Swapping elements in current into place until the correct element has been swapped in
++ for(target_bin = bins + static_cast<unsignedchar_type>((*current)[char_offset]); target_bin != local_bin;
++ target_bin = bins + static_cast<unsignedchar_type>((*current)[char_offset]))
++ iter_swap(current, (*target_bin)++);
++ }
++ *local_bin = nextbinstart;
++ }
++ bins[last_bin] = last;
++ //Recursing
++ RandomAccessIter lastPos = bin_cache[cache_offset];
++ //Skip this loop for empties
++ for(unsigned u = cache_offset + 1; u < cache_offset + last_bin + 2; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ //don't sort unless there are at least two items to compare
++ if(count < 2)
++ continue;
++ //using std::sort if its worst-case is better
++ if(count < max_size)
++ std::sort(lastPos, bin_cache[u], offset_lessthan<data_type, unsignedchar_type>(char_offset + 1));
++ else
++ string_sort_rec<RandomAccessIter, data_type, unsignedchar_type>(lastPos, bin_cache[u], char_offset + 1, bin_cache, cache_end, bin_sizes);
++ }
++ }
++
++ //Sorts strings in reverse order, with empties at the end
++ template <class RandomAccessIter, class data_type, class unsignedchar_type>
++ inline void
++ reverse_string_sort_rec(RandomAccessIter first, RandomAccessIter last, unsigned char_offset, std::vector<RandomAccessIter> &bin_cache
++ , unsigned cache_offset, std::vector<size_t> &bin_sizes)
++ {
++ //This section is not strictly necessary, but makes handling of long identical substrings much faster, with a mild average performance impact.
++ RandomAccessIter curr = first;
++ //Iterate to the end of the empties. If all empty, return
++ while((*curr).size() <= char_offset) {
++ if(++curr == last)
++ return;
++ }
++ //Getting the last non-empty
++ while((*(--last)).size() <= char_offset) { }
++ ++last;
++ //Offsetting on identical characters. This section works a character at a time for optimal worst-case performance.
++ update_offset(curr, last, char_offset);
++ RandomAccessIter * target_bin;
++
++ const unsigned bin_count = (1 << (sizeof(unsignedchar_type)*8));
++ //Equal worst-case between radix and comparison-based is when bin_count = n*log(n).
++ const unsigned max_size = bin_count;
++ const unsigned membin_count = bin_count + 1;
++ const unsigned max_bin = bin_count - 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, membin_count);
++ RandomAccessIter * end_bin = &(bin_cache[cache_offset + max_bin]);
++
++ //Calculating the size of each bin; this takes roughly 10% of runtime
++ for (RandomAccessIter current = first; current != last; ++current) {
++ if((*current).size() <= char_offset) {
++ bin_sizes[bin_count]++;
++ }
++ else
++ bin_sizes[max_bin - static_cast<unsignedchar_type>((*current)[char_offset])]++;
++ }
++ //Assign the bin positions
++ bin_cache[cache_offset] = first;
++ for(unsigned u = 0; u < membin_count - 1; u++)
++ bin_cache[cache_offset + u + 1] = bin_cache[cache_offset + u] + bin_sizes[u];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = last;
++ //handling empty bins
++ RandomAccessIter * local_bin = &(bin_cache[cache_offset + bin_count]);
++ RandomAccessIter lastFull = *local_bin;
++ //Iterating over each element in the bin of empties
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //empties belong in this bin
++ while((*current).size() > char_offset) {
++ target_bin = end_bin - static_cast<unsignedchar_type>((*current)[char_offset]);
++ iter_swap(current, (*target_bin)++);
++ }
++ }
++ *local_bin = nextbinstart;
++ nextbinstart = first;
++ //iterate backwards to find the last bin with elements in it; this saves iterations in multiple loops
++ unsigned last_bin = max_bin;
++ for(; last_bin && !bin_sizes[last_bin]; --last_bin) { }
++ //This dominates runtime, mostly in the swap and bin lookups
++ for(unsigned u = 0; u < last_bin; ++u) {
++ local_bin = bins + u;
++ nextbinstart += bin_sizes[u];
++ //Iterating over each element in this bin
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //Swapping elements in current into place until the correct element has been swapped in
++ for(target_bin = end_bin - static_cast<unsignedchar_type>((*current)[char_offset]); target_bin != local_bin;
++ target_bin = end_bin - static_cast<unsignedchar_type>((*current)[char_offset]))
++ iter_swap(current, (*target_bin)++);
++ }
++ *local_bin = nextbinstart;
++ }
++ bins[last_bin] = lastFull;
++ //Recursing
++ RandomAccessIter lastPos = first;
++ //Skip this loop for empties
++ for(unsigned u = cache_offset; u <= cache_offset + last_bin; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ //don't sort unless there are at least two items to compare
++ if(count < 2)
++ continue;
++ //using std::sort if its worst-case is better
++ if(count < max_size)
++ std::sort(lastPos, bin_cache[u], offset_greaterthan<data_type, unsignedchar_type>(char_offset + 1));
++ else
++ reverse_string_sort_rec<RandomAccessIter, data_type, unsignedchar_type>(lastPos, bin_cache[u], char_offset + 1, bin_cache, cache_end, bin_sizes);
++ }
++ }
++
++ //String sorting recursive implementation
++ template <class RandomAccessIter, class data_type, class unsignedchar_type, class get_char, class get_length>
++ inline void
++ string_sort_rec(RandomAccessIter first, RandomAccessIter last, unsigned char_offset, std::vector<RandomAccessIter> &bin_cache
++ , unsigned cache_offset, std::vector<size_t> &bin_sizes, get_char getchar, get_length length)
++ {
++ //This section is not strictly necessary, but makes handling of long identical substrings much faster, with a mild average performance impact.
++ //Iterate to the end of the empties. If all empty, return
++ while(length(*first) <= char_offset) {
++ if(++first == last)
++ return;
++ }
++ RandomAccessIter finish = last - 1;
++ //Getting the last non-empty
++ for(;length(*finish) <= char_offset; --finish) { }
++ ++finish;
++ update_offset(first, finish, char_offset, getchar, length);
++
++ const unsigned bin_count = (1 << (sizeof(unsignedchar_type)*8));
++ //Equal worst-case between radix and comparison-based is when bin_count = n*log(n).
++ const unsigned max_size = bin_count;
++ const unsigned membin_count = bin_count + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, membin_count) + 1;
++
++ //Calculating the size of each bin; this takes roughly 10% of runtime
++ for (RandomAccessIter current = first; current != last; ++current) {
++ if(length(*current) <= char_offset) {
++ bin_sizes[0]++;
++ }
++ else
++ bin_sizes[getchar((*current), char_offset) + 1]++;
++ }
++ //Assign the bin positions
++ bin_cache[cache_offset] = first;
++ for(unsigned u = 0; u < membin_count - 1; u++)
++ bin_cache[cache_offset + u + 1] = bin_cache[cache_offset + u] + bin_sizes[u];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ //handling empty bins
++ RandomAccessIter * local_bin = &(bin_cache[cache_offset]);
++ nextbinstart += bin_sizes[0];
++ RandomAccessIter * target_bin;
++ //Iterating over each element in the bin of empties
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //empties belong in this bin
++ while(length(*current) > char_offset) {
++ target_bin = bins + getchar((*current), char_offset);
++ iter_swap(current, (*target_bin)++);
++ }
++ }
++ *local_bin = nextbinstart;
++ //iterate backwards to find the last bin with elements in it; this saves iterations in multiple loops
++ unsigned last_bin = bin_count - 1;
++ for(; last_bin && !bin_sizes[last_bin + 1]; --last_bin) { }
++ //This dominates runtime, mostly in the swap and bin lookups
++ for(unsigned ii = 0; ii < last_bin; ++ii) {
++ local_bin = bins + ii;
++ nextbinstart += bin_sizes[ii + 1];
++ //Iterating over each element in this bin
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //Swapping elements in current into place until the correct element has been swapped in
++ for(target_bin = bins + getchar((*current), char_offset); target_bin != local_bin;
++ target_bin = bins + getchar((*current), char_offset))
++ iter_swap(current, (*target_bin)++);
++ }
++ *local_bin = nextbinstart;
++ }
++ bins[last_bin] = last;
++
++ //Recursing
++ RandomAccessIter lastPos = bin_cache[cache_offset];
++ //Skip this loop for empties
++ for(unsigned u = cache_offset + 1; u < cache_offset + last_bin + 2; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ //don't sort unless there are at least two items to compare
++ if(count < 2)
++ continue;
++ //using std::sort if its worst-case is better
++ if(count < max_size)
++ std::sort(lastPos, bin_cache[u], offset_char_lessthan<data_type, get_char, get_length>(char_offset + 1));
++ else
++ string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length>(lastPos, bin_cache[u], char_offset + 1, bin_cache, cache_end, bin_sizes, getchar, length);
++ }
++ }
++
++ //String sorting recursive implementation
++ template <class RandomAccessIter, class data_type, class unsignedchar_type, class get_char, class get_length, class compare>
++ inline void
++ string_sort_rec(RandomAccessIter first, RandomAccessIter last, unsigned char_offset, std::vector<RandomAccessIter> &bin_cache
++ , unsigned cache_offset, std::vector<size_t> &bin_sizes, get_char getchar, get_length length, compare comp)
++ {
++ //This section is not strictly necessary, but makes handling of long identical substrings much faster, with a mild average performance impact.
++ //Iterate to the end of the empties. If all empty, return
++ while(length(*first) <= char_offset) {
++ if(++first == last)
++ return;
++ }
++ RandomAccessIter finish = last - 1;
++ //Getting the last non-empty
++ for(;length(*finish) <= char_offset; --finish) { }
++ ++finish;
++ update_offset(first, finish, char_offset, getchar, length);
++
++ const unsigned bin_count = (1 << (sizeof(unsignedchar_type)*8));
++ //Equal worst-case between radix and comparison-based is when bin_count = n*log(n).
++ const unsigned max_size = bin_count;
++ const unsigned membin_count = bin_count + 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, membin_count) + 1;
++
++ //Calculating the size of each bin; this takes roughly 10% of runtime
++ for (RandomAccessIter current = first; current != last; ++current) {
++ if(length(*current) <= char_offset) {
++ bin_sizes[0]++;
++ }
++ else
++ bin_sizes[getchar((*current), char_offset) + 1]++;
++ }
++ //Assign the bin positions
++ bin_cache[cache_offset] = first;
++ for(unsigned u = 0; u < membin_count - 1; u++)
++ bin_cache[cache_offset + u + 1] = bin_cache[cache_offset + u] + bin_sizes[u];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = first;
++ //handling empty bins
++ RandomAccessIter * local_bin = &(bin_cache[cache_offset]);
++ nextbinstart += bin_sizes[0];
++ RandomAccessIter * target_bin;
++ //Iterating over each element in the bin of empties
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //empties belong in this bin
++ while(length(*current) > char_offset) {
++ target_bin = bins + getchar((*current), char_offset);
++ iter_swap(current, (*target_bin)++);
++ }
++ }
++ *local_bin = nextbinstart;
++ //iterate backwards to find the last bin with elements in it; this saves iterations in multiple loops
++ unsigned last_bin = bin_count - 1;
++ for(; last_bin && !bin_sizes[last_bin + 1]; --last_bin) { }
++ //This dominates runtime, mostly in the swap and bin lookups
++ for(unsigned u = 0; u < last_bin; ++u) {
++ local_bin = bins + u;
++ nextbinstart += bin_sizes[u + 1];
++ //Iterating over each element in this bin
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //Swapping elements in current into place until the correct element has been swapped in
++ for(target_bin = bins + getchar((*current), char_offset); target_bin != local_bin;
++ target_bin = bins + getchar((*current), char_offset))
++ iter_swap(current, (*target_bin)++);
++ }
++ *local_bin = nextbinstart;
++ }
++ bins[last_bin] = last;
++
++ //Recursing
++ RandomAccessIter lastPos = bin_cache[cache_offset];
++ //Skip this loop for empties
++ for(unsigned u = cache_offset + 1; u < cache_offset + last_bin + 2; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ //don't sort unless there are at least two items to compare
++ if(count < 2)
++ continue;
++ //using std::sort if its worst-case is better
++ if(count < max_size)
++ std::sort(lastPos, bin_cache[u], comp);
++ else
++ string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length, compare>(lastPos
++ , bin_cache[u], char_offset + 1, bin_cache, cache_end, bin_sizes, getchar, length, comp);
++ }
++ }
++
++ //Sorts strings in reverse order, with empties at the end
++ template <class RandomAccessIter, class data_type, class unsignedchar_type, class get_char, class get_length, class compare>
++ inline void
++ reverse_string_sort_rec(RandomAccessIter first, RandomAccessIter last, unsigned char_offset, std::vector<RandomAccessIter> &bin_cache
++ , unsigned cache_offset, std::vector<size_t> &bin_sizes, get_char getchar, get_length length, compare comp)
++ {
++ //This section is not strictly necessary, but makes handling of long identical substrings much faster, with a mild average performance impact.
++ RandomAccessIter curr = first;
++ //Iterate to the end of the empties. If all empty, return
++ while(length(*curr) <= char_offset) {
++ if(++curr == last)
++ return;
++ }
++ //Getting the last non-empty
++ while(length(*(--last)) <= char_offset) { }
++ ++last;
++ //Offsetting on identical characters. This section works a character at a time for optimal worst-case performance.
++ update_offset(first, last, char_offset, getchar, length);
++
++ const unsigned bin_count = (1 << (sizeof(unsignedchar_type)*8));
++ //Equal worst-case between radix and comparison-based is when bin_count = n*log(n).
++ const unsigned max_size = bin_count;
++ const unsigned membin_count = bin_count + 1;
++ const unsigned max_bin = bin_count - 1;
++ unsigned cache_end;
++ RandomAccessIter * bins = size_bins(bin_sizes, bin_cache, cache_offset, cache_end, membin_count);
++ RandomAccessIter *end_bin = &(bin_cache[cache_offset + max_bin]);
++
++ //Calculating the size of each bin; this takes roughly 10% of runtime
++ for (RandomAccessIter current = first; current != last; ++current) {
++ if(length(*current) <= char_offset) {
++ bin_sizes[bin_count]++;
++ }
++ else
++ bin_sizes[max_bin - getchar((*current), char_offset)]++;
++ }
++ //Assign the bin positions
++ bin_cache[cache_offset] = first;
++ for(unsigned u = 0; u < membin_count - 1; u++)
++ bin_cache[cache_offset + u + 1] = bin_cache[cache_offset + u] + bin_sizes[u];
++
++ //Swap into place
++ RandomAccessIter nextbinstart = last;
++ //handling empty bins
++ RandomAccessIter * local_bin = &(bin_cache[cache_offset + bin_count]);
++ RandomAccessIter lastFull = *local_bin;
++ RandomAccessIter * target_bin;
++ //Iterating over each element in the bin of empties
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //empties belong in this bin
++ while(length(*current) > char_offset) {
++ target_bin = end_bin - getchar((*current), char_offset);
++ iter_swap(current, (*target_bin)++);
++ }
++ }
++ *local_bin = nextbinstart;
++ nextbinstart = first;
++ //iterate backwards to find the last bin with elements in it; this saves iterations in multiple loops
++ unsigned last_bin = max_bin;
++ for(; last_bin && !bin_sizes[last_bin]; --last_bin) { }
++ //This dominates runtime, mostly in the swap and bin lookups
++ for(unsigned u = 0; u < last_bin; ++u) {
++ local_bin = bins + u;
++ nextbinstart += bin_sizes[u];
++ //Iterating over each element in this bin
++ for(RandomAccessIter current = *local_bin; current < nextbinstart; ++current) {
++ //Swapping elements in current into place until the correct element has been swapped in
++ for(target_bin = end_bin - getchar((*current), char_offset); target_bin != local_bin;
++ target_bin = end_bin - getchar((*current), char_offset))
++ iter_swap(current, (*target_bin)++);
++ }
++ *local_bin = nextbinstart;
++ }
++ bins[last_bin] = lastFull;
++ //Recursing
++ RandomAccessIter lastPos = first;
++ //Skip this loop for empties
++ for(unsigned u = cache_offset; u <= cache_offset + last_bin; lastPos = bin_cache[u], ++u) {
++ size_t count = bin_cache[u] - lastPos;
++ //don't sort unless there are at least two items to compare
++ if(count < 2)
++ continue;
++ //using std::sort if its worst-case is better
++ if(count < max_size)
++ std::sort(lastPos, bin_cache[u], comp);
++ else
++ reverse_string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length, compare>(lastPos
++ , bin_cache[u], char_offset + 1, bin_cache, cache_end, bin_sizes, getchar, length, comp);
++ }
++ }
++
++ //Holds the bin vector and makes the initial recursive call
++ template <class RandomAccessIter, class data_type, class unsignedchar_type>
++ inline void
++ string_sort(RandomAccessIter first, RandomAccessIter last, data_type, unsignedchar_type)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ string_sort_rec<RandomAccessIter, data_type, unsignedchar_type>(first, last, 0, bin_cache, 0, bin_sizes);
++ }
++
++ //Holds the bin vector and makes the initial recursive call
++ template <class RandomAccessIter, class data_type, class unsignedchar_type>
++ inline void
++ reverse_string_sort(RandomAccessIter first, RandomAccessIter last, data_type, unsignedchar_type)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ reverse_string_sort_rec<RandomAccessIter, data_type, unsignedchar_type>(first, last, 0, bin_cache, 0, bin_sizes);
++ }
++
++ //Holds the bin vector and makes the initial recursive call
++ template <class RandomAccessIter, class get_char, class get_length, class data_type, class unsignedchar_type>
++ inline void
++ string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length, data_type, unsignedchar_type)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length>(first, last, 0, bin_cache, 0, bin_sizes, getchar, length);
++ }
++
++ //Holds the bin vector and makes the initial recursive call
++ template <class RandomAccessIter, class get_char, class get_length, class compare, class data_type, class unsignedchar_type>
++ inline void
++ string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length, compare comp, data_type, unsignedchar_type)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length, compare>(first, last, 0, bin_cache, 0, bin_sizes, getchar, length, comp);
++ }
++
++ //Holds the bin vector and makes the initial recursive call
++ template <class RandomAccessIter, class get_char, class get_length, class compare, class data_type, class unsignedchar_type>
++ inline void
++ reverse_string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length, compare comp, data_type, unsignedchar_type)
++ {
++ std::vector<size_t> bin_sizes;
++ std::vector<RandomAccessIter> bin_cache;
++ reverse_string_sort_rec<RandomAccessIter, data_type, unsignedchar_type, get_char, get_length, compare>(first, last, 0, bin_cache, 0, bin_sizes, getchar, length, comp);
++ }
++ }
++
++ //Allows character-type overloads
++ template <class RandomAccessIter, class unsignedchar_type>
++ inline void string_sort(RandomAccessIter first, RandomAccessIter last, unsignedchar_type unused)
++ {
++ //Don't sort if it's too small to optimize
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last);
++ else
++ detail::string_sort(first, last, *first, unused);
++ }
++
++ //Top-level sorting call; wraps using default of unsigned char
++ template <class RandomAccessIter>
++ inline void string_sort(RandomAccessIter first, RandomAccessIter last)
++ {
++ unsigned char unused = '\0';
++ string_sort(first, last, unused);
++ }
++
++ //Allows character-type overloads
++ template <class RandomAccessIter, class compare, class unsignedchar_type>
++ inline void reverse_string_sort(RandomAccessIter first, RandomAccessIter last, compare comp, unsignedchar_type unused)
++ {
++ //Don't sort if it's too small to optimize
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last, comp);
++ else
++ detail::reverse_string_sort(first, last, *first, unused);
++ }
++
++ //Top-level sorting call; wraps using default of unsigned char
++ template <class RandomAccessIter, class compare>
++ inline void reverse_string_sort(RandomAccessIter first, RandomAccessIter last, compare comp)
++ {
++ unsigned char unused = '\0';
++ reverse_string_sort(first, last, comp, unused);
++ }
++
++ template <class RandomAccessIter, class get_char, class get_length>
++ inline void string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length)
++ {
++ //Don't sort if it's too small to optimize
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last);
++ else {
++ //skipping past empties at the beginning, which allows us to get the character type
++ //.empty() is not used so as not to require a user declaration of it
++ while(!length(*first)) {
++ if(++first == last)
++ return;
++ }
++ detail::string_sort(first, last, getchar, length, *first, getchar((*first), 0));
++ }
++ }
++
++ template <class RandomAccessIter, class get_char, class get_length, class compare>
++ inline void string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length, compare comp)
++ {
++ //Don't sort if it's too small to optimize
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last, comp);
++ else {
++ //skipping past empties at the beginning, which allows us to get the character type
++ //.empty() is not used so as not to require a user declaration of it
++ while(!length(*first)) {
++ if(++first == last)
++ return;
++ }
++ detail::string_sort(first, last, getchar, length, comp, *first, getchar((*first), 0));
++ }
++ }
++
++ template <class RandomAccessIter, class get_char, class get_length, class compare>
++ inline void reverse_string_sort(RandomAccessIter first, RandomAccessIter last, get_char getchar, get_length length, compare comp)
++ {
++ //Don't sort if it's too small to optimize
++ if(last - first < detail::MIN_SORT_SIZE)
++ std::sort(first, last, comp);
++ else {
++ //skipping past empties at the beginning, which allows us to get the character type
++ //.empty() is not used so as not to require a user declaration of it
++ while(!length(*(--last))) {
++ //Note: if there is just one non-empty, and it's at the beginning, then it's already in sorted order
++ if(first == last)
++ return;
++ }
++ //making last just after the end of the non-empty part of the array
++ ++last;
++ detail::reverse_string_sort(first, last, getchar, length, comp, *first, getchar((*first), 0));
++ }
++ }
++}
++
++#endif
diff --git a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_thread__posix.cc b/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_thread__posix.cc
deleted file mode 100644
index 37104eed4dc..00000000000
--- a/www/firefox/patches/patch-media_webrtc_trunk_webrtc_system__wrappers_source_thread__posix.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-$NetBSD: patch-media_webrtc_trunk_webrtc_system__wrappers_source_thread__posix.cc,v 1.4 2013/11/02 22:57:55 ryoon Exp $
-
---- media/webrtc/trunk/webrtc/system_wrappers/source/thread_posix.cc.orig 2013-10-25 22:27:35.000000000 +0000
-+++ media/webrtc/trunk/webrtc/system_wrappers/source/thread_posix.cc
-@@ -278,20 +278,34 @@ bool ThreadPosix::SetAffinity(const int*
- }
- #if defined(__FreeBSD__)
- cpuset_t mask;
-+#elif defined(__NetBSD__)
-+ cpuset_t *mask;
- #else
- cpu_set_t mask;
- #endif
-+#if defined(__NetBSD__)
-+ cpuset_zero(mask);
-+#else
- CPU_ZERO(&mask);
-+#endif
-
- for (unsigned int processor = 0;
- processor < amount_of_processors;
- ++processor) {
-+#if defined(__NetBSD__)
-+ cpuset_set(processor_numbers[processor], mask);
-+#else
- CPU_SET(processor_numbers[processor], &mask);
-+#endif
- }
- #if defined(__FreeBSD__)
- const int result = pthread_setaffinity_np(thread_,
- sizeof(mask),
- &mask);
-+#elif defined(__NetBSD__)
-+ const int result = pthread_setaffinity_np(thread_,
-+ sizeof(mask),
-+ mask);
- #elif defined(WEBRTC_ANDROID) || defined(WEBRTC_GONK)
- // Android.
- const int result = syscall(__NR_sched_setaffinity,
diff --git a/www/firefox/patches/patch-mfbt_Atomics.h b/www/firefox/patches/patch-mfbt_Atomics.h
deleted file mode 100644
index 2180a116324..00000000000
--- a/www/firefox/patches/patch-mfbt_Atomics.h
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-mfbt_Atomics.h,v 1.1 2013/09/19 12:37:50 ryoon Exp $
-
---- mfbt/Atomics.h.orig 2013-09-10 03:43:48.000000000 +0000
-+++ mfbt/Atomics.h
-@@ -37,7 +37,7 @@
- */
- # if !defined(__linux__) && !defined(__OpenBSD__) && \
- (__cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)) && \
-- __has_include(<atomic>)
-+ __has_include_next(<atomic>)
- # define MOZ_HAVE_CXX11_ATOMICS
- # endif
- /*
diff --git a/www/firefox/patches/patch-modules_libpref_src_init_all.js b/www/firefox/patches/patch-modules_libpref_src_init_all.js
deleted file mode 100644
index 57a3c709c1f..00000000000
--- a/www/firefox/patches/patch-modules_libpref_src_init_all.js
+++ /dev/null
@@ -1,13 +0,0 @@
-$NetBSD: patch-modules_libpref_src_init_all.js,v 1.1 2013/09/19 12:37:50 ryoon Exp $
-
---- modules/libpref/src/init/all.js.orig 2013-09-10 03:43:49.000000000 +0000
-+++ modules/libpref/src/init/all.js
-@@ -188,7 +188,7 @@ pref("media.webm.enabled", true);
- pref("media.dash.enabled", false);
- #endif
- #ifdef MOZ_GSTREAMER
--pref("media.gstreamer.enabled", false);
-+pref("media.gstreamer.enabled", true);
- #endif
- #ifdef MOZ_WEBRTC
- pref("media.navigator.enabled", true);
diff --git a/www/firefox/patches/patch-netwerk_wifi_moz.build b/www/firefox/patches/patch-netwerk_wifi_moz.build
index 1224b6f6a32..76ab2625781 100644
--- a/www/firefox/patches/patch-netwerk_wifi_moz.build
+++ b/www/firefox/patches/patch-netwerk_wifi_moz.build
@@ -1,8 +1,8 @@
-$NetBSD: patch-netwerk_wifi_moz.build,v 1.2 2013/11/02 22:57:55 ryoon Exp $
+$NetBSD: patch-netwerk_wifi_moz.build,v 1.3 2013/12/15 13:54:37 ryoon Exp $
---- netwerk/wifi/moz.build.orig 2013-10-25 22:27:38.000000000 +0000
+--- netwerk/wifi/moz.build.orig 2013-12-05 16:07:52.000000000 +0000
+++ netwerk/wifi/moz.build
-@@ -34,6 +34,14 @@ if CONFIG['OS_ARCH'] == 'Darwin':
+@@ -38,6 +38,10 @@ if CONFIG['OS_ARCH'] == 'Darwin':
CMMSRCS += [
'osx_corewlan.mm',
]
@@ -10,10 +10,6 @@ $NetBSD: patch-netwerk_wifi_moz.build,v 1.2 2013/11/02 22:57:55 ryoon Exp $
+ CPP_SOURCES += [
+ 'nsWifiScannerFreeBSD.cpp',
+ ]
-+elif CONFIG['OS_ARCH'] == 'FreeBSD':
-+ CPP_SOURCES += [
-+ 'nsWifiScannerFreeBSD.cpp',
-+ ]
elif CONFIG['OS_ARCH'] == 'WINNT':
CPP_SOURCES += [
'nsWifiScannerWin.cpp',
diff --git a/www/firefox/patches/patch-toolkit_library_Makefile.in b/www/firefox/patches/patch-toolkit_library_Makefile.in
index 008c4950b8a..872dec163ff 100644
--- a/www/firefox/patches/patch-toolkit_library_Makefile.in
+++ b/www/firefox/patches/patch-toolkit_library_Makefile.in
@@ -1,8 +1,8 @@
-$NetBSD: patch-toolkit_library_Makefile.in,v 1.1 2013/05/23 13:12:13 ryoon Exp $
+$NetBSD: patch-toolkit_library_Makefile.in,v 1.2 2013/12/15 13:54:37 ryoon Exp $
---- toolkit/library/Makefile.in.orig 2013-05-11 19:19:54.000000000 +0000
+--- toolkit/library/Makefile.in.orig 2013-12-05 16:07:57.000000000 +0000
+++ toolkit/library/Makefile.in
-@@ -405,6 +405,7 @@ endif
+@@ -399,6 +399,7 @@ endif
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib)
ifdef MOZ_WEBRTC
@@ -10,3 +10,14 @@ $NetBSD: patch-toolkit_library_Makefile.in,v 1.1 2013/05/23 13:12:13 ryoon Exp $
ifdef MOZ_PEERCONNECTION
COMPONENT_LIBS += peerconnection
endif
+@@ -541,6 +542,10 @@ OS_LIBS += $(call EXPAND_LIBNAME,kvm)
+ EXTRA_DSO_LDOPTS += -Wl,--warn-unresolved-symbols
+ endif
+
++ifeq ($(OS_ARCH),FreeBSD)
++OS_LIBS += $(call EXPAND_LIBNAME,util)
++endif
++
+ ifeq ($(OS_ARCH),WINNT)
+ OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 version winspool comdlg32 imm32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg iphlpapi uxtheme setupapi secur32 sensorsapi portabledeviceguids windowscodecs wininet)
+ ifdef ACCESSIBILITY
diff --git a/www/firefox/patches/patch-toolkit_toolkit.mozbuild b/www/firefox/patches/patch-toolkit_toolkit.mozbuild
index 6b098bf4e46..e0d1b78f304 100644
--- a/www/firefox/patches/patch-toolkit_toolkit.mozbuild
+++ b/www/firefox/patches/patch-toolkit_toolkit.mozbuild
@@ -1,12 +1,14 @@
-$NetBSD: patch-toolkit_toolkit.mozbuild,v 1.1 2013/06/26 11:32:12 ryoon Exp $
+$NetBSD: patch-toolkit_toolkit.mozbuild,v 1.2 2013/12/15 13:54:37 ryoon Exp $
---- toolkit/toolkit.mozbuild.orig 2013-06-17 22:13:28.000000000 +0000
+--- toolkit/toolkit.mozbuild.orig 2013-12-05 16:07:58.000000000 +0000
+++ toolkit/toolkit.mozbuild
-@@ -46,7 +46,7 @@ if CONFIG['MOZ_UPDATER']:
- if not CONFIG['MOZ_NATIVE_BZ2']:
- add_tier_dir('platform', 'modules/libbz2')
+@@ -43,8 +43,8 @@ add_tier_dir('platform', [
+ if CONFIG['MOZ_AUTH_EXTENSION']:
+ add_tier_dir('platform', 'extensions/auth')
+-if CONFIG['MOZ_UPDATER']:
- add_tier_dir('platform', 'other-licenses/bsdiff')
++#if CONFIG['MOZ_UPDATER']:
+# add_tier_dir('platform', 'other-licenses/bsdiff')
# Gecko/Core components.
diff --git a/www/firefox/patches/patch-xpcom_base_nsMemoryInfoDumper.cpp b/www/firefox/patches/patch-xpcom_base_nsMemoryInfoDumper.cpp
new file mode 100644
index 00000000000..36ad1f8ad09
--- /dev/null
+++ b/www/firefox/patches/patch-xpcom_base_nsMemoryInfoDumper.cpp
@@ -0,0 +1,31 @@
+$NetBSD: patch-xpcom_base_nsMemoryInfoDumper.cpp,v 1.1 2013/12/15 13:54:37 ryoon Exp $
+
+--- xpcom/base/nsMemoryInfoDumper.cpp.orig 2013-12-05 16:08:00.000000000 +0000
++++ xpcom/base/nsMemoryInfoDumper.cpp
+@@ -30,7 +30,7 @@
+ #include <unistd.h>
+ #endif
+
+-#ifdef XP_LINUX
++#if defined(XP_LINUX) || defined(__FreeBSD__)
+ #include <fcntl.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -109,7 +109,7 @@ private:
+
+ } // anonymous namespace
+
+-#ifdef XP_LINUX // {
++#if defined(XP_LINUX) || defined(__FreeBSD__) // {
+ namespace {
+
+ /*
+@@ -548,7 +548,7 @@ nsMemoryInfoDumper::~nsMemoryInfoDumper(
+ /* static */ void
+ nsMemoryInfoDumper::Initialize()
+ {
+-#ifdef XP_LINUX
++#if defined(XP_LINUX) || defined(__FreeBSD__)
+ SignalPipeWatcher::Create();
+ FifoWatcher::MaybeCreate();
+ #endif
diff --git a/www/firefox/patches/patch-xpcom_base_nsMemoryReporterManager.cpp b/www/firefox/patches/patch-xpcom_base_nsMemoryReporterManager.cpp
new file mode 100644
index 00000000000..ae1df00b4f1
--- /dev/null
+++ b/www/firefox/patches/patch-xpcom_base_nsMemoryReporterManager.cpp
@@ -0,0 +1,106 @@
+$NetBSD: patch-xpcom_base_nsMemoryReporterManager.cpp,v 1.1 2013/12/15 13:54:37 ryoon Exp $
+
+--- xpcom/base/nsMemoryReporterManager.cpp.orig 2013-12-05 16:08:00.000000000 +0000
++++ xpcom/base/nsMemoryReporterManager.cpp
+@@ -196,6 +196,43 @@ static nsresult GetResidentFast(int64_t*
+ return GetResident(aN);
+ }
+
++#ifdef __FreeBSD__
++#include <libutil.h>
++
++static nsresult
++GetKinfoVmentrySelf(int64_t* prss)
++{
++ int cnt;
++ struct kinfo_vmentry *vmmap, *kve;
++ if ((vmmap = kinfo_getvmmap(getpid(), &cnt)) == NULL)
++ return NS_ERROR_FAILURE;
++
++ if (prss)
++ *prss = 0;
++
++ for (int i = 0; i < cnt; i++) {
++ kve = &vmmap[i];
++ if (prss)
++ *prss += kve->kve_private_resident;
++ }
++
++ free(vmmap);
++ return NS_OK;
++}
++
++#define HAVE_PRIVATE_REPORTER
++static nsresult
++GetPrivate(int64_t* aN)
++{
++ int64_t priv;
++ nsresult rv = GetKinfoVmentrySelf(&priv);
++ if (NS_SUCCEEDED(rv))
++ *aN = priv * getpagesize();
++
++ return NS_OK;
++}
++#endif // FreeBSD
++
+ #elif defined(SOLARIS)
+
+ #include <procfs.h>
+@@ -370,6 +407,24 @@ static nsresult GetResidentFast(int64_t*
+ }
+
+ #define HAVE_PRIVATE_REPORTER
++static nsresult
++GetPrivate(int64_t* aN)
++{
++ PROCESS_MEMORY_COUNTERS_EX pmcex;
++ pmcex.cb = sizeof(PROCESS_MEMORY_COUNTERS_EX);
++
++ if (!GetProcessMemoryInfo(
++ GetCurrentProcess(),
++ (PPROCESS_MEMORY_COUNTERS) &pmcex, sizeof(pmcex))) {
++ return NS_ERROR_FAILURE;
++ }
++
++ *aN = pmcex.PrivateUsage;
++ return NS_OK;
++}
++#endif // XP_<PLATFORM>
++
++#ifdef HAVE_PRIVATE_REPORTER
+ class PrivateReporter MOZ_FINAL : public MemoryUniReporter
+ {
+ public:
+@@ -382,21 +437,10 @@ public:
+
+ NS_IMETHOD GetAmount(int64_t* aAmount)
+ {
+- PROCESS_MEMORY_COUNTERS_EX pmcex;
+- pmcex.cb = sizeof(PROCESS_MEMORY_COUNTERS_EX);
+-
+- if (!GetProcessMemoryInfo(
+- GetCurrentProcess(),
+- (PPROCESS_MEMORY_COUNTERS) &pmcex, sizeof(pmcex))) {
+- return NS_ERROR_FAILURE;
+- }
+-
+- *aAmount = pmcex.PrivateUsage;
+- return NS_OK;
++ return GetPrivate(aAmount);
+ }
+ };
+-
+-#endif // XP_<PLATFORM>
++#endif
+
+ #ifdef HAVE_VSIZE_AND_RESIDENT_REPORTERS
+ class VsizeReporter MOZ_FINAL : public MemoryUniReporter
+@@ -780,7 +824,7 @@ nsMemoryReporterManager::Init()
+ RegisterReporter(new mozilla::dmd::DMDReporter);
+ #endif
+
+-#if defined(XP_LINUX)
++#if defined(XP_LINUX) || defined(__FreeBSD__)
+ nsMemoryInfoDumper::Initialize();
+ #endif
+
diff --git a/www/firefox/patches/patch-xpcom_ds_moz.build b/www/firefox/patches/patch-xpcom_ds_moz.build
index 4246ca09376..cf300e2d329 100644
--- a/www/firefox/patches/patch-xpcom_ds_moz.build
+++ b/www/firefox/patches/patch-xpcom_ds_moz.build
@@ -1,18 +1,18 @@
-$NetBSD: patch-xpcom_ds_moz.build,v 1.2 2013/11/02 22:57:55 ryoon Exp $
+$NetBSD: patch-xpcom_ds_moz.build,v 1.3 2013/12/15 13:54:37 ryoon Exp $
* Honor sFirstTimeStamp and sProcessCreation, fix segfault.
---- xpcom/ds/moz.build.orig 2013-10-25 22:27:44.000000000 +0000
+--- xpcom/ds/moz.build.orig 2013-12-05 16:08:00.000000000 +0000
+++ xpcom/ds/moz.build
-@@ -95,7 +95,6 @@ CPP_SOURCES += [
+@@ -90,7 +90,6 @@ CPP_SOURCES += [
+ 'nsSupportsArrayEnumerator.cpp',
'nsSupportsPrimitives.cpp',
- 'nsUnicharBuffer.cpp',
'nsVariant.cpp',
- 'TimeStamp.cpp',
]
if CONFIG['OS_ARCH'] == 'WINNT':
-@@ -113,6 +112,10 @@ elif CONFIG['OS_ARCH'] == 'Darwin':
+@@ -108,6 +107,10 @@ elif CONFIG['OS_ARCH'] == 'Darwin':
else:
error('No TimeStamp implementation on this platform. Build will not succeed')