summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2020-08-11 22:35:12 +0100
committerThomas Preud'homme <robotux@celest.fr>2020-08-11 22:35:12 +0100
commit3ac113857071fc1f225b2e1b42547269e568c6b7 (patch)
tree8b28dd9c44a0d3c7ab8187cd8d8f19d47591d813
parent9b10c21f5cad0e2ec27d23c59e65af7141a226f3 (diff)
New upstream version 2.2.4.4
-rwxr-xr-x[-rw-r--r--]COPYING0
-rwxr-xr-x[-rw-r--r--]CliParser.cpp0
-rwxr-xr-x[-rw-r--r--]CliParser.h0
-rwxr-xr-x[-rw-r--r--]CompilerInfo.h2
-rwxr-xr-x[-rw-r--r--]CopyEngineManager.cpp8
-rwxr-xr-x[-rw-r--r--]CopyEngineManager.h1
-rwxr-xr-x[-rw-r--r--]CopyListener.cpp1
-rwxr-xr-x[-rw-r--r--]CopyListener.h0
-rwxr-xr-x[-rw-r--r--]Core.cpp54
-rwxr-xr-x[-rw-r--r--]Core.h11
-rwxr-xr-x[-rw-r--r--]DebugEngine.cpp8
-rwxr-xr-x[-rw-r--r--]DebugEngine.h0
-rwxr-xr-x[-rw-r--r--]DebugEngineMacro.h3
-rwxr-xr-x[-rw-r--r--]DebugModel.cpp0
-rwxr-xr-x[-rw-r--r--]Environment.h0
-rwxr-xr-x[-rw-r--r--]EventDispatcher.cpp103
-rwxr-xr-x[-rw-r--r--]EventDispatcher.h0
-rwxr-xr-x[-rw-r--r--]ExtraSocket.cpp0
-rwxr-xr-x[-rw-r--r--]ExtraSocket.h0
-rwxr-xr-x[-rw-r--r--]FacilityEngine.cpp103
-rwxr-xr-x[-rw-r--r--]FacilityEngine.h3
-rwxr-xr-xFacilityEngineVersion.cpp7
-rwxr-xr-x[-rw-r--r--]HelpDialog.cpp9
-rwxr-xr-x[-rw-r--r--]HelpDialog.h0
-rwxr-xr-x[-rw-r--r--]HelpDialog.ui3
-rwxr-xr-x[-rw-r--r--]InternetUpdater.cpp13
-rwxr-xr-x[-rw-r--r--]InternetUpdater.h0
-rwxr-xr-x[-rw-r--r--]LanguagesManager.cpp0
-rwxr-xr-x[-rw-r--r--]LanguagesManager.h0
-rwxr-xr-x[-rw-r--r--]LocalListener.cpp8
-rwxr-xr-x[-rw-r--r--]LocalListener.h0
-rwxr-xr-x[-rw-r--r--]LocalPluginOptions.cpp0
-rwxr-xr-x[-rw-r--r--]LocalPluginOptions.h0
-rwxr-xr-x[-rw-r--r--]LogThread.cpp0
-rwxr-xr-x[-rw-r--r--]LogThread.h0
-rwxr-xr-x[-rw-r--r--]OSSpecific.cpp42
-rwxr-xr-x[-rw-r--r--]OSSpecific.h2
-rwxr-xr-x[-rw-r--r--]OSSpecific.ui127
-rwxr-xr-x[-rw-r--r--]OptionDialog.cpp68
-rwxr-xr-x[-rw-r--r--]OptionDialog.h10
-rwxr-xr-x[-rw-r--r--]OptionDialog.ui111
-rwxr-xr-x[-rw-r--r--]OptionEngine.cpp0
-rwxr-xr-x[-rw-r--r--]OptionEngine.h0
-rwxr-xr-x[-rw-r--r--]PlatformMacro.h86
-rwxr-xr-x[-rw-r--r--]PluginInformation.cpp0
-rwxr-xr-x[-rw-r--r--]PluginInformation.h0
-rwxr-xr-x[-rw-r--r--]PluginInformation.ui0
-rwxr-xr-x[-rw-r--r--]PluginLoaderCore.cpp0
-rwxr-xr-x[-rw-r--r--]PluginLoaderCore.h0
-rwxr-xr-x[-rw-r--r--]PluginsManager.cpp15
-rwxr-xr-x[-rw-r--r--]PluginsManager.h0
-rwxr-xr-x[-rw-r--r--]ProductKey.cpp2
-rwxr-xr-x[-rw-r--r--]ProductKey.h0
-rwxr-xr-x[-rw-r--r--]ProductKey.ui6
-rwxr-xr-x[-rw-r--r--]README.md3
-rwxr-xr-x[-rw-r--r--]README.sources9
-rwxr-xr-x[-rw-r--r--]ResourcesManager.cpp0
-rwxr-xr-x[-rw-r--r--]ResourcesManager.h0
-rwxr-xr-x[-rw-r--r--]SessionLoader.cpp0
-rwxr-xr-x[-rw-r--r--]SessionLoader.h0
-rwxr-xr-x[-rw-r--r--]StructEnumDefinition.h96
-rwxr-xr-x[-rw-r--r--]StructEnumDefinition_UltracopierSpecific.h0
-rwxr-xr-x[-rw-r--r--]SystrayIcon.cpp21
-rwxr-xr-x[-rw-r--r--]SystrayIcon.h6
-rwxr-xr-x[-rw-r--r--]ThemesManager.cpp2
-rwxr-xr-x[-rw-r--r--]ThemesManager.h0
-rwxr-xr-x[-rw-r--r--]Variable.h19
-rwxr-xr-xVersion.h9
-rw-r--r--android-libultracopier.so-deployment-settings.json14
-rw-r--r--android-sources/AndroidManifest.xml92
-rwxr-xr-xandroid-sources/build.sh7
-rw-r--r--android-sources/res/drawable-hdpi/icon.pngbin0 -> 3057 bytes
-rw-r--r--android-sources/res/drawable-ldpi/icon.pngbin0 -> 1649 bytes
-rw-r--r--android-sources/res/drawable-mdpi/icon.pngbin0 -> 2162 bytes
-rwxr-xr-xcatchcopy-windows-explorer-plugin/CatchCopy.cpp115
-rwxr-xr-xcatchcopy-windows-explorer-plugin/CatchCopy.def7
-rwxr-xr-xcatchcopy-windows-explorer-plugin/CatchCopy.pro49
-rwxr-xr-xcatchcopy-windows-explorer-plugin/ClassFactory.cpp84
-rwxr-xr-xcatchcopy-windows-explorer-plugin/ClassFactory.h22
-rwxr-xr-xcatchcopy-windows-explorer-plugin/ClientCatchcopy.cpp455
-rwxr-xr-xcatchcopy-windows-explorer-plugin/ClientCatchcopy.h68
-rwxr-xr-xcatchcopy-windows-explorer-plugin/DDShellExt.cpp188
-rwxr-xr-xcatchcopy-windows-explorer-plugin/DDShellExt.h46
-rwxr-xr-xcatchcopy-windows-explorer-plugin/Deque.cpp100
-rwxr-xr-xcatchcopy-windows-explorer-plugin/Deque.h29
-rwxr-xr-xcatchcopy-windows-explorer-plugin/Reg.cpp403
-rwxr-xr-xcatchcopy-windows-explorer-plugin/Reg.h103
-rwxr-xr-xcatchcopy-windows-explorer-plugin/Variable.h7
-rwxr-xr-xcatchcopy-windows-explorer-plugin/resource.h18
-rwxr-xr-x[-rw-r--r--]cpp11addition.cpp165
-rwxr-xr-x[-rw-r--r--]cpp11addition.h10
-rwxr-xr-x[-rw-r--r--]cpp11additionstringtointcpp.cpp0
-rw-r--r--file-manager/libfm-qt-uc.patch94
-rw-r--r--file-manager/pcmanfm-qt-uc.patch191
-rw-r--r--file-manager/pcmanfm-qt.txt3
-rw-r--r--interface/FacilityInterface.h3
-rw-r--r--interface/PluginInterface_CopyEngine.h4
-rw-r--r--interface/PluginInterface_Listener.h2
-rw-r--r--interface/PluginInterface_PluginLoader.h2
-rw-r--r--interface/PluginInterface_SessionLoader.h2
-rw-r--r--interface/PluginInterface_Themes.h6
-rw-r--r--lib/qt-tar-xz/xz_dec_lzma2.c1696
-rw-r--r--lib/qt-tar-xz/xz_dec_stream.c1215
-rw-r--r--libfm-qt-ultracopier/README1
-rw-r--r--libfm-qt-ultracopier/libfm-qt-ultracopier.pro14
-rw-r--r--libfm-qt-ultracopier/utilities.cpp89
-rw-r--r--libfm-qt-ultracopier/utilities.h21
-rw-r--r--libogg/COPYING28
-rw-r--r--libogg/bitwise.c1088
-rw-r--r--libogg/framing.c2140
-rw-r--r--libogg/ogg.h210
-rw-r--r--libogg/os_types.h153
-rw-r--r--little/main-little.cpp19
-rwxr-xr-x[-rw-r--r--]main.cpp10
-rw-r--r--opusfile/info.c771
-rw-r--r--opusfile/internal.c42
-rw-r--r--opusfile/internal.h259
-rw-r--r--opusfile/opusfile.c3326
-rw-r--r--opusfile/opusfile.h2164
-rw-r--r--opusfile/stream.c364
-rwxr-xr-x[-rw-r--r--]other-pro/static.pro0
-rwxr-xr-x[-rw-r--r--]other-pro/supercopier-core.pro0
-rwxr-xr-x[-rw-r--r--]other-pro/ultracopier-core.pro45
-rwxr-xr-xother-pro/ultracopier-core.pro.user.4.8-pre1336
-rwxr-xr-xother-pro/ultracopier-core.pro.user.74ab603.4.8-pre1336
-rwxr-xr-xother-pro/ultracopier-little-random.pro11
-rwxr-xr-xother-pro/ultracopier-little-random.pro.user.4.8-pre1291
-rwxr-xr-xother-pro/ultracopier-little.pri63
-rwxr-xr-x[-rw-r--r--]other-pro/ultracopier-little.pro200
-rwxr-xr-xother-pro/ultracopier-little.pro.user.74ab603.4.9-pre1281
-rwxr-xr-x[-rw-r--r--]other-pro/ultracopier-static.pro6
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/AvancedQFile.cpp (renamed from plugins/CopyEngine/Ultracopier/AvancedQFile.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/AvancedQFile.h (renamed from plugins/CopyEngine/Ultracopier/AvancedQFile.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/CompilerInfo.h (renamed from plugins/CopyEngine/Ultracopier/CompilerInfo.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/CopyEngine-collision-and-error.cpp (renamed from plugins/CopyEngine/Ultracopier/CopyEngine-collision-and-error.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/CopyEngine.cpp (renamed from plugins/CopyEngine/Ultracopier/CopyEngine.cpp)8
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/CopyEngine.h (renamed from plugins/CopyEngine/Ultracopier/CopyEngine.h)4
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/CopyEngine.pro (renamed from plugins/CopyEngine/Ultracopier/CopyEngine.pro)2
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/CopyEngine.pro.user.4.8-pre1288
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/CopyEngineFactory.cpp (renamed from plugins/CopyEngine/Ultracopier/CopyEngineFactory.cpp)6
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/CopyEngineFactory.h (renamed from plugins/CopyEngine/Ultracopier/CopyEngineFactory.h)2
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/CopyEngineUltracopierVariable.h (renamed from plugins/CopyEngine/Ultracopier/Variable.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/DebugDialog.cpp (renamed from plugins/CopyEngine/Ultracopier/DebugDialog.cpp)4
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/DebugDialog.h (renamed from plugins/CopyEngine/Ultracopier/DebugDialog.h)2
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/DebugEngineMacro.h (renamed from plugins/CopyEngine/Ultracopier/DebugEngineMacro.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/DiskSpace.cpp (renamed from plugins/CopyEngine/Ultracopier/DiskSpace.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/DiskSpace.h (renamed from plugins/CopyEngine/Ultracopier/DiskSpace.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/DiskSpace.ui (renamed from plugins/CopyEngine/Ultracopier/DiskSpace.ui)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/DriveManagement.cpp (renamed from plugins/CopyEngine/Ultracopier/DriveManagement.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/DriveManagement.h (renamed from plugins/CopyEngine/Ultracopier/DriveManagement.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Environment.h (renamed from plugins/CopyEngine/Ultracopier/Environment.h)2
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FileErrorDialog.cpp (renamed from plugins/CopyEngine/Ultracopier/FileErrorDialog.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FileErrorDialog.h (renamed from plugins/CopyEngine/Ultracopier/FileErrorDialog.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FileExistsDialog.cpp (renamed from plugins/CopyEngine/Ultracopier/FileExistsDialog.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FileExistsDialog.h (renamed from plugins/CopyEngine/Ultracopier/FileExistsDialog.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FileIsSameDialog.cpp (renamed from plugins/CopyEngine/Ultracopier/FileIsSameDialog.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FileIsSameDialog.h (renamed from plugins/CopyEngine/Ultracopier/FileIsSameDialog.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FilterRules.cpp (renamed from plugins/CopyEngine/Ultracopier/FilterRules.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FilterRules.h (renamed from plugins/CopyEngine/Ultracopier/FilterRules.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FilterRules.ui (renamed from plugins/CopyEngine/Ultracopier/FilterRules.ui)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Filters.cpp (renamed from plugins/CopyEngine/Ultracopier/Filters.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Filters.h (renamed from plugins/CopyEngine/Ultracopier/Filters.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Filters.ui (renamed from plugins/CopyEngine/Ultracopier/Filters.ui)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FolderExistsDialog.cpp (renamed from plugins/CopyEngine/Ultracopier/FolderExistsDialog.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/FolderExistsDialog.h (renamed from plugins/CopyEngine/Ultracopier/FolderExistsDialog.h)0
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/ar/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/ar/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/id/translation.ts)136
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/de/translation.qmbin0 -> 26769 bytes
-rw-r--r--plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/de/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/de/translation.ts)238
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/el/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/el/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/el/translation.ts)136
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/en/translation.qmbin0 -> 334 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/en/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/en/translation.ts)126
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/es/translation.qmbin0 -> 22315 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/es/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/es/translation.ts)140
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/fr/translation.qmbin0 -> 24417 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/fr/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/fr/translation.ts)140
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/hi/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/hi/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/ar/translation.ts)136
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/hu/translation.qmbin0 -> 20586 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/hu/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/hu/translation.ts)130
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/id/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/id/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/hi/translation.ts)136
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/it/translation.qmbin0 -> 17126 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/it/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/it/translation.ts)140
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/ja/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/ja/translation.ts1291
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/ko/translation.qmbin0 -> 3219 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/ko/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/ko/translation.ts)126
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/nl/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/nl/translation.ts1291
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/no/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/no/translation.ts1291
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/pl/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/pl/translation.ts1291
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/pt/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/pt/translation.ts1291
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/ru/translation.qmbin0 -> 7450 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/ru/translation.ts (renamed from plugins/CopyEngine/Ultracopier/Languages/ru/translation.ts)140
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/th/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/th/translation.ts1291
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/tr/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/tr/translation.ts1291
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/zh/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins-unmaintained/CopyEngine/Ultracopier-Qt/Languages/zh/translation.ts1291
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/ListThread.cpp (renamed from plugins/CopyEngine/Ultracopier/ListThread.cpp)27
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/ListThread.h (renamed from plugins/CopyEngine/Ultracopier/ListThread.h)2
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/ListThread_InodeAction.cpp (renamed from plugins/CopyEngine/Ultracopier/ListThread_InodeAction.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/MkPath.cpp (renamed from plugins/CopyEngine/Ultracopier/MkPath.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/MkPath.h (renamed from plugins/CopyEngine/Ultracopier/MkPath.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/README.md (renamed from plugins/CopyEngine/Ultracopier/README.md)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/ReadThread.cpp (renamed from plugins/CopyEngine/Ultracopier/ReadThread.cpp)2
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/ReadThread.h (renamed from plugins/CopyEngine/Ultracopier/ReadThread.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/RenamingRules.cpp (renamed from plugins/CopyEngine/Ultracopier/RenamingRules.cpp)8
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/RenamingRules.h (renamed from plugins/CopyEngine/Ultracopier/RenamingRules.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/RenamingRules.ui (renamed from plugins/CopyEngine/Ultracopier/RenamingRules.ui)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/ScanFileOrFolder.cpp (renamed from plugins/CopyEngine/Ultracopier/ScanFileOrFolder.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/ScanFileOrFolder.h (renamed from plugins/CopyEngine/Ultracopier/ScanFileOrFolder.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/StructEnumDefinition.h (renamed from plugins/CopyEngine/Ultracopier/StructEnumDefinition.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/StructEnumDefinition_CopyEngine.h (renamed from plugins/CopyEngine/Ultracopier/StructEnumDefinition_CopyEngine.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/TransferThread.cpp (renamed from plugins/CopyEngine/Ultracopier/TransferThread.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/TransferThread.h (renamed from plugins/CopyEngine/Ultracopier/TransferThread.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/WriteThread.cpp (renamed from plugins/CopyEngine/Ultracopier/WriteThread.cpp)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/WriteThread.h (renamed from plugins/CopyEngine/Ultracopier/WriteThread.h)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/copyEngineOptions.ui (renamed from plugins/CopyEngine/Ultracopier/copyEngineOptions.ui)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/copyEngineResources.qrc (renamed from plugins/CopyEngine/Ultracopier/copyEngineResources.qrc)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/debugDialog.ui (renamed from plugins/CopyEngine/Ultracopier/debugDialog.ui)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/documentation.dox (renamed from plugins/CopyEngine/Ultracopier/documentation.dox)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/fileErrorDialog.ui (renamed from plugins/CopyEngine/Ultracopier/fileErrorDialog.ui)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/fileExistsDialog.ui (renamed from plugins/CopyEngine/Ultracopier/fileExistsDialog.ui)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/fileIsSameDialog.ui (renamed from plugins/CopyEngine/Ultracopier/fileIsSameDialog.ui)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/folderExistsDialog.ui (renamed from plugins/CopyEngine/Ultracopier/folderExistsDialog.ui)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/informations.xml (renamed from plugins/CopyEngine/Ultracopier/informations.xml)2
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/plugin.json (renamed from plugins/CopyEngine/Ultracopier/plugin.json)0
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/resources/add.png (renamed from plugins/CopyEngine/Ultracopier/resources/add.png)bin552 -> 552 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/resources/edit.png (renamed from plugins/CopyEngine/Ultracopier/resources/edit.png)bin623 -> 623 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/resources/filter.png (renamed from plugins/CopyEngine/Ultracopier/resources/filter.png)bin685 -> 685 bytes
-rwxr-xr-x[-rw-r--r--]plugins-unmaintained/CopyEngine/Ultracopier-Qt/resources/remove.png (renamed from plugins/CopyEngine/Ultracopier/resources/remove.png)bin683 -> 683 bytes
-rw-r--r--plugins-unmaintained/Listener/dbus/informations.xml2
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/ar/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/de/translation.qmbin0 -> 334 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/el/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/en/translation.qmbin0 -> 334 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/es/translation.qmbin0 -> 334 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/fr/translation.qmbin0 -> 334 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/hi/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/hu/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/id/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/it/translation.qmbin0 -> 334 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/ja/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/ko/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/nl/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/no/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/pl/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/pt/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/ru/translation.qmbin0 -> 345 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/th/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/tr/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/Languages/zh/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/PluginLoader/keybinding/informations.xml2
-rw-r--r--plugins-unmaintained/SessionLoader/KDE4/informations.xml2
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/ar/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/de/translation.qmbin0 -> 1094 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/el/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/en/translation.qmbin0 -> 334 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/es/translation.qmbin0 -> 1015 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/fr/translation.qmbin0 -> 986 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/hi/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/hu/translation.qmbin0 -> 1065 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/id/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/it/translation.qmbin0 -> 983 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/ja/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/ko/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/nl/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/no/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/pl/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/ru/translation.qmbin0 -> 1036 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/th/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/tr/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/Languages/zh/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Clean/informations.xml2
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/ar/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/de/translation.qmbin0 -> 3171 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/el/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/en/translation.qmbin0 -> 334 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/es/translation.qmbin0 -> 2972 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/fr/translation.qmbin0 -> 3131 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/hi/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/hu/translation.qmbin0 -> 3148 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/id/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/it/translation.qmbin0 -> 3129 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/ja/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/ko/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/nl/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/no/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/pl/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/ru/translation.qmbin0 -> 3011 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/th/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/tr/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/Languages/zh/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Teracopy/informations.xml2
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/ar/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/de/translation.qmbin0 -> 2224 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/el/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/en/translation.qmbin0 -> 807 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/es/translation.qmbin0 -> 1380 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/fr/translation.qmbin0 -> 2281 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/hi/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/hu/translation.qmbin0 -> 2031 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/id/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/it/translation.qmbin0 -> 2249 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/ja/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/ko/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/nl/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/no/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/pl/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/ru/translation.qmbin0 -> 859 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/th/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/tr/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/Languages/zh/translation.qmbin0 -> 327 bytes
-rw-r--r--plugins-unmaintained/Themes/Windows/informations.xml2
-rwxr-xr-x[-rw-r--r--]plugins/CopyEngine/README.md0
-rwxr-xr-xplugins/CopyEngine/Random/CopyEngine.cpp253
-rwxr-xr-xplugins/CopyEngine/Random/CopyEngine.h128
-rwxr-xr-xplugins/CopyEngine/Random/CopyEngine.pro26
-rwxr-xr-xplugins/CopyEngine/Random/CopyEngineFactory.cpp78
-rwxr-xr-xplugins/CopyEngine/Random/CopyEngineFactory.h58
-rwxr-xr-xplugins/CopyEngine/Random/README.md3
-rwxr-xr-xplugins/CopyEngine/Random/informations.xml24
-rwxr-xr-xplugins/CopyEngine/Random/plugin.json1
-rwxr-xr-xplugins/CopyEngine/Rsync/CopyEngine.pro2
-rwxr-xr-x[-rw-r--r--]plugins/CopyEngine/Rsync/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/CopyEngine/Rsync/Rsync.pro0
-rwxr-xr-x[-rw-r--r--]plugins/CopyEngine/Rsync/informations.xml2
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/CallBackEventLoop.h15
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/CompilerInfo.h1
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/CopyEngine-collision-and-error.cpp719
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/CopyEngine.cpp1129
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/CopyEngine.h356
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/CopyEngine.pro115
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/CopyEngineFactory.cpp654
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/CopyEngineFactory.h127
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/CopyEngineUltracopier-SpecVariable.h43
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/DebugDialog.cpp63
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/DebugDialog.h48
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/DebugEngineMacro.h28
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/DiskSpace.cpp53
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/DiskSpace.h29
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/DiskSpace.ui68
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/DriveManagement.cpp180
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/DriveManagement.h34
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Environment.h11
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/EventLoop.cpp71
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/EventLoop.h30
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FileErrorDialog.cpp209
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FileErrorDialog.h56
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FileExistsDialog.cpp313
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FileExistsDialog.h68
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FileIsSameDialog.cpp226
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FileIsSameDialog.h63
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FilterRules.cpp199
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FilterRules.h47
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FilterRules.ui162
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Filters.cpp464
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Filters.h45
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Filters.ui221
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FolderExistsDialog.cpp252
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/FolderExistsDialog.h60
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/ar/translation.qmbin0 -> 20287 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/ar/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/de/translation.qmbin0 -> 19546 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/de/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/el/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/el/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/en/translation.qmbin0 -> 334 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/en/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/es/translation.qmbin0 -> 23560 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/es/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/fr/translation.qmbin0 -> 23074 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/fr/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/hi/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/hi/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/hu/translation.qmbin0 -> 15971 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/hu/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/id/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/id/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/it/translation.qmbin0 -> 23932 bytes
-rw-r--r--plugins/CopyEngine/Ultracopier-Spec/Languages/it/translation.ts1150
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/ja/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/ja/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/ko/translation.qmbin0 -> 2785 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/ko/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/nl/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/nl/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/no/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/no/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/pl/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/pl/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/pt/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/pt/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/ru/translation.qmbin0 -> 6529 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/ru/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/th/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/th/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/tr/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/tr/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/zh/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/Languages/zh/translation.ts1147
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThread.cpp1235
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThread.h437
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThreadActions.cpp129
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThreadListChange.cpp423
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThreadMedia.cpp169
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThreadNew.cpp104
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThreadOptions.cpp296
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThreadScan.cpp97
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThreadStat.cpp184
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ListThread_InodeAction.cpp91
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/MkPath.cpp676
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/MkPath.h100
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/README.md3
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/RenamingRules.cpp96
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/RenamingRules.h34
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/RenamingRules.ui134
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ScanFileOrFolder.cpp953
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ScanFileOrFolder.h118
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/StructEnumDefinition.h1
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/StructEnumDefinition_CopyEngine.h118
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/TransferThread.cpp1547
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/TransferThread.h265
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/async/ReadThread.cpp883
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/async/ReadThread.h163
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/async/TransferThreadAsync.cpp1442
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/async/TransferThreadAsync.h153
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/async/WriteThread.cpp1164
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/async/WriteThread.h181
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/copyEngineOptions.ui602
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/copyEngineResources.qrc8
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/debugDialog.ui120
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/documentation.dox39
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/fileErrorDialog.ui264
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/fileExistsDialog.ui428
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/fileIsSameDialog.ui214
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/folderExistsDialog.ui309
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/informations.xml26
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/plugin.json1
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/ports.h6
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/resources/add.pngbin0 -> 552 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/resources/edit.pngbin0 -> 623 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/resources/filter.pngbin0 -> 685 bytes
-rwxr-xr-xplugins/CopyEngine/Ultracopier-Spec/resources/remove.pngbin0 -> 683 bytes
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/ja/translation.ts1291
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/nl/translation.ts1291
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/no/translation.ts1291
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/pl/translation.ts1291
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/pt/translation.ts1291
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/th/translation.ts1291
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/tr/translation.ts1291
-rw-r--r--plugins/CopyEngine/Ultracopier/Languages/zh/translation.ts1291
-rwxr-xr-x[-rw-r--r--]plugins/Languages/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/Languages/ar/flag.pngbin585 -> 585 bytes
-rw-r--r--plugins/Languages/ar/informations.xml6
-rwxr-xr-xplugins/Languages/ar/translation.qmbin0 -> 28595 bytes
-rw-r--r--plugins/Languages/ar/translation.ts1853
-rw-r--r--plugins/Languages/de/informations.xml2
-rwxr-xr-xplugins/Languages/de/translation.qmbin0 -> 30785 bytes
-rw-r--r--plugins/Languages/de/translation.ts1444
-rwxr-xr-x[-rw-r--r--]plugins/Languages/el/flag.pngbin726 -> 726 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/el/informations.xml2
-rwxr-xr-xplugins/Languages/el/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/el/translation.ts1287
-rwxr-xr-xplugins/Languages/en/translation.qm1
-rwxr-xr-x[-rw-r--r--]plugins/Languages/es/flag.pngbin726 -> 726 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/es/informations.xml2
-rwxr-xr-xplugins/Languages/es/translation.qmbin0 -> 31962 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/es/translation.ts1343
-rwxr-xr-x[-rw-r--r--]plugins/Languages/fr/flag.pngbin699 -> 699 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/fr/informations.xml2
-rwxr-xr-xplugins/Languages/fr/translation.qmbin0 -> 32564 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/fr/translation.ts1299
-rwxr-xr-x[-rw-r--r--]plugins/Languages/hi/flag.pngbin728 -> 728 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/hi/informations.xml2
-rwxr-xr-xplugins/Languages/hi/translation.qmbin0 -> 334 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/hi/translation.ts1287
-rwxr-xr-x[-rw-r--r--]plugins/Languages/hu/flag.pngbin810 -> 810 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/hu/informations.xml2
-rwxr-xr-xplugins/Languages/hu/translation.qmbin0 -> 23508 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/hu/translation.ts1292
-rwxr-xr-x[-rw-r--r--]plugins/Languages/id/flag.pngbin691 -> 691 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/id/informations.xml2
-rwxr-xr-xplugins/Languages/id/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/id/translation.ts1287
-rw-r--r--plugins/Languages/it/informations.xml2
-rwxr-xr-xplugins/Languages/it/translation.qmbin0 -> 32517 bytes
-rw-r--r--plugins/Languages/it/translation.ts1574
-rwxr-xr-x[-rw-r--r--]plugins/Languages/ja/flag.pngbin595 -> 595 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/ja/informations.xml2
-rwxr-xr-xplugins/Languages/ja/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/ja/translation.ts1287
-rwxr-xr-x[-rw-r--r--]plugins/Languages/ko/flag.pngbin650 -> 650 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/ko/informations.xml2
-rwxr-xr-xplugins/Languages/ko/translation.qmbin0 -> 8248 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/ko/translation.ts1289
-rwxr-xr-x[-rw-r--r--]plugins/Languages/nl/flag.pngbin709 -> 709 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/nl/informations.xml2
-rwxr-xr-xplugins/Languages/nl/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/nl/translation.ts1287
-rwxr-xr-x[-rw-r--r--]plugins/Languages/no/flag.pngbin715 -> 715 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/no/informations.xml2
-rwxr-xr-xplugins/Languages/no/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/no/translation.ts1287
-rwxr-xr-x[-rw-r--r--]plugins/Languages/pl/flag.pngbin586 -> 586 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/pl/informations.xml2
-rwxr-xr-xplugins/Languages/pl/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/pl/translation.ts1287
-rwxr-xr-x[-rw-r--r--]plugins/Languages/pt/flag.pngbin686 -> 686 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/pt/informations.xml2
-rwxr-xr-xplugins/Languages/pt/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/pt/translation.ts1287
-rwxr-xr-x[-rw-r--r--]plugins/Languages/ru/flag.pngbin721 -> 721 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/ru/informations.xml2
-rwxr-xr-xplugins/Languages/ru/translation.qmbin0 -> 15940 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/ru/translation.ts1287
-rwxr-xr-x[-rw-r--r--]plugins/Languages/th/flag.pngbin731 -> 731 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/th/informations.xml2
-rwxr-xr-xplugins/Languages/th/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/th/translation.ts1287
-rwxr-xr-x[-rw-r--r--]plugins/Languages/tr/flag.pngbin634 -> 634 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/tr/informations.xml2
-rwxr-xr-xplugins/Languages/tr/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/tr/translation.ts1287
-rwxr-xr-x[-rw-r--r--]plugins/Languages/zh/flag.pngbin538 -> 538 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/zh/informations.xml2
-rwxr-xr-xplugins/Languages/zh/translation.qmbin0 -> 412 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/zh/translation.ts1424
-rwxr-xr-x[-rw-r--r--]plugins/Languages/zh_TW/flag.pngbin616 -> 616 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/zh_TW/informations.xml2
-rwxr-xr-xplugins/Languages/zh_TW/translation.qmbin0 -> 2444 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Languages/zh_TW/translation.ts1287
-rwxr-xr-x[-rw-r--r--]plugins/Listener/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/DebugEngineMacro.h0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/Environment.h2
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/Listenercatchcopy-v0002Variable.h (renamed from plugins/SessionLoader/Windows/Variable.h)2
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/StructEnumDefinition.h0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ClientCatchcopy.cpp0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ClientCatchcopy.h0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.cpp0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.h0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.cpp0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.h0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/catchcopy-api-0002/VariablesCatchcopy.h0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/documentation.dox0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/informations.xml2
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/listener.cpp0
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/listener.h18
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/listener.pro2
-rwxr-xr-x[-rw-r--r--]plugins/Listener/catchcopy-v0002/plugin.json0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/DebugEngineMacro.h0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Environment.h2
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/ar/translation.qmbin0 -> 1059 bytes
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/ar/translation.ts8
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/de/translation.qmbin0 -> 1136 bytes
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/de/translation.ts4
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/el/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/el/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/en/translation.qmbin0 -> 334 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/en/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/es/translation.qmbin0 -> 487 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/es/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/fr/translation.qmbin0 -> 1246 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/fr/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/hi/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/hi/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/hu/translation.qmbin0 -> 989 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/hu/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/id/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/id/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/it/translation.qmbin0 -> 1300 bytes
-rw-r--r--plugins/PluginLoader/catchcopy-v0002/Languages/it/translation.ts6
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/ja/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/ja/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/ko/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/ko/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/nl/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/nl/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/no/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/no/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/pl/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/pl/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/pt/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/pt/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/ru/translation.qmbin0 -> 498 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/ru/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/th/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/th/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/tr/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/tr/translation.ts0
-rwxr-xr-xplugins/PluginLoader/catchcopy-v0002/Languages/zh/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/Languages/zh/translation.ts0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/OptionsWidget.cpp0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/OptionsWidget.h0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/OptionsWidget.ui0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/PlatformMacro.h0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/PluginLoadercatchcopy-v0002Variable.h (renamed from plugins/PluginLoader/catchcopy-v0002/Variable.h)2
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/StructEnumDefinition.h0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/documentation.dox0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/informations.xml2
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/plugin.json0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/pluginLoader.cpp0
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/pluginLoader.h8
-rwxr-xr-x[-rw-r--r--]plugins/PluginLoader/catchcopy-v0002/pluginLoader.pro2
-rwxr-xr-x[-rw-r--r--]plugins/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/DebugEngineMacro.h0
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/Environment.h2
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/SessionLoaderWindowsVariable.h (renamed from plugins/Listener/catchcopy-v0002/Variable.h)2
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/StructEnumDefinition.h0
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/documentation.dox0
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/informations.xml2
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/plugin.json0
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/sessionLoader.cpp0
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/sessionLoader.h0
-rwxr-xr-x[-rw-r--r--]plugins/SessionLoader/Windows/sessionLoader.pro2
-rwxr-xr-xplugins/SessionLoader/Windows/sessionLoader.pro.user.4.8-pre1333
-rwxr-xr-xplugins/SessionLoader/Windows/sessionLoader.pro.user.74ab603.4.8-pre1333
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/DebugEngineMacro.h0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Environment.h2
-rwxr-xr-xplugins/Themes/Oxygen/Languages/ar/translation.qmbin0 -> 5785 bytes
-rw-r--r--plugins/Themes/Oxygen/Languages/ar/translation.ts166
-rwxr-xr-xplugins/Themes/Oxygen/Languages/de/translation.qmbin0 -> 6711 bytes
-rw-r--r--plugins/Themes/Oxygen/Languages/de/translation.ts50
-rwxr-xr-xplugins/Themes/Oxygen/Languages/el/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/el/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/en/translation.qmbin0 -> 334 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/en/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/es/translation.qmbin0 -> 6167 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/es/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/fr/translation.qmbin0 -> 6346 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/fr/translation.ts16
-rwxr-xr-xplugins/Themes/Oxygen/Languages/hi/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/hi/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/hu/translation.qmbin0 -> 5951 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/hu/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/id/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/id/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/it/translation.qmbin0 -> 6445 bytes
-rw-r--r--plugins/Themes/Oxygen/Languages/it/translation.ts128
-rwxr-xr-xplugins/Themes/Oxygen/Languages/ja/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/ja/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/ko/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/ko/translation.ts16
-rwxr-xr-xplugins/Themes/Oxygen/Languages/nl/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/nl/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/no/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/no/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/pl/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/pl/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/pt/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/pt/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/ru/translation.qmbin0 -> 1630 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/ru/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/th/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/th/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/tr/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/tr/translation.ts40
-rwxr-xr-xplugins/Themes/Oxygen/Languages/zh/translation.qmbin0 -> 327 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/Languages/zh/translation.ts40
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/OxygenVariable.h (renamed from plugins/Themes/Oxygen/Variable.h)2
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/StructEnumDefinition.h0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/ThemesFactory.cpp0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/ThemesFactory.h0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/TransferModel.cpp0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/TransferModel.h0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/documentation.dox0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/informations.xml2
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/interface.cpp48
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/interface.h5
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/interface.pro2
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/interface.ui0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/interfaceInclude.pri4
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/interfaceResources.qrc0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/interfaceResources_unix.qrc0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/interfaceResources_windows.qrc0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/options.ui0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/plugin.json0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/SystemTrayIcon/add.pngbin552 -> 552 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/SystemTrayIcon/exit.pngbin874 -> 874 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/SystemTrayIcon/informations.pngbin841 -> 841 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/SystemTrayIcon/options.pngbin624 -> 624 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Caught_Unix.pngbin1093 -> 1093 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Caught_Windows.pngbin623 -> 623 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Semiuncaught_Unix.pngbin1174 -> 1174 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Semiuncaught_Windows.pngbin677 -> 677 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Uncaught_Unix.pngbin665 -> 665 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/SystemTrayIcon/systray_Uncaught_Windows.pngbin439 -> 439 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/add.pngbin552 -> 552 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/cancel.pngbin874 -> 874 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/export-transfer-list.pngbin455 -> 455 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/import-transfer-list.pngbin454 -> 454 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/main.pngbin623 -> 623 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/moveDown.pngbin466 -> 466 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/moveUp.pngbin466 -> 466 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/player_end.pngbin696 -> 696 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/player_pause.pngbin640 -> 640 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/player_play.pngbin673 -> 673 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/putOnBottom.pngbin676 -> 676 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/putOnTop.pngbin681 -> 681 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/remove.pngbin683 -> 683 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/resources/search.pngbin781 -> 781 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Oxygen/themesOptions.ui0
-rwxr-xr-xplugins/Themes/Oxygen2/DarkButton.cpp99
-rwxr-xr-xplugins/Themes/Oxygen2/DarkButton.h22
-rwxr-xr-xplugins/Themes/Oxygen2/DebugEngineMacro.h28
-rwxr-xr-xplugins/Themes/Oxygen2/Environment.h10
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/ar/translation.qmbin0 -> 6338 bytes
-rw-r--r--plugins/Themes/Oxygen2/Languages/ar/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/de/translation.qmbin0 -> 7079 bytes
-rw-r--r--plugins/Themes/Oxygen2/Languages/de/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/el/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/el/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/en/translation.qmbin0 -> 334 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/en/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/es/translation.qmbin0 -> 6112 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/es/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/fr/translation.qmbin0 -> 6702 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/fr/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/hi/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/hi/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/hu/translation.qmbin0 -> 5898 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/hu/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/id/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/id/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/it/translation.qmbin0 -> 7360 bytes
-rw-r--r--plugins/Themes/Oxygen2/Languages/it/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/ja/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/ja/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/ko/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/ko/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/nl/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/nl/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/no/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/no/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/pl/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/pl/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/pt/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/pt/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/ru/translation.qmbin0 -> 1581 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/ru/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/th/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/th/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/tr/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/tr/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/zh/translation.qmbin0 -> 327 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/Languages/zh/translation.ts382
-rwxr-xr-xplugins/Themes/Oxygen2/Oxygen2Environment.h10
-rwxr-xr-xplugins/Themes/Oxygen2/Oxygen2Variable.h18
-rwxr-xr-xplugins/Themes/Oxygen2/ProgressBarDark.cpp69
-rwxr-xr-xplugins/Themes/Oxygen2/ProgressBarDark.h17
-rwxr-xr-xplugins/Themes/Oxygen2/README.md4
-rwxr-xr-xplugins/Themes/Oxygen2/StructEnumDefinition.h1
-rwxr-xr-xplugins/Themes/Oxygen2/ThemesFactory.cpp573
-rwxr-xr-xplugins/Themes/Oxygen2/ThemesFactory.h89
-rwxr-xr-xplugins/Themes/Oxygen2/TransferModel.cpp755
-rwxr-xr-xplugins/Themes/Oxygen2/TransferModel.h106
-rwxr-xr-xplugins/Themes/Oxygen2/VerticalLabel.cpp44
-rwxr-xr-xplugins/Themes/Oxygen2/VerticalLabel.h21
-rwxr-xr-xplugins/Themes/Oxygen2/chartarea.cpp117
-rwxr-xr-xplugins/Themes/Oxygen2/chartarea.h31
-rwxr-xr-xplugins/Themes/Oxygen2/documentation.dox31
-rwxr-xr-xplugins/Themes/Oxygen2/fileTree.cpp149
-rwxr-xr-xplugins/Themes/Oxygen2/fileTree.h133
-rwxr-xr-xplugins/Themes/Oxygen2/informations.xml26
-rwxr-xr-xplugins/Themes/Oxygen2/interface.cpp1995
-rwxr-xr-xplugins/Themes/Oxygen2/interface.h259
-rwxr-xr-xplugins/Themes/Oxygen2/interface.pro8
-rwxr-xr-xplugins/Themes/Oxygen2/interface.ui1098
-rwxr-xr-xplugins/Themes/Oxygen2/interfaceInclude.pri73
-rwxr-xr-xplugins/Themes/Oxygen2/interfaceResources.qrc36
-rwxr-xr-xplugins/Themes/Oxygen2/interfaceResources_unix.qrc7
-rwxr-xr-xplugins/Themes/Oxygen2/interfaceResources_windows.qrc7
-rwxr-xr-xplugins/Themes/Oxygen2/options.ui280
-rwxr-xr-xplugins/Themes/Oxygen2/plugin.json1
-rwxr-xr-xplugins/Themes/Oxygen2/radialMap/labels.cpp338
-rwxr-xr-xplugins/Themes/Oxygen2/radialMap/map.cpp421
-rwxr-xr-xplugins/Themes/Oxygen2/radialMap/map.h85
-rwxr-xr-xplugins/Themes/Oxygen2/radialMap/radialMap.h109
-rwxr-xr-xplugins/Themes/Oxygen2/radialMap/widget.cpp211
-rwxr-xr-xplugins/Themes/Oxygen2/radialMap/widget.h118
-rwxr-xr-xplugins/Themes/Oxygen2/radialMap/widgetEvents.cpp254
-rwxr-xr-xplugins/Themes/Oxygen2/resources/SystemTrayIcon/add.pngbin0 -> 552 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/SystemTrayIcon/exit.pngbin0 -> 874 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/SystemTrayIcon/informations.pngbin0 -> 841 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/SystemTrayIcon/options.pngbin0 -> 624 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/SystemTrayIcon/systray_Caught_Unix.pngbin0 -> 1093 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/SystemTrayIcon/systray_Caught_Windows.pngbin0 -> 623 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/SystemTrayIcon/systray_Semiuncaught_Unix.pngbin0 -> 1174 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/SystemTrayIcon/systray_Semiuncaught_Windows.pngbin0 -> 677 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/SystemTrayIcon/systray_Uncaught_Unix.pngbin0 -> 665 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/SystemTrayIcon/systray_Uncaught_Windows.pngbin0 -> 439 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/add.pngbin0 -> 552 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/cancel.pngbin0 -> 874 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/cancelDarkD.pngbin0 -> 151 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/cancelDarkE.pngbin0 -> 473 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/click.opusbin0 -> 632 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/darkButton.pngbin0 -> 3632 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/darkButtonOver.pngbin0 -> 4286 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/darkButtonPushed.pngbin0 -> 3541 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/darkmoveDown.pngbin0 -> 1349 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/darkmoveUp.pngbin0 -> 1530 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/darkplayer_end.pngbin0 -> 1153 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/darkplayer_pause.pngbin0 -> 1059 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/darkplayer_play.pngbin0 -> 1166 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/export-transfer-list.pngbin0 -> 455 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/import-transfer-list.pngbin0 -> 454 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/main.pngbin0 -> 623 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/moveDown.pngbin0 -> 466 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/moveUp.pngbin0 -> 466 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/over.opusbin0 -> 527 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/player_end.pngbin0 -> 696 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/player_pause.pngbin0 -> 640 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/player_play.pngbin0 -> 673 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/progressBarin.pngbin0 -> 4487 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/progressBarout.pngbin0 -> 1287 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/putOnBottom.pngbin0 -> 676 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/putOnTop.pngbin0 -> 681 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/remove.pngbin0 -> 683 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/resources/search.pngbin0 -> 781 bytes
-rwxr-xr-xplugins/Themes/Oxygen2/themesOptions.ui466
-rwxr-xr-x[-rw-r--r--]plugins/Themes/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/README.md0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/informations.xml2
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/interface.pro2
-rwxr-xr-xplugins/Themes/Supercopier/interface.pro.user.4.8-pre1328
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/interfaceResources.qrc0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/interfaceResources_unix.qrc0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/interfaceResources_windows.qrc0
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/SystemTrayIcon/add.pngbin246 -> 246 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/SystemTrayIcon/exit.pngbin545 -> 545 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/SystemTrayIcon/informations.pngbin281 -> 281 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/SystemTrayIcon/options.pngbin275 -> 275 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/SystemTrayIcon/systray_Caught_Unix.pngbin147 -> 147 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/SystemTrayIcon/systray_Caught_Windows.pngbin148 -> 148 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/SystemTrayIcon/systray_Semiuncaught_Unix.pngbin147 -> 147 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/SystemTrayIcon/systray_Semiuncaught_Windows.pngbin148 -> 148 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/SystemTrayIcon/systray_Uncaught_Unix.pngbin141 -> 141 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/SystemTrayIcon/systray_Uncaught_Windows.pngbin139 -> 139 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/add.pngbin240 -> 240 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/cancel.pngbin284 -> 284 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/export-transfer-list.pngbin264 -> 264 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/import-transfer-list.pngbin316 -> 316 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/main.pngbin148 -> 148 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/moveDown.pngbin191 -> 191 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/moveUp.pngbin190 -> 190 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/player_end.pngbin226 -> 226 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/player_pause.pngbin207 -> 207 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/player_play.pngbin208 -> 208 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/progressbarleft.pngbin133 -> 133 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/progressbarright.pngbin132 -> 132 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/putOnBottom.pngbin206 -> 206 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/putOnTop.pngbin208 -> 208 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/remove.pngbin254 -> 254 bytes
-rwxr-xr-x[-rw-r--r--]plugins/Themes/Supercopier/resources/search.pngbin237 -> 237 bytes
-rwxr-xr-x[-rw-r--r--]plugins/static-plugins-oxygen.qrc3
-rwxr-xr-x[-rw-r--r--]plugins/static-plugins-windows.qrc1
-rwxr-xr-x[-rw-r--r--]plugins/static-plugins.qrc9
-rwxr-xr-xrecipe-haiku.txt60
-rw-r--r--resources/Languages/en/informations.xml2
-rw-r--r--resources/Languages/en/translation.qmbin0 -> 334 bytes
-rw-r--r--resources/Languages/en/translation.ts1287
-rw-r--r--resources/finish.opusbin0 -> 2096 bytes
-rw-r--r--resources/resources-windows.rc2
-rw-r--r--resources/ultracopier-36x36.pngbin0 -> 1649 bytes
-rw-r--r--resources/ultracopier-48x48.pngbin0 -> 2162 bytes
-rw-r--r--resources/ultracopier-72x72.pngbin0 -> 3057 bytes
-rw-r--r--resources/ultracopier-oxygen.pngbin0 -> 3805 bytes
-rw-r--r--resources/ultracopier-oxygen2.pngbin0 -> 8794 bytes
-rw-r--r--resources/ultracopier-resources.qrc3
-rw-r--r--resources/ultracopier-supercopier.pngbin0 -> 2740 bytes
-rw-r--r--test-client-catchcopy/catchcopy-api-0002/ClientCatchcopy.cpp380
-rw-r--r--test-client-catchcopy/catchcopy-api-0002/ClientCatchcopy.h114
-rw-r--r--test-client-catchcopy/catchcopy-api-0002/ExtraSocketCatchcopy.cpp31
-rw-r--r--test-client-catchcopy/catchcopy-api-0002/ExtraSocketCatchcopy.h27
-rw-r--r--test-client-catchcopy/catchcopy-api-0002/ServerCatchcopy.cpp725
-rw-r--r--test-client-catchcopy/catchcopy-api-0002/ServerCatchcopy.h162
-rw-r--r--test-client-catchcopy/catchcopy-api-0002/VariablesCatchcopy.h14
-rwxr-xr-xtest-client-catchcopy/catchcopy-api-0002/documentation.dox31
-rw-r--r--test-client-catchcopy/icon.icobin0 -> 101758 bytes
-rw-r--r--test-client-catchcopy/images/dialog-ok-apply.pngbin0 -> 1977 bytes
-rwxr-xr-xtest-client-catchcopy/images/download.pngbin0 -> 3284 bytes
-rw-r--r--test-client-catchcopy/images/main.pngbin0 -> 621 bytes
-rw-r--r--test-client-catchcopy/images/process-stop.pngbin0 -> 2780 bytes
-rw-r--r--test-client-catchcopy/images/tools-report-bug.pngbin0 -> 3329 bytes
-rwxr-xr-xtest-client-catchcopy/images/upload.pngbin0 -> 3193 bytes
-rw-r--r--test-client-catchcopy/main.cpp10
-rw-r--r--test-client-catchcopy/mainwindow.cpp305
-rw-r--r--test-client-catchcopy/mainwindow.h68
-rw-r--r--test-client-catchcopy/mainwindow.ui441
-rwxr-xr-xtest-client-catchcopy/resources-windows.rc2
-rw-r--r--test-client-catchcopy/resources.qrc10
-rw-r--r--test-client-catchcopy/test-client-catchcopy.pro24
-rw-r--r--test/button.pngbin0 -> 3962 bytes
-rw-r--r--test/button.xcfbin0 -> 7496 bytes
-rw-r--r--test/chartarea/MainWindow.cpp26
-rw-r--r--test/chartarea/MainWindow.h26
-rw-r--r--test/chartarea/MainWindow.ui49
-rw-r--r--test/chartarea/chartarea.pro35
-rw-r--r--test/chartarea/main.cpp11
-rw-r--r--test/chartarea/widget.cpp134
-rw-r--r--test/chartarea/widget.h49
-rw-r--r--test/darkbutton/DarkButton.cpp99
-rw-r--r--test/darkbutton/DarkButton.h22
-rw-r--r--test/darkbutton/MainWindow.cpp41
-rw-r--r--test/darkbutton/MainWindow.h26
-rw-r--r--test/darkbutton/MainWindow.ui26
-rw-r--r--test/darkbutton/cancelDarkD.pngbin0 -> 151 bytes
-rw-r--r--test/darkbutton/cancelDarkE.pngbin0 -> 473 bytes
-rw-r--r--test/darkbutton/darkButton.pngbin0 -> 3969 bytes
-rw-r--r--test/darkbutton/darkButtonOver.pngbin0 -> 4286 bytes
-rw-r--r--test/darkbutton/darkButtonPushed.pngbin0 -> 3903 bytes
-rw-r--r--test/darkbutton/darkbutton.pro38
-rw-r--r--test/darkbutton/main.cpp11
-rw-r--r--test/darkbutton/res.qrc9
-rw-r--r--test/progressbardark/MainWindow.cpp32
-rw-r--r--test/progressbardark/MainWindow.h26
-rw-r--r--test/progressbardark/MainWindow.ui26
-rw-r--r--test/progressbardark/ProgressBarDark.cpp50
-rw-r--r--test/progressbardark/ProgressBarDark.h16
-rw-r--r--test/progressbardark/main.cpp11
-rw-r--r--test/progressbardark/progressBarin.pngbin0 -> 4487 bytes
-rw-r--r--test/progressbardark/progressBarout.pngbin0 -> 1287 bytes
-rw-r--r--test/progressbardark/progressbardark.pro38
-rw-r--r--test/progressbardark/progressbardark.pro.user.4.8-pre1336
-rw-r--r--test/progressbardark/res.qrc6
-rw-r--r--test/radialmap/Config.cpp31
-rw-r--r--test/radialmap/Config.h45
-rw-r--r--test/radialmap/MainWindow.cpp81
-rw-r--r--test/radialmap/MainWindow.h29
-rw-r--r--test/radialmap/MainWindow.ui46
-rw-r--r--test/radialmap/fileTree.cpp54
-rw-r--r--test/radialmap/fileTree.h157
-rw-r--r--test/radialmap/main.cpp11
-rw-r--r--test/radialmap/radialMap/labels.cpp317
-rw-r--r--test/radialmap/radialMap/map.cpp413
-rw-r--r--test/radialmap/radialMap/map.h84
-rw-r--r--test/radialmap/radialMap/radialMap.h109
-rw-r--r--test/radialmap/radialMap/sincos.h45
-rw-r--r--test/radialmap/radialMap/widget.cpp191
-rw-r--r--test/radialmap/radialMap/widget.h112
-rw-r--r--test/radialmap/radialMap/widgetEvents.cpp212
-rw-r--r--test/radialmap/radialmap.pro46
-rw-r--r--tools/to-pack/data/gentoo/ultracopier.ebuild118
-rwxr-xr-xtools/to-pack/data/qm-translation/ar.qmbin0 -> 33910 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/cs.qmbin0 -> 319922 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/da.qmbin0 -> 119836 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/de.qmbin0 -> 172 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/es.qmbin0 -> 82411 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/fa.qmbin0 -> 293111 bytes
-rw-r--r--tools/to-pack/data/qm-translation/fr.qmbin0 -> 255133 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/gl.qmbin0 -> 323577 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/he.qmbin0 -> 25666 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/hu.qmbin0 -> 272162 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/ja.qmbin0 -> 247883 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/ko.qmbin0 -> 241968 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/lt.qmbin0 -> 165373 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/pl.qmbin0 -> 316163 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/pt.qmbin0 -> 70321 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/ru.qmbin0 -> 183 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/sk.qmbin0 -> 176 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/sl.qmbin0 -> 228418 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/sv.qmbin0 -> 65848 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/uk.qmbin0 -> 216013 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/zh_CN.qmbin0 -> 117337 bytes
-rwxr-xr-xtools/to-pack/data/qm-translation/zh_TW.qmbin0 -> 117253 bytes
-rwxr-xr-x[-rw-r--r--]ultracopier.dox0
-rwxr-xr-x[-rw-r--r--]ultracopier.pro142
-rwxr-xr-xultracopier.pro.user.4.9-pre1601
981 files changed, 107279 insertions, 29372 deletions
diff --git a/COPYING b/COPYING
index 818433e..818433e 100644..100755
--- a/COPYING
+++ b/COPYING
diff --git a/CliParser.cpp b/CliParser.cpp
index a18e270..a18e270 100644..100755
--- a/CliParser.cpp
+++ b/CliParser.cpp
diff --git a/CliParser.h b/CliParser.h
index edcf115..edcf115 100644..100755
--- a/CliParser.h
+++ b/CliParser.h
diff --git a/CompilerInfo.h b/CompilerInfo.h
index 0ec1e08..c795fa3 100644..100755
--- a/CompilerInfo.h
+++ b/CompilerInfo.h
@@ -3,6 +3,8 @@
\author alpha_one_x86
\licence GPL3, see the file COPYING */
+#include <QObject>
+
/// \def COMPILERINFO the string to identify the compiler
#if defined(Q_CC_GNU)
#define COMPILERINFO std::string("GCC ")+std::to_string(__GNUC__)+"."+std::to_string(__GNUC_MINOR__)+"."+std::to_string(__GNUC_PATCHLEVEL__)
diff --git a/CopyEngineManager.cpp b/CopyEngineManager.cpp
index fc1ec95..61a1399 100644..100755
--- a/CopyEngineManager.cpp
+++ b/CopyEngineManager.cpp
@@ -10,7 +10,7 @@
#include "cpp11addition.h"
#ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
-#include "plugins/CopyEngine/Ultracopier/CopyEngineFactory.h"
+#include "plugins/CopyEngine/Ultracopier-Spec/CopyEngineFactory.h"
#endif
CopyEngineManager::CopyEngineManager(OptionDialog *optionDialog)
@@ -221,6 +221,7 @@ CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultra
pluginList[index].intances.push_back(pluginList.at(index).factory->getInstance());
temp.engine=pluginList.at(index).intances.back();
temp.canDoOnlyCopy=pluginList.at(index).canDoOnlyCopy;
+ temp.havePause=pluginList.at(index).factory->havePause();
temp.type=pluginList.at(index).type;
temp.transferListOperation=pluginList.at(index).transferListOperation;
return temp;
@@ -262,10 +263,13 @@ CopyEngineManager::returnCopyEngine CopyEngineManager::getCopyEngine(const Ultra
temp.engine=NULL;
return temp;
}
- pluginList[index].intances.push_back(pluginList.at(index).factory->getInstance());
+ PluginInterface_CopyEngineFactory * factory=pluginList.at(index).factory;
+ PluginInterface_CopyEngine * newIntance=factory->getInstance();
+ pluginList[index].intances.push_back(newIntance);
temp.engine=pluginList.at(index).intances.back();
temp.canDoOnlyCopy=pluginList.at(index).canDoOnlyCopy;
temp.type=pluginList.at(index).type;
+ temp.havePause=factory->havePause();
temp.transferListOperation=pluginList.at(index).transferListOperation;
return temp;
}
diff --git a/CopyEngineManager.h b/CopyEngineManager.h
index 904508c..4966004 100644..100755
--- a/CopyEngineManager.h
+++ b/CopyEngineManager.h
@@ -34,6 +34,7 @@ public:
{
PluginInterface_CopyEngine * engine; ///< The copy engine instance
bool canDoOnlyCopy; ///< true if can do only the copy (not move)
+ bool havePause;
Ultracopier::CopyType type; ///< Kind of copy what it can do
Ultracopier::TransferListOperation transferListOperation;
};
diff --git a/CopyListener.cpp b/CopyListener.cpp
index 31517d2..f357303 100644..100755
--- a/CopyListener.cpp
+++ b/CopyListener.cpp
@@ -16,6 +16,7 @@
CopyListener::CopyListener(OptionDialog *optionDialog)
{
+ nextOrderId=1;
stopIt=false;
this->optionDialog=optionDialog;
pluginLoader=new PluginLoaderCore(optionDialog);
diff --git a/CopyListener.h b/CopyListener.h
index 02a123c..02a123c 100644..100755
--- a/CopyListener.h
+++ b/CopyListener.h
diff --git a/Core.cpp b/Core.cpp
index eab1a8c..25f26eb 100644..100755
--- a/Core.cpp
+++ b/Core.cpp
@@ -22,6 +22,9 @@ Core::Core(CopyEngineManager *copyEngineList)
connect(ThemesManager::themesManager, &ThemesManager::theThemeNeedBeUnloaded, this, &Core::unloadInterface);
connect(ThemesManager::themesManager, &ThemesManager::theThemeIsReloaded, this, &Core::loadInterface, Qt::QueuedConnection);
connect(&forUpateInformation, &QTimer::timeout, this, &Core::periodicSynchronization);
+ #ifndef NOAUDIO
+ audio=nullptr;
+ #endif
}
Core::~Core()
@@ -35,6 +38,13 @@ Core::~Core()
delete copyList.at(index).engine;
index++;
}
+ #ifndef NOAUDIO
+ if(audio!=nullptr)
+ {
+ audio->stop();
+ delete audio;
+ }
+ #endif
}
void Core::newCopyWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &protocolsUsedForTheSources,const std::vector<std::string> &sources)
@@ -355,6 +365,7 @@ int Core::connectCopyEngine(const Ultracopier::CopyMode &mode,bool ignoreMode,co
newItem.action=Ultracopier::Idle;
newItem.lastProgression=0;//store the real byte transfered, used in time remaining calculation
newItem.isPaused=false;
+ newItem.havePause=returnInformations.havePause;
newItem.isRunning=false;
newItem.haveError=false;
newItem.lastConditionalSync.start();
@@ -461,7 +472,7 @@ void Core::doneTime(const std::vector<std::pair<uint64_t,uint32_t> > &timeList)
{
case Ultracopier::RemainingTimeAlgo_Logarithmic:
if(copyInstance.remainingTimeLogarithmicValue.size()<ULTRACOPIER_MAXREMAININGTIMECOL)
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"bug, copyInstance.remainingTimeLogarithmicValue.size() "+std::to_string(copyInstance.remainingTimeLogarithmicValue.size())+" <ULTRACOPIER_MAXREMAININGTIMECOL");
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"bug, copyInstance.remainingTimeLogarithmicValue.size() "+std::to_string(copyInstance.remainingTimeLogarithmicValue.size())+" <ULTRACOPIER_MAXREMAININGTIMECOL");
else
{
unsigned int sub_index=0;
@@ -472,7 +483,7 @@ void Core::doneTime(const std::vector<std::pair<uint64_t,uint32_t> > &timeList)
RemainingTimeLogarithmicColumn &remainingTimeLogarithmicColumn=copyInstance.remainingTimeLogarithmicValue[col];
if(copyInstance.remainingTimeLogarithmicValue.size()<=col)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"bug, copyInstance.remainingTimeLogarithmicValue.size() "+std::to_string(copyInstance.remainingTimeLogarithmicValue.size())+" < col %2"+std::to_string(col));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"bug, copyInstance.remainingTimeLogarithmicValue.size() "+std::to_string(copyInstance.remainingTimeLogarithmicValue.size())+" < col %2"+std::to_string(col));
break;
}
else
@@ -481,7 +492,7 @@ void Core::doneTime(const std::vector<std::pair<uint64_t,uint32_t> > &timeList)
{
remainingTimeLogarithmicColumn.lastProgressionSpeed.push_back(static_cast<unsigned int>(timeUnit.first/timeUnit.second));
if(remainingTimeLogarithmicColumn.lastProgressionSpeed.size()>ULTRACOPIER_MAXVALUESPEEDSTORED)
- remainingTimeLogarithmicColumn.lastProgressionSpeed.pop_back();
+ remainingTimeLogarithmicColumn.lastProgressionSpeed.erase(remainingTimeLogarithmicColumn.lastProgressionSpeed.begin());
}
}
sub_index++;
@@ -536,6 +547,25 @@ void Core::actionInProgess(const Ultracopier::EngineActionInProgress &action)
copyList[index].orderId.clear();
resetSpeedDetected(index);
}
+ #ifndef NOAUDIO
+ if(action==Ultracopier::Idle)
+ if(stringtobool(OptionEngine::optionEngine->getOptionValue("Ultracopier","soundWhenFinish")))
+ {
+ const std::string newSoundFile=OptionEngine::optionEngine->getOptionValue("Ultracopier","soundFile");
+ if(newSoundFile!=soundFile)
+ {
+ if(audio!=nullptr)
+ delete audio;
+ audio=static_cast<QAudioOutput *>(FacilityEngine::facilityEngine.prepareOpusAudio(newSoundFile,buffer));
+ soundFile=newSoundFile;
+ }
+ if(audio!=nullptr)
+ {
+ buffer.seek(0);
+ audio->start(&buffer);
+ }
+ }
+ #endif
}
else
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"unable to locate the interface sender");
@@ -702,14 +732,17 @@ void Core::connectInterfaceAndSync(const unsigned int &index)
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for pushGeneralProgression()");
if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::pushGeneralProgression, this,&Core::pushGeneralProgression, Qt::QueuedConnection))
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for pushGeneralProgression() for this");
- if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::errorToRetry, currentCopyInstance.interface,&PluginInterface_Themes::errorToRetry, Qt::QueuedConnection))
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::errorToRetry, currentCopyInstance.interface,&PluginInterface_Themes::errorToRetry, Qt::QueuedConnection))
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the interface can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for errorToRetry() for this");
+ if(!connect(currentCopyInstance.engine,&PluginInterface_CopyEngine::doneTime, currentCopyInstance.interface,&PluginInterface_Themes::doneTime,Qt::QueuedConnection))
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"error at connect, the engine can not work correctly: "+std::to_string(index)+": "+std::to_string((uint64_t)sender())+" for doneTime()");
currentCopyInstance.interface->setSupportSpeedLimitation(currentCopyInstance.engine->supportSpeedLimitation());
currentCopyInstance.interface->setCopyType(currentCopyInstance.type);
currentCopyInstance.interface->setTransferListOperation(currentCopyInstance.transferListOperation);
currentCopyInstance.interface->actionInProgess(currentCopyInstance.action);
currentCopyInstance.interface->isInPause(currentCopyInstance.isPaused);
+ currentCopyInstance.interface->havePause(currentCopyInstance.havePause);
if(currentCopyInstance.haveError)
currentCopyInstance.interface->errorDetected();
QWidget *tempWidget=currentCopyInstance.interface->getOptionsEngineWidget();
@@ -848,8 +881,12 @@ void Core::periodicSynchronizationWithIndex(const int &index)
average_speed+=remainingTimeLogarithmicColumn.lastProgressionSpeed.at(temp_loop_index);
temp_loop_index++;
}
- average_speed/=remainingTimeLogarithmicColumn.lastProgressionSpeed.size();
- remainingTimeValue+=remainingSize/average_speed;
+ if(!remainingTimeLogarithmicColumn.lastProgressionSpeed.empty())
+ {
+ average_speed/=remainingTimeLogarithmicColumn.lastProgressionSpeed.size();
+ if(average_speed!=0)
+ remainingTimeValue+=remainingSize/average_speed;
+ }
}
//fallback
else
@@ -860,7 +897,10 @@ void Core::periodicSynchronizationWithIndex(const int &index)
if(currentCopyInstance.totalProgression==0 || currentCopyInstance.currentProgression==0)
remainingTimeValue+=1;
else if((currentCopyInstance.totalProgression-currentCopyInstance.currentProgression)>1024)
- remainingTimeValue+=remainingSize/totAverageSpeed;
+ {
+ if(totAverageSpeed!=0)
+ remainingTimeValue+=remainingSize/totAverageSpeed;
+ }
}
else
remainingTimeValue+=1;
diff --git a/Core.h b/Core.h
index cd8733e..8b40ae3 100644..100755
--- a/Core.h
+++ b/Core.h
@@ -14,6 +14,10 @@
#include <QTime>
#include <QFile>
#include <QUrl>
+#ifndef NOAUDIO
+#include <QBuffer>
+#include <QAudioOutput>
+#endif
#include "Environment.h"
#include "StructEnumDefinition.h"
@@ -64,6 +68,7 @@ class Core : public QObject
std::string collisionAction;
std::string errorAction;
bool isPaused;
+ bool havePause;
bool isRunning;
Ultracopier::CopyType type;
Ultracopier::TransferListOperation transferListOperation;
@@ -129,6 +134,12 @@ class Core : public QObject
LogThread log;///< To save the log like mkpath, rmpath, error, copy, ...
uint64_t realByteTransfered;
+ #ifndef NOAUDIO
+ QBuffer buffer;
+ QAudioOutput *audio;
+ std::string soundFile;
+ #endif
+
static uint8_t fileCatNumber(uint64_t size);
signals:
void copyFinished(const uint32_t & orderId,bool withError) const;
diff --git a/DebugEngine.cpp b/DebugEngine.cpp
index 2168210..336b138 100644..100755
--- a/DebugEngine.cpp
+++ b/DebugEngine.cpp
@@ -14,11 +14,15 @@
#include "DebugEngine.h"
#include "ExtraSocket.h"
#include "cpp11addition.h"
+#include "FacilityEngine.h"
#ifdef WIN32
# define __func__ __FUNCTION__
#endif
+#ifdef ULTRACOPIER_DEBUGCONSOLE
+#undef ULTRACOPIER_DEBUGCONSOLE
+#endif
/// \brief The local macro: ULTRACOPIER_DEBUGCONSOLE
#if defined (__FILE__) && defined (__LINE__)
# define ULTRACOPIER_DEBUGCONSOLE(a,b) addDebugInformation(a,__func__,b,__FILE__,__LINE__)
@@ -59,7 +63,7 @@ DebugEngine::DebugEngine()
debugHtmlContent+="</style>";
debugHtmlContent+="<title>";
debugHtmlContent+="Ultracopier";
- debugHtmlContent+=" "+std::string(ULTRACOPIER_VERSION)+" "+ULTRACOPIER_PLATFORM_NAME.toStdString()+", debug report</title>";
+ debugHtmlContent+=" "+FacilityEngine::version()+" "+ULTRACOPIER_PLATFORM_NAME.toStdString()+", debug report</title>";
debugHtmlContent+="</head>";
debugHtmlContent+="<body>";
debugHtmlContent+="<table>";
@@ -335,7 +339,7 @@ void DebugEngine::addDebugInformation(const DebugLevel_custom &level,const std::
if(addDebugInformationCallNumber<ULTRACOPIER_DEBUG_MAX_GUI_LINE)
{
addDebugInformationCallNumber++;
- DebugModel::debugModel->addDebugInformation(startTime.elapsed(),level,function,text,file,static_cast<const unsigned int>(ligne),location);
+ DebugModel::debugModel->addDebugInformation(startTime.elapsed(),level,function,text,file,static_cast<unsigned int>(ligne),location);
}
}
}
diff --git a/DebugEngine.h b/DebugEngine.h
index 7a75264..7a75264 100644..100755
--- a/DebugEngine.h
+++ b/DebugEngine.h
diff --git a/DebugEngineMacro.h b/DebugEngineMacro.h
index 4785067..ab53c55 100644..100755
--- a/DebugEngineMacro.h
+++ b/DebugEngineMacro.h
@@ -12,6 +12,9 @@
#include "Variable.h"
+#ifdef ULTRACOPIER_DEBUGCONSOLE
+#undef ULTRACOPIER_DEBUGCONSOLE
+#endif
/// \brief Macro for the debug log
#ifdef ULTRACOPIER_DEBUG
# include "DebugEngine.h"
diff --git a/DebugModel.cpp b/DebugModel.cpp
index 5afa3ba..5afa3ba 100644..100755
--- a/DebugModel.cpp
+++ b/DebugModel.cpp
diff --git a/Environment.h b/Environment.h
index d653c5f..d653c5f 100644..100755
--- a/Environment.h
+++ b/Environment.h
diff --git a/EventDispatcher.cpp b/EventDispatcher.cpp
index c3fc61f..1e37592 100644..100755
--- a/EventDispatcher.cpp
+++ b/EventDispatcher.cpp
@@ -28,8 +28,6 @@
#include <tchar.h>
#include <stdio.h>
#include <strsafe.h>
- typedef void (WINAPI *PGNSI) (LPSYSTEM_INFO);
- typedef BOOL (WINAPI *PGPI) (DWORD, DWORD, DWORD, DWORD, PDWORD);
#endif
#ifdef Q_OS_MAC
#include <QStringList>
@@ -51,6 +49,7 @@ EventDispatcher::EventDispatcher()
qRegisterMetaType<std::vector<Ultracopier::ProgressionItem> >("std::vector<Ultracopier::ProgressionItem>");
qRegisterMetaType<std::vector<Ultracopier::ReturnActionOnCopyList> >("std::vector<Ultracopier::ReturnActionOnCopyList>");
qRegisterMetaType<std::vector<std::string> >("std::vector<std::string>");
+ qRegisterMetaType<QLocalSocket::LocalSocketError >("QLocalSocket::LocalSocketError");
copyServer=new CopyListener(&optionDialog);
if(!connect(&localListener, &LocalListener::cli, &cliParser, &CliParser::cli,Qt::QueuedConnection))
@@ -113,7 +112,7 @@ EventDispatcher::EventDispatcher()
#ifdef __STDC_VERSION__
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"__STDC_VERSION__: "+std::to_string(__STDC_VERSION__));
#endif
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,std::string("ULTRACOPIER_VERSION: ")+ULTRACOPIER_VERSION);
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,std::string("ULTRACOPIER_VERSION: ")+FacilityEngine::version());
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,std::string("Qt version: ")+qVersion()+" "+std::to_string(QT_VERSION));
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,std::string("ULTRACOPIER_PLATFORM_NAME: ")+ULTRACOPIER_PLATFORM_NAME.toStdString());
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"Application path: "+QCoreApplication::applicationFilePath().toStdString()+" "+std::to_string(QCoreApplication::applicationPid()));
@@ -139,7 +138,24 @@ EventDispatcher::EventDispatcher()
int index=0;
while(index<mountedVolumesList.size())
{
+ #ifdef Q_OS_WIN32
+ const int typeint=GetDriveTypeA(mountedVolumesList.at(index).rootPath().toStdString().c_str());
+ std::string type("Unknown type ("+std::to_string(typeint)+")");
+ switch(typeint)
+ {
+ case 0: type="Cannot be determined";break;
+ case 1: type="Invalid root path/Not available";break;
+ case 2: type="Removable";break;
+ case 3: type="Fixed";break;
+ case 4: type="Network";break;
+ case 5: type="CD-ROM";break;
+ case 6: type="RAMDISK";break;
+ default:break;
+ }
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"mountSysPoint: "+mountedVolumesList.at(index).rootPath().toStdString()+" "+type);
+ #else
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,"mountSysPoint: "+mountedVolumesList.at(index).rootPath().toStdString());
+ #endif
index++;
}
if(mountedVolumesList.isEmpty())
@@ -151,11 +167,11 @@ EventDispatcher::EventDispatcher()
lunchInitFunction.setSingleShot(true);
connect(&lunchInitFunction,&QTimer::timeout,this,&EventDispatcher::initFunction,Qt::QueuedConnection);
lunchInitFunction.start();
- if(OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!="na" && OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!=ULTRACOPIER_VERSION)
+ if(OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!="na" && OptionEngine::optionEngine->getOptionValue("Ultracopier","Last_version_used")!=FacilityEngine::version())
{
//then ultracopier have been updated
}
- OptionEngine::optionEngine->setOptionValue("Ultracopier","Last_version_used",ULTRACOPIER_VERSION);
+ OptionEngine::optionEngine->setOptionValue("Ultracopier","Last_version_used",FacilityEngine::version());
unsigned int a=stringtouint32(OptionEngine::optionEngine->getOptionValue("Ultracopier","ActionOnManualOpen"));
if(a>2)
OptionEngine::optionEngine->setOptionValue("Ultracopier","ActionOnManualOpen","1");
@@ -393,10 +409,7 @@ std::string EventDispatcher::GetOSDisplayString()
QString Os;
OSVERSIONINFOEX osvi;
SYSTEM_INFO si;
- PGNSI pGNSI;
- PGPI pGPI;
BOOL bOsVersionInfoEx;
- DWORD dwType;
ZeroMemory(&si, sizeof(SYSTEM_INFO));
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
@@ -406,15 +419,7 @@ std::string EventDispatcher::GetOSDisplayString()
if(bOsVersionInfoEx == 0)
return "Os detection blocked";
-
- // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
-
- pGNSI = (PGNSI) GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")),
- "GetNativeSystemInfo");
- if(NULL != pGNSI)
- pGNSI(&si);
- else GetSystemInfo(&si);
+ GetNativeSystemInfo(&si);
if(VER_PLATFORM_WIN32_NT==osvi.dwPlatformId && osvi.dwMajorVersion>4)
{
@@ -443,70 +448,6 @@ std::string EventDispatcher::GetOSDisplayString()
else Os+=QStringLiteral("Windows Server (dwMajorVersion: %1, dwMinorVersion: %2)").arg(osvi.dwMinorVersion).arg(osvi.dwMinorVersion);
break;
}
-
- pGPI = (PGPI) GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")),
- "GetProductInfo");
-
- pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
-
- switch(dwType)
- {
- case PRODUCT_ULTIMATE:
- Os+=QStringLiteral("Ultimate Edition");
- break;
- case PRODUCT_PROFESSIONAL:
- Os+=QStringLiteral("Professional");
- break;
- case PRODUCT_HOME_PREMIUM:
- Os+=QStringLiteral("Home Premium Edition");
- break;
- case PRODUCT_HOME_BASIC:
- Os+=QStringLiteral("Home Basic Edition");
- break;
- case PRODUCT_ENTERPRISE:
- Os+=QStringLiteral("Enterprise Edition");
- break;
- case PRODUCT_BUSINESS:
- Os+=QStringLiteral("Business Edition");
- break;
- case PRODUCT_STARTER:
- Os+=QStringLiteral("Starter Edition");
- break;
- case PRODUCT_CLUSTER_SERVER:
- Os+=QStringLiteral("Cluster Server Edition");
- break;
- case PRODUCT_DATACENTER_SERVER:
- Os+=QStringLiteral("Datacenter Edition");
- break;
- case PRODUCT_DATACENTER_SERVER_CORE:
- Os+=QStringLiteral("Datacenter Edition (core installation)");
- break;
- case PRODUCT_ENTERPRISE_SERVER:
- Os+=QStringLiteral("Enterprise Edition");
- break;
- case PRODUCT_ENTERPRISE_SERVER_CORE:
- Os+=QStringLiteral("Enterprise Edition (core installation)");
- break;
- case PRODUCT_ENTERPRISE_SERVER_IA64:
- Os+=QStringLiteral("Enterprise Edition for Itanium-based Systems");
- break;
- case PRODUCT_SMALLBUSINESS_SERVER:
- Os+=QStringLiteral("Small Business Server");
- break;
- case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
- Os+=QStringLiteral("Small Business Server Premium Edition");
- break;
- case PRODUCT_STANDARD_SERVER:
- Os+=QStringLiteral("Standard Edition");
- break;
- case PRODUCT_STANDARD_SERVER_CORE:
- Os+=QStringLiteral("Standard Edition (core installation)");
- break;
- case PRODUCT_WEB_SERVER:
- Os+=QStringLiteral("Web Server Edition");
- break;
- }
}
else if(osvi.dwMajorVersion==5)
{
diff --git a/EventDispatcher.h b/EventDispatcher.h
index 77b1948..77b1948 100644..100755
--- a/EventDispatcher.h
+++ b/EventDispatcher.h
diff --git a/ExtraSocket.cpp b/ExtraSocket.cpp
index ef196fa..ef196fa 100644..100755
--- a/ExtraSocket.cpp
+++ b/ExtraSocket.cpp
diff --git a/ExtraSocket.h b/ExtraSocket.h
index c8d44c5..c8d44c5 100644..100755
--- a/ExtraSocket.h
+++ b/ExtraSocket.h
diff --git a/FacilityEngine.cpp b/FacilityEngine.cpp
index 185492a..b96c932 100644..100755
--- a/FacilityEngine.cpp
+++ b/FacilityEngine.cpp
@@ -13,6 +13,11 @@
#endif
#include <windows.h>
#endif
+#ifndef NOAUDIO
+#include "opusfile/opusfile.h"
+#include <QAudioOutput>
+#include <QCoreApplication>
+#endif
FacilityEngine FacilityEngine::facilityEngine;
@@ -73,6 +78,7 @@ void FacilityEngine::retranslate()
translations["Copying"]=tr("Copying").toStdString();
translations["Listing and copying"]=tr("Listing and copying").toStdString();
translations["Time remaining:"]=tr("Time remaining:").toStdString();
+ translations["Remaining:"]=tr("Remaining:").toStdString();
//for copy engine
translations["Ask"]=tr("Ask").toStdString();
translations["Skip"]=tr("Skip").toStdString();
@@ -230,21 +236,29 @@ std::string FacilityEngine::simplifiedRemainingTime(const uint32_t &seconds) con
/// \brief Return ultimate url, empty is not found or already ultimate
std::string FacilityEngine::ultimateUrl() const
{
+ #ifndef ULTRACOPIER_LITTLE
if(ProductKey::productKey->isUltimate())
return std::string();
else
{
- #if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
+ #if ! defined(Q_OS_LINUX)
return "https://shop.first-world.info/";
#else
return std::string();
#endif
}
+ #else
+ return std::string();
+ #endif
}
bool FacilityEngine::isUltimate() const
{
+ #ifndef ULTRACOPIER_LITTLE
return ProductKey::productKey->isUltimate();
+ #else
+ return true;
+ #endif
}
/// \brief Return the software name
@@ -256,3 +270,90 @@ std::string FacilityEngine::softwareName() const
return "Ultracopier";
#endif
}
+
+/// \brief return audio if created from opus file, nullptr if failed
+void *FacilityEngine::prepareOpusAudio(const std::string &file,QBuffer &buffer) const
+{
+ #ifndef NOAUDIO
+ if(file.empty())
+ return nullptr;
+
+ QAudioOutput* audio;
+ QAudioFormat format;
+ format.setSampleRate(48000);
+ format.setChannelCount(2);
+ format.setSampleSize(16);
+ format.setCodec("audio/pcm");
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setSampleType(QAudioFormat::SignedInt);
+
+ QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
+ if (!info.isFormatSupported(format)) {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"raw audio format not supported by backend, cannot play audio.");
+ return nullptr;
+ }
+ audio = new QAudioOutput(format);
+ buffer.open(QBuffer::ReadWrite);
+
+ int ret;
+ std::string path=file;
+ if(path.find("/") == std::string::npos && path.find("\\") == std::string::npos)
+ {
+ QString appPath=QCoreApplication::applicationDirPath();
+ if(appPath.endsWith("/") || appPath.endsWith("\\"))
+ path=appPath.toStdString()+path;
+ else
+ path=appPath.toStdString()+"/"+path;
+ }
+ OggOpusFile *of=op_open_file(file.c_str(),&ret);
+ if(of==NULL) {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"Failed to open file"+file+", "+std::to_string(ret));
+ return nullptr;
+ }
+ ogg_int64_t pcm_offset;
+ ogg_int64_t nsamples;
+ nsamples=0;
+ pcm_offset=op_pcm_tell(of);
+ if(pcm_offset!=0)
+ fprintf(stderr,"Non-zero starting PCM offset: %li\n",(long)pcm_offset);
+ for(;;) {
+ ogg_int64_t next_pcm_offset;
+ opus_int16 pcm[120*48*2];
+ unsigned char out[120*48*2*2];
+ int si;
+ ret=op_read_stereo(of,pcm,sizeof(pcm)/sizeof(*pcm));
+ if(ret==OP_HOLE) {
+ fprintf(stderr,"\nHole detected! Corrupt file segment?\n");
+ continue;
+ }
+ else if(ret<0) {
+ fprintf(stderr,"\nError decoding '%s': %i\n","file.opus",ret);
+ ret=EXIT_FAILURE;
+ break;
+ }
+ next_pcm_offset=op_pcm_tell(of);
+ pcm_offset=next_pcm_offset;
+ if(ret<=0) {
+ ret=EXIT_SUCCESS;
+ break;
+ }
+ for(si=0;si<2*ret;si++) { /// Ensure the data is little-endian before writing it out.
+ out[2*si+0]=(unsigned char)(pcm[si]&0xFF);
+ out[2*si+1]=(unsigned char)(pcm[si]>>8&0xFF);
+ }
+ buffer.write(reinterpret_cast<char *>(out),sizeof(*out)*4*ret);
+ nsamples+=ret;
+ }
+ if(ret==EXIT_SUCCESS)
+ fprintf(stderr,"\nDone: played ");
+ op_free(of);
+
+ buffer.seek(0);
+ return audio;
+ // audio->start(&buffer); -> do out of this function
+ #else
+ (void)file;
+ (void)buffer;
+ return nullptr;
+ #endif
+}
diff --git a/FacilityEngine.h b/FacilityEngine.h
index ce4bb36..fb93876 100644..100755
--- a/FacilityEngine.h
+++ b/FacilityEngine.h
@@ -47,7 +47,10 @@ public:
static std::string separator();
/// \brief return if is ultimate
bool isUltimate() const;
+ /// \brief return audio if created from opus file, nullptr if failed
+ void/*casted to #ifndef QAudioOutput*/* prepareOpusAudio(const std::string &file,QBuffer &buffer) const;
+ static std::string version();
static FacilityEngine facilityEngine;
private:
//undirect translated string
diff --git a/FacilityEngineVersion.cpp b/FacilityEngineVersion.cpp
new file mode 100755
index 0000000..5fe36f6
--- /dev/null
+++ b/FacilityEngineVersion.cpp
@@ -0,0 +1,7 @@
+#include "FacilityEngine.h"
+#include "Version.h"
+
+std::string FacilityEngine::version()
+{
+ return ULTRACOPIER_VERSION;
+}
diff --git a/HelpDialog.cpp b/HelpDialog.cpp
index b52e402..584e76e 100644..100755
--- a/HelpDialog.cpp
+++ b/HelpDialog.cpp
@@ -5,6 +5,7 @@
#include "HelpDialog.h"
#include "ProductKey.h"
+#include "FacilityEngine.h"
#include <QTreeWidgetItem>
#include <QApplication>
@@ -32,11 +33,7 @@ HelpDialog::HelpDialog() :
#endif // ULTRACOPIER_DEBUG
//connect the about Qt
connect(ui->pushButtonAboutQt,&QPushButton::toggled,&QApplication::aboutQt);
- #ifdef ULTRACOPIER_MODE_SUPERCOPIER
- setWindowTitle(tr("About Supercopier"));
- #else
setWindowTitle(tr("About Ultracopier"));
- #endif
#ifndef ULTRACOPIER_INTERNET_SUPPORT
ui->checkUpdate->hide();
#endif
@@ -69,9 +66,9 @@ void HelpDialog::reloadTextValue()
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
QString text=ui->label_ultracopier->text();
if(ProductKey::productKey->isUltimate())
- text=text.replace(QStringLiteral("%1"),QStringLiteral("Ultimate %1").arg(ULTRACOPIER_VERSION));
+ text=text.replace(QStringLiteral("%1"),QStringLiteral("Ultimate %1").arg(QString::fromStdString(FacilityEngine::version())));
else
- text=text.replace(QStringLiteral("%1"),ULTRACOPIER_VERSION);
+ text=text.replace(QStringLiteral("%1"),QString::fromStdString(FacilityEngine::version()));
#ifdef ULTRACOPIER_MODE_SUPERCOPIER
text=text.replace(QStringLiteral("Ultracopier"),QStringLiteral("Supercopier"),Qt::CaseInsensitive);
#endif
diff --git a/HelpDialog.h b/HelpDialog.h
index cb47606..cb47606 100644..100755
--- a/HelpDialog.h
+++ b/HelpDialog.h
diff --git a/HelpDialog.ui b/HelpDialog.ui
index d3f3076..617041e 100644..100755
--- a/HelpDialog.ui
+++ b/HelpDialog.ui
@@ -91,6 +91,9 @@ This version is compiled as version: %1.</string>
<property name="text">
<string>Author: BRULE Herman Jacques Roger (alpha_one_x86), company: &lt;a href=&quot;http://www.confiared.com/&quot;&gt;confiared&lt;/a&gt;</string>
</property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
</widget>
</item>
</layout>
diff --git a/InternetUpdater.cpp b/InternetUpdater.cpp
index 28b7215..c5d4ec9 100644..100755
--- a/InternetUpdater.cpp
+++ b/InternetUpdater.cpp
@@ -3,6 +3,7 @@
#include "OptionEngine.h"
#include "cpp11addition.h"
#include "ProductKey.h"
+#include "Version.h"
#ifdef ULTRACOPIER_INTERNET_SUPPORT
@@ -16,9 +17,9 @@ InternetUpdater::InternetUpdater(QObject *parent) :
{
connect(&newUpdateTimer,&QTimer::timeout,this,&InternetUpdater::downloadFile);
connect(&firstUpdateTimer,&QTimer::timeout,this,&InternetUpdater::downloadFile);
- newUpdateTimer.start(1000*3600);
+ newUpdateTimer.start(1000*3600*72);
firstUpdateTimer.setSingleShot(true);
- firstUpdateTimer.start(1000*60);
+ firstUpdateTimer.start(1000*600);
reply=NULL;
qnam=new QNetworkAccessManager();
}
@@ -55,9 +56,9 @@ void InternetUpdater::downloadFileInternal(const bool force)
#endif
std::string ultracopierVersion;
if(ProductKey::productKey->isUltimate())
- ultracopierVersion=name+" Ultimate/"+ULTRACOPIER_VERSION;
+ ultracopierVersion=name+" Ultimate/"+FacilityEngine::version();
else
- ultracopierVersion=name+"/"+ULTRACOPIER_VERSION;
+ ultracopierVersion=name+"/"+FacilityEngine::version();
#ifdef ULTRACOPIER_VERSION_PORTABLE
#ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
ultracopierVersion+=" portable/all-in-one";
@@ -122,14 +123,14 @@ void InternetUpdater::httpFinished()
reply=NULL;
return;
}
- if(newVersion==ULTRACOPIER_VERSION)
+ if(newVersion.toStdString()==FacilityEngine::version())
{
reply->deleteLater();
reply=NULL;
emit noNewUpdate();
return;
}
- if(PluginsManager::compareVersion(newVersion.toStdString(),"<=",ULTRACOPIER_VERSION))
+ if(PluginsManager::compareVersion(newVersion.toStdString(),"<=",FacilityEngine::version()))
{
reply->deleteLater();
reply=NULL;
diff --git a/InternetUpdater.h b/InternetUpdater.h
index 7ed6abc..7ed6abc 100644..100755
--- a/InternetUpdater.h
+++ b/InternetUpdater.h
diff --git a/LanguagesManager.cpp b/LanguagesManager.cpp
index 136c590..136c590 100644..100755
--- a/LanguagesManager.cpp
+++ b/LanguagesManager.cpp
diff --git a/LanguagesManager.h b/LanguagesManager.h
index e7c715e..e7c715e 100644..100755
--- a/LanguagesManager.h
+++ b/LanguagesManager.h
diff --git a/LocalListener.cpp b/LocalListener.cpp
index 4a418aa..6983b10 100644..100755
--- a/LocalListener.cpp
+++ b/LocalListener.cpp
@@ -83,6 +83,7 @@ bool LocalListener::tryConnect()
int byteWriten =
#endif
localSocket.write(blockToSend);
+ localSocket.readAll();
#ifdef ULTRACOPIER_DEBUG
if(!localSocket.isValid())
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"localSocket is not valid!");
@@ -92,7 +93,7 @@ bool LocalListener::tryConnect()
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"blockToSend("+std::to_string(blockToSend.size())+
")!=byteWriten("+std::to_string(byteWriten)+")");
#endif // ULTRACOPIER_DEBUG
- if(localSocket.waitForBytesWritten(200))
+ if(localSocket.waitForBytesWritten())
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"Block send correctly");
}
@@ -107,7 +108,12 @@ bool LocalListener::tryConnect()
}
while(block.size());
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"disconnect the socket");
+ localSocket.readAll();
+ localSocket.waitForBytesWritten();
+ QThread::msleep(50);
localSocket.disconnectFromServer();
+ QThread::msleep(50);
+ localSocket.waitForDisconnected();
return true;
}
else
diff --git a/LocalListener.h b/LocalListener.h
index 9f91a95..9f91a95 100644..100755
--- a/LocalListener.h
+++ b/LocalListener.h
diff --git a/LocalPluginOptions.cpp b/LocalPluginOptions.cpp
index 0834d9d..0834d9d 100644..100755
--- a/LocalPluginOptions.cpp
+++ b/LocalPluginOptions.cpp
diff --git a/LocalPluginOptions.h b/LocalPluginOptions.h
index 853181f..853181f 100644..100755
--- a/LocalPluginOptions.h
+++ b/LocalPluginOptions.h
diff --git a/LogThread.cpp b/LogThread.cpp
index 234ccbf..234ccbf 100644..100755
--- a/LogThread.cpp
+++ b/LogThread.cpp
diff --git a/LogThread.h b/LogThread.h
index 40f9154..40f9154 100644..100755
--- a/LogThread.h
+++ b/LogThread.h
diff --git a/OSSpecific.cpp b/OSSpecific.cpp
index ada8d68..60f5b92 100644..100755
--- a/OSSpecific.cpp
+++ b/OSSpecific.cpp
@@ -9,6 +9,12 @@ OSSpecific::OSSpecific(QWidget *parent) :
if(!QIcon::fromTheme(QStringLiteral("dialog-warning")).isNull())
setWindowIcon(QIcon::fromTheme(QStringLiteral("dialog-warning")));
updateText();
+ #if defined(ULTRACOPIER_PLUGIN_ALL_IN_ONE) || defined(ULTRACOPIER_MODE_SUPERCOPIER)
+ setMinimumWidth(0);
+ ui->widgetStyle->setVisible(false);
+ #endif
+ updateGeometry();
+ adjustSize();
}
OSSpecific::~OSSpecific()
@@ -20,7 +26,7 @@ void OSSpecific::updateText()
{
QString text;
#if defined(Q_OS_LINUX)
- text=tr("The replacement of default copy/move system is not supported by the file manager (Dolphin, Nautilus, ...).<br />Ask the developer to support it.<br />You need do the copy/move manually.");
+ text=tr("The replacement of default copy/move system is not supported by the file manager (Dolphin, Nautilus, ...).<br />Ask the developer of your file manager to support it.<br />You need do the copy/move manually.");
#elif defined(Q_OS_WIN32)
text=tr("Reboot the system if previously had similar software installed (like Teracopy, Supercopier or an earlier version of Ultracopier).");
#elif defined(Q_OS_MAC)
@@ -52,7 +58,41 @@ bool OSSpecific::dontShowAgain()
return ui->dontShowAgain->isChecked();
}
+QString OSSpecific::theme()
+{
+ #if defined(ULTRACOPIER_PLUGIN_ALL_IN_ONE) || defined(ULTRACOPIER_MODE_SUPERCOPIER)
+ return "classic";
+ #else
+ switch (ui->comboBox->currentIndex()) {
+ default:
+ case 0:
+ return "classic";
+ case 1:
+ return "modern";
+ case 2:
+ return "supercopier";
+ }
+ #endif
+}
+
void OSSpecific::on_pushButton_clicked()
{
close();
}
+
+void OSSpecific::on_comboBox_currentIndexChanged(int index)
+{
+ switch(index)
+ {
+ default:
+ case 0:
+ ui->themePreview->setPixmap(QPixmap(":/ultracopier-oxygen.png"));
+ break;
+ case 1:
+ ui->themePreview->setPixmap(QPixmap(":/ultracopier-oxygen2.png"));
+ break;
+ case 2:
+ ui->themePreview->setPixmap(QPixmap(":/ultracopier-supercopier.png"));
+ break;
+ }
+}
diff --git a/OSSpecific.h b/OSSpecific.h
index 0b6ffcb..d9f3d0d 100644..100755
--- a/OSSpecific.h
+++ b/OSSpecific.h
@@ -17,9 +17,11 @@ public:
explicit OSSpecific(QWidget *parent = 0);
~OSSpecific();
bool dontShowAgain();
+ QString theme();
private slots:
void on_pushButton_clicked();
void updateText();
+ void on_comboBox_currentIndexChanged(int index);
protected slots:
void changeEvent(QEvent *e);
private:
diff --git a/OSSpecific.ui b/OSSpecific.ui
index 3d0d89e..2a76c69 100644..100755
--- a/OSSpecific.ui
+++ b/OSSpecific.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>600</width>
- <height>88</height>
+ <width>731</width>
+ <height>413</height>
</rect>
</property>
<property name="sizePolicy">
@@ -18,7 +18,7 @@
</property>
<property name="minimumSize">
<size>
- <width>500</width>
+ <width>380</width>
<height>0</height>
</size>
</property>
@@ -29,7 +29,126 @@
<iconset resource="resources/ultracopier-resources.qrc">
<normaloff>:/warning.png</normaloff>:/warning.png</iconset>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QWidget" name="widgetStyle" native="true">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <spacer name="horizontalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="themePreview">
+ <property name="minimumSize">
+ <size>
+ <width>360</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>360</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="pixmap">
+ <pixmap resource="resources/ultracopier-resources.qrc">:/ultracopier-oxygen.png</pixmap>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBox">
+ <item>
+ <property name="text">
+ <string>Classic</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Modern</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string notr="true">Supercopier</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
diff --git a/OptionDialog.cpp b/OptionDialog.cpp
index 4727501..64d5e13 100644..100755
--- a/OptionDialog.cpp
+++ b/OptionDialog.cpp
@@ -8,13 +8,20 @@
#include "OSSpecific.h"
#include "LanguagesManager.h"
#include "cpp11addition.h"
+#include "FacilityEngine.h"
#include <QDomElement>
#include <QFileDialog>
#include <QMessageBox>
+#ifndef NOAUDIO
+#include <QAudioOutput>
+#endif
OptionDialog::OptionDialog() :
ui(new Ui::OptionDialog)
+ #ifndef NOAUDIO
+ ,buffer(&data)
+ #endif
{
quit=false;
QStringList ultracopierArguments=QCoreApplication::arguments();
@@ -27,8 +34,8 @@ OptionDialog::OptionDialog() :
oSSpecific=NULL;
ui->setupUi(this);
ui->treeWidget->topLevelItem(0)->setSelected(true);
- ui->treeWidget->topLevelItem(4)->setTextColor(0,QColor(150, 150, 150, 255));
- ui->treeWidget->topLevelItem(5)->setTextColor(0,QColor(150, 150, 150, 255));
+ ui->treeWidget->topLevelItem(4)->setForeground(0,QColor(150, 150, 150, 255));
+ ui->treeWidget->topLevelItem(5)->setForeground(0,QColor(150, 150, 150, 255));
ui->treeWidget->expandAll();
ui->pluginList->expandAll();
number_of_listener=0;
@@ -402,10 +409,12 @@ void OptionDialog::loadOption()
newOptionValue("Ultracopier", "ActionOnManualOpen", OptionEngine::optionEngine->getOptionValue("Ultracopier","ActionOnManualOpen"));
newOptionValue("Ultracopier", "GroupWindowWhen", OptionEngine::optionEngine->getOptionValue("Ultracopier","GroupWindowWhen"));
newOptionValue("Ultracopier", "confirmToGroupWindows", OptionEngine::optionEngine->getOptionValue("Ultracopier","confirmToGroupWindows"));
- newOptionValue("Ultracopier", "displayOSSpecific", OptionEngine::optionEngine->getOptionValue("Ultracopier","displayOSSpecific"));
+ newOptionValue("Ultracopier", "displayOSSpecific2", OptionEngine::optionEngine->getOptionValue("Ultracopier","displayOSSpecific2"));
newOptionValue("Ultracopier", "checkTheUpdate", OptionEngine::optionEngine->getOptionValue("Ultracopier","checkTheUpdate"));
newOptionValue("Ultracopier", "remainingTimeAlgorithm", OptionEngine::optionEngine->getOptionValue("Ultracopier","remainingTimeAlgorithm"));
newOptionValue("Ultracopier", "portable", OptionEngine::optionEngine->getOptionValue("Ultracopier","portable"));
+ newOptionValue("Ultracopier", "soundFile", OptionEngine::optionEngine->getOptionValue("Ultracopier","soundFile"));
+ newOptionValue("Ultracopier", "soundWhenFinish", OptionEngine::optionEngine->getOptionValue("Ultracopier","soundWhenFinish"));
newOptionValue("Language", "Language", OptionEngine::optionEngine->getOptionValue("Language","Language"));
newOptionValue("Language", "Language_force", OptionEngine::optionEngine->getOptionValue("Language","Language_force"));
#ifndef ULTRACOPIER_VERSION_PORTABLE
@@ -447,7 +456,7 @@ void OptionDialog::loadOption()
allPluginsIsLoaded=true;
on_Ultracopier_current_theme_currentIndexChanged(ui->Ultracopier_current_theme->currentIndex());
- if(stringtobool(OptionEngine::optionEngine->getOptionValue("Ultracopier","displayOSSpecific")))
+ if(stringtobool(OptionEngine::optionEngine->getOptionValue("Ultracopier","displayOSSpecific2")))
{
if(!quit)
{
@@ -463,7 +472,11 @@ void OptionDialog::oSSpecificClosed()
if(oSSpecific==NULL)
return;
if(oSSpecific->dontShowAgain())
- OptionEngine::optionEngine->setOptionValue("Ultracopier","displayOSSpecific","false");
+ OptionEngine::optionEngine->setOptionValue("Ultracopier","displayOSSpecific2","false");
+ if(oSSpecific->theme()=="classic")
+ OptionEngine::optionEngine->setOptionValue("Themes","Ultracopier_current_theme","Oxygen");
+ else if(oSSpecific->theme()=="supercopier")
+ OptionEngine::optionEngine->setOptionValue("Themes","Ultracopier_current_theme","Supercopier");
delete oSSpecific;
oSSpecific=NULL;
}
@@ -585,10 +598,14 @@ void OptionDialog::newOptionValue(const std::string &group,const std::string &na
ui->GroupWindowWhen->setCurrentIndex(stringtoint32(value));
else if(name=="confirmToGroupWindows")
ui->confirmToGroupWindows->setChecked(stringtobool(value));
- else if(name=="displayOSSpecific")
+ else if(name=="displayOSSpecific2")
ui->DisplayOSWarning->setChecked(stringtobool(value));
else if(name=="checkTheUpdate")
ui->checkTheUpdate->setChecked(stringtobool(value));
+ else if(name=="soundFile")
+ ui->soundFile->setText(QString::fromStdString(value));
+ else if(name=="soundWhenFinish")
+ ui->soundWhenFinish->setChecked(stringtobool(value));
else if(name=="remainingTimeAlgorithm")
{
bool ok;
@@ -984,7 +1001,7 @@ void OptionDialog::on_DisplayOSWarning_clicked()
if(allPluginsIsLoaded)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
- OptionEngine::optionEngine->setOptionValue("Ultracopier","displayOSSpecific",booltostring(ui->DisplayOSWarning->isChecked()));
+ OptionEngine::optionEngine->setOptionValue("Ultracopier","displayOSSpecific2",booltostring(ui->DisplayOSWarning->isChecked()));
}
}
@@ -1036,3 +1053,40 @@ void OptionDialog::on_portable_toggled(bool)
else
QFile::remove(settingsFilePath+"/Ultracopier.conf");
}
+
+void OptionDialog::on_soundFile_editingFinished()
+{
+ if(allPluginsIsLoaded)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
+ OptionEngine::optionEngine->setOptionValue("Ultracopier","soundFile",ui->soundFile->text().toStdString());
+ }
+}
+
+void OptionDialog::on_soundWhenFinish_toggled(bool checked)
+{
+ if(allPluginsIsLoaded)
+ {
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
+ OptionEngine::optionEngine->setOptionValue("Ultracopier","soundWhenFinish",std::to_string(checked));
+ }
+}
+
+void OptionDialog::on_playSound_clicked()
+{
+ #ifndef NOAUDIO
+ const std::string newSoundFile=ui->soundFile->text().toStdString();
+ buffer.seek(0);
+ data.clear();
+ if(!buffer.isOpen())
+ buffer.open(QIODevice::ReadWrite);
+ QAudioOutput *audio=static_cast<QAudioOutput *>(FacilityEngine::facilityEngine.prepareOpusAudio(newSoundFile,buffer));
+ if(audio!=nullptr)
+ {
+ buffer.seek(0);
+ audio->start(&buffer);
+ }
+ else
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"unable to open sound file: "+newSoundFile);
+ #endif
+}
diff --git a/OptionDialog.h b/OptionDialog.h
index d1de3db..b1595d9 100644..100755
--- a/OptionDialog.h
+++ b/OptionDialog.h
@@ -11,6 +11,9 @@
#include <QDialog>
#include <QAbstractButton>
#include <QTreeWidgetItem>
+#ifndef NOAUDIO
+#include <QBuffer>
+#endif
#include "Environment.h"
#include "OSSpecific.h"
@@ -82,6 +85,9 @@ private slots:
void oSSpecificClosed();
void on_remainingTimeAlgorithm_currentIndexChanged(int index);
void on_portable_toggled(bool);
+ void on_soundFile_editingFinished();
+ void on_soundWhenFinish_toggled(bool checked);
+ void on_playSound_clicked();
private:
bool quit;
Ui::OptionDialog *ui;
@@ -112,6 +118,10 @@ private:
QTreeWidgetItem * treeWidgetItem;
OSSpecific *oSSpecific;
bool allPluginsIsLoaded;
+ #ifndef NOAUDIO
+ QByteArray data;
+ QBuffer buffer;
+ #endif
public slots:
void newThemeOptions(const std::string &name,QWidget* theNewOptionsWidget,bool isLoaded,bool havePlugin);
void newClientList(const std::vector<std::string> &clientsList);
diff --git a/OptionDialog.ui b/OptionDialog.ui
index 2a154ec..7cb657d 100644..100755
--- a/OptionDialog.ui
+++ b/OptionDialog.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>779</width>
+ <width>808</width>
<height>455</height>
</rect>
</property>
@@ -290,6 +290,37 @@
</property>
</widget>
</item>
+ <item row="10" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QCheckBox" name="soundWhenFinish"/>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="soundFile">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="placeholderText">
+ <string>default: finish.opus</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="playSound">
+ <property name="text">
+ <string>Play</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="10" column="0">
+ <widget class="QLabel" name="label_13">
+ <property name="text">
+ <string>Sound when finish</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
@@ -877,12 +908,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>313</x>
- <y>13</y>
+ <x>301</x>
+ <y>7</y>
</hint>
<hint type="destinationlabel">
- <x>533</x>
- <y>44</y>
+ <x>252</x>
+ <y>11</y>
</hint>
</hints>
</connection>
@@ -893,12 +924,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>583</x>
- <y>20</y>
+ <x>301</x>
+ <y>7</y>
</hint>
<hint type="destinationlabel">
- <x>584</x>
- <y>40</y>
+ <x>300</x>
+ <y>11</y>
</hint>
</hints>
</connection>
@@ -909,12 +940,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>345</x>
- <y>21</y>
+ <x>301</x>
+ <y>7</y>
</hint>
<hint type="destinationlabel">
- <x>582</x>
- <y>105</y>
+ <x>301</x>
+ <y>14</y>
</hint>
</hints>
</connection>
@@ -925,12 +956,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>348</x>
- <y>25</y>
+ <x>301</x>
+ <y>7</y>
</hint>
<hint type="destinationlabel">
- <x>557</x>
- <y>156</y>
+ <x>301</x>
+ <y>20</y>
</hint>
</hints>
</connection>
@@ -941,12 +972,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>537</x>
- <y>105</y>
+ <x>301</x>
+ <y>14</y>
</hint>
<hint type="destinationlabel">
- <x>533</x>
- <y>131</y>
+ <x>301</x>
+ <y>16</y>
</hint>
</hints>
</connection>
@@ -957,12 +988,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>501</x>
- <y>156</y>
+ <x>301</x>
+ <y>20</y>
</hint>
<hint type="destinationlabel">
- <x>501</x>
- <y>182</y>
+ <x>301</x>
+ <y>22</y>
</hint>
</hints>
</connection>
@@ -973,12 +1004,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>269</x>
- <y>15</y>
+ <x>301</x>
+ <y>7</y>
</hint>
<hint type="destinationlabel">
- <x>456</x>
- <y>207</y>
+ <x>301</x>
+ <y>27</y>
</hint>
</hints>
</connection>
@@ -989,12 +1020,28 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
- <x>334</x>
+ <x>301</x>
+ <y>7</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>301</x>
<y>12</y>
</hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>soundWhenFinish</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>soundFile</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>488</x>
+ <y>337</y>
+ </hint>
<hint type="destinationlabel">
- <x>304</x>
- <y>69</y>
+ <x>632</x>
+ <y>346</y>
</hint>
</hints>
</connection>
diff --git a/OptionEngine.cpp b/OptionEngine.cpp
index cd3adf1..cd3adf1 100644..100755
--- a/OptionEngine.cpp
+++ b/OptionEngine.cpp
diff --git a/OptionEngine.h b/OptionEngine.h
index 027861f..027861f 100644..100755
--- a/OptionEngine.h
+++ b/OptionEngine.h
diff --git a/PlatformMacro.h b/PlatformMacro.h
index d15329d..b5815c9 100644..100755
--- a/PlatformMacro.h
+++ b/PlatformMacro.h
@@ -10,50 +10,54 @@
//windows
#if defined(Q_OS_WIN32)
- #if defined(_M_X64) //_WIN64
- //windows 64Bits
- #define ULTRACOPIER_PLATFORM_NAME tr("Windows 64Bits")
- #define ULTRACOPIER_PLATFORM_CODE "windows-x86_64"
- #else
- //windows 32Bits
- #define ULTRACOPIER_PLATFORM_NAME tr("Windows 32Bits")
- #define ULTRACOPIER_PLATFORM_CODE "windows-x86"
- #endif
+ #if defined(_M_X64) //_WIN64
+ //windows 64Bits
+ #define ULTRACOPIER_PLATFORM_NAME tr("Windows 64Bits")
+ #define ULTRACOPIER_PLATFORM_CODE "windows-x86_64"
+ #else
+ //windows 32Bits
+ #define ULTRACOPIER_PLATFORM_NAME tr("Windows 32Bits")
+ #define ULTRACOPIER_PLATFORM_CODE "windows-x86"
+ #endif
#elif defined(Q_OS_MAC)
- //Mac OS X
- #define ULTRACOPIER_PLATFORM_NAME tr("Mac OS X")
- #define ULTRACOPIER_PLATFORM_CODE "mac-os-x"
+ //Mac OS X
+ #define ULTRACOPIER_PLATFORM_NAME tr("Mac OS X")
+ #define ULTRACOPIER_PLATFORM_CODE "mac-os-x"
#elif defined(Q_OS_LINUX)
- #if defined(__i386__)
- //linux pc i386
- #define ULTRACOPIER_PLATFORM_NAME tr("Linux pc i386")
- #define ULTRACOPIER_PLATFORM_CODE "linux-i386-pc"
- #elif defined(__i486__)
- //linux pc i486
- #define ULTRACOPIER_PLATFORM_NAME tr("Linux pc i486")
- #define ULTRACOPIER_PLATFORM_CODE "linux-i486-pc"
- #elif defined(__i586__)
- //linux pc i586
- #define ULTRACOPIER_PLATFORM_NAME tr("Linux pc i586")
- #define ULTRACOPIER_PLATFORM_CODE "linux-i586-pc"
- #elif defined(__i686__)
- //linux pc i686
- #define ULTRACOPIER_PLATFORM_NAME tr("Linux pc i686")
- #define ULTRACOPIER_PLATFORM_CODE "linux-i686-pc"
- #elif defined(__x86_64__)
- //linux pc 64Bits
- #define ULTRACOPIER_PLATFORM_NAME tr("Linux pc 64Bits")
- #define ULTRACOPIER_PLATFORM_CODE "linux-x86_64-pc"
- #else
- //linux unknow
- #define ULTRACOPIER_PLATFORM_NAME tr("Linux unknow platform")
- #define ULTRACOPIER_PLATFORM_CODE "linux-unknow-pc"
- #endif
+ #if defined(__i386__)
+ //linux pc i386
+ #define ULTRACOPIER_PLATFORM_NAME tr("Linux pc i386")
+ #define ULTRACOPIER_PLATFORM_CODE "linux-i386-pc"
+ #elif defined(__i486__)
+ //linux pc i486
+ #define ULTRACOPIER_PLATFORM_NAME tr("Linux pc i486")
+ #define ULTRACOPIER_PLATFORM_CODE "linux-i486-pc"
+ #elif defined(__i586__)
+ //linux pc i586
+ #define ULTRACOPIER_PLATFORM_NAME tr("Linux pc i586")
+ #define ULTRACOPIER_PLATFORM_CODE "linux-i586-pc"
+ #elif defined(__i686__)
+ //linux pc i686
+ #define ULTRACOPIER_PLATFORM_NAME tr("Linux pc i686")
+ #define ULTRACOPIER_PLATFORM_CODE "linux-i686-pc"
+ #elif defined(__x86_64__)
+ //linux pc 64Bits
+ #define ULTRACOPIER_PLATFORM_NAME tr("Linux pc 64Bits")
+ #define ULTRACOPIER_PLATFORM_CODE "linux-x86_64-pc"
+ #else
+ //linux unknow
+ #define ULTRACOPIER_PLATFORM_NAME tr("Linux unknow platform")
+ #define ULTRACOPIER_PLATFORM_CODE "linux-unknow-pc"
+ #endif
+#elif defined(__HAIKU__)
+ //Haiku OS
+ #define ULTRACOPIER_PLATFORM_NAME tr("Haiku OS platform")
+ #define ULTRACOPIER_PLATFORM_CODE "haiku-os"
#else
- //unknow
- #define ULTRACOPIER_PLATFORM_NAME tr("Unknow platform")
- #define ULTRACOPIER_PLATFORM_CODE "unknow"
+ //unknow
+ #define ULTRACOPIER_PLATFORM_NAME tr("Unknow platform")
+ #define ULTRACOPIER_PLATFORM_CODE "unknow"
#endif
#endif // PLATFORM_MACRO_H
-
+
diff --git a/PluginInformation.cpp b/PluginInformation.cpp
index 8c1551c..8c1551c 100644..100755
--- a/PluginInformation.cpp
+++ b/PluginInformation.cpp
diff --git a/PluginInformation.h b/PluginInformation.h
index d3c1d5a..d3c1d5a 100644..100755
--- a/PluginInformation.h
+++ b/PluginInformation.h
diff --git a/PluginInformation.ui b/PluginInformation.ui
index 64a0bd1..64a0bd1 100644..100755
--- a/PluginInformation.ui
+++ b/PluginInformation.ui
diff --git a/PluginLoaderCore.cpp b/PluginLoaderCore.cpp
index 1cc3089..1cc3089 100644..100755
--- a/PluginLoaderCore.cpp
+++ b/PluginLoaderCore.cpp
diff --git a/PluginLoaderCore.h b/PluginLoaderCore.h
index fbbc6f6..fbbc6f6 100644..100755
--- a/PluginLoaderCore.h
+++ b/PluginLoaderCore.h
diff --git a/PluginsManager.cpp b/PluginsManager.cpp
index 269e837..b885612 100644..100755
--- a/PluginsManager.cpp
+++ b/PluginsManager.cpp
@@ -310,8 +310,9 @@ void PluginsManager::loadPluginXml(PluginsAvailable * thePlugin,const QByteArray
loadBalise(root,"architecture",&(thePlugin->informations),&(thePlugin->errorString),true,false);
if(thePlugin->errorString.empty())
{
- if(thePlugin->informations.back().back()!=ULTRACOPIER_PLATFORM_CODE)
- thePlugin->errorString="Wrong platform code: "+thePlugin->informations.back().back();
+ const std::string &platform=thePlugin->informations.back().back();
+ if(platform!=ULTRACOPIER_PLATFORM_CODE)
+ thePlugin->errorString="Wrong platform code: "+platform+std::string(" should be ")+ULTRACOPIER_PLATFORM_CODE;
}
#endif
}
@@ -528,10 +529,10 @@ std::string PluginsManager::getPluginVersion(const std::string &pluginName) cons
{
#ifdef ULTRACOPIER_MODE_SUPERCOPIER
if(pluginName=="supercopier")
- return ULTRACOPIER_VERSION;
+ return FacilityEngine::version();
#else
if(pluginName=="ultracopier")
- return ULTRACOPIER_VERSION;
+ return FacilityEngine::version();
#endif
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
unsigned int index=0;
@@ -907,7 +908,7 @@ void PluginsManager::newAuthPath(const std::string &path)
/// \brief transfor short plugin name into file name
std::string PluginsManager::getResolvedPluginName(const std::string &name)
{
- #if defined(Q_OS_LINUX) || defined(Q_OS_HURD)
+ #if defined(Q_OS_LINUX) || defined(Q_OS_HURD) || defined(__HAIKU__)
return "lib"+name+".so";
#elif defined(Q_OS_MAC)
#if defined(QT_DEBUG)
@@ -922,7 +923,11 @@ std::string PluginsManager::getResolvedPluginName(const std::string &name)
return name+".dll";
#endif
#else
+ #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
#error "Platform not supported"
+ #else
+ return std::string();
+ #endif
#endif
}
diff --git a/PluginsManager.h b/PluginsManager.h
index 4e24839..4e24839 100644..100755
--- a/PluginsManager.h
+++ b/PluginsManager.h
diff --git a/ProductKey.cpp b/ProductKey.cpp
index eeb533c..a96efec 100644..100755
--- a/ProductKey.cpp
+++ b/ProductKey.cpp
@@ -28,7 +28,7 @@ bool ProductKey::parseKey(QString orgkey)
if(!key.isEmpty())
{
QCryptographicHash hash(QCryptographicHash::Sha224);
- hash.addData(QStringLiteral("U2NgvbKVrVwlaXnx").toUtf8());
+ hash.addData(QStringLiteral("mQcLvEg1HW8JuRXY3BawjSpe").toUtf8());
hash.addData(key.toUtf8());
const QByteArray &result=hash.result();
if(!result.isEmpty() && result.at(0)==0x00 && result.at(1)==0x00)
diff --git a/ProductKey.h b/ProductKey.h
index 64fd536..64fd536 100644..100755
--- a/ProductKey.h
+++ b/ProductKey.h
diff --git a/ProductKey.ui b/ProductKey.ui
index bd881ec..c7d49f8 100644..100755
--- a/ProductKey.ui
+++ b/ProductKey.ui
@@ -14,8 +14,8 @@
<string>Product key</string>
</property>
<property name="windowIcon">
- <iconset resource="plugins/Themes/Oxygen/interfaceResources_unix.qrc">
- <normaloff>:/Themes/Oxygen/resources/SystemTrayIcon/systray_Caught_Unix.png</normaloff>:/Themes/Oxygen/resources/SystemTrayIcon/systray_Caught_Unix.png</iconset>
+ <iconset resource="plugins/Themes/Oxygen2/interfaceResources_unix.qrc">
+ <normaloff>:/Themes/Oxygen2/resources/SystemTrayIcon/systray_Caught_Unix.png</normaloff>:/Themes/Oxygen2/resources/SystemTrayIcon/systray_Caught_Unix.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -35,7 +35,7 @@
</layout>
</widget>
<resources>
- <include location="plugins/Themes/Oxygen/interfaceResources_unix.qrc"/>
+ <include location="plugins/Themes/Oxygen2/interfaceResources_unix.qrc"/>
</resources>
<connections/>
</ui>
diff --git a/README.md b/README.md
index 18d0a4e..1c0783a 100644..100755
--- a/README.md
+++ b/README.md
@@ -12,11 +12,14 @@ Main features include:
- collision management
- plugin support
+# Dependency
+- libogg and libopus if audio support is enabled
# Building
Building an all-in-one version is as easy as compiling the main Qt project:
+ find ./ -name '*.ts' -exec lrelease {} \;
qmake ultracopier.pro
diff --git a/README.sources b/README.sources
index d569b28..5abd28f 100644..100755
--- a/README.sources
+++ b/README.sources
@@ -29,4 +29,11 @@ Licensing of XZ Embedded =============================
All the files in this package have been written by Lasse Collin
and/or Igor Pavlov. All these files have been put into the
public domain. You can do whatever you want with these files.
-As usual, this software is provided "as is", without any warranty. \ No newline at end of file
+As usual, this software is provided "as is", without any warranty.
+
+======================================================
+MXE ==================================================
+======================================================
+
+To compile for windows I use MXE:
+make MXE_TARGETS='i686-w64-mingw32.shared' QT5_BUILD_TYPE=-debug-and-release MXE_PLUGIN_DIRS=plugins/gcc7 qt5 opus ogg zstd
diff --git a/ResourcesManager.cpp b/ResourcesManager.cpp
index 32106a8..32106a8 100644..100755
--- a/ResourcesManager.cpp
+++ b/ResourcesManager.cpp
diff --git a/ResourcesManager.h b/ResourcesManager.h
index fec25da..fec25da 100644..100755
--- a/ResourcesManager.h
+++ b/ResourcesManager.h
diff --git a/SessionLoader.cpp b/SessionLoader.cpp
index 1266e2f..1266e2f 100644..100755
--- a/SessionLoader.cpp
+++ b/SessionLoader.cpp
diff --git a/SessionLoader.h b/SessionLoader.h
index 7889284..7889284 100644..100755
--- a/SessionLoader.h
+++ b/SessionLoader.h
diff --git a/StructEnumDefinition.h b/StructEnumDefinition.h
index e8f8de2..b275c36 100644..100755
--- a/StructEnumDefinition.h
+++ b/StructEnumDefinition.h
@@ -11,78 +11,78 @@
namespace Ultracopier {
/// \brief Define the mode of the copy window/request, if need be copy or move
-enum CopyMode
+enum CopyMode : uint8_t
{
- Copy=0x00000000,
- Move=0x00000001
+ Copy=0x00,
+ Move=0x01
};
-enum RemainingTimeAlgo
+enum RemainingTimeAlgo : uint8_t
{
- RemainingTimeAlgo_Traditional=0x00000000,
- RemainingTimeAlgo_Logarithmic=0x00000001
+ RemainingTimeAlgo_Traditional=0x00,
+ RemainingTimeAlgo_Logarithmic=0x01
};
/// \brief Define the catching state, if the copy is totally catch of the explorer, partially or nothing
-enum CatchState
+enum CatchState : uint8_t
{
- Uncaught=0x00000000,
- Semiuncaught=0x00000001,
- Caught=0x00000002
+ Uncaught=0x00,
+ Semiuncaught=0x01,
+ Caught=0x02
};
/// \brief Define the listening state
-enum ListeningState
+enum ListeningState : uint8_t
{
- NotListening=0x00000000,///< 0 listener is listening
- SemiListening=0x00000001,///< only part of listeners are listening
- FullListening=0x00000002///< all the listeners are listening
+ NotListening=0x00,///< 0 listener is listening
+ SemiListening=0x01,///< only part of listeners are listening
+ FullListening=0x02///< all the listeners are listening
};
/// \brief Define the copy type, if folder, file or both
-enum CopyType
+enum CopyType : uint8_t
{
- File = 0x00000001,
- FileAndFolder = 0x00000002
+ File = 0x01,
+ FileAndFolder = 0x02
};
/// \brief transfer list operation, can define nothing, the import/export or both
-enum TransferListOperation
+enum TransferListOperation : uint8_t
{
- TransferListOperation_None = 0x00000000,
- TransferListOperation_Import = 0x00000001,
- TransferListOperation_Export = 0x00000002,
+ TransferListOperation_None = 0x00,
+ TransferListOperation_Import = 0x01,
+ TransferListOperation_Export = 0x02,
TransferListOperation_ImportExport = TransferListOperation_Import | TransferListOperation_Export
};
-enum EngineActionInProgress
+enum EngineActionInProgress : uint8_t
{
- Idle = 0x00000000,
- Listing = 0x00000001,
- Copying = 0x00000002,
+ Idle = 0x00,
+ Listing = 0x01,
+ Copying = 0x02,
CopyingAndListing = Listing | Copying
};
/// \brief the level of information
-enum DebugLevel
+enum DebugLevel : uint8_t
{
- DebugLevel_Information=0x00000001, ///< Information like the compiler, OS, Qt version, all to know in witch condition ultracopier is launched
- DebugLevel_Critical=0x00000002, ///< Critical error, where it don't know how skip it
- DebugLevel_Warning=0x00000003, ///< Error, but have way to skip it
- DebugLevel_Notice=0x00000004 ///< General information to debug, what file is open, what event is received, ...
+ DebugLevel_Information=0x01, ///< Information like the compiler, OS, Qt version, all to know in witch condition ultracopier is launched
+ DebugLevel_Critical=0x02, ///< Critical error, where it don't know how skip it
+ DebugLevel_Warning=0x03, ///< Error, but have way to skip it
+ DebugLevel_Notice=0x04 ///< General information to debug, what file is open, what event is received, ...
};
-enum SizeUnit
+enum SizeUnit : uint8_t
{
- SizeUnit_byte=0x00000000,
- SizeUnit_KiloByte=0x00000001,
- SizeUnit_MegaByte=0x00000002,
- SizeUnit_GigaByte=0x00000003,
- SizeUnit_TeraByte=0x00000004,
- SizeUnit_PetaByte=0x00000005,
- SizeUnit_ExaByte=0x00000006,
- SizeUnit_ZettaByte=0x00000007,
- SizeUnit_YottaByte=0x00000008
+ SizeUnit_byte=0x00,
+ SizeUnit_KiloByte=0x01,
+ SizeUnit_MegaByte=0x02,
+ SizeUnit_GigaByte=0x03,
+ SizeUnit_TeraByte=0x04,
+ SizeUnit_PetaByte=0x05,
+ SizeUnit_ExaByte=0x06,
+ SizeUnit_ZettaByte=0x07,
+ SizeUnit_YottaByte=0x08
};
/// \brief structure for decompossed time
@@ -94,17 +94,17 @@ struct TimeDecomposition
};
//////////////////////////// Return list //////////////////////////////
-enum ActionTypeCopyList
+enum ActionTypeCopyList : uint8_t
{
//playlist action
- MoveItem=0x00000000,
- RemoveItem=0x00000001,
- AddingItem=0x00000002,
+ MoveItem=0x00,
+ RemoveItem=0x01,
+ AddingItem=0x02,
//Item action, to inform the stat of one entry
- PreOperation=0x00000003,
- Transfer=0x00000004,
- PostOperation=0x00000005,
- CustomOperation=0x00000006 /// \note this need be used after preoperation and before postoperation
+ PreOperation=0x03,
+ Transfer=0x04,//need send PreOperation before
+ PostOperation=0x05,
+ CustomOperation=0x06 /// \note this need be used after preoperation and before postoperation
};
/// \brief structure for progression item
diff --git a/StructEnumDefinition_UltracopierSpecific.h b/StructEnumDefinition_UltracopierSpecific.h
index 067eb18..067eb18 100644..100755
--- a/StructEnumDefinition_UltracopierSpecific.h
+++ b/StructEnumDefinition_UltracopierSpecific.h
diff --git a/SystrayIcon.cpp b/SystrayIcon.cpp
index eb09f3b..ceed27d 100644..100755
--- a/SystrayIcon.cpp
+++ b/SystrayIcon.cpp
@@ -36,7 +36,7 @@ SystrayIcon::SystrayIcon(QObject * parent) :
actionOptions = new QAction(this);
actionProductKey = new QAction(this);
//actionTransfer = new QAction(this);
- #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
+ #ifdef TREEMENU
copyMenu = NULL;
#endif
//to prevent init bug
@@ -80,8 +80,10 @@ SystrayIcon::SystrayIcon(QObject * parent) :
#ifdef ULTRACOPIER_DEBUG
systrayMenu->addAction(actionSaveBugReport);
#endif
+ #ifndef Q_OS_LINUX
if(!ProductKey::productKey->isUltimate())
systrayMenu->addAction(actionProductKey);
+ #endif
systrayMenu->addAction(actionMenuQuit);
#ifndef Q_OS_MAC
systrayMenu->insertSeparator(actionOptions);
@@ -90,7 +92,7 @@ SystrayIcon::SystrayIcon(QObject * parent) :
updateSystrayIcon();
#ifdef ULTRACOPIER_INTERNET_SUPPORT
- lastVersion=ULTRACOPIER_VERSION;
+ lastVersion=FacilityEngine::version();
#endif
timerCheckSetTooltip.setSingleShot(true);
@@ -118,7 +120,7 @@ SystrayIcon::~SystrayIcon()
delete actionOptions;
delete actionProductKey;
delete systrayMenu;
- #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
+ #ifdef TREEMENU
if(copyMenu!=NULL)
{
delete copyMenu;
@@ -267,8 +269,11 @@ void SystrayIcon::updateSystrayIcon()
#endif
}
if(theNewSystrayIcon.isNull())
+ {
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"All the icon include the default icon remain null");
- setIcon(theNewSystrayIcon);
+ }
+ else
+ setIcon(theNewSystrayIcon);
#ifdef ULTRACOPIER_MODE_SUPERCOPIER
setToolTip(QString::fromStdString("Supercopier - "+toolTip));
#else
@@ -494,7 +499,7 @@ void SystrayIcon::addEngineAction(const QString &name, const QIcon &icon, const
QAction *copy = new QAction(icon, label, menu);
connect(copy,&QAction::triggered, this, query);
copy->setData(name);
- #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
+ #ifdef TREEMENU
copyMenu->addAction(copy);
#else
actions.push_back(copy);
@@ -505,7 +510,7 @@ void SystrayIcon::addEngineAction(const QString &name, const QIcon &icon, const
void SystrayIcon::reloadEngineList()
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start");
- #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
+ #ifdef TREEMENU
if(copyMenu!=NULL)
{
delete copyMenu;
@@ -542,7 +547,7 @@ void SystrayIcon::reloadEngineList()
QString labelTransfer = tr("Add &transfer");
QString labelMove = tr("Add &move");
QMenu *menu = nullptr;
- #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
+ #ifdef TREEMENU
if(engineEntryList.size()==1)
menu = copyMenu;
else
@@ -560,7 +565,7 @@ void SystrayIcon::reloadEngineList()
addEngineAction(name, IconAdd, labelTransfer, menu, &SystrayIcon::CatchTransferQuery);
addEngineAction(name, IconAdd, labelMove, menu, &SystrayIcon::CatchMoveQuery);
}
- #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
+ #ifdef TREEMENU
if(engineEntryList.size()!=1)
copyMenu->addMenu(menu);
#endif
diff --git a/SystrayIcon.h b/SystrayIcon.h
index e17da02..6b909de 100644..100755
--- a/SystrayIcon.h
+++ b/SystrayIcon.h
@@ -15,6 +15,10 @@
#include <QList>
#include <QUrl>
+#ifdef Q_OS_WIN32
+#define TREEMENU
+#endif
+
#include "Environment.h"
/** \brief The systray icon
@@ -49,7 +53,7 @@ class SystrayIcon : public QSystemTrayIcon
std::string lastVersion;
#endif
QMenu* systrayMenu; ///< Pointer on the menu
- #if ! defined(Q_OS_LINUX) || (QT_VERSION < QT_VERSION_CHECK(5, 6, 0))
+ #ifdef TREEMENU
QMenu* copyMenu; ///< Pointer on the copy menu (move or copy)
#else
std::vector<QAction*> actions;
diff --git a/ThemesManager.cpp b/ThemesManager.cpp
index ab61e44..c78ea9c 100644..100755
--- a/ThemesManager.cpp
+++ b/ThemesManager.cpp
@@ -12,7 +12,7 @@
#include "LanguagesManager.h"
#ifdef ULTRACOPIER_PLUGIN_ALL_IN_ONE
-#include "plugins/Themes/Oxygen/ThemesFactory.h"
+#include "plugins/Themes/Oxygen2/ThemesFactory.h"
#endif
#ifdef ULTRACOPIER_MODE_SUPERCOPIER
diff --git a/ThemesManager.h b/ThemesManager.h
index 9e83af8..9e83af8 100644..100755
--- a/ThemesManager.h
+++ b/ThemesManager.h
diff --git a/Variable.h b/Variable.h
index 957530e..7107d0d 100644..100755
--- a/Variable.h
+++ b/Variable.h
@@ -3,26 +3,21 @@
\author alpha_one_x86
\licence GPL3, see the file COPYING */
-#ifndef VARIABLE_H
-#define VARIABLE_H
+#ifndef VARIABLEUCP_H
+#define VARIABLEUCP_H
/// \brief Un-comment this next line to put ultracopier in debug mode
#ifndef ULTRACOPIER_NODEBUG
-#define ULTRACOPIER_DEBUG
+////#define ULTRACOPIER_DEBUG
#endif
-#define ULTRACOPIER_DEBUG_MAX_GUI_LINE 50000 ///< \brief Max number of ligne show on the GUI
-#define ULTRACOPIER_DEBUG_MAX_ALL_SIZE 128 ///< \brief Max size (in MB) after the console/file output is dropped
-#define ULTRACOPIER_DEBUG_MAX_IMPORTANT_SIZE 150 ///< \brief Max size (in MB) after the console/file important output is dropped
-/// \brief the version
-#define ULTRACOPIER_VERSION "1.6.1.3"
-/// \brief the windows version
-#define ULTRACOPIER_WINDOWS_VERSION 1,6,1,3
+//#define ULTRACOPIER_DEBUG_MAX_GUI_LINE 50000 ///< \brief Max number of ligne show on the GUI
+//#define ULTRACOPIER_DEBUG_MAX_ALL_SIZE 128 ///< \brief Max size (in MB) after the console/file output is dropped
+//#define ULTRACOPIER_DEBUG_MAX_IMPORTANT_SIZE 150 ///< \brief Max size (in MB) after the console/file important output is dropped
// define if the version is portable or not
////#define ULTRACOPIER_VERSION_PORTABLE
////#define ULTRACOPIER_VERSION_PORTABLEAPPS
// define if the version is ultimate, need change only the name in the code
//#define ULTRACOPIER_PLUGIN_ALL_IN_ONE
-//#define ULTRACOPIER_MODE_SUPERCOPIER
/// \brief define time to update the speed detection update ont the interface (in ms)
#define ULTRACOPIER_TIME_INTERFACE_UPDATE 500
@@ -45,6 +40,6 @@
/// \brief to disable plugin support, import and remove
#define ULTRACOPIER_PLUGIN_IMPORT_SUPPORT
-#define ULTRACOPIER_UPDATER_URL "http://ultracopier-update.first-world.info:10852/updater.txt"
+#define ULTRACOPIER_UPDATER_URL "http://cdn.confiared.com/ultracopier-update.first-world.info/updater.txt"
#endif // VARIABLE_H
diff --git a/Version.h b/Version.h
new file mode 100755
index 0000000..c345541
--- /dev/null
+++ b/Version.h
@@ -0,0 +1,9 @@
+#ifndef VERSIONUC_H
+#define VERSIONUC_H
+
+/// \brief the version
+#define ULTRACOPIER_VERSION "2.2.4.4"
+/// \brief the windows version
+#define ULTRACOPIER_WINDOWS_VERSION 2,2,4,4
+
+#endif // VARIABLE_H
diff --git a/android-libultracopier.so-deployment-settings.json b/android-libultracopier.so-deployment-settings.json
new file mode 100644
index 0000000..1dedb66
--- /dev/null
+++ b/android-libultracopier.so-deployment-settings.json
@@ -0,0 +1,14 @@
+{
+ "description": "This file is generated by qmake to be read by androiddeployqt and should not be modified by hand.",
+ "qt": "/usr",
+ "sdk": "",
+ "sdkBuildToolsRevision": "",
+ "ndk": "/opt/android/android-ndk",
+ "toolchain-prefix": "arm-linux-androideabi",
+ "tool-prefix": "arm-linux-androideabi",
+ "toolchain-version": "4.9",
+ "ndk-host": "",
+ "target-architecture": "",
+ "qml-root-path": "/data",
+ "application-binary": "/data/libultracopier.so"
+}
diff --git a/android-sources/AndroidManifest.xml b/android-sources/AndroidManifest.xml
new file mode 100644
index 0000000..1ef9946
--- /dev/null
+++ b/android-sources/AndroidManifest.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0"?>
+<manifest package="org.qtproject.example.ultracopier" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.0.4.0" android:versionCode="20000400" android:installLocation="auto">
+ <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28"/>
+
+ <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
+ Remove the comment if you do not require these default permissions. -->
+
+
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+
+
+ <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
+ Remove the comment if you do not require these default features. -->
+
+
+ <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
+
+ <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="ultracopier" android:icon="@drawable/icon">
+ <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="ultracopier" android:screenOrientation="unspecified" android:launchMode="singleTop">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ </intent-filter>
+
+ <!-- Application arguments -->
+ <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
+ <!-- Application arguments -->
+
+ <meta-data android:name="android.app.lib_name" android:value="ultracopier"/>
+ <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
+ <meta-data android:name="android.app.repository" android:value="default"/>
+ <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
+ <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
+ <!-- Deploy Qt libs as part of package -->
+ <meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/>
+ <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
+ <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
+ <!-- Run with local libs -->
+ <meta-data android:name="android.app.use_local_qt_libs" android:value="1"/>
+ <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
+ <meta-data android:name="android.app.load_local_libs" android:value="plugins/platforms/android/libqtforandroid.so"/>
+ <meta-data android:name="android.app.load_local_jars" android:value="jar/QtAndroid.jar"/>
+ <meta-data android:name="android.app.static_init_classes" android:value=""/>
+ <!-- Used to specify custom system library path to run with local system libs -->
+ <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
+ <!-- Messages maps -->
+ <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
+ <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
+ <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
+ <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/>
+ <!-- Messages maps -->
+
+ <!-- Splash screen -->
+ <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation,
+ then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and
+ use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you
+ are done populating your window with content. -->
+ <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / -->
+ <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / -->
+ <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
+ <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
+ <!-- Splash screen -->
+
+ <!-- Background running -->
+ <!-- Warning: changing this value to true may cause unexpected crashes if the
+ application still try to draw after
+ "applicationStateChanged(Qt::ApplicationSuspended)"
+ signal is sent! -->
+ <meta-data android:name="android.app.background_running" android:value="false"/>
+ <!-- Background running -->
+
+ <!-- auto screen scale factor -->
+ <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
+ <!-- auto screen scale factor -->
+
+ <!-- extract android style -->
+ <!-- available android:values :
+ * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
+ * full - useful QWidget & Quick Controls 1 apps
+ * minimal - useful for Quick Controls 2 apps, it is much faster than "full"
+ * none - useful for apps that don't use any of the above Qt modules
+ -->
+ <meta-data android:name="android.app.extract_android_style" android:value="default"/>
+ <!-- extract android style -->
+ </activity>
+
+ <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
+
+ </application>
+
+</manifest>
diff --git a/android-sources/build.sh b/android-sources/build.sh
new file mode 100755
index 0000000..b160c18
--- /dev/null
+++ b/android-sources/build.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+cd /home/user/src/
+mkdir ~/build && cd ~/build
+qmake -r ~/src/other-pro/ultracopier-little.pro ANDROID_EXTRA_LIBS+=$ANDROID_DEV/lib/libcrypto.so ANDROID_EXTRA_LIBS+=$ANDROID_DEV/lib/libssl.so
+make -j5
+make install INSTALL_ROOT=/home/user/build/dist/
+androiddeployqt --input android-libultracopier.so-deployment-settings.json --output dist/ --android-platform 28 --deployment bundled --gradle --release
diff --git a/android-sources/res/drawable-hdpi/icon.png b/android-sources/res/drawable-hdpi/icon.png
new file mode 100644
index 0000000..8a276d7
--- /dev/null
+++ b/android-sources/res/drawable-hdpi/icon.png
Binary files differ
diff --git a/android-sources/res/drawable-ldpi/icon.png b/android-sources/res/drawable-ldpi/icon.png
new file mode 100644
index 0000000..844c690
--- /dev/null
+++ b/android-sources/res/drawable-ldpi/icon.png
Binary files differ
diff --git a/android-sources/res/drawable-mdpi/icon.png b/android-sources/res/drawable-mdpi/icon.png
new file mode 100644
index 0000000..2adbb48
--- /dev/null
+++ b/android-sources/res/drawable-mdpi/icon.png
Binary files differ
diff --git a/catchcopy-windows-explorer-plugin/CatchCopy.cpp b/catchcopy-windows-explorer-plugin/CatchCopy.cpp
new file mode 100755
index 0000000..58d36fb
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/CatchCopy.cpp
@@ -0,0 +1,115 @@
+// Implementation of DLL Exports.
+#include "resource.h"
+#include "DDShellExt.h"
+#include "ClassFactory.h"
+#include "Reg.h"
+
+#ifndef _M_X64
+const CLSID CLSID_DDShellExt = {0x68D44A27,0xFFB6,0x4B89,{0xA3,0xE5,0x7B,0x0E,0x50,0xA7,0xAB,0x33}};
+#else
+const CLSID CLSID_DDShellExt = {0x68ff37c4,0x51bc,0x4c2a,{0xa9,0x92,0x7e,0x39,0xbc,0xe,0x70,0x6f}};
+#endif
+
+HINSTANCE g_hInst = NULL;
+long g_cDllRef = 0;
+
+// DLL Entry Point
+extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+ (void)lpReserved;
+ switch(dwReason){
+ case DLL_PROCESS_ATTACH:
+ //MessageBox ( NULL,L"DLL_PROCESS_ATTACH", L"DLL_PROCESS_ATTACH", MB_OK);
+ // Hold the instance of this DLL module, we will use it to get the
+ // path of the DLL to register the component.
+ g_hInst = hInstance;
+ DisableThreadLibraryCalls(hInstance);
+ break;
+ case DLL_PROCESS_DETACH:
+ //MessageBox ( NULL,L"DLL_PROCESS_DETACH", L"DLL_PROCESS_DETACH", MB_OK);
+ break;
+ }
+
+ return TRUE; //_AtlModule.DllMain(hInstance, dwReason, lpReserved,ObjectMap,NULL);
+}
+
+
+// Used to determine whether the DLL can be unloaded by OLE
+STDAPI DllCanUnloadNow(void)
+{
+ return g_cDllRef > 0 ? S_FALSE : S_OK;
+}
+
+
+// Returns a class factory to create an object of the requested type
+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
+{
+ HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
+ if (IsEqualCLSID(CLSID_DDShellExt, rclsid))
+ {
+ hr = E_OUTOFMEMORY;
+ ClassFactory *pClassFactory = new ClassFactory();
+ if (pClassFactory)
+ {
+ hr = pClassFactory->QueryInterface(riid, ppv);
+ pClassFactory->Release();
+ }
+ }
+ return hr;
+}
+
+
+// DllRegisterServer - Adds entries to the system registry
+STDAPI DllRegisterServer(void)
+{
+// registers object, typelib and all interfaces in typelib
+
+ HRESULT hr;
+
+ wchar_t szModule[MAX_PATH];
+ if (GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule)) == 0)
+ {
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ return hr;
+ }
+ // Register the component.
+ hr = RegisterInprocServer(szModule, CLSID_DDShellExt, L"CatchCopy Class", L"Apartment");
+ if (SUCCEEDED(hr))
+ {
+ // Register the context menu handler. The context menu handler is
+ // associated with the * file class.
+ hr = RegisterShellExtContextMenuHandler(L"textfile", CLSID_DDShellExt, L"CatchCopy");
+ hr = RegisterShellExtContextMenuHandler(L"Drive", CLSID_DDShellExt, L"CatchCopy");
+ hr = RegisterShellExtContextMenuHandler(L"Directory", CLSID_DDShellExt, L"CatchCopy");
+ hr = RegisterShellExtContextMenuHandler(L"Folder", CLSID_DDShellExt, L"CatchCopy");
+ }
+ return hr;
+}
+
+
+// DllUnregisterServer - Removes entries from the system registry
+STDAPI DllUnregisterServer(void)
+{
+ m_ac.disconnectFromServer();
+ HRESULT hr = S_OK;
+
+ wchar_t szModule[MAX_PATH];
+ if (GetModuleFileName(g_hInst, szModule, ARRAYSIZE(szModule)) == 0)
+ {
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ return hr;
+ }
+
+ // Unregister the component.
+ hr = UnregisterInprocServer(CLSID_DDShellExt);
+ if (SUCCEEDED(hr))
+ {
+ // Unregister the context menu handler.
+ hr = UnregisterShellExtContextMenuHandler(L"textfile", CLSID_DDShellExt);
+ hr = UnregisterShellExtContextMenuHandler(L"Drive", CLSID_DDShellExt);
+ hr = UnregisterShellExtContextMenuHandler(L"Directory", CLSID_DDShellExt);
+ hr = UnregisterShellExtContextMenuHandler(L"Folder", CLSID_DDShellExt);
+ return hr;
+ }
+ return S_OK;
+}
diff --git a/catchcopy-windows-explorer-plugin/CatchCopy.def b/catchcopy-windows-explorer-plugin/CatchCopy.def
new file mode 100755
index 0000000..78582f4
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/CatchCopy.def
@@ -0,0 +1,7 @@
+LIBRARY "CatchCopy.DLL"
+
+EXPORTS
+ DllGetClassObject = DllGetClassObject@12
+ DllCanUnloadNow = DllCanUnloadNow@0
+ DllRegisterServer = DllRegisterServer@0
+ DllUnregisterServer = DllUnregisterServer@0
diff --git a/catchcopy-windows-explorer-plugin/CatchCopy.pro b/catchcopy-windows-explorer-plugin/CatchCopy.pro
new file mode 100755
index 0000000..99dcd62
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/CatchCopy.pro
@@ -0,0 +1,49 @@
+QT -= core gui
+
+CONFIG += 64bit
+CONFIG -= exceptions rtti
+
+#DEFINES += CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+
+CONFIG(32bit) {
+ TARGET = catchcopy32
+ QMAKE_CFLAGS = -march=i586 -m32
+ QMAKE_CXXFLAGS = -march=i586 -m32
+ QMAKE_LFLAGS += -m32
+}
+CONFIG(64bit) {
+ TARGET = catchcopy64
+ LIBS += -LC:\x86_64-4.9.3-release-win32-seh-rt_v4-rev1\mingw64\lib64
+ DEFINES += _M_X64
+ QMAKE_CFLAGS = -m64
+ QMAKE_CXXFLAGS = -m64
+ QMAKE_LFLAGS += -m64
+}
+
+QMAKE_CFLAGS -= -fexceptions -mthreads -O2
+QMAKE_CXXFLAGS -= -fexceptions -mthreads -O2
+QMAKE_CFLAGS += -std=c++98 -fno-keep-inline-dllexport -mtune=generic -fno-exceptions -Os -Wall -Wextra -fno-rtti -s -static -static-libgcc -static-libstdc++
+QMAKE_CXXFLAGS += -std=c++98 -fno-keep-inline-dllexport -mtune=generic -fno-exceptions -Os -Wall -Wno-write-strings -Wextra -fno-rtti -s -static -static-libgcc -static-libstdc++
+
+DEF_FILE += CatchCopy.def
+
+LIBS+= -lws2_32 -lole32 -luuid -static-libstdc++ -static-libgcc -static
+
+TEMPLATE = lib
+
+HEADERS += \
+ Variable.h \
+ Deque.h \
+ resource.h \
+ Reg.h \
+ ClientCatchcopy.h \
+ DDShellExt.h \
+ ClassFactory.h
+
+SOURCES += \
+ Deque.cpp \
+ ClientCatchcopy.cpp \
+ Reg.cpp \
+ DDShellExt.cpp \
+ ClassFactory.cpp \
+ CatchCopy.cpp
diff --git a/catchcopy-windows-explorer-plugin/ClassFactory.cpp b/catchcopy-windows-explorer-plugin/ClassFactory.cpp
new file mode 100755
index 0000000..9ad7a5c
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/ClassFactory.cpp
@@ -0,0 +1,84 @@
+
+#include "ClassFactory.h"
+#include "DDShellExt.h"
+#include <new>
+#include <Shlwapi.h>
+
+extern long g_cDllRef;
+
+ClassFactory::ClassFactory() : m_cRef(1)
+{
+ InterlockedIncrement(&g_cDllRef);
+}
+
+ClassFactory::~ClassFactory()
+{
+ InterlockedDecrement(&g_cDllRef);
+}
+
+// IUnknown
+HRESULT __stdcall ClassFactory::QueryInterface(const IID& iid, void **ppv)
+{
+ if(iid == IID_IUnknown || iid == IID_IClassFactory)
+ {
+ *ppv = static_cast<IClassFactory*>(this);
+ }
+ else
+ {
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+ reinterpret_cast<IUnknown*>(*ppv)->AddRef();
+ return S_OK;
+}
+ULONG __stdcall ClassFactory::AddRef()
+{
+ return InterlockedIncrement(&m_cRef);
+}
+
+ULONG __stdcall ClassFactory::Release()
+{
+ ULONG cRef = InterlockedDecrement(&m_cRef);
+ if (0 == cRef)
+ {
+ delete this;
+ }
+ return cRef;
+}
+
+//CreateInstance
+HRESULT __stdcall ClassFactory::CreateInstance(IUnknown *pIUnknownOuter, const IID& iid, void **ppv)
+{
+ HRESULT hr = CLASS_E_NOAGGREGATION;
+
+ // pIUnknownOuter is used for aggregation. We do not support it in the sample.
+ if (pIUnknownOuter == NULL)
+ {
+ hr = E_OUTOFMEMORY;
+
+ //// Create the COM component.
+ CDDShellExt *pExt = new (std::nothrow) CDDShellExt();
+ if (pExt)
+ {
+ // Query the specified interface.
+ hr = pExt->QueryInterface(iid, ppv);
+ pExt->Release();
+ }
+ }
+
+ return hr;
+}
+
+HRESULT __stdcall ClassFactory::LockServer(BOOL bLock)
+{
+ if(bLock == TRUE)
+ {
+ InterlockedIncrement(&g_cDllRef);
+ }
+ else
+ {
+ InterlockedDecrement(&g_cDllRef);
+ }
+ return S_OK;
+}
+
diff --git a/catchcopy-windows-explorer-plugin/ClassFactory.h b/catchcopy-windows-explorer-plugin/ClassFactory.h
new file mode 100755
index 0000000..203ff40
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/ClassFactory.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <unknwn.h> // For IClassFactory
+#include <windows.h>
+
+
+class ClassFactory : public IClassFactory
+{
+public:
+ //interface iunknown
+ virtual HRESULT __stdcall QueryInterface(const IID& iid, void **ppv);
+ virtual ULONG __stdcall AddRef();
+ virtual ULONG __stdcall Release();
+ //interface iclassfactory
+ virtual HRESULT __stdcall CreateInstance(IUnknown *pIUnknownOuter, const IID& iid, void **ppv);
+ virtual HRESULT __stdcall LockServer(BOOL bLock);
+
+ ClassFactory();
+ ~ClassFactory();
+private:
+ long m_cRef;
+};
diff --git a/catchcopy-windows-explorer-plugin/ClientCatchcopy.cpp b/catchcopy-windows-explorer-plugin/ClientCatchcopy.cpp
new file mode 100755
index 0000000..2491795
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/ClientCatchcopy.cpp
@@ -0,0 +1,455 @@
+/** \file ClientCatchcopy.cpp
+\brief Define the catchcopy client
+\author alpha_one_x86
+\version 0002
+\date 2010 */
+
+#include <stdio.h>
+
+#include "ClientCatchcopy.h"
+#include <WinSock.h>
+//#pragma comment(lib, "Ws2_32.lib")
+
+#undef NONBLOCK_FLAG
+ClientCatchcopy::ClientCatchcopy()
+{
+ m_hpipe=NULL;
+ idNextOrder=0;
+ const char prefix[]="\\\\.\\pipe\\advanced-copier-";
+ char uname[1024];
+ DWORD len=1023;
+ char *data;
+ // false ??
+ if(GetUserNameA(uname, &len)!=FALSE)
+ {
+ // convert into hexa
+ data = toHex(uname);
+ m_pipename = (char *) malloc(sizeof(prefix)+strlen(data)+2);
+ #if defined(_MFC_VER)
+ strcpy_s(m_pipename, _countof(prefix) ,prefix);
+ strcat_s(m_pipename, sizeof(prefix)+strlen(data)+2,data);
+ #else
+ strcpy(m_pipename, prefix);
+ strcat(m_pipename, data);
+ #endif
+ free(data);
+ m_blk=NULL;
+ m_len=0;
+ m_tot=0;
+
+ canConnect=true;
+ }
+ else
+ {
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ void* lpBuffer;
+ FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ ::GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpBuffer,
+ 0,
+ NULL );
+ MessageBox(NULL,(LPCTSTR)lpBuffer, L"GetUserName Failed", MB_OK);
+ LocalFree( lpBuffer );
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ canConnect=false;
+ }
+}
+
+ClientCatchcopy::~ClientCatchcopy()
+{
+ disconnectFromServer();
+}
+
+// Dump UTF16 (little endian)
+char * ClientCatchcopy::toHex(const char *str)
+{
+ char *p, *sz;
+ size_t len;
+ if (str==NULL)
+ return NULL;
+ len= strlen(str);
+ p = sz = (char *) malloc((len+1)*4);
+ // username goes hexa...
+ for (size_t i=0; i<len; i++)
+ {
+ #if defined(_MFC_VER)
+ sprintf_s(p, (len+1)*4, "%.2x00", str[i]);
+ #else
+ sprintf(p, "%.2x00", str[i]);
+ #endif
+ p+=4;
+ }
+ *p=0;
+ return sz;
+}
+
+bool ClientCatchcopy::connectToServer()
+{
+ if(!canConnect)
+ {
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ MessageBox(NULL,L"Can't connect due to previous error",L"Checking", MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ return false;
+ }
+ if (m_hpipe==NULL)
+ {
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ char uname[1024];
+ DWORD len=1023;
+ GetUserNameA(uname, &len);
+ char temp_char_debug[1024];
+ sprintf(temp_char_debug, "user name: %s, pipe name: %s",uname , m_pipename);
+ MessageBoxA(NULL,temp_char_debug,"Pipe name", MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ // create pipe
+ m_hpipe = CreateFileA(m_pipename, GENERIC_READ|GENERIC_WRITE|FILE_FLAG_OVERLAPPED , 0, NULL, OPEN_EXISTING, 0, NULL);
+ if (m_hpipe==INVALID_HANDLE_VALUE)
+ {
+ m_hpipe=NULL;
+ if (GetLastError()!= ERROR_PIPE_BUSY)
+ {
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ void* lpBuffer;
+ FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ ::GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpBuffer,
+ 0,
+ NULL );
+ MessageBox(NULL,(LPCTSTR)lpBuffer, L"Can't connect to catchcopy application compatible: GetLastError()!= ERROR_PIPE_BUSY", MB_OK);
+ LocalFree( lpBuffer );
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ return false;
+ }
+ #ifdef NONBLOCK_FLAG
+ return false;
+ #else
+ if (!WaitNamedPipeA(m_pipename, 10000))
+ {
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ void* lpBuffer;
+ FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ ::GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpBuffer,
+ 0,
+ NULL );
+ MessageBox(NULL,(LPCTSTR)lpBuffer, L"Named pipe too long to responds", MB_OK);
+ LocalFree( lpBuffer );
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ CloseHandle(m_hpipe);
+ m_hpipe=NULL;
+ return false;
+ }
+ #endif
+ }
+
+ #ifdef NONBLOCK_FLAG
+ // The pipe connected; change to pipe_nowait mode.
+ DWORD dwMode;
+ BOOL fSuccess = FALSE;
+ dwMode = PIPE_READMODE_BYTE|PIPE_NOWAIT;
+
+ fSuccess = SetNamedPipeHandleState(
+ m_hpipe, // pipe handle
+ &dwMode, // new pipe mode
+ NULL, // don't set maximum bytes
+ NULL); // don't set maximum time
+ if ( ! fSuccess)
+ {
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ char error_str[1024];
+ sprintf(error_str, "SetNamedPipeHandleState failed. GLE=%d\n", ::GetLastError() );
+ MessageBoxA( NULL, error_str,"SetNamedPipeHandleState error", MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ return false;
+ }
+ #endif //NONBLOCK_FLAG
+ }
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ MessageBox(NULL,L"The explorer is now connected to the catchcopy compatible application",L"Checking", MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+
+ bool f = sendProtocol();
+ if(f!=true)
+ return false;
+ #if defined(_M_X64)
+ setClientName(L"Windows Explorer 64Bits");
+ #else
+ setClientName(L"Windows Explorer 32Bits");
+ #endif
+ return true;
+}
+
+void ClientCatchcopy::disconnectFromServer()
+{
+ clear();
+ if(m_hpipe!=NULL)
+ {
+ /* needed to not crash the server when have data to read */
+ FlushFileBuffers(m_hpipe);
+ CloseHandle(m_hpipe);
+ m_hpipe=NULL;
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ MessageBox(NULL, L"The explorer is now disconnected of the catchcopy compatible application",L"Checking", MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ }
+}
+
+/// \brief to send order
+bool ClientCatchcopy::sendProtocol()
+{
+ CDeque data;
+ data.push_back(L"protocol");
+ data.push_back(L"0002");
+ return sendRawOrderList(data);
+}
+
+bool ClientCatchcopy::setClientName(wchar_t *name)
+{
+ CDeque data;
+ data.push_back(L"client");
+ data.push_back(name);
+ return sendRawOrderList(data);
+}
+
+bool ClientCatchcopy::addCopyWithDestination(CDeque sources,wchar_t *destination)
+{
+ sources.push_front(L"cp");
+ sources.push_back(destination);
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ MessageBox(NULL, "sources size: "+sources.size()+", first: "+sources.at(0),L"Checking", MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ return sendRawOrderList(sources);
+}
+
+bool ClientCatchcopy::addCopyWithoutDestination(CDeque sources)
+{
+ sources.push_front(L"cp-?");
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ MessageBox(NULL, "sources size: "+sources.size()+", first: "+sources.at(0),L"Checking", MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ return sendRawOrderList(sources);
+}
+
+bool ClientCatchcopy::addMoveWithDestination(CDeque sources, wchar_t *destination)
+{
+ sources.push_front(L"mv");
+ sources.push_back(destination);
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ MessageBox(NULL, "sources size: "+sources.size()+", first: "+sources.at(0),L"Checking", MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ return sendRawOrderList(sources);
+}
+
+bool ClientCatchcopy::addMoveWithoutDestination(CDeque sources)
+{
+ sources.push_front(L"mv-?");
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ MessageBox(NULL, "sources size: "+sources.size()+", first: "+sources.at(0),L"Checking", MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ return sendRawOrderList(sources);
+}
+
+/// \brief to send stream of string list
+bool ClientCatchcopy::sendRawOrderList(CDeque order, bool first_try)
+{
+ if(m_hpipe!=NULL)
+ {
+ int data_size=sizeof(int)*3;
+ for(int i=0;i<order.size();i++)
+ {
+ if (order.at(i) == NULL)
+ continue;
+
+ data_size+=(int)sizeof(int);
+ data_size+=(int)sizeof(wchar_t)*(int)wcslen(order.at(i));
+ }
+ addInt32(data_size);
+ addInt32(idNextOrder++);
+ addInt32((int)order.size());
+ for(int i=0;i<order.size();i++)
+ {
+ if (order.at(i) == NULL)
+ continue;
+
+ //set string contenant
+ addStr(order.at(i));
+ }
+ if(dataToPipe()<0)
+ {
+ if(first_try)
+ {
+ disconnectFromServer();
+ connectToServer();
+ return sendRawOrderList(order,false);
+ }
+ else
+ clear();
+ }
+ return true;
+ }
+ else
+ {
+ clear();
+ return false;
+ }
+}
+
+// Send data block to named pipe
+int ClientCatchcopy::dataToPipe()
+{
+ byte_t *ptr;
+ int ret=0, max;
+ if (m_hpipe!=NULL)
+ {
+ ptr = m_blk;
+ while (!ret && m_len)
+ {
+ max=(m_len>BUFFER_PIPE) ? BUFFER_PIPE:m_len;
+ #ifdef NONBLOCK_FLAG
+ writePipe_nonBlock(m_hpipe, ptr, max);
+ break;
+ #else
+ if(writePipe(m_hpipe, ptr, max)!=0)
+ {
+ ret=-2;
+ break;
+ }
+ m_len-=max;
+ ptr+=max;
+ #endif
+ }
+ }
+ return ret;
+}
+
+int ClientCatchcopy::writePipe(HANDLE hPipe, byte_t *ptr, int len)
+{
+ DWORD cbWritten;
+ if (!WriteFile(hPipe, ptr, len, &cbWritten, NULL))
+ return -4;
+ return 0;
+}
+
+#ifdef NONBLOCK_FLAG
+int ClientCatchcopy::writePipe_nonBlock(HANDLE hPipe, byte_t *ptr, int len)
+{
+ DWORD cbWritten;
+ WriteFile(hPipe, ptr, len, &cbWritten, NULL);
+ return 0;
+}
+#endif
+
+// Add int32 (big-endian) into binary block
+int ClientCatchcopy::addInt32(int value)
+{
+ blkGrowing(sizeof(int));
+ // add value
+ setInt32(m_len, value);
+ m_len+=sizeof(int);
+ return m_len-sizeof(int);
+}
+
+void ClientCatchcopy::setInt32(int offset, int value)
+{
+ C_INT(m_blk+offset)=htonl(value);
+}
+
+// Add unicode string into binary block from ASCIIZ
+int ClientCatchcopy::addStr(WCHAR *data)
+{
+ int ret=-1, len;
+ WCHAR *x;
+ if (data!=NULL && *data)
+ {
+ // le => be
+ x = _wcsdup(data);
+ len = toBigEndian(x);
+ // set size of string
+ ret = addInt32(len);
+ // and add it to block
+ blkGrowing(len);
+ memmove(m_blk+m_len, x, len);
+ m_len+=len;
+ free(x);
+ }
+ return ret;
+}
+
+// resize binary block (if needed)
+byte_t *ClientCatchcopy::blkGrowing(int added)
+{
+ if (m_len+added>m_tot)
+ {
+ // check if added isn't bigger than buffer itself...
+ m_tot+= (added>BLOCK_SIZ) ? added:BLOCK_SIZ;
+ m_blk = (byte_t *) realloc(m_blk, m_tot);
+ }
+ return m_blk+m_len;
+}
+
+int ClientCatchcopy::toBigEndian(WCHAR *p)
+{
+ WCHAR tmp;
+ int ret=0;
+ while(*p)
+ {
+ tmp = htons(*p);
+ *p++=tmp;
+ ret+=2;
+ }
+ return ret;
+}
+
+void ClientCatchcopy::clear()
+{
+ m_tot=0;
+ m_len=0;
+ idNextOrder=0;
+ if (m_blk!=NULL)
+ {
+ free(m_blk);
+ m_blk=NULL;
+ }
+}
+
+bool ClientCatchcopy::isConnected()
+{
+ if(m_hpipe==NULL)
+ return false;
+
+ bool fSuccess = PeekNamedPipe(
+ m_hpipe,
+ NULL,
+ 0,
+ 0,
+ 0,
+ 0
+ );
+
+ if(!fSuccess && GetLastError() != ERROR_MORE_DATA)
+ {
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ void* lpBuffer;
+ FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ ::GetLastError(),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR) &lpBuffer,
+ 0,
+ NULL );
+ MessageBox(NULL,(LPCTSTR)lpBuffer, L"Error detected with the connexion", MB_OK);
+ LocalFree( lpBuffer );
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ disconnectFromServer();
+ return false;
+ }
+ else
+ return true;
+}
diff --git a/catchcopy-windows-explorer-plugin/ClientCatchcopy.h b/catchcopy-windows-explorer-plugin/ClientCatchcopy.h
new file mode 100755
index 0000000..954bff7
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/ClientCatchcopy.h
@@ -0,0 +1,68 @@
+/** \file ClientCatchcopy.h
+\brief Define the catchcopy client
+\author alpha_one_x86
+\version 0002
+\date 2010 */
+
+#ifndef CLIENTCATCHCOPY_H
+#define CLIENTCATCHCOPY_H
+
+#define NONBLOCK_FLAG
+#define BUFSIZE 512
+#define S_LEN 8
+
+#define C_INT(p) *((int *) (p))
+#define BLOCK_SIZ 64000
+#define BUFFER_PIPE 32000
+
+#include <windows.h>
+#include <string>
+#include <deque>
+#include <stdlib.h>
+
+#include "Variable.h"
+#include "Deque.h"
+
+typedef unsigned char byte_t;
+
+class ClientCatchcopy
+{
+ public:
+ ClientCatchcopy();
+ ~ClientCatchcopy();
+ bool connectToServer();
+ void disconnectFromServer();
+ /// \brief to send order
+ bool sendProtocol();
+ bool setClientName(wchar_t *name);
+ bool addCopyWithDestination(CDeque sources,wchar_t *destination);
+ bool addCopyWithoutDestination(CDeque sources);
+ bool addMoveWithDestination(CDeque sources,wchar_t *destination);
+ bool addMoveWithoutDestination(CDeque sources);
+ /// \brief to send stream of string list
+ bool sendRawOrderList(CDeque order,bool first_try=true);
+ bool isConnected();
+ private:
+ HANDLE m_hpipe;
+ unsigned int idNextOrder;
+ char *m_pipename;
+ byte_t *m_blk;
+ int m_tot;
+ int m_len;
+
+ char * toHex(const char *str);
+ int dataToPipe();
+ int addInt32(int value);
+ int addStr(WCHAR *data);
+ byte_t *blkGrowing(int added);
+ void setInt32(int offset, int value);
+ int toBigEndian(WCHAR *p);
+ void clear();
+ int writePipe(HANDLE hPipe, byte_t *ptr, int len);
+ #ifdef NONBLOCK_FLAG
+ int writePipe_nonBlock(HANDLE hPipe, byte_t *ptr, int len);
+ #endif
+ bool canConnect;
+};
+
+#endif // CLIENTCATCHCOPY_H
diff --git a/catchcopy-windows-explorer-plugin/DDShellExt.cpp b/catchcopy-windows-explorer-plugin/DDShellExt.cpp
new file mode 100755
index 0000000..25142d5
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/DDShellExt.cpp
@@ -0,0 +1,188 @@
+// DDShellExt.cpp : Implementation of CDDShellExt
+
+#include "tchar.h"
+#include "DDShellExt.h"
+#include "ClientCatchcopy.h"
+
+#include <Shlwapi.h>
+
+extern HINSTANCE g_hInst;
+extern long g_cDllRef;
+
+CDDShellExt::CDDShellExt(): m_cRef(1)
+{
+ InterlockedIncrement(&g_cDllRef);
+}
+
+CDDShellExt::~CDDShellExt()
+{
+ InterlockedDecrement(&g_cDllRef);
+}
+
+// Query to the interface the component supported.
+IFACEMETHODIMP CDDShellExt::QueryInterface(REFIID riid, void **ppv)
+{
+ if(riid == IID_IUnknown || riid == IID_IContextMenu)
+ {
+ *ppv = static_cast<IContextMenu*>(this);
+ }
+ else if (riid == IID_IShellExtInit)
+ {
+ *ppv = static_cast<IShellExtInit*>(this);
+ }
+ else
+ {
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+ reinterpret_cast<IUnknown*>(*ppv)->AddRef();
+ return S_OK;
+}
+
+// Increase the reference count for an interface on an object.
+IFACEMETHODIMP_(ULONG) CDDShellExt::AddRef()
+{
+ return InterlockedIncrement(&m_cRef);
+}
+
+// Decrease the reference count for an interface on an object.
+IFACEMETHODIMP_(ULONG) CDDShellExt::Release()
+{
+ ULONG cRef = InterlockedDecrement(&m_cRef);
+ if (0 == cRef)
+ delete this;
+ return cRef;
+}
+
+STDMETHODIMP CDDShellExt::Initialize(LPCITEMIDLIST pidlFolder,LPDATAOBJECT pDO,HKEY hProgID)
+{
+ (void)hProgID;
+ if(!connected)
+ {
+ bool b = m_ac.connectToServer();
+
+ if (b==true)
+ {
+ connected=true;
+ }
+ else
+ return E_FAIL;
+ }
+
+ FORMATETC fmt={CF_HDROP,NULL,DVASPECT_CONTENT,-1,TYMED_HGLOBAL};
+ STGMEDIUM stg={TYMED_HGLOBAL};
+ HDROP hDrop;
+
+ fDestDir[0]=0;
+ if (!SHGetPathFromIDList(pidlFolder,fDestDir))
+ {
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ MessageBox(NULL,L"Initialize",L"E_FAIL 1",MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ return E_FAIL;
+ }
+
+ // Detect if it's explorer that started the operation by enumerating available
+ // clipboard formats and searching for one that only explorer uses
+ IEnumFORMATETC *en;
+ FORMATETC fmt2;
+ WCHAR fmtName[65535]=L"\0";
+ fFromExplorer=false;
+ pDO->EnumFormatEtc(DATADIR_GET,&en);
+ while(en->Next(1,&fmt2,NULL)==S_OK){
+ GetClipboardFormatName(fmt2.cfFormat,fmtName,sizeof(fmtName));
+ if (!wcscmp(fmtName,CFSTR_SHELLIDLIST)) fFromExplorer=true;
+ }
+ en->Release();
+
+ // Look for CF_HDROP data in the data object. If there
+ // is no such data, return an error back to Explorer.
+ if (FAILED(pDO->GetData(&fmt,&stg)))
+ {
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ MessageBox(NULL,L"Initialize",L"E_INVALIDARG 2",MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ return E_INVALIDARG;
+ }
+
+ // Get a pointer to the actual data.
+ hDrop=(HDROP)GlobalLock(stg.hGlobal);
+
+ // Make sure it worked.
+ if (hDrop==NULL)
+ {
+ #ifdef CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ MessageBox(NULL,L"Initialize",L"E_INVALIDARG 1",MB_OK);
+ #endif // CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+ return E_INVALIDARG;
+ }
+
+ UINT numFiles,i;
+ WCHAR fn[MAX_PATH]=L"";
+
+ numFiles=DragQueryFile(hDrop,0xFFFFFFFF,NULL,0);
+
+ if (numFiles)
+ {
+ for(i=0;i<numFiles;++i)
+ {
+ if(DragQueryFile(hDrop,i,fn,MAX_PATH))
+ sources.push_back(fn);
+ }
+ }
+
+ GlobalUnlock(stg.hGlobal);
+ ReleaseStgMedium(&stg);
+
+ return S_OK;
+}
+
+STDMETHODIMP CDDShellExt::QueryContextMenu(HMENU hmenu,UINT uMenuIndex,UINT uidFirstCmd,UINT uidLastCmd,UINT uFlags)
+{
+ (void)uidLastCmd;
+ if(!m_ac.isConnected())
+ {
+ if(!m_ac.connectToServer())
+ return E_FAIL;
+ }
+ if (uFlags&CMF_DEFAULTONLY)
+ return MAKE_HRESULT(SEVERITY_SUCCESS,FACILITY_NULL,0);
+
+ int x=uidFirstCmd;
+
+ InsertMenu(hmenu,uMenuIndex++,MF_STRING|MF_BYPOSITION,x++,L"Copy with advanced software");
+ InsertMenu(hmenu,uMenuIndex++,MF_STRING|MF_BYPOSITION,x++,L"Move with advanced software");
+
+ int defItem=GetMenuDefaultItem(hmenu,false,0);
+ if (defItem==1) // 1: Copy
+ {
+ if (fFromExplorer)
+ SetMenuDefaultItem(hmenu,uidFirstCmd,false);
+ }
+ else if (defItem==2) //2: Move
+ {
+ SetMenuDefaultItem(hmenu,uidFirstCmd+1,false);
+ }
+ return MAKE_HRESULT(SEVERITY_SUCCESS,FACILITY_NULL,2);
+}
+
+
+STDMETHODIMP CDDShellExt::InvokeCommand ( LPCMINVOKECOMMANDINFO pInfo )
+{
+ if(HIWORD(pInfo->lpVerb))
+ return E_INVALIDARG;
+ switch(LOWORD(pInfo->lpVerb))
+ {
+ case 0:// copy
+ if(!m_ac.addCopyWithDestination(sources,fDestDir))
+ return E_FAIL;
+ break;
+ case 1:// move
+ if(!m_ac.addMoveWithDestination(sources,fDestDir))
+ return E_FAIL;
+ break;
+ default :
+ return S_OK;
+ }
+ return S_OK;
+}
diff --git a/catchcopy-windows-explorer-plugin/DDShellExt.h b/catchcopy-windows-explorer-plugin/DDShellExt.h
new file mode 100755
index 0000000..9e9f68f
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/DDShellExt.h
@@ -0,0 +1,46 @@
+// DDShellExt.h : Declaration of the CDDShellExt
+
+#pragma once
+#include "resource.h" // main symbols
+#include "shlobj.h"
+#include "ClientCatchcopy.h"
+#include "Variable.h"
+#include "Deque.h"
+
+static bool connected=false;
+static ClientCatchcopy m_ac;
+
+// CDDShellExt
+
+extern const CLSID CLSID_DDShellExt;
+
+class CDDShellExt :
+ public IShellExtInit,
+ public IContextMenu
+{
+private:
+ static int fBaselistHandle;
+ bool fFromExplorer;
+ WCHAR fDestDir[MAX_PATH];
+ //static ClientCatchcopy m_ac;
+ CDeque sources;
+ //static bool connected;
+
+ // Reference count of component.
+ long m_cRef;
+public:
+ // IUnknown
+ IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv);
+ IFACEMETHODIMP_(ULONG) AddRef();
+ IFACEMETHODIMP_(ULONG) Release();
+
+ // IShellExtInit
+ STDMETHODIMP Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY);
+
+ CDDShellExt(void);
+ ~CDDShellExt(void);
+ // IContextMenu
+ STDMETHODIMP GetCommandString(UINT_PTR idCmd,UINT uFlags,UINT* pwReserved,LPSTR pszName,UINT cchMax){(void)idCmd;(void)uFlags;(void)pwReserved;(void)pszName;(void)cchMax;(void)connected;return E_NOTIMPL;};
+ STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO);
+ STDMETHODIMP QueryContextMenu(HMENU,UINT,UINT,UINT,UINT);
+};
diff --git a/catchcopy-windows-explorer-plugin/Deque.cpp b/catchcopy-windows-explorer-plugin/Deque.cpp
new file mode 100755
index 0000000..93a9fcb
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/Deque.cpp
@@ -0,0 +1,100 @@
+#include "Deque.h"
+#include <windows.h>
+
+CDeque::CDeque(void)
+{
+ top1=0;
+ top2=0;
+ head=NULL;
+ tail=NULL;
+}
+
+CDeque::~CDeque(void)
+{
+}
+
+void CDeque::push_front(wchar_t *str)
+{
+ CNode *temp;
+ if(top1+top2 >= MAX_DEQUE)
+ {
+ return ;
+ }
+
+ if(top1+top2 == 0)
+ {
+ head = new CNode;
+ wcscpy(head->str, str);
+ head->next=NULL;
+ head->prev=NULL;
+ tail=head;
+ top1++;
+ }
+ else
+ {
+ top1++;
+ temp=new CNode;
+ wcscpy(temp->str, str);
+ temp->next=head;
+ temp->prev=NULL;
+ head->prev=temp;
+ head=temp;
+ }
+}
+
+void CDeque::push_back(wchar_t *str)
+{
+ CNode *temp;
+ if(top1+top2 >= MAX_DEQUE)
+ {
+ return ;
+ }
+ if(top1+top2 == 0)
+ {
+ head = new CNode;
+ wcscpy(head->str, str);
+ head->next=NULL;
+ head->prev=NULL;
+ tail=head;
+ top1++;
+ }
+ else
+ {
+ top2++;
+ temp=new CNode;
+ wcscpy(temp->str, str);
+ temp->next=NULL;
+ temp->prev=tail;
+ tail->next=temp;
+ tail=temp;
+ }
+}
+
+int CDeque::size()
+{
+ return top1 + top2;
+}
+
+wchar_t *CDeque::at(int pos)
+{
+ int i=0;
+ CNode *temp;
+
+ if(top1+top2 <= 0)
+ {
+ return NULL;
+ }
+
+ temp=head;
+ while(temp!=NULL)
+ {
+ if(i==pos)
+ return temp->str;
+
+ temp=temp->next;
+
+ i++;
+ }
+
+ return NULL;
+}
diff --git a/catchcopy-windows-explorer-plugin/Deque.h b/catchcopy-windows-explorer-plugin/Deque.h
new file mode 100755
index 0000000..e0e1f28
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/Deque.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#define MAX_STR_LEN 512
+#define MAX_DEQUE 512
+
+class CNode
+{
+public:
+ wchar_t str[MAX_STR_LEN];
+ class CNode *next;
+ class CNode *prev;
+};
+
+class CDeque : public CNode
+{
+public:
+ CDeque(void);
+ ~CDeque(void);
+
+private:
+ CNode *head,*tail;
+ int top1,top2;
+
+public:
+ void push_front(wchar_t *str);
+ void push_back(wchar_t *str);
+ int size();
+ wchar_t *at(int pos);
+};
diff --git a/catchcopy-windows-explorer-plugin/Reg.cpp b/catchcopy-windows-explorer-plugin/Reg.cpp
new file mode 100755
index 0000000..37f7cc1
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/Reg.cpp
@@ -0,0 +1,403 @@
+#include "Reg.h"
+#include <strsafe.h>
+
+//
+// FUNCTION: SetHKCRRegistryKeyAndValue
+//
+// PURPOSE: The function creates a HKCR registry key and sets the specified
+// registry value.
+//
+// PARAMETERS:
+// * pszSubKey - specifies the registry key under HKCR. If the key does not
+// exist, the function will create the registry key.
+// * pszValueName - specifies the registry value to be set. If pszValueName
+// is NULL, the function will set the default value.
+// * pszData - specifies the string data of the registry value.
+//
+// RETURN VALUE:
+// If the function succeeds, it returns S_OK. Otherwise, it returns an
+// HRESULT error code.
+//
+HRESULT SetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName,
+ PCWSTR pszData)
+{
+ HRESULT hr;
+ HKEY hKey = NULL;
+
+ // Creates the specified registry key. If the key already exists, the
+ // function opens it.
+ hr = HRESULT_FROM_WIN32(RegCreateKeyEx(
+ #ifdef CATCHCOPY_ROOT_MODE
+ HKEY_CLASSES_ROOT
+ #else
+ HKEY_CURRENT_USER
+ #endif
+ , pszSubKey, 0,
+ NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS | KEY_WOW64_64KEY, NULL, &hKey, NULL));
+
+ if (SUCCEEDED(hr))
+ {
+ if (pszData != NULL)
+ {
+ // Set the specified value of the key.
+ DWORD cbData = lstrlen(pszData) * sizeof(*pszData);
+ hr = HRESULT_FROM_WIN32(RegSetValueEx(hKey, pszValueName, 0,
+ REG_SZ, reinterpret_cast<const BYTE *>(pszData), cbData));
+ }
+
+ RegCloseKey(hKey);
+ }
+
+ return hr;
+}
+
+LONG RecursiveDeleteKey(HKEY hKeyParent, PCWSTR szKeyChild)
+{
+ // Open the child.
+ HKEY hKeyChild ;
+ LONG lRes = RegOpenKeyEx(hKeyParent, szKeyChild, 0,
+ KEY_ALL_ACCESS | KEY_WOW64_64KEY, &hKeyChild) ;
+ if (lRes != ERROR_SUCCESS)
+ {
+ return lRes ;
+ }
+ // Enumerate all of the decendents of this child.
+ FILETIME time ;
+ wchar_t szBuffer[MAX_PATH];
+ DWORD dwSize = MAX_PATH ;
+ while (RegEnumKeyEx(hKeyChild, 0, (LPWSTR)szBuffer, &dwSize, NULL,
+ NULL, NULL, &time) == ERROR_SUCCESS)
+ {
+ // Delete the decendents of this child.
+ lRes = RecursiveDeleteKey(hKeyChild, (PCWSTR)szBuffer) ;
+ if (lRes != ERROR_SUCCESS)
+ {
+ // Cleanup before exiting.
+ RegCloseKey(hKeyChild) ;
+ return lRes;
+ }
+ dwSize = MAX_PATH ;
+ }
+
+ // Close the child.
+ RegCloseKey(hKeyChild) ;
+
+ // Delete this child.
+ return RegDeleteKey(hKeyParent, szKeyChild) ;
+}
+
+//
+// FUNCTION: GetHKCRRegistryKeyAndValue
+//
+// PURPOSE: The function opens a HKCR registry key and gets the data for the
+// specified registry value name.
+//
+// PARAMETERS:
+// * pszSubKey - specifies the registry key under HKCR. If the key does not
+// exist, the function returns an error.
+// * pszValueName - specifies the registry value to be retrieved. If
+// pszValueName is NULL, the function will get the default value.
+// * pszData - a pointer to a buffer that receives the value's string data.
+// * cbData - specifies the size of the buffer in bytes.
+//
+// RETURN VALUE:
+// If the function succeeds, it returns S_OK. Otherwise, it returns an
+// HRESULT error code. For example, if the specified registry key does not
+// exist or the data for the specified value name was not set, the function
+// returns COR_E_FILENOTFOUND (0x80070002).
+//
+HRESULT GetHKCRRegistryKeyAndValue(PCWSTR pszSubKey, PCWSTR pszValueName,
+ PWSTR pszData, DWORD cbData)
+{
+ HRESULT hr;
+ HKEY hKey = NULL;
+
+ // Try to open the specified registry key.
+ hr = HRESULT_FROM_WIN32(RegOpenKeyEx(
+ #ifdef CATCHCOPY_ROOT_MODE
+ HKEY_CLASSES_ROOT
+ #else
+ HKEY_CURRENT_USER
+ #endif
+ , pszSubKey, 0,
+ KEY_READ, &hKey));
+
+ if (SUCCEEDED(hr))
+ {
+ // Get the data for the specified value name.
+ hr = HRESULT_FROM_WIN32(RegQueryValueEx(hKey, pszValueName, NULL,
+ NULL, reinterpret_cast<LPBYTE>(pszData), &cbData));
+
+ RegCloseKey(hKey);
+ }
+
+ return hr;
+}
+
+//
+// FUNCTION: RegisterInprocServer
+//
+// PURPOSE: Register the in-process component in the registry.
+//
+// PARAMETERS:
+// * pszModule - Path of the module that contains the component
+// * clsid - Class ID of the component
+// * pszFriendlyName - Friendly name
+// * pszThreadModel - Threading model
+//
+// NOTE: The function creates the HKCR\CLSID\{<CLSID>} key in the registry.
+//
+// HKCR
+// {
+// NoRemove CLSID
+// {
+// ForceRemove {<CLSID>} = s '<Friendly Name>'
+// {
+// InprocServer32 = s '%MODULE%'
+// {
+// val ThreadingModel = s '<Thread Model>'
+// }
+// }
+// }
+// }
+//
+HRESULT RegisterInprocServer(PCWSTR pszModule, const CLSID& clsid, PCWSTR pszFriendlyName, PCWSTR pszThreadModel)
+{
+ if (pszModule == NULL || pszThreadModel == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ HRESULT hr;
+
+ wchar_t szCLSID[MAX_PATH];
+ StringFromGUID2(clsid, szCLSID, ARRAYSIZE(szCLSID));
+
+ wchar_t szSubkey[MAX_PATH];
+
+ // Create the HKCR\CLSID\{<CLSID>} key.
+ hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
+ #ifdef CATCHCOPY_ROOT_MODE
+ L"CLSID\\%s"
+ #else
+ L"Software\\Classes\\CLSID\\%s"
+ #endif
+ , szCLSID);
+ if (SUCCEEDED(hr))
+ {
+ hr = SetHKCRRegistryKeyAndValue(szSubkey, NULL, pszFriendlyName);
+
+ // Create the HKCR\CLSID\{<CLSID>}\InprocServer32 key.
+ if (SUCCEEDED(hr))
+ {
+ hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
+ #ifdef CATCHCOPY_ROOT_MODE
+ L"CLSID\\%s\\InprocServer32"
+ #else
+ L"Software\\Classes\\CLSID\\%s\\InprocServer32"
+ #endif
+ , szCLSID);
+ if (SUCCEEDED(hr))
+ {
+ // Set the default value of the InprocServer32 key to the
+ // path of the COM module.
+ hr = SetHKCRRegistryKeyAndValue(szSubkey, NULL, pszModule);
+ if (SUCCEEDED(hr))
+ {
+ // Set the threading model of the component.
+ hr = SetHKCRRegistryKeyAndValue(szSubkey, L"ThreadingModel", pszThreadModel);
+ }
+ }
+ }
+ }
+
+ return hr;
+}
+
+
+//
+// FUNCTION: UnregisterInprocServer
+//
+// PURPOSE: Unegister the in-process component in the registry.
+//
+// PARAMETERS:
+// * clsid - Class ID of the component
+//
+// NOTE: The function deletes the HKCR\CLSID\{<CLSID>} key in the registry.
+//
+HRESULT UnregisterInprocServer(const CLSID& clsid)
+{
+ HRESULT hr = S_OK;
+
+ wchar_t szCLSID[MAX_PATH];
+ StringFromGUID2(clsid, szCLSID, ARRAYSIZE(szCLSID));
+
+ wchar_t szSubkey[MAX_PATH];
+
+ // Delete the HKCR\CLSID\{<CLSID>} key.
+ hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
+ #ifdef CATCHCOPY_ROOT_MODE
+ L"CLSID\\%s"
+ #else
+ L"Software\\Classes\\CLSID\\%s"
+ #endif
+ , szCLSID);
+
+ if (SUCCEEDED(hr))
+ {
+ hr = HRESULT_FROM_WIN32(RecursiveDeleteKey(
+ #ifdef CATCHCOPY_ROOT_MODE
+ HKEY_CLASSES_ROOT
+ #else
+ HKEY_CURRENT_USER
+ #endif
+ , szSubkey));
+ }
+
+ return hr;
+}
+//
+// FUNCTION: RegisterShellExtContextMenuHandler
+//
+// PURPOSE: Register the context menu handler.
+//
+// PARAMETERS:
+// * pszFileType - The file type that the context menu handler is
+// associated with. For example, '*' means all file types; '.txt' means
+// all .txt files. The parameter must not be NULL.
+// * clsid - Class ID of the component
+// * pszFriendlyName - Friendly name
+//
+// NOTE: The function creates the following key in the registry.
+//
+// HKCR
+// {
+// NoRemove <File Type>
+// {
+// NoRemove shellex
+// {
+// NoRemove ContextMenuHandlers
+// {
+// {<CLSID>} = s '<Friendly Name>'
+// }
+// }
+// }
+// }
+//
+HRESULT RegisterShellExtContextMenuHandler(
+ PCWSTR pszFileType, const CLSID& clsid, PCWSTR pszFriendlyName)
+{
+ if (pszFileType == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ HRESULT hr;
+
+ wchar_t szCLSID[MAX_PATH];
+ StringFromGUID2(clsid, szCLSID, ARRAYSIZE(szCLSID));
+
+ wchar_t szSubkey[MAX_PATH];
+
+ // If pszFileType starts with '.', try to read the default value of the
+ // HKCR\<File Type> key which contains the ProgID to which the file type
+ // is linked.
+ if (*pszFileType == L'.')
+ {
+ wchar_t szDefaultVal[260];
+ hr = GetHKCRRegistryKeyAndValue(pszFileType, NULL, szDefaultVal,
+ sizeof(szDefaultVal));
+
+ // If the key exists and its default value is not empty, use the
+ // ProgID as the file type.
+ if (SUCCEEDED(hr) && szDefaultVal[0] != L'\0')
+ {
+ pszFileType = szDefaultVal;
+ }
+ }
+
+ // Create the key HKCR\<File Type>\shellex\DragDropHandlers\{<CLSID>}
+ hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
+ #ifdef CATCHCOPY_ROOT_MODE
+ L"%s\\shellex\\DragDropHandlers\\%s"
+ #else
+ L"Software\\Classes\\%s\\shellex\\DragDropHandlers\\%s"
+ #endif
+ , pszFileType, szCLSID);
+ if (SUCCEEDED(hr))
+ {
+ // Set the default value of the key.
+ hr = SetHKCRRegistryKeyAndValue(szSubkey, NULL, pszFriendlyName);
+ }
+
+ return hr;
+}
+
+
+//
+// FUNCTION: UnregisterShellExtContextMenuHandler
+//
+// PURPOSE: Unregister the context menu handler.
+//
+// PARAMETERS:
+// * pszFileType - The file type that the context menu handler is
+// associated with. For example, '*' means all file types; '.txt' means
+// all .txt files. The parameter must not be NULL.
+// * clsid - Class ID of the component
+//
+// NOTE: The function removes the {<CLSID>} key under
+// HKCR\<File Type>\shellex\ContextMenuHandlers in the registry.
+//
+HRESULT UnregisterShellExtContextMenuHandler(
+ PCWSTR pszFileType, const CLSID& clsid)
+{
+ if (pszFileType == NULL)
+ {
+ return E_INVALIDARG;
+ }
+
+ HRESULT hr;
+
+ wchar_t szCLSID[MAX_PATH];
+ StringFromGUID2(clsid, szCLSID, ARRAYSIZE(szCLSID));
+
+ wchar_t szSubkey[MAX_PATH];
+
+ // If pszFileType starts with '.', try to read the default value of the
+ // HKCR\<File Type> key which contains the ProgID to which the file type
+ // is linked.
+ if (*pszFileType == L'.')
+ {
+ wchar_t szDefaultVal[260];
+ hr = GetHKCRRegistryKeyAndValue(pszFileType, NULL, szDefaultVal,
+ sizeof(szDefaultVal));
+
+ // If the key exists and its default value is not empty, use the
+ // ProgID as the file type.
+ if (SUCCEEDED(hr) && szDefaultVal[0] != L'\0')
+ {
+ pszFileType = szDefaultVal;
+ }
+ }
+
+ // Remove the HKCR\<File Type>\shellex\DragDropHandlers\{<CLSID>} key.
+ hr = StringCchPrintf(szSubkey, ARRAYSIZE(szSubkey),
+ #ifdef CATCHCOPY_ROOT_MODE
+ L"%s\\shellex\\DragDropHandlers\\%s"
+ #else
+ L"Software\\Classes\\%s\\shellex\\DragDropHandlers\\%s"
+ #endif
+ , pszFileType, szCLSID);
+ if (SUCCEEDED(hr))
+ {
+ hr = HRESULT_FROM_WIN32(RecursiveDeleteKey(
+ #ifdef CATCHCOPY_ROOT_MODE
+ HKEY_CLASSES_ROOT
+ #else
+ HKEY_CURRENT_USER
+ #endif
+ , szSubkey));
+ }
+
+ return hr;
+}
diff --git a/catchcopy-windows-explorer-plugin/Reg.h b/catchcopy-windows-explorer-plugin/Reg.h
new file mode 100755
index 0000000..6bc9a26
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/Reg.h
@@ -0,0 +1,103 @@
+#ifndef _REG_H_
+#define _REG_H_
+#pragma once
+
+//#define CATCHCOPY_ROOT_MODE
+
+#include <windows.h>
+#include <winreg.h>
+//
+// FUNCTION: RegisterInprocServer
+//
+// PURPOSE: Register the in-process component in the registry.
+//
+// PARAMETERS:
+// * pszModule - Path of the module that contains the component
+// * clsid - Class ID of the component
+// * pszFriendlyName - Friendly name
+// * pszThreadModel - Threading model
+//
+// NOTE: The function creates the HKCR\CLSID\{<CLSID>} key in the registry.
+//
+// HKCR
+// {
+// NoRemove CLSID
+// {
+// ForceRemove {<CLSID>} = s '<Friendly Name>'
+// {
+// InprocServer32 = s '%MODULE%'
+// {
+// val ThreadingModel = s '<Thread Model>'
+// }
+// }
+// }
+// }
+//
+HRESULT RegisterInprocServer(PCWSTR pszModule, const CLSID& clsid,
+ PCWSTR pszFriendlyName, PCWSTR pszThreadModel);
+
+
+//
+// FUNCTION: UnregisterInprocServer
+//
+// PURPOSE: Unegister the in-process component in the registry.
+//
+// PARAMETERS:
+// * clsid - Class ID of the component
+//
+// NOTE: The function deletes the HKCR\CLSID\{<CLSID>} key in the registry.
+//
+HRESULT UnregisterInprocServer(const CLSID& clsid);
+
+
+//
+// FUNCTION: RegisterShellExtContextMenuHandler
+//
+// PURPOSE: Register the context menu handler.
+//
+// PARAMETERS:
+// * pszFileType - The file type that the context menu handler is
+// associated with. For example, '*' means all file types; '.txt' means
+// all .txt files. The parameter must not be NULL.
+// * clsid - Class ID of the component
+// * pszFriendlyName - Friendly name
+//
+// NOTE: The function creates the following key in the registry.
+//
+// HKCR
+// {
+// NoRemove <File Type>
+// {
+// NoRemove shellex
+// {
+// NoRemove ContextMenuHandlers
+// {
+// {<CLSID>} = s '<Friendly Name>'
+// }
+// }
+// }
+// }
+//
+HRESULT RegisterShellExtContextMenuHandler(
+ PCWSTR pszFileType, const CLSID& clsid, PCWSTR pszFriendlyName);
+
+
+//
+// FUNCTION: UnregisterShellExtContextMenuHandler
+//
+// PURPOSE: Unregister the context menu handler.
+//
+// PARAMETERS:
+// * pszFileType - The file type that the context menu handler is
+// associated with. For example, '*' means all file types; '.txt' means
+// all .txt files. The parameter must not be NULL.
+// * clsid - Class ID of the component
+//
+// NOTE: The function removes the {<CLSID>} key under
+// HKCR\<File Type>\shellex\ContextMenuHandlers in the registry.
+//
+HRESULT UnregisterShellExtContextMenuHandler(
+ PCWSTR pszFileType, const CLSID& clsid);
+
+LONG RecursiveDeleteKey(HKEY hKeyParent, PCWSTR szKeyChild);
+#endif //_REG_H_
diff --git a/catchcopy-windows-explorer-plugin/Variable.h b/catchcopy-windows-explorer-plugin/Variable.h
new file mode 100755
index 0000000..292e2a0
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/Variable.h
@@ -0,0 +1,7 @@
+#ifndef VARIABLE_H
+#define VARIABLE_H
+
+/// \brief Un-comment this next line to put ultracopier in debug mode
+//#define CATCHCOPY_EXPLORER_PLUGIN_DEBUG
+
+#endif // VARIABLE_H
diff --git a/catchcopy-windows-explorer-plugin/resource.h b/catchcopy-windows-explorer-plugin/resource.h
new file mode 100755
index 0000000..4823355
--- /dev/null
+++ b/catchcopy-windows-explorer-plugin/resource.h
@@ -0,0 +1,18 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by CatchCopy.rc
+//
+#define IDS_PROJNAME 100
+#define IDR_CATCHCOPY 101
+#define IDR_DDSHELLEXT 102
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 201
+#define _APS_NEXT_COMMAND_VALUE 32768
+#define _APS_NEXT_CONTROL_VALUE 201
+#define _APS_NEXT_SYMED_VALUE 103
+#endif
+#endif
diff --git a/cpp11addition.cpp b/cpp11addition.cpp
index 41f3cc1..0375ea3 100644..100755
--- a/cpp11addition.cpp
+++ b/cpp11addition.cpp
@@ -214,7 +214,7 @@ std::string binarytoHexa(const std::vector<char> &data, bool *ok)
std::string binarytoHexa(const void * const data, const uint32_t &size, bool *ok)
{
- return binarytoHexa(reinterpret_cast<const char * const>(data),size,ok);
+ return binarytoHexa(reinterpret_cast<const char *>(data),size,ok);
}
std::string binarytoHexa(const char * const data, const uint32_t &size, bool *ok)
@@ -476,6 +476,69 @@ std::string FSabsolutePath(const std::string &string)
return tempFile;
}
+std::wstring FSabsoluteFilePath(const std::wstring &string)
+{
+ std::wstring newstring=string;
+ #ifdef _WIN32
+ stringreplaceAll(newstring,L"\\",L"/");
+ #endif
+ stringreplaceAll(newstring,L"//",L"/");
+ std::vector<std::wstring> parts=stringsplit(newstring,'/');
+
+ #ifndef _WIN32
+ unsigned int index=1;
+ #else
+ unsigned int index=2;
+ #endif
+ while(index<parts.size())
+ {
+ if(parts.at(index)==L"..")
+ {
+ parts.erase(parts.begin()+index);
+ #ifndef _WIN32
+ if(index>0 && (index>1 || !parts.at(index-1).empty()))
+ #else
+ if(index>1)
+ #endif
+ {
+ parts.erase(parts.begin()+index-1);
+ index--;
+ }
+ }
+ else
+ index++;
+ }
+
+ #ifndef _WIN32
+ if(parts.empty() || (parts.size()==1 && parts.at(0).empty()))
+ return L"/";
+ #endif
+
+ std::wstring newString;
+ std::vector<std::wstring> copy=parts;
+ unsigned int count=0;
+ while(!copy.empty())
+ {
+ if(count>0)
+ newString+=L'/';
+ newString+=copy.front();
+ copy.erase(copy.begin());
+ ++count;
+ }
+
+ return newString;
+}
+
+std::wstring FSabsolutePath(const std::wstring &string)
+{
+ const std::wstring &tempFile=FSabsoluteFilePath(string);
+ const std::size_t &found=tempFile.find_last_of(L"/\\");
+ if(found!=std::wstring::npos)
+ return tempFile.substr(0,found)+L'/';
+ else
+ return tempFile;
+}
+
uint64_t msFrom1970()
{
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
@@ -501,16 +564,22 @@ std::vector<std::string> stringtostringlist(const std::string &string)
std::vector<std::string> returnedVar;
size_t start_pos = 0;
size_t firstChar = 0;
- while((start_pos = string.find(',', start_pos)) != std::string::npos) {
- if(start_pos==0 || string.at(start_pos-1)!=',')
+ do
+ {
+ size_t s=start_pos = string.find(',', start_pos);
+ if(s == std::string::npos)
+ start_pos=string.size();
+ if(start_pos>=string.size() || string.at(start_pos+1)!=',')
{
- std::string tempString=string.substr(firstChar,start_pos-1);
+ std::string tempString=string.substr(firstChar,start_pos-firstChar);
stringreplaceAll(tempString,",,",",");
returnedVar.push_back(tempString);
start_pos++;
firstChar=start_pos;
}
- }
+ else
+ start_pos+=2;
+ } while(firstChar<start_pos || start_pos<string.size());
return returnedVar;
}
@@ -529,3 +598,89 @@ std::string stringlisttostring(const std::vector<std::string> &stringlist)
}
return returnedString;
}
+
+bool stringreplaceOne(std::wstring& str, const std::wstring& from, const std::wstring& to)
+{
+ const size_t start_pos = str.find(from);
+ if(start_pos == std::wstring::npos)
+ return false;
+ str.replace(start_pos, from.length(), to);
+ return true;
+}
+
+uint8_t stringreplaceAll(std::wstring& str, const std::wstring& from, const std::wstring& to)
+{
+ if(from.empty())
+ return 0;
+ size_t start_pos = 0;
+ uint8_t count=0;
+ while((start_pos = str.find(from, start_pos)) != std::wstring::npos) {
+ str.replace(start_pos, from.length(), to);
+ start_pos += to.length(); // In case 'to' contains 'from', like replacing 'x' with 'yx'
+ count++;
+ }
+ return count;
+}
+
+bool stringEndsWith(std::wstring const &fullString, std::wstring const &ending)
+{
+ if (fullString.length() >= ending.length()) {
+ return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending));
+ } else {
+ return false;
+ }
+}
+
+bool stringEndsWith(std::wstring const &fullString, char const &ending)
+{
+ if (fullString.length()>0) {
+ return fullString[fullString.size()-1]==ending;
+ } else {
+ return false;
+ }
+}
+
+bool stringStartWith(std::wstring const &fullString, std::wstring const &starting)
+{
+ if (fullString.length() >= starting.length()) {
+ return (fullString.substr(0,starting.length())==starting);
+ } else {
+ return false;
+ }
+}
+
+bool stringStartWith(std::wstring const &fullString, char const &starting)
+{
+ if (fullString.length()>0) {
+ return fullString[0]==starting;
+ } else {
+ return false;
+ }
+}
+
+std::vector<std::wstring> stringsplit(const std::wstring &s, wchar_t delim)
+{
+ std::vector<std::wstring> elems;
+
+ std::wstring::size_type i = 0;
+ std::wstring::size_type j = s.find(delim);
+
+ if(j == std::wstring::npos)
+ {
+ if(!s.empty())
+ elems.push_back(s);
+ return elems;
+ }
+ else
+ {
+ while (j != std::wstring::npos) {
+ elems.push_back(s.substr(i, j-i));
+ i = ++j;
+ j = s.find(delim, j);
+
+ if (j == std::wstring::npos)
+ elems.push_back(s.substr(i, s.length()));
+ }
+ return elems;
+ }
+}
diff --git a/cpp11addition.h b/cpp11addition.h
index 022f175..061285e 100644..100755
--- a/cpp11addition.h
+++ b/cpp11addition.h
@@ -39,6 +39,14 @@ std::string stringimplode(const std::vector<std::string>& elems, char delim);
std::string stringimplode(const std::queue<std::string>& elems, char delim);
std::string stringimplode(const std::vector<std::string>& elems, const std::string &delim);
+bool stringreplaceOne(std::wstring& str, const std::wstring& from, const std::wstring& to);
+uint8_t stringreplaceAll(std::wstring& str, const std::wstring& from, const std::wstring& to);
+bool stringEndsWith(std::wstring const &fullString, std::wstring const &ending);
+bool stringEndsWith(std::wstring const &fullString, char const &ending);
+bool stringStartWith(std::wstring const &fullString, std::wstring const &starting);
+bool stringStartWith(std::wstring const &fullString, char const &starting);
+std::vector<std::wstring> stringsplit(const std::wstring &s, wchar_t delim);
+
uint8_t stringtouint8(const std::string &string,bool *ok=NULL);
uint16_t stringtouint16(const std::string &string,bool *ok=NULL);
uint32_t stringtouint32(const std::string &string,bool *ok=NULL);
@@ -65,6 +73,8 @@ void binaryAppend(std::vector<char> &data, const char * const add, const uint32_
std::vector<char> base64toBinary(const std::string &string);
std::string FSabsoluteFilePath(const std::string &string);
std::string FSabsolutePath(const std::string &string);
+std::wstring FSabsoluteFilePath(const std::wstring &string);
+std::wstring FSabsolutePath(const std::wstring &string);
uint64_t msFrom1970();
uint64_t sFrom1970();
diff --git a/cpp11additionstringtointcpp.cpp b/cpp11additionstringtointcpp.cpp
index 50a9d17..50a9d17 100644..100755
--- a/cpp11additionstringtointcpp.cpp
+++ b/cpp11additionstringtointcpp.cpp
diff --git a/file-manager/libfm-qt-uc.patch b/file-manager/libfm-qt-uc.patch
new file mode 100644
index 0000000..1f2dfb9
--- /dev/null
+++ b/file-manager/libfm-qt-uc.patch
@@ -0,0 +1,94 @@
+diff -ur libfm-qt-0.14.1/CMakeLists.txt libfm-qt-0.14.1-patched/CMakeLists.txt
+--- libfm-qt-0.14.1/CMakeLists.txt 2019-02-24 10:56:00.000000000 -0400
++++ libfm-qt-0.14.1-patched/CMakeLists.txt 2019-12-19 13:58:02.031193213 -0400
+@@ -34,6 +34,7 @@
+ find_package(Qt5Widgets "${QT_MINIMUM_VERSION}" REQUIRED)
+ find_package(Qt5LinguistTools "${QT_MINIMUM_VERSION}" REQUIRED)
+ find_package(Qt5X11Extras "${QT_MINIMUM_VERSION}" REQUIRED)
++find_package(Qt5Network "${QT_MINIMUM_VERSION}" REQUIRED)
+
+ find_package(lxqt-build-tools "${LXQTBT_MINIMUM_VERSION}" REQUIRED)
+ find_package(GLIB "${GLIB_MINIMUM_VERSION}" REQUIRED COMPONENTS gio gio-unix gobject gthread)
+diff -ur libfm-qt-0.14.1/src/utilities.cpp libfm-qt-0.14.1-patched/src/utilities.cpp
+--- libfm-qt-0.14.1/src/utilities.cpp 2019-02-24 10:56:00.000000000 -0400
++++ libfm-qt-0.14.1-patched/src/utilities.cpp 2019-12-19 16:25:07.811840646 -0400
+@@ -28,6 +28,7 @@
+ #include <QMessageBox>
+ #include "fileoperation.h"
+ #include <QEventLoop>
++#include <QtNetwork/QLocalSocket>
+
+ #include <pwd.h>
+ #include <grp.h>
+@@ -95,6 +96,27 @@
+ return std::make_pair(paths, isCut);
+ }
+
++void sendRawOrderList(const QStringList & order, QLocalSocket &socket, int idNextOrder)
++{
++ QByteArray block;
++ QDataStream out(&block, QIODevice::WriteOnly);
++ out.setVersion(QDataStream::Qt_4_4);
++ out << int(0);
++ out << idNextOrder;
++ out << order;
++ out.device()->seek(0);
++ out << block.size();
++ do //cut string list and send it as block of 32KB
++ {
++ QByteArray blockToSend;
++ int byteWriten;
++ blockToSend=block.left(32*1024);//32KB
++ block.remove(0,blockToSend.size());
++ byteWriten = socket.write(blockToSend);
++ }
++ while(block.size());
++}
++
+ void pasteFilesFromClipboard(const Fm::FilePath& destPath, QWidget* parent) {
+ QClipboard* clipboard = QApplication::clipboard();
+ const QMimeData* data = clipboard->mimeData();
+@@ -104,12 +126,38 @@
+ std::tie(paths, isCut) = parseClipboardData(*data);
+
+ if(!paths.empty()) {
+- if(isCut) {
+- FileOperation::moveFiles(paths, destPath, parent);
+- clipboard->clear(QClipboard::Clipboard);
++ QLocalSocket socket;
++ socket.connectToServer(QString::fromStdString("advanced-copier-"+std::to_string(getuid())));
++ socket.waitForConnected();
++ if(socket.state()==QLocalSocket::ConnectedState)
++ {
++ sendRawOrderList(QStringList() << "protocol" << "0002", socket, 1);
++ socket.waitForReadyRead();
++ socket.readAll();
++ QStringList l;
++ if(isCut) {
++ l << "mv";
++ clipboard->clear(QClipboard::Clipboard);
++ }
++ else {
++ l << "cp";
++ }
++ for(const FilePath &n : paths)
++ l << n.toString().get();
++ l << destPath.toString().get();
++ sendRawOrderList(l, socket, 2);
++ socket.waitForBytesWritten();
++ socket.close();
+ }
+- else {
+- FileOperation::copyFiles(paths, destPath, parent);
++ else
++ {
++ if(isCut) {
++ FileOperation::moveFiles(paths, destPath, parent);
++ clipboard->clear(QClipboard::Clipboard);
++ }
++ else {
++ FileOperation::copyFiles(paths, destPath, parent);
++ }
+ }
+ }
+ }
diff --git a/file-manager/pcmanfm-qt-uc.patch b/file-manager/pcmanfm-qt-uc.patch
new file mode 100644
index 0000000..16c80d2
--- /dev/null
+++ b/file-manager/pcmanfm-qt-uc.patch
@@ -0,0 +1,191 @@
+diff -ur pcmanfm-qt-0.14.1/CMakeLists.txt pcmanfm-qt-patched/CMakeLists.txt
+--- pcmanfm-qt-0.14.1/CMakeLists.txt 2019-02-23 20:16:13.000000000 -0400
++++ pcmanfm-qt-patched/CMakeLists.txt 2019-12-19 17:16:14.796019382 -0400
+@@ -24,6 +24,7 @@
+ find_package(Qt5LinguistTools ${QT_MINIMUM_VERSION} REQUIRED)
+ find_package(Qt5Widgets ${QT_MINIMUM_VERSION} REQUIRED)
+ find_package(Qt5X11Extras ${QT_MINIMUM_VERSION} REQUIRED)
++find_package(Qt5Network "${QT_MINIMUM_VERSION}" REQUIRED)
+ find_package(fm-qt ${LIBFMQT_MINIMUM_VERSION} REQUIRED)
+ find_package(lxqt-build-tools ${LXQTBT_MINIMUM_VERSION} REQUIRED)
+
+diff -ur pcmanfm-qt-0.14.1/pcmanfm/CMakeLists.txt pcmanfm-qt-patched/pcmanfm/CMakeLists.txt
+--- pcmanfm-qt-0.14.1/pcmanfm/CMakeLists.txt 2019-02-23 20:16:13.000000000 -0400
++++ pcmanfm-qt-patched/pcmanfm/CMakeLists.txt 2019-12-19 17:16:55.556039000 -0400
+@@ -79,6 +79,7 @@
+ Qt5::X11Extras
+ Qt5::Widgets
+ Qt5::DBus
++ Qt5::Network
+ fm-qt
+ )
+
+diff -ur pcmanfm-qt-0.14.1/pcmanfm/desktopwindow.cpp pcmanfm-qt-patched/pcmanfm/desktopwindow.cpp
+--- pcmanfm-qt-0.14.1/pcmanfm/desktopwindow.cpp 2019-02-23 20:16:13.000000000 -0400
++++ pcmanfm-qt-patched/pcmanfm/desktopwindow.cpp 2019-12-19 16:52:39.985314000 -0400
+@@ -40,6 +40,7 @@
+ #include <QStandardPaths>
+ #include <QClipboard>
+ #include <QWindow>
++#include <QtNetwork/QLocalSocket>
+
+ #include "./application.h"
+ #include "mainwindow.h"
+@@ -1324,11 +1325,73 @@
+ }
+ }
+
++void sendRawOrderList(const QStringList & order, QLocalSocket &socket, int idNextOrder)
++{
++ QByteArray block;
++ QDataStream out(&block, QIODevice::WriteOnly);
++ out.setVersion(QDataStream::Qt_4_4);
++ out << int(0);
++ out << idNextOrder;
++ out << order;
++ out.device()->seek(0);
++ out << block.size();
++ do //cut string list and send it as block of 32KB
++ {
++ QByteArray blockToSend;
++ int byteWriten;
++ blockToSend=block.left(32*1024);//32KB
++ block.remove(0,blockToSend.size());
++ byteWriten = socket.write(blockToSend);
++ }
++ while(block.size());
++}
++
+ void DesktopWindow::onPasteActivated() {
+ if(desktopHideItems_) {
+ return;
+ }
+- Fm::pasteFilesFromClipboard(path());
++ QClipboard* clipboard = QApplication::clipboard();
++ const QMimeData* data = clipboard->mimeData();
++ Fm::FilePathList paths;
++ bool isCut = false;
++
++ std::tie(paths, isCut) = Fm::parseClipboardData(*data);
++
++ if(!paths.empty()) {
++ QLocalSocket socket;
++ socket.connectToServer(QString::fromStdString("advanced-copier-"+std::to_string(getuid())));
++ socket.waitForConnected();
++ if(socket.state()==QLocalSocket::ConnectedState)
++ {
++ sendRawOrderList(QStringList() << "protocol" << "0002", socket, 1);
++ socket.waitForReadyRead();
++ socket.readAll();
++ QStringList l;
++ if(isCut) {
++ l << "mv";
++ clipboard->clear(QClipboard::Clipboard);
++ }
++ else {
++ l << "cp";
++ }
++ for(const Fm::FilePath &n : paths)
++ l << n.toString().get();
++ l << path().toString().get();
++ sendRawOrderList(l, socket, 2);
++ socket.waitForBytesWritten();
++ socket.close();
++ }
++ else
++ {
++ if(isCut) {
++ Fm::FileOperation::moveFiles(paths, path(), nullptr);
++ clipboard->clear(QClipboard::Clipboard);
++ }
++ else {
++ Fm::FileOperation::copyFiles(paths, path(), nullptr);
++ }
++ }
++ }
+ }
+
+ void DesktopWindow::onDeleteActivated() {
+diff -ur pcmanfm-qt-0.14.1/pcmanfm/mainwindow.cpp pcmanfm-qt-patched/pcmanfm/mainwindow.cpp
+--- pcmanfm-qt-0.14.1/pcmanfm/mainwindow.cpp 2019-02-23 20:16:13.000000000 -0400
++++ pcmanfm-qt-patched/pcmanfm/mainwindow.cpp 2019-12-19 17:21:07.078366000 -0400
+@@ -34,6 +34,7 @@
+ #include <QStandardPaths>
+ #include <QClipboard>
+ #include <QDebug>
++#include <QtNetwork/QLocalSocket>
+
+ #include "tabpage.h"
+ #include "launcher.h"
+@@ -1529,8 +1530,70 @@
+ cutFilesToClipboard(paths);
+ }
+
++void sendRawOrderListA(const QStringList & order, QLocalSocket &socket, int idNextOrder)
++{
++ QByteArray block;
++ QDataStream out(&block, QIODevice::WriteOnly);
++ out.setVersion(QDataStream::Qt_4_4);
++ out << int(0);
++ out << idNextOrder;
++ out << order;
++ out.device()->seek(0);
++ out << block.size();
++ do //cut string list and send it as block of 32KB
++ {
++ QByteArray blockToSend;
++ int byteWriten;
++ blockToSend=block.left(32*1024);//32KB
++ block.remove(0,blockToSend.size());
++ byteWriten = socket.write(blockToSend);
++ }
++ while(block.size());
++}
++
+ void MainWindow::on_actionPaste_triggered() {
+- pasteFilesFromClipboard(currentPage()->path(), this);
++ QClipboard* clipboard = QApplication::clipboard();
++ const QMimeData* data = clipboard->mimeData();
++ Fm::FilePathList paths;
++ bool isCut = false;
++
++ std::tie(paths, isCut) = parseClipboardData(*data);
++
++ if(!paths.empty()) {
++ QLocalSocket socket;
++ socket.connectToServer(QString::fromStdString("advanced-copier-"+std::to_string(getuid())));
++ socket.waitForConnected();
++ if(socket.state()==QLocalSocket::ConnectedState)
++ {
++ sendRawOrderListA(QStringList() << "protocol" << "0002", socket, 1);
++ socket.waitForReadyRead();
++ socket.readAll();
++ QStringList l;
++ if(isCut) {
++ l << "mv";
++ clipboard->clear(QClipboard::Clipboard);
++ }
++ else {
++ l << "cp";
++ }
++ for(const Fm::FilePath &n : paths)
++ l << n.toString().get();
++ l << currentPage()->path().toString().get();
++ sendRawOrderListA(l, socket, 2);
++ socket.waitForBytesWritten();
++ socket.close();
++ }
++ else
++ {
++ if(isCut) {
++ Fm::FileOperation::moveFiles(paths, currentPage()->path(), this);
++ clipboard->clear(QClipboard::Clipboard);
++ }
++ else {
++ Fm::FileOperation::copyFiles(paths, currentPage()->path(), this);
++ }
++ }
++ }
+ }
+
+ void MainWindow::on_actionDelete_triggered() {
diff --git a/file-manager/pcmanfm-qt.txt b/file-manager/pcmanfm-qt.txt
new file mode 100644
index 0000000..753ac4f
--- /dev/null
+++ b/file-manager/pcmanfm-qt.txt
@@ -0,0 +1,3 @@
+mkdir -v build;cd build;cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$LXQT_PREFIX -DPULL_TRANSLATIONS=no ..
+
+make
diff --git a/interface/FacilityInterface.h b/interface/FacilityInterface.h
index b64733b..1fd5366 100644
--- a/interface/FacilityInterface.h
+++ b/interface/FacilityInterface.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
#include <QObject>
+#include <QBuffer>
#include "../StructEnumDefinition.h"
@@ -41,6 +42,8 @@ class FacilityInterface : public QObject
virtual std::string softwareName() const = 0;
/// \brief return if is ultimate
virtual bool isUltimate() const = 0;
+ /// \brief return audio if created from opus file, nullptr if failed
+ virtual void/*casted to #ifndef QAudioOutput*/* prepareOpusAudio(const std::string &file,QBuffer &buffer) const = 0;
};
#endif // FACILITY_INTERFACE_H
diff --git a/interface/PluginInterface_CopyEngine.h b/interface/PluginInterface_CopyEngine.h
index e6a243f..86b17b8 100644
--- a/interface/PluginInterface_CopyEngine.h
+++ b/interface/PluginInterface_CopyEngine.h
@@ -193,6 +193,8 @@ class PluginInterface_CopyEngineFactory : public QObject
virtual std::vector<std::string> supportedProtocolsForTheDestination() const = 0;
/// \brief to get the options of the copy engine
virtual QWidget * options() = 0;
+ /// \brief to get if have pause
+ virtual bool havePause() = 0;
public slots:
/// \brief to reset the options
virtual void resetOptions() = 0;
@@ -204,7 +206,7 @@ class PluginInterface_CopyEngineFactory : public QObject
};
#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
-Q_DECLARE_INTERFACE(PluginInterface_CopyEngineFactory,"first-world.info.ultracopier.PluginInterface.CopyEngineFactory/1.2.4.0");
+Q_DECLARE_INTERFACE(PluginInterface_CopyEngineFactory,"first-world.info.ultracopier.PluginInterface.CopyEngineFactory/2.0.0.0");
#endif
#endif // PLUGININTERFACE_COPYENGINE_H
diff --git a/interface/PluginInterface_Listener.h b/interface/PluginInterface_Listener.h
index bd278e4..e1ee026 100644
--- a/interface/PluginInterface_Listener.h
+++ b/interface/PluginInterface_Listener.h
@@ -52,7 +52,7 @@ class PluginInterface_Listener : public QObject
};
#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
-Q_DECLARE_INTERFACE(PluginInterface_Listener,"first-world.info.ultracopier.PluginInterface.Listener/1.2.4.0");
+Q_DECLARE_INTERFACE(PluginInterface_Listener,"first-world.info.ultracopier.PluginInterface.Listener/2.0.0.0");
#endif
#endif // PLUGININTERFACE_LISTENER_H
diff --git a/interface/PluginInterface_PluginLoader.h b/interface/PluginInterface_PluginLoader.h
index 6b5742c..aa38b9a 100644
--- a/interface/PluginInterface_PluginLoader.h
+++ b/interface/PluginInterface_PluginLoader.h
@@ -35,7 +35,7 @@ class PluginInterface_PluginLoader : public QObject
};
#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
-Q_DECLARE_INTERFACE(PluginInterface_PluginLoader,"first-world.info.ultracopier.PluginInterface.PluginLoader/1.2.4.0");
+Q_DECLARE_INTERFACE(PluginInterface_PluginLoader,"first-world.info.ultracopier.PluginInterface.PluginLoader/2.0.0.0");
#endif
#endif // PLUGININTERFACE_PLUGINLOADER_H
diff --git a/interface/PluginInterface_SessionLoader.h b/interface/PluginInterface_SessionLoader.h
index 2361505..10ed856 100644
--- a/interface/PluginInterface_SessionLoader.h
+++ b/interface/PluginInterface_SessionLoader.h
@@ -35,7 +35,7 @@ class PluginInterface_SessionLoader : public QObject
};
#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
-Q_DECLARE_INTERFACE(PluginInterface_SessionLoader,"first-world.info.ultracopier.PluginInterface.SessionLoader/1.2.4.0");
+Q_DECLARE_INTERFACE(PluginInterface_SessionLoader,"first-world.info.ultracopier.PluginInterface.SessionLoader/2.0.0.0");
#endif
#endif // PLUGININTERFACE_SESSIONLOADER_H
diff --git a/interface/PluginInterface_Themes.h b/interface/PluginInterface_Themes.h
index 73045ed..2bce397 100644
--- a/interface/PluginInterface_Themes.h
+++ b/interface/PluginInterface_Themes.h
@@ -47,6 +47,8 @@ class PluginInterface_Themes : public QWidget
virtual void setGeneralProgression(const uint64_t &current,const uint64_t &total) = 0;
/// \brief show the file progression
virtual void setFileProgression(const std::vector<Ultracopier::ProgressionItem> &progressionList) = 0;
+ /// to get by file speed, size and ms
+ virtual void doneTime(const std::vector<std::pair<uint64_t,uint32_t> > &timeList) = 0;
public:
/// \brief get the widget for the copy engine
virtual QWidget * getOptionsEngineWidget() = 0;
@@ -63,6 +65,8 @@ class PluginInterface_Themes : public QWidget
virtual void haveExternalOrder() = 0;
/// \brief set if is in pause
virtual void isInPause(const bool &isInPause) = 0;
+ /// \brief set if is in pause
+ virtual void havePause(const bool &havePause) = 0;
// signal to implement
signals:
//set the transfer list
@@ -111,7 +115,7 @@ class PluginInterface_ThemesFactory : public QObject
};
#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE
-Q_DECLARE_INTERFACE(PluginInterface_ThemesFactory,"first-world.info.ultracopier.PluginInterface.ThemesFactory/1.2.4.0");
+Q_DECLARE_INTERFACE(PluginInterface_ThemesFactory,"first-world.info.ultracopier.PluginInterface.ThemesFactory/2.0.0.0");
#endif
#endif // PLUGININTERFACE_THEMES_H
diff --git a/lib/qt-tar-xz/xz_dec_lzma2.c b/lib/qt-tar-xz/xz_dec_lzma2.c
index ad36e29..ac3b9ec 100644
--- a/lib/qt-tar-xz/xz_dec_lzma2.c
+++ b/lib/qt-tar-xz/xz_dec_lzma2.c
@@ -42,237 +42,237 @@
* buffer directly.
*/
struct dictionary {
- /* Beginning of the history buffer */
- uint8_t *buf;
-
- /* Old position in buf (before decoding more data) */
- size_t start;
-
- /* Position in buf */
- size_t pos;
-
- /*
- * How full dictionary is. This is used to detect corrupt input that
- * would read beyond the beginning of the uncompressed stream.
- */
- size_t full;
-
- /* Write limit; we don't write to buf[limit] or later bytes. */
- size_t limit;
-
- /*
- * End of the dictionary buffer. In multi-call mode, this is
- * the same as the dictionary size. In single-call mode, this
- * indicates the size of the output buffer.
- */
- size_t end;
-
- /*
- * Size of the dictionary as specified in Block Header. This is used
- * together with "full" to detect corrupt input that would make us
- * read beyond the beginning of the uncompressed stream.
- */
- uint32_t size;
-
- /*
- * Maximum allowed dictionary size in multi-call mode.
- * This is ignored in single-call mode.
- */
- uint32_t size_max;
-
- /*
- * Amount of memory currently allocated for the dictionary.
- * This is used only with XZ_DYNALLOC. (With XZ_PREALLOC,
- * size_max is always the same as the allocated size.)
- */
- uint32_t allocated;
-
- /* Operation mode */
- enum xz_mode mode;
+ /* Beginning of the history buffer */
+ uint8_t *buf;
+
+ /* Old position in buf (before decoding more data) */
+ size_t start;
+
+ /* Position in buf */
+ size_t pos;
+
+ /*
+ * How full dictionary is. This is used to detect corrupt input that
+ * would read beyond the beginning of the uncompressed stream.
+ */
+ size_t full;
+
+ /* Write limit; we don't write to buf[limit] or later bytes. */
+ size_t limit;
+
+ /*
+ * End of the dictionary buffer. In multi-call mode, this is
+ * the same as the dictionary size. In single-call mode, this
+ * indicates the size of the output buffer.
+ */
+ size_t end;
+
+ /*
+ * Size of the dictionary as specified in Block Header. This is used
+ * together with "full" to detect corrupt input that would make us
+ * read beyond the beginning of the uncompressed stream.
+ */
+ uint32_t size;
+
+ /*
+ * Maximum allowed dictionary size in multi-call mode.
+ * This is ignored in single-call mode.
+ */
+ uint32_t size_max;
+
+ /*
+ * Amount of memory currently allocated for the dictionary.
+ * This is used only with XZ_DYNALLOC. (With XZ_PREALLOC,
+ * size_max is always the same as the allocated size.)
+ */
+ uint32_t allocated;
+
+ /* Operation mode */
+ enum xz_mode mode;
};
/* Range decoder */
struct rc_dec {
- uint32_t range;
- uint32_t code;
-
- /*
- * Number of initializing bytes remaining to be read
- * by rc_read_init().
- */
- uint32_t init_bytes_left;
-
- /*
- * Buffer from which we read our input. It can be either
- * temp.buf or the caller-provided input buffer.
- */
- const uint8_t *in;
- size_t in_pos;
- size_t in_limit;
+ uint32_t range;
+ uint32_t code;
+
+ /*
+ * Number of initializing bytes remaining to be read
+ * by rc_read_init().
+ */
+ uint32_t init_bytes_left;
+
+ /*
+ * Buffer from which we read our input. It can be either
+ * temp.buf or the caller-provided input buffer.
+ */
+ const uint8_t *in;
+ size_t in_pos;
+ size_t in_limit;
};
/* Probabilities for a length decoder. */
struct lzma_len_dec {
- /* Probability of match length being at least 10 */
- uint16_t choice;
+ /* Probability of match length being at least 10 */
+ uint16_t choice;
- /* Probability of match length being at least 18 */
- uint16_t choice2;
+ /* Probability of match length being at least 18 */
+ uint16_t choice2;
- /* Probabilities for match lengths 2-9 */
- uint16_t low[POS_STATES_MAX][LEN_LOW_SYMBOLS];
+ /* Probabilities for match lengths 2-9 */
+ uint16_t low[POS_STATES_MAX][LEN_LOW_SYMBOLS];
- /* Probabilities for match lengths 10-17 */
- uint16_t mid[POS_STATES_MAX][LEN_MID_SYMBOLS];
+ /* Probabilities for match lengths 10-17 */
+ uint16_t mid[POS_STATES_MAX][LEN_MID_SYMBOLS];
- /* Probabilities for match lengths 18-273 */
- uint16_t high[LEN_HIGH_SYMBOLS];
+ /* Probabilities for match lengths 18-273 */
+ uint16_t high[LEN_HIGH_SYMBOLS];
};
struct lzma_dec {
- /* Distances of latest four matches */
- uint32_t rep0;
- uint32_t rep1;
- uint32_t rep2;
- uint32_t rep3;
-
- /* Types of the most recently seen LZMA symbols */
- enum lzma_state state;
-
- /*
- * Length of a match. This is updated so that dict_repeat can
- * be called again to finish repeating the whole match.
- */
- uint32_t len;
-
- /*
- * LZMA properties or related bit masks (number of literal
- * context bits, a mask dervied from the number of literal
- * position bits, and a mask dervied from the number
- * position bits)
- */
- uint32_t lc;
- uint32_t literal_pos_mask; /* (1 << lp) - 1 */
- uint32_t pos_mask; /* (1 << pb) - 1 */
-
- /* If 1, it's a match. Otherwise it's a single 8-bit literal. */
- uint16_t is_match[STATES][POS_STATES_MAX];
-
- /* If 1, it's a repeated match. The distance is one of rep0 .. rep3. */
- uint16_t is_rep[STATES];
-
- /*
- * If 0, distance of a repeated match is rep0.
- * Otherwise check is_rep1.
- */
- uint16_t is_rep0[STATES];
-
- /*
- * If 0, distance of a repeated match is rep1.
- * Otherwise check is_rep2.
- */
- uint16_t is_rep1[STATES];
-
- /* If 0, distance of a repeated match is rep2. Otherwise it is rep3. */
- uint16_t is_rep2[STATES];
-
- /*
- * If 1, the repeated match has length of one byte. Otherwise
- * the length is decoded from rep_len_decoder.
- */
- uint16_t is_rep0_long[STATES][POS_STATES_MAX];
-
- /*
- * Probability tree for the highest two bits of the match
- * distance. There is a separate probability tree for match
- * lengths of 2 (i.e. MATCH_LEN_MIN), 3, 4, and [5, 273].
- */
- uint16_t dist_slot[DIST_STATES][DIST_SLOTS];
-
- /*
- * Probility trees for additional bits for match distance
- * when the distance is in the range [4, 127].
- */
- uint16_t dist_special[FULL_DISTANCES - DIST_MODEL_END];
-
- /*
- * Probability tree for the lowest four bits of a match
- * distance that is equal to or greater than 128.
- */
- uint16_t dist_align[ALIGN_SIZE];
-
- /* Length of a normal match */
- struct lzma_len_dec match_len_dec;
-
- /* Length of a repeated match */
- struct lzma_len_dec rep_len_dec;
-
- /* Probabilities of literals */
- uint16_t literal[LITERAL_CODERS_MAX][LITERAL_CODER_SIZE];
+ /* Distances of latest four matches */
+ uint32_t rep0;
+ uint32_t rep1;
+ uint32_t rep2;
+ uint32_t rep3;
+
+ /* Types of the most recently seen LZMA symbols */
+ enum lzma_state state;
+
+ /*
+ * Length of a match. This is updated so that dict_repeat can
+ * be called again to finish repeating the whole match.
+ */
+ uint32_t len;
+
+ /*
+ * LZMA properties or related bit masks (number of literal
+ * context bits, a mask dervied from the number of literal
+ * position bits, and a mask dervied from the number
+ * position bits)
+ */
+ uint32_t lc;
+ uint32_t literal_pos_mask; /* (1 << lp) - 1 */
+ uint32_t pos_mask; /* (1 << pb) - 1 */
+
+ /* If 1, it's a match. Otherwise it's a single 8-bit literal. */
+ uint16_t is_match[STATES][POS_STATES_MAX];
+
+ /* If 1, it's a repeated match. The distance is one of rep0 .. rep3. */
+ uint16_t is_rep[STATES];
+
+ /*
+ * If 0, distance of a repeated match is rep0.
+ * Otherwise check is_rep1.
+ */
+ uint16_t is_rep0[STATES];
+
+ /*
+ * If 0, distance of a repeated match is rep1.
+ * Otherwise check is_rep2.
+ */
+ uint16_t is_rep1[STATES];
+
+ /* If 0, distance of a repeated match is rep2. Otherwise it is rep3. */
+ uint16_t is_rep2[STATES];
+
+ /*
+ * If 1, the repeated match has length of one byte. Otherwise
+ * the length is decoded from rep_len_decoder.
+ */
+ uint16_t is_rep0_long[STATES][POS_STATES_MAX];
+
+ /*
+ * Probability tree for the highest two bits of the match
+ * distance. There is a separate probability tree for match
+ * lengths of 2 (i.e. MATCH_LEN_MIN), 3, 4, and [5, 273].
+ */
+ uint16_t dist_slot[DIST_STATES][DIST_SLOTS];
+
+ /*
+ * Probility trees for additional bits for match distance
+ * when the distance is in the range [4, 127].
+ */
+ uint16_t dist_special[FULL_DISTANCES - DIST_MODEL_END];
+
+ /*
+ * Probability tree for the lowest four bits of a match
+ * distance that is equal to or greater than 128.
+ */
+ uint16_t dist_align[ALIGN_SIZE];
+
+ /* Length of a normal match */
+ struct lzma_len_dec match_len_dec;
+
+ /* Length of a repeated match */
+ struct lzma_len_dec rep_len_dec;
+
+ /* Probabilities of literals */
+ uint16_t literal[LITERAL_CODERS_MAX][LITERAL_CODER_SIZE];
};
struct lzma2_dec {
- /* Position in xz_dec_lzma2_run(). */
- enum lzma2_seq {
- SEQ_CONTROL,
- SEQ_UNCOMPRESSED_1,
- SEQ_UNCOMPRESSED_2,
- SEQ_COMPRESSED_0,
- SEQ_COMPRESSED_1,
- SEQ_PROPERTIES,
- SEQ_LZMA_PREPARE,
- SEQ_LZMA_RUN,
- SEQ_COPY
- } sequence;
-
- /* Next position after decoding the compressed size of the chunk. */
- enum lzma2_seq next_sequence;
-
- /* Uncompressed size of LZMA chunk (2 MiB at maximum) */
- uint32_t uncompressed;
-
- /*
- * Compressed size of LZMA chunk or compressed/uncompressed
- * size of uncompressed chunk (64 KiB at maximum)
- */
- uint32_t compressed;
-
- /*
- * True if dictionary reset is needed. This is false before
- * the first chunk (LZMA or uncompressed).
- */
- bool need_dict_reset;
-
- /*
- * True if new LZMA properties are needed. This is false
- * before the first LZMA chunk.
- */
- bool need_props;
+ /* Position in xz_dec_lzma2_run(). */
+ enum lzma2_seq {
+ SEQ_CONTROL,
+ SEQ_UNCOMPRESSED_1,
+ SEQ_UNCOMPRESSED_2,
+ SEQ_COMPRESSED_0,
+ SEQ_COMPRESSED_1,
+ SEQ_PROPERTIES,
+ SEQ_LZMA_PREPARE,
+ SEQ_LZMA_RUN,
+ SEQ_COPY
+ } sequence;
+
+ /* Next position after decoding the compressed size of the chunk. */
+ enum lzma2_seq next_sequence;
+
+ /* Uncompressed size of LZMA chunk (2 MiB at maximum) */
+ uint32_t uncompressed;
+
+ /*
+ * Compressed size of LZMA chunk or compressed/uncompressed
+ * size of uncompressed chunk (64 KiB at maximum)
+ */
+ uint32_t compressed;
+
+ /*
+ * True if dictionary reset is needed. This is false before
+ * the first chunk (LZMA or uncompressed).
+ */
+ bool need_dict_reset;
+
+ /*
+ * True if new LZMA properties are needed. This is false
+ * before the first LZMA chunk.
+ */
+ bool need_props;
};
struct xz_dec_lzma2 {
- /*
- * The order below is important on x86 to reduce code size and
- * it shouldn't hurt on other platforms. Everything up to and
- * including lzma.pos_mask are in the first 128 bytes on x86-32,
- * which allows using smaller instructions to access those
- * variables. On x86-64, fewer variables fit into the first 128
- * bytes, but this is still the best order without sacrificing
- * the readability by splitting the structures.
- */
- struct rc_dec rc;
- struct dictionary dict;
- struct lzma2_dec lzma2;
- struct lzma_dec lzma;
-
- /*
- * Temporary buffer which holds small number of input bytes between
- * decoder calls. See lzma2_lzma() for details.
- */
- struct {
- uint32_t size;
- uint8_t buf[3 * LZMA_IN_REQUIRED];
- } temp;
+ /*
+ * The order below is important on x86 to reduce code size and
+ * it shouldn't hurt on other platforms. Everything up to and
+ * including lzma.pos_mask are in the first 128 bytes on x86-32,
+ * which allows using smaller instructions to access those
+ * variables. On x86-64, fewer variables fit into the first 128
+ * bytes, but this is still the best order without sacrificing
+ * the readability by splitting the structures.
+ */
+ struct rc_dec rc;
+ struct dictionary dict;
+ struct lzma2_dec lzma2;
+ struct lzma_dec lzma;
+
+ /*
+ * Temporary buffer which holds small number of input bytes between
+ * decoder calls. See lzma2_lzma() for details.
+ */
+ struct {
+ uint32_t size;
+ uint8_t buf[3 * LZMA_IN_REQUIRED];
+ } temp;
};
/**************
@@ -285,30 +285,30 @@ struct xz_dec_lzma2 {
*/
static void XZ_FUNC dict_reset(struct dictionary *dict, struct xz_buf *b)
{
- if (DEC_IS_SINGLE(dict->mode)) {
- dict->buf = b->out + b->out_pos;
- dict->end = b->out_size - b->out_pos;
- }
-
- dict->start = 0;
- dict->pos = 0;
- dict->limit = 0;
- dict->full = 0;
+ if (DEC_IS_SINGLE(dict->mode)) {
+ dict->buf = b->out + b->out_pos;
+ dict->end = b->out_size - b->out_pos;
+ }
+
+ dict->start = 0;
+ dict->pos = 0;
+ dict->limit = 0;
+ dict->full = 0;
}
/* Set dictionary write limit */
static void XZ_FUNC dict_limit(struct dictionary *dict, size_t out_max)
{
- if (dict->end - dict->pos <= out_max)
- dict->limit = dict->end;
- else
- dict->limit = dict->pos + out_max;
+ if (dict->end - dict->pos <= out_max)
+ dict->limit = dict->end;
+ else
+ dict->limit = dict->pos + out_max;
}
/* Return true if at least one byte can be written into the dictionary. */
static inline bool XZ_FUNC dict_has_space(const struct dictionary *dict)
{
- return dict->pos < dict->limit;
+ return dict->pos < dict->limit;
}
/*
@@ -318,14 +318,14 @@ static inline bool XZ_FUNC dict_has_space(const struct dictionary *dict)
* avoid writing a '\0' to the end of the destination buffer.
*/
static inline uint32_t XZ_FUNC dict_get(
- const struct dictionary *dict, uint32_t dist)
+ const struct dictionary *dict, uint32_t dist)
{
- size_t offset = dict->pos - dist - 1;
+ size_t offset = dict->pos - dist - 1;
- if (dist >= dict->pos)
- offset += dict->end;
+ if (dist >= dict->pos)
+ offset += dict->end;
- return dict->full > 0 ? dict->buf[offset] : 0;
+ return dict->full > 0 ? dict->buf[offset] : 0;
}
/*
@@ -333,10 +333,10 @@ static inline uint32_t XZ_FUNC dict_get(
*/
static inline void XZ_FUNC dict_put(struct dictionary *dict, uint8_t byte)
{
- dict->buf[dict->pos++] = byte;
+ dict->buf[dict->pos++] = byte;
- if (dict->full < dict->pos)
- dict->full = dict->pos;
+ if (dict->full < dict->pos)
+ dict->full = dict->pos;
}
/*
@@ -345,70 +345,70 @@ static inline void XZ_FUNC dict_put(struct dictionary *dict, uint8_t byte)
* updated to indicate how many bytes were left to be repeated.
*/
static bool XZ_FUNC dict_repeat(
- struct dictionary *dict, uint32_t *len, uint32_t dist)
+ struct dictionary *dict, uint32_t *len, uint32_t dist)
{
- size_t back;
- uint32_t left;
+ size_t back;
+ uint32_t left;
- if (dist >= dict->full || dist >= dict->size)
- return false;
+ if (dist >= dict->full || dist >= dict->size)
+ return false;
- left = min_t(size_t, dict->limit - dict->pos, *len);
- *len -= left;
+ left = min_t(size_t, dict->limit - dict->pos, *len);
+ *len -= left;
- back = dict->pos - dist - 1;
- if (dist >= dict->pos)
- back += dict->end;
+ back = dict->pos - dist - 1;
+ if (dist >= dict->pos)
+ back += dict->end;
- do {
- dict->buf[dict->pos++] = dict->buf[back++];
- if (back == dict->end)
- back = 0;
- } while (--left > 0);
+ do {
+ dict->buf[dict->pos++] = dict->buf[back++];
+ if (back == dict->end)
+ back = 0;
+ } while (--left > 0);
- if (dict->full < dict->pos)
- dict->full = dict->pos;
+ if (dict->full < dict->pos)
+ dict->full = dict->pos;
- return true;
+ return true;
}
/* Copy uncompressed data as is from input to dictionary and output buffers. */
static void XZ_FUNC dict_uncompressed(
- struct dictionary *dict, struct xz_buf *b, uint32_t *left)
+ struct dictionary *dict, struct xz_buf *b, uint32_t *left)
{
- size_t copy_size;
+ size_t copy_size;
- while (*left > 0 && b->in_pos < b->in_size
- && b->out_pos < b->out_size) {
- copy_size = min(b->in_size - b->in_pos,
- b->out_size - b->out_pos);
- if (copy_size > dict->end - dict->pos)
- copy_size = dict->end - dict->pos;
- if (copy_size > *left)
- copy_size = *left;
+ while (*left > 0 && b->in_pos < b->in_size
+ && b->out_pos < b->out_size) {
+ copy_size = min(b->in_size - b->in_pos,
+ b->out_size - b->out_pos);
+ if (copy_size > dict->end - dict->pos)
+ copy_size = dict->end - dict->pos;
+ if (copy_size > *left)
+ copy_size = *left;
- *left -= copy_size;
+ *left -= copy_size;
- memcpy(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
- dict->pos += copy_size;
+ memcpy(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
+ dict->pos += copy_size;
- if (dict->full < dict->pos)
- dict->full = dict->pos;
+ if (dict->full < dict->pos)
+ dict->full = dict->pos;
- if (DEC_IS_MULTI(dict->mode)) {
- if (dict->pos == dict->end)
- dict->pos = 0;
+ if (DEC_IS_MULTI(dict->mode)) {
+ if (dict->pos == dict->end)
+ dict->pos = 0;
- memcpy(b->out + b->out_pos, b->in + b->in_pos,
- copy_size);
- }
+ memcpy(b->out + b->out_pos, b->in + b->in_pos,
+ copy_size);
+ }
- dict->start = dict->pos;
+ dict->start = dict->pos;
- b->out_pos += copy_size;
- b->in_pos += copy_size;
+ b->out_pos += copy_size;
+ b->in_pos += copy_size;
- }
+ }
}
/*
@@ -418,19 +418,19 @@ static void XZ_FUNC dict_uncompressed(
*/
static uint32_t XZ_FUNC dict_flush(struct dictionary *dict, struct xz_buf *b)
{
- size_t copy_size = dict->pos - dict->start;
+ size_t copy_size = dict->pos - dict->start;
- if (DEC_IS_MULTI(dict->mode)) {
- if (dict->pos == dict->end)
- dict->pos = 0;
+ if (DEC_IS_MULTI(dict->mode)) {
+ if (dict->pos == dict->end)
+ dict->pos = 0;
- memcpy(b->out + b->out_pos, dict->buf + dict->start,
- copy_size);
- }
+ memcpy(b->out + b->out_pos, dict->buf + dict->start,
+ copy_size);
+ }
- dict->start = dict->pos;
- b->out_pos += copy_size;
- return copy_size;
+ dict->start = dict->pos;
+ b->out_pos += copy_size;
+ return copy_size;
}
/*****************
@@ -440,9 +440,9 @@ static uint32_t XZ_FUNC dict_flush(struct dictionary *dict, struct xz_buf *b)
/* Reset the range decoder. */
static void XZ_FUNC rc_reset(struct rc_dec *rc)
{
- rc->range = (uint32_t)-1;
- rc->code = 0;
- rc->init_bytes_left = RC_INIT_BYTES;
+ rc->range = (uint32_t)-1;
+ rc->code = 0;
+ rc->init_bytes_left = RC_INIT_BYTES;
}
/*
@@ -451,21 +451,21 @@ static void XZ_FUNC rc_reset(struct rc_dec *rc)
*/
static bool XZ_FUNC rc_read_init(struct rc_dec *rc, struct xz_buf *b)
{
- while (rc->init_bytes_left > 0) {
- if (b->in_pos == b->in_size)
- return false;
+ while (rc->init_bytes_left > 0) {
+ if (b->in_pos == b->in_size)
+ return false;
- rc->code = (rc->code << 8) + b->in[b->in_pos++];
- --rc->init_bytes_left;
- }
+ rc->code = (rc->code << 8) + b->in[b->in_pos++];
+ --rc->init_bytes_left;
+ }
- return true;
+ return true;
}
/* Return true if there may not be enough input for the next decoding loop. */
static inline bool XZ_FUNC rc_limit_exceeded(const struct rc_dec *rc)
{
- return rc->in_pos > rc->in_limit;
+ return rc->in_pos > rc->in_limit;
}
/*
@@ -474,16 +474,16 @@ static inline bool XZ_FUNC rc_limit_exceeded(const struct rc_dec *rc)
*/
static inline bool XZ_FUNC rc_is_finished(const struct rc_dec *rc)
{
- return rc->code == 0;
+ return rc->code == 0;
}
/* Read the next input byte if needed. */
static __always_inline void XZ_FUNC rc_normalize(struct rc_dec *rc)
{
- if (rc->range < RC_TOP_VALUE) {
- rc->range <<= RC_SHIFT_BITS;
- rc->code = (rc->code << RC_SHIFT_BITS) + rc->in[rc->in_pos++];
- }
+ if (rc->range < RC_TOP_VALUE) {
+ rc->range <<= RC_SHIFT_BITS;
+ rc->code = (rc->code << RC_SHIFT_BITS) + rc->in[rc->in_pos++];
+ }
}
/*
@@ -499,72 +499,72 @@ static __always_inline void XZ_FUNC rc_normalize(struct rc_dec *rc)
*/
static __always_inline int XZ_FUNC rc_bit(struct rc_dec *rc, uint16_t *prob)
{
- uint32_t bound;
- int bit;
-
- rc_normalize(rc);
- bound = (rc->range >> RC_BIT_MODEL_TOTAL_BITS) * *prob;
- if (rc->code < bound) {
- rc->range = bound;
- *prob += (RC_BIT_MODEL_TOTAL - *prob) >> RC_MOVE_BITS;
- bit = 0;
- } else {
- rc->range -= bound;
- rc->code -= bound;
- *prob -= *prob >> RC_MOVE_BITS;
- bit = 1;
- }
-
- return bit;
+ uint32_t bound;
+ int bit;
+
+ rc_normalize(rc);
+ bound = (rc->range >> RC_BIT_MODEL_TOTAL_BITS) * *prob;
+ if (rc->code < bound) {
+ rc->range = bound;
+ *prob += (RC_BIT_MODEL_TOTAL - *prob) >> RC_MOVE_BITS;
+ bit = 0;
+ } else {
+ rc->range -= bound;
+ rc->code -= bound;
+ *prob -= *prob >> RC_MOVE_BITS;
+ bit = 1;
+ }
+
+ return bit;
}
/* Decode a bittree starting from the most significant bit. */
static __always_inline uint32_t XZ_FUNC rc_bittree(
- struct rc_dec *rc, uint16_t *probs, uint32_t limit)
+ struct rc_dec *rc, uint16_t *probs, uint32_t limit)
{
- uint32_t symbol = 1;
+ uint32_t symbol = 1;
- do {
- if (rc_bit(rc, &probs[symbol]))
- symbol = (symbol << 1) + 1;
- else
- symbol <<= 1;
- } while (symbol < limit);
+ do {
+ if (rc_bit(rc, &probs[symbol]))
+ symbol = (symbol << 1) + 1;
+ else
+ symbol <<= 1;
+ } while (symbol < limit);
- return symbol;
+ return symbol;
}
/* Decode a bittree starting from the least significant bit. */
static __always_inline void XZ_FUNC rc_bittree_reverse(struct rc_dec *rc,
- uint16_t *probs, uint32_t *dest, uint32_t limit)
+ uint16_t *probs, uint32_t *dest, uint32_t limit)
{
- uint32_t symbol = 1;
- uint32_t i = 0;
-
- do {
- if (rc_bit(rc, &probs[symbol])) {
- symbol = (symbol << 1) + 1;
- *dest += 1 << i;
- } else {
- symbol <<= 1;
- }
- } while (++i < limit);
+ uint32_t symbol = 1;
+ uint32_t i = 0;
+
+ do {
+ if (rc_bit(rc, &probs[symbol])) {
+ symbol = (symbol << 1) + 1;
+ *dest += 1 << i;
+ } else {
+ symbol <<= 1;
+ }
+ } while (++i < limit);
}
/* Decode direct bits (fixed fifty-fifty probability) */
static inline void XZ_FUNC rc_direct(
- struct rc_dec *rc, uint32_t *dest, uint32_t limit)
+ struct rc_dec *rc, uint32_t *dest, uint32_t limit)
{
- uint32_t mask;
-
- do {
- rc_normalize(rc);
- rc->range >>= 1;
- rc->code -= rc->range;
- mask = (uint32_t)0 - (rc->code >> 31);
- rc->code += rc->range & mask;
- *dest = (*dest << 1) + (mask + 1);
- } while (--limit > 0);
+ uint32_t mask;
+
+ do {
+ rc_normalize(rc);
+ rc->range >>= 1;
+ rc->code -= rc->range;
+ mask = (uint32_t)0 - (rc->code >> 31);
+ rc->code += rc->range & mask;
+ *dest = (*dest << 1) + (mask + 1);
+ } while (--limit > 0);
}
/********
@@ -574,114 +574,114 @@ static inline void XZ_FUNC rc_direct(
/* Get pointer to literal coder probability array. */
static uint16_t * XZ_FUNC lzma_literal_probs(struct xz_dec_lzma2 *s)
{
- uint32_t prev_byte = dict_get(&s->dict, 0);
- uint32_t low = prev_byte >> (8 - s->lzma.lc);
- uint32_t high = (s->dict.pos & s->lzma.literal_pos_mask) << s->lzma.lc;
- return s->lzma.literal[low + high];
+ uint32_t prev_byte = dict_get(&s->dict, 0);
+ uint32_t low = prev_byte >> (8 - s->lzma.lc);
+ uint32_t high = (s->dict.pos & s->lzma.literal_pos_mask) << s->lzma.lc;
+ return s->lzma.literal[low + high];
}
/* Decode a literal (one 8-bit byte) */
static void XZ_FUNC lzma_literal(struct xz_dec_lzma2 *s)
{
- uint16_t *probs;
- uint32_t symbol;
- uint32_t match_byte;
- uint32_t match_bit;
- uint32_t offset;
- uint32_t i;
-
- probs = lzma_literal_probs(s);
-
- if (lzma_state_is_literal(s->lzma.state)) {
- symbol = rc_bittree(&s->rc, probs, 0x100);
- } else {
- symbol = 1;
- match_byte = dict_get(&s->dict, s->lzma.rep0) << 1;
- offset = 0x100;
-
- do {
- match_bit = match_byte & offset;
- match_byte <<= 1;
- i = offset + match_bit + symbol;
-
- if (rc_bit(&s->rc, &probs[i])) {
- symbol = (symbol << 1) + 1;
- offset &= match_bit;
- } else {
- symbol <<= 1;
- offset &= ~match_bit;
- }
- } while (symbol < 0x100);
- }
-
- dict_put(&s->dict, (uint8_t)symbol);
- lzma_state_literal(&s->lzma.state);
+ uint16_t *probs;
+ uint32_t symbol;
+ uint32_t match_byte;
+ uint32_t match_bit;
+ uint32_t offset;
+ uint32_t i;
+
+ probs = lzma_literal_probs(s);
+
+ if (lzma_state_is_literal(s->lzma.state)) {
+ symbol = rc_bittree(&s->rc, probs, 0x100);
+ } else {
+ symbol = 1;
+ match_byte = dict_get(&s->dict, s->lzma.rep0) << 1;
+ offset = 0x100;
+
+ do {
+ match_bit = match_byte & offset;
+ match_byte <<= 1;
+ i = offset + match_bit + symbol;
+
+ if (rc_bit(&s->rc, &probs[i])) {
+ symbol = (symbol << 1) + 1;
+ offset &= match_bit;
+ } else {
+ symbol <<= 1;
+ offset &= ~match_bit;
+ }
+ } while (symbol < 0x100);
+ }
+
+ dict_put(&s->dict, (uint8_t)symbol);
+ lzma_state_literal(&s->lzma.state);
}
/* Decode the length of the match into s->lzma.len. */
static void XZ_FUNC lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l,
- uint32_t pos_state)
+ uint32_t pos_state)
{
- uint16_t *probs;
- uint32_t limit;
-
- if (!rc_bit(&s->rc, &l->choice)) {
- probs = l->low[pos_state];
- limit = LEN_LOW_SYMBOLS;
- s->lzma.len = MATCH_LEN_MIN;
- } else {
- if (!rc_bit(&s->rc, &l->choice2)) {
- probs = l->mid[pos_state];
- limit = LEN_MID_SYMBOLS;
- s->lzma.len = MATCH_LEN_MIN + LEN_LOW_SYMBOLS;
- } else {
- probs = l->high;
- limit = LEN_HIGH_SYMBOLS;
- s->lzma.len = MATCH_LEN_MIN + LEN_LOW_SYMBOLS
- + LEN_MID_SYMBOLS;
- }
- }
-
- s->lzma.len += rc_bittree(&s->rc, probs, limit) - limit;
+ uint16_t *probs;
+ uint32_t limit;
+
+ if (!rc_bit(&s->rc, &l->choice)) {
+ probs = l->low[pos_state];
+ limit = LEN_LOW_SYMBOLS;
+ s->lzma.len = MATCH_LEN_MIN;
+ } else {
+ if (!rc_bit(&s->rc, &l->choice2)) {
+ probs = l->mid[pos_state];
+ limit = LEN_MID_SYMBOLS;
+ s->lzma.len = MATCH_LEN_MIN + LEN_LOW_SYMBOLS;
+ } else {
+ probs = l->high;
+ limit = LEN_HIGH_SYMBOLS;
+ s->lzma.len = MATCH_LEN_MIN + LEN_LOW_SYMBOLS
+ + LEN_MID_SYMBOLS;
+ }
+ }
+
+ s->lzma.len += rc_bittree(&s->rc, probs, limit) - limit;
}
/* Decode a match. The distance will be stored in s->lzma.rep0. */
static void XZ_FUNC lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
{
- uint16_t *probs;
- uint32_t dist_slot;
- uint32_t limit;
-
- lzma_state_match(&s->lzma.state);
-
- s->lzma.rep3 = s->lzma.rep2;
- s->lzma.rep2 = s->lzma.rep1;
- s->lzma.rep1 = s->lzma.rep0;
-
- lzma_len(s, &s->lzma.match_len_dec, pos_state);
-
- probs = s->lzma.dist_slot[lzma_get_dist_state(s->lzma.len)];
- dist_slot = rc_bittree(&s->rc, probs, DIST_SLOTS) - DIST_SLOTS;
-
- if (dist_slot < DIST_MODEL_START) {
- s->lzma.rep0 = dist_slot;
- } else {
- limit = (dist_slot >> 1) - 1;
- s->lzma.rep0 = 2 + (dist_slot & 1);
-
- if (dist_slot < DIST_MODEL_END) {
- s->lzma.rep0 <<= limit;
- probs = s->lzma.dist_special + s->lzma.rep0
- - dist_slot - 1;
- rc_bittree_reverse(&s->rc, probs,
- &s->lzma.rep0, limit);
- } else {
- rc_direct(&s->rc, &s->lzma.rep0, limit - ALIGN_BITS);
- s->lzma.rep0 <<= ALIGN_BITS;
- rc_bittree_reverse(&s->rc, s->lzma.dist_align,
- &s->lzma.rep0, ALIGN_BITS);
- }
- }
+ uint16_t *probs;
+ uint32_t dist_slot;
+ uint32_t limit;
+
+ lzma_state_match(&s->lzma.state);
+
+ s->lzma.rep3 = s->lzma.rep2;
+ s->lzma.rep2 = s->lzma.rep1;
+ s->lzma.rep1 = s->lzma.rep0;
+
+ lzma_len(s, &s->lzma.match_len_dec, pos_state);
+
+ probs = s->lzma.dist_slot[lzma_get_dist_state(s->lzma.len)];
+ dist_slot = rc_bittree(&s->rc, probs, DIST_SLOTS) - DIST_SLOTS;
+
+ if (dist_slot < DIST_MODEL_START) {
+ s->lzma.rep0 = dist_slot;
+ } else {
+ limit = (dist_slot >> 1) - 1;
+ s->lzma.rep0 = 2 + (dist_slot & 1);
+
+ if (dist_slot < DIST_MODEL_END) {
+ s->lzma.rep0 <<= limit;
+ probs = s->lzma.dist_special + s->lzma.rep0
+ - dist_slot - 1;
+ rc_bittree_reverse(&s->rc, probs,
+ &s->lzma.rep0, limit);
+ } else {
+ rc_direct(&s->rc, &s->lzma.rep0, limit - ALIGN_BITS);
+ s->lzma.rep0 <<= ALIGN_BITS;
+ rc_bittree_reverse(&s->rc, s->lzma.dist_align,
+ &s->lzma.rep0, ALIGN_BITS);
+ }
+ }
}
/*
@@ -690,77 +690,77 @@ static void XZ_FUNC lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
*/
static void XZ_FUNC lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state)
{
- uint32_t tmp;
-
- if (!rc_bit(&s->rc, &s->lzma.is_rep0[s->lzma.state])) {
- if (!rc_bit(&s->rc, &s->lzma.is_rep0_long[
- s->lzma.state][pos_state])) {
- lzma_state_short_rep(&s->lzma.state);
- s->lzma.len = 1;
- return;
- }
- } else {
- if (!rc_bit(&s->rc, &s->lzma.is_rep1[s->lzma.state])) {
- tmp = s->lzma.rep1;
- } else {
- if (!rc_bit(&s->rc, &s->lzma.is_rep2[s->lzma.state])) {
- tmp = s->lzma.rep2;
- } else {
- tmp = s->lzma.rep3;
- s->lzma.rep3 = s->lzma.rep2;
- }
-
- s->lzma.rep2 = s->lzma.rep1;
- }
-
- s->lzma.rep1 = s->lzma.rep0;
- s->lzma.rep0 = tmp;
- }
-
- lzma_state_long_rep(&s->lzma.state);
- lzma_len(s, &s->lzma.rep_len_dec, pos_state);
+ uint32_t tmp;
+
+ if (!rc_bit(&s->rc, &s->lzma.is_rep0[s->lzma.state])) {
+ if (!rc_bit(&s->rc, &s->lzma.is_rep0_long[
+ s->lzma.state][pos_state])) {
+ lzma_state_short_rep(&s->lzma.state);
+ s->lzma.len = 1;
+ return;
+ }
+ } else {
+ if (!rc_bit(&s->rc, &s->lzma.is_rep1[s->lzma.state])) {
+ tmp = s->lzma.rep1;
+ } else {
+ if (!rc_bit(&s->rc, &s->lzma.is_rep2[s->lzma.state])) {
+ tmp = s->lzma.rep2;
+ } else {
+ tmp = s->lzma.rep3;
+ s->lzma.rep3 = s->lzma.rep2;
+ }
+
+ s->lzma.rep2 = s->lzma.rep1;
+ }
+
+ s->lzma.rep1 = s->lzma.rep0;
+ s->lzma.rep0 = tmp;
+ }
+
+ lzma_state_long_rep(&s->lzma.state);
+ lzma_len(s, &s->lzma.rep_len_dec, pos_state);
}
/* LZMA decoder core */
static bool XZ_FUNC lzma_main(struct xz_dec_lzma2 *s)
{
- uint32_t pos_state;
-
- /*
- * If the dictionary was reached during the previous call, try to
- * finish the possibly pending repeat in the dictionary.
- */
- if (dict_has_space(&s->dict) && s->lzma.len > 0)
- dict_repeat(&s->dict, &s->lzma.len, s->lzma.rep0);
-
- /*
- * Decode more LZMA symbols. One iteration may consume up to
- * LZMA_IN_REQUIRED - 1 bytes.
- */
- while (dict_has_space(&s->dict) && !rc_limit_exceeded(&s->rc)) {
- pos_state = s->dict.pos & s->lzma.pos_mask;
-
- if (!rc_bit(&s->rc, &s->lzma.is_match[
- s->lzma.state][pos_state])) {
- lzma_literal(s);
- } else {
- if (rc_bit(&s->rc, &s->lzma.is_rep[s->lzma.state]))
- lzma_rep_match(s, pos_state);
- else
- lzma_match(s, pos_state);
-
- if (!dict_repeat(&s->dict, &s->lzma.len, s->lzma.rep0))
- return false;
- }
- }
-
- /*
- * Having the range decoder always normalized when we are outside
- * this function makes it easier to correctly handle end of the chunk.
- */
- rc_normalize(&s->rc);
-
- return true;
+ uint32_t pos_state;
+
+ /*
+ * If the dictionary was reached during the previous call, try to
+ * finish the possibly pending repeat in the dictionary.
+ */
+ if (dict_has_space(&s->dict) && s->lzma.len > 0)
+ dict_repeat(&s->dict, &s->lzma.len, s->lzma.rep0);
+
+ /*
+ * Decode more LZMA symbols. One iteration may consume up to
+ * LZMA_IN_REQUIRED - 1 bytes.
+ */
+ while (dict_has_space(&s->dict) && !rc_limit_exceeded(&s->rc)) {
+ pos_state = s->dict.pos & s->lzma.pos_mask;
+
+ if (!rc_bit(&s->rc, &s->lzma.is_match[
+ s->lzma.state][pos_state])) {
+ lzma_literal(s);
+ } else {
+ if (rc_bit(&s->rc, &s->lzma.is_rep[s->lzma.state]))
+ lzma_rep_match(s, pos_state);
+ else
+ lzma_match(s, pos_state);
+
+ if (!dict_repeat(&s->dict, &s->lzma.len, s->lzma.rep0))
+ return false;
+ }
+ }
+
+ /*
+ * Having the range decoder always normalized when we are outside
+ * this function makes it easier to correctly handle end of the chunk.
+ */
+ rc_normalize(&s->rc);
+
+ return true;
}
/*
@@ -769,29 +769,29 @@ static bool XZ_FUNC lzma_main(struct xz_dec_lzma2 *s)
*/
static void XZ_FUNC lzma_reset(struct xz_dec_lzma2 *s)
{
- uint16_t *probs;
- size_t i;
-
- s->lzma.state = STATE_LIT_LIT;
- s->lzma.rep0 = 0;
- s->lzma.rep1 = 0;
- s->lzma.rep2 = 0;
- s->lzma.rep3 = 0;
-
- /*
- * All probabilities are initialized to the same value. This hack
- * makes the code smaller by avoiding a separate loop for each
- * probability array.
- *
- * This could be optimized so that only that part of literal
- * probabilities that are actually required. In the common case
- * we would write 12 KiB less.
- */
- probs = s->lzma.is_match[0];
- for (i = 0; i < PROBS_TOTAL; ++i)
- probs[i] = RC_BIT_MODEL_TOTAL / 2;
-
- rc_reset(&s->rc);
+ uint16_t *probs;
+ size_t i;
+
+ s->lzma.state = STATE_LIT_LIT;
+ s->lzma.rep0 = 0;
+ s->lzma.rep1 = 0;
+ s->lzma.rep2 = 0;
+ s->lzma.rep3 = 0;
+
+ /*
+ * All probabilities are initialized to the same value. This hack
+ * makes the code smaller by avoiding a separate loop for each
+ * probability array.
+ *
+ * This could be optimized so that only that part of literal
+ * probabilities that are actually required. In the common case
+ * we would write 12 KiB less.
+ */
+ probs = s->lzma.is_match[0];
+ for (i = 0; i < PROBS_TOTAL; ++i)
+ probs[i] = RC_BIT_MODEL_TOTAL / 2;
+
+ rc_reset(&s->rc);
}
/*
@@ -801,33 +801,33 @@ static void XZ_FUNC lzma_reset(struct xz_dec_lzma2 *s)
*/
static bool XZ_FUNC lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
{
- if (props > (4 * 5 + 4) * 9 + 8)
- return false;
+ if (props > (4 * 5 + 4) * 9 + 8)
+ return false;
- s->lzma.pos_mask = 0;
- while (props >= 9 * 5) {
- props -= 9 * 5;
- ++s->lzma.pos_mask;
- }
+ s->lzma.pos_mask = 0;
+ while (props >= 9 * 5) {
+ props -= 9 * 5;
+ ++s->lzma.pos_mask;
+ }
- s->lzma.pos_mask = (1 << s->lzma.pos_mask) - 1;
+ s->lzma.pos_mask = (1 << s->lzma.pos_mask) - 1;
- s->lzma.literal_pos_mask = 0;
- while (props >= 9) {
- props -= 9;
- ++s->lzma.literal_pos_mask;
- }
+ s->lzma.literal_pos_mask = 0;
+ while (props >= 9) {
+ props -= 9;
+ ++s->lzma.literal_pos_mask;
+ }
- s->lzma.lc = props;
+ s->lzma.lc = props;
- if (s->lzma.lc + s->lzma.literal_pos_mask > 4)
- return false;
+ if (s->lzma.lc + s->lzma.literal_pos_mask > 4)
+ return false;
- s->lzma.literal_pos_mask = (1 << s->lzma.literal_pos_mask) - 1;
+ s->lzma.literal_pos_mask = (1 << s->lzma.literal_pos_mask) - 1;
- lzma_reset(s);
+ lzma_reset(s);
- return true;
+ return true;
}
/*********
@@ -848,83 +848,83 @@ static bool XZ_FUNC lzma_props(struct xz_dec_lzma2 *s, uint8_t props)
*/
static bool XZ_FUNC lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
{
- size_t in_avail;
- uint32_t tmp;
-
- in_avail = b->in_size - b->in_pos;
- if (s->temp.size > 0 || s->lzma2.compressed == 0) {
- tmp = 2 * LZMA_IN_REQUIRED - s->temp.size;
- if (tmp > s->lzma2.compressed - s->temp.size)
- tmp = s->lzma2.compressed - s->temp.size;
- if (tmp > in_avail)
- tmp = in_avail;
-
- memcpy(s->temp.buf + s->temp.size, b->in + b->in_pos, tmp);
-
- if (s->temp.size + tmp == s->lzma2.compressed) {
- memzero(s->temp.buf + s->temp.size + tmp,
- sizeof(s->temp.buf)
- - s->temp.size - tmp);
- s->rc.in_limit = s->temp.size + tmp;
- } else if (s->temp.size + tmp < LZMA_IN_REQUIRED) {
- s->temp.size += tmp;
- b->in_pos += tmp;
- return true;
- } else {
- s->rc.in_limit = s->temp.size + tmp - LZMA_IN_REQUIRED;
- }
-
- s->rc.in = s->temp.buf;
- s->rc.in_pos = 0;
-
- if (!lzma_main(s) || s->rc.in_pos > s->temp.size + tmp)
- return false;
-
- s->lzma2.compressed -= s->rc.in_pos;
-
- if (s->rc.in_pos < s->temp.size) {
- s->temp.size -= s->rc.in_pos;
- memmove(s->temp.buf, s->temp.buf + s->rc.in_pos,
- s->temp.size);
- return true;
- }
-
- b->in_pos += s->rc.in_pos - s->temp.size;
- s->temp.size = 0;
- }
-
- in_avail = b->in_size - b->in_pos;
- if (in_avail >= LZMA_IN_REQUIRED) {
- s->rc.in = b->in;
- s->rc.in_pos = b->in_pos;
-
- if (in_avail >= s->lzma2.compressed + LZMA_IN_REQUIRED)
- s->rc.in_limit = b->in_pos + s->lzma2.compressed;
- else
- s->rc.in_limit = b->in_size - LZMA_IN_REQUIRED;
-
- if (!lzma_main(s))
- return false;
-
- in_avail = s->rc.in_pos - b->in_pos;
- if (in_avail > s->lzma2.compressed)
- return false;
-
- s->lzma2.compressed -= in_avail;
- b->in_pos = s->rc.in_pos;
- }
-
- in_avail = b->in_size - b->in_pos;
- if (in_avail < LZMA_IN_REQUIRED) {
- if (in_avail > s->lzma2.compressed)
- in_avail = s->lzma2.compressed;
-
- memcpy(s->temp.buf, b->in + b->in_pos, in_avail);
- s->temp.size = in_avail;
- b->in_pos += in_avail;
- }
-
- return true;
+ size_t in_avail;
+ uint32_t tmp;
+
+ in_avail = b->in_size - b->in_pos;
+ if (s->temp.size > 0 || s->lzma2.compressed == 0) {
+ tmp = 2 * LZMA_IN_REQUIRED - s->temp.size;
+ if (tmp > s->lzma2.compressed - s->temp.size)
+ tmp = s->lzma2.compressed - s->temp.size;
+ if (tmp > in_avail)
+ tmp = in_avail;
+
+ memcpy(s->temp.buf + s->temp.size, b->in + b->in_pos, tmp);
+
+ if (s->temp.size + tmp == s->lzma2.compressed) {
+ memzero(s->temp.buf + s->temp.size + tmp,
+ sizeof(s->temp.buf)
+ - s->temp.size - tmp);
+ s->rc.in_limit = s->temp.size + tmp;
+ } else if (s->temp.size + tmp < LZMA_IN_REQUIRED) {
+ s->temp.size += tmp;
+ b->in_pos += tmp;
+ return true;
+ } else {
+ s->rc.in_limit = s->temp.size + tmp - LZMA_IN_REQUIRED;
+ }
+
+ s->rc.in = s->temp.buf;
+ s->rc.in_pos = 0;
+
+ if (!lzma_main(s) || s->rc.in_pos > s->temp.size + tmp)
+ return false;
+
+ s->lzma2.compressed -= s->rc.in_pos;
+
+ if (s->rc.in_pos < s->temp.size) {
+ s->temp.size -= s->rc.in_pos;
+ memmove(s->temp.buf, s->temp.buf + s->rc.in_pos,
+ s->temp.size);
+ return true;
+ }
+
+ b->in_pos += s->rc.in_pos - s->temp.size;
+ s->temp.size = 0;
+ }
+
+ in_avail = b->in_size - b->in_pos;
+ if (in_avail >= LZMA_IN_REQUIRED) {
+ s->rc.in = b->in;
+ s->rc.in_pos = b->in_pos;
+
+ if (in_avail >= s->lzma2.compressed + LZMA_IN_REQUIRED)
+ s->rc.in_limit = b->in_pos + s->lzma2.compressed;
+ else
+ s->rc.in_limit = b->in_size - LZMA_IN_REQUIRED;
+
+ if (!lzma_main(s))
+ return false;
+
+ in_avail = s->rc.in_pos - b->in_pos;
+ if (in_avail > s->lzma2.compressed)
+ return false;
+
+ s->lzma2.compressed -= in_avail;
+ b->in_pos = s->rc.in_pos;
+ }
+
+ in_avail = b->in_size - b->in_pos;
+ if (in_avail < LZMA_IN_REQUIRED) {
+ if (in_avail > s->lzma2.compressed)
+ in_avail = s->lzma2.compressed;
+
+ memcpy(s->temp.buf, b->in + b->in_pos, in_avail);
+ s->temp.size = in_avail;
+ b->in_pos += in_avail;
+ }
+
+ return true;
}
/*
@@ -932,244 +932,248 @@ static bool XZ_FUNC lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
* decoding or copying of uncompressed chunks to other functions.
*/
XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_run(
- struct xz_dec_lzma2 *s, struct xz_buf *b)
+ struct xz_dec_lzma2 *s, struct xz_buf *b)
{
- uint32_t tmp;
-
- while (b->in_pos < b->in_size || s->lzma2.sequence == SEQ_LZMA_RUN) {
- switch (s->lzma2.sequence) {
- case SEQ_CONTROL:
- /*
- * LZMA2 control byte
- *
- * Exact values:
- * 0x00 End marker
- * 0x01 Dictionary reset followed by
- * an uncompressed chunk
- * 0x02 Uncompressed chunk (no dictionary reset)
- *
- * Highest three bits (s->control & 0xE0):
- * 0xE0 Dictionary reset, new properties and state
- * reset, followed by LZMA compressed chunk
- * 0xC0 New properties and state reset, followed
- * by LZMA compressed chunk (no dictionary
- * reset)
- * 0xA0 State reset using old properties,
- * followed by LZMA compressed chunk (no
- * dictionary reset)
- * 0x80 LZMA chunk (no dictionary or state reset)
- *
- * For LZMA compressed chunks, the lowest five bits
- * (s->control & 1F) are the highest bits of the
- * uncompressed size (bits 16-20).
- *
- * A new LZMA2 stream must begin with a dictionary
- * reset. The first LZMA chunk must set new
- * properties and reset the LZMA state.
- *
- * Values that don't match anything described above
- * are invalid and we return XZ_DATA_ERROR.
- */
- tmp = b->in[b->in_pos++];
-
- if (tmp >= 0xE0 || tmp == 0x01) {
- s->lzma2.need_props = true;
- s->lzma2.need_dict_reset = false;
- dict_reset(&s->dict, b);
- } else if (s->lzma2.need_dict_reset) {
- return XZ_DATA_ERROR;
- }
-
- if (tmp >= 0x80) {
- s->lzma2.uncompressed = (tmp & 0x1F) << 16;
- s->lzma2.sequence = SEQ_UNCOMPRESSED_1;
-
- if (tmp >= 0xC0) {
- /*
- * When there are new properties,
- * state reset is done at
- * SEQ_PROPERTIES.
- */
- s->lzma2.need_props = false;
- s->lzma2.next_sequence
- = SEQ_PROPERTIES;
-
- } else if (s->lzma2.need_props) {
- return XZ_DATA_ERROR;
-
- } else {
- s->lzma2.next_sequence
- = SEQ_LZMA_PREPARE;
- if (tmp >= 0xA0)
- lzma_reset(s);
- }
- } else {
- if (tmp == 0x00)
- return XZ_STREAM_END;
-
- if (tmp > 0x02)
- return XZ_DATA_ERROR;
-
- s->lzma2.sequence = SEQ_COMPRESSED_0;
- s->lzma2.next_sequence = SEQ_COPY;
- }
-
- break;
-
- case SEQ_UNCOMPRESSED_1:
- s->lzma2.uncompressed
- += (uint32_t)b->in[b->in_pos++] << 8;
- s->lzma2.sequence = SEQ_UNCOMPRESSED_2;
- break;
-
- case SEQ_UNCOMPRESSED_2:
- s->lzma2.uncompressed
- += (uint32_t)b->in[b->in_pos++] + 1;
- s->lzma2.sequence = SEQ_COMPRESSED_0;
- break;
-
- case SEQ_COMPRESSED_0:
- s->lzma2.compressed
- = (uint32_t)b->in[b->in_pos++] << 8;
- s->lzma2.sequence = SEQ_COMPRESSED_1;
- break;
-
- case SEQ_COMPRESSED_1:
- s->lzma2.compressed
- += (uint32_t)b->in[b->in_pos++] + 1;
- s->lzma2.sequence = s->lzma2.next_sequence;
- break;
-
- case SEQ_PROPERTIES:
- if (!lzma_props(s, b->in[b->in_pos++]))
- return XZ_DATA_ERROR;
-
- s->lzma2.sequence = SEQ_LZMA_PREPARE;
-
- case SEQ_LZMA_PREPARE:
- if (s->lzma2.compressed < RC_INIT_BYTES)
- return XZ_DATA_ERROR;
-
- if (!rc_read_init(&s->rc, b))
- return XZ_OK;
-
- s->lzma2.compressed -= RC_INIT_BYTES;
- s->lzma2.sequence = SEQ_LZMA_RUN;
-
- case SEQ_LZMA_RUN:
- /*
- * Set dictionary limit to indicate how much we want
- * to be encoded at maximum. Decode new data into the
- * dictionary. Flush the new data from dictionary to
- * b->out. Check if we finished decoding this chunk.
- * In case the dictionary got full but we didn't fill
- * the output buffer yet, we may run this loop
- * multiple times without changing s->lzma2.sequence.
- */
- dict_limit(&s->dict, min_t(size_t,
- b->out_size - b->out_pos,
- s->lzma2.uncompressed));
- if (!lzma2_lzma(s, b))
- return XZ_DATA_ERROR;
-
- s->lzma2.uncompressed -= dict_flush(&s->dict, b);
-
- if (s->lzma2.uncompressed == 0) {
- if (s->lzma2.compressed > 0 || s->lzma.len > 0
- || !rc_is_finished(&s->rc))
- return XZ_DATA_ERROR;
-
- rc_reset(&s->rc);
- s->lzma2.sequence = SEQ_CONTROL;
-
- } else if (b->out_pos == b->out_size
- || (b->in_pos == b->in_size
- && s->temp.size
- < s->lzma2.compressed)) {
- return XZ_OK;
- }
-
- break;
-
- case SEQ_COPY:
- dict_uncompressed(&s->dict, b, &s->lzma2.compressed);
- if (s->lzma2.compressed > 0)
- return XZ_OK;
-
- s->lzma2.sequence = SEQ_CONTROL;
- break;
- }
- }
-
- return XZ_OK;
+ uint32_t tmp;
+
+ while (b->in_pos < b->in_size || s->lzma2.sequence == SEQ_LZMA_RUN) {
+ switch (s->lzma2.sequence) {
+ case SEQ_CONTROL:
+ /*
+ * LZMA2 control byte
+ *
+ * Exact values:
+ * 0x00 End marker
+ * 0x01 Dictionary reset followed by
+ * an uncompressed chunk
+ * 0x02 Uncompressed chunk (no dictionary reset)
+ *
+ * Highest three bits (s->control & 0xE0):
+ * 0xE0 Dictionary reset, new properties and state
+ * reset, followed by LZMA compressed chunk
+ * 0xC0 New properties and state reset, followed
+ * by LZMA compressed chunk (no dictionary
+ * reset)
+ * 0xA0 State reset using old properties,
+ * followed by LZMA compressed chunk (no
+ * dictionary reset)
+ * 0x80 LZMA chunk (no dictionary or state reset)
+ *
+ * For LZMA compressed chunks, the lowest five bits
+ * (s->control & 1F) are the highest bits of the
+ * uncompressed size (bits 16-20).
+ *
+ * A new LZMA2 stream must begin with a dictionary
+ * reset. The first LZMA chunk must set new
+ * properties and reset the LZMA state.
+ *
+ * Values that don't match anything described above
+ * are invalid and we return XZ_DATA_ERROR.
+ */
+ tmp = b->in[b->in_pos++];
+
+ if (tmp >= 0xE0 || tmp == 0x01) {
+ s->lzma2.need_props = true;
+ s->lzma2.need_dict_reset = false;
+ dict_reset(&s->dict, b);
+ } else if (s->lzma2.need_dict_reset) {
+ return XZ_DATA_ERROR;
+ }
+
+ if (tmp >= 0x80) {
+ s->lzma2.uncompressed = (tmp & 0x1F) << 16;
+ s->lzma2.sequence = SEQ_UNCOMPRESSED_1;
+
+ if (tmp >= 0xC0) {
+ /*
+ * When there are new properties,
+ * state reset is done at
+ * SEQ_PROPERTIES.
+ */
+ s->lzma2.need_props = false;
+ s->lzma2.next_sequence
+ = SEQ_PROPERTIES;
+
+ } else if (s->lzma2.need_props) {
+ return XZ_DATA_ERROR;
+
+ } else {
+ s->lzma2.next_sequence
+ = SEQ_LZMA_PREPARE;
+ if (tmp >= 0xA0)
+ lzma_reset(s);
+ }
+ } else {
+ if (tmp == 0x00)
+ return XZ_STREAM_END;
+
+ if (tmp > 0x02)
+ return XZ_DATA_ERROR;
+
+ s->lzma2.sequence = SEQ_COMPRESSED_0;
+ s->lzma2.next_sequence = SEQ_COPY;
+ }
+
+ break;
+
+ case SEQ_UNCOMPRESSED_1:
+ s->lzma2.uncompressed
+ += (uint32_t)b->in[b->in_pos++] << 8;
+ s->lzma2.sequence = SEQ_UNCOMPRESSED_2;
+ break;
+
+ case SEQ_UNCOMPRESSED_2:
+ s->lzma2.uncompressed
+ += (uint32_t)b->in[b->in_pos++] + 1;
+ s->lzma2.sequence = SEQ_COMPRESSED_0;
+ break;
+
+ case SEQ_COMPRESSED_0:
+ s->lzma2.compressed
+ = (uint32_t)b->in[b->in_pos++] << 8;
+ s->lzma2.sequence = SEQ_COMPRESSED_1;
+ break;
+
+ case SEQ_COMPRESSED_1:
+ s->lzma2.compressed
+ += (uint32_t)b->in[b->in_pos++] + 1;
+ s->lzma2.sequence = s->lzma2.next_sequence;
+ break;
+
+ case SEQ_PROPERTIES:
+ if (!lzma_props(s, b->in[b->in_pos++]))
+ return XZ_DATA_ERROR;
+
+ s->lzma2.sequence = SEQ_LZMA_PREPARE;
+ #ifndef __clang__
+ __attribute__ ((fallthrough));
+ #endif
+ case SEQ_LZMA_PREPARE:
+ if (s->lzma2.compressed < RC_INIT_BYTES)
+ return XZ_DATA_ERROR;
+
+ if (!rc_read_init(&s->rc, b))
+ return XZ_OK;
+
+ s->lzma2.compressed -= RC_INIT_BYTES;
+ s->lzma2.sequence = SEQ_LZMA_RUN;
+ #ifndef __clang__
+ __attribute__ ((fallthrough));
+ #endif
+ case SEQ_LZMA_RUN:
+ /*
+ * Set dictionary limit to indicate how much we want
+ * to be encoded at maximum. Decode new data into the
+ * dictionary. Flush the new data from dictionary to
+ * b->out. Check if we finished decoding this chunk.
+ * In case the dictionary got full but we didn't fill
+ * the output buffer yet, we may run this loop
+ * multiple times without changing s->lzma2.sequence.
+ */
+ dict_limit(&s->dict, min_t(size_t,
+ b->out_size - b->out_pos,
+ s->lzma2.uncompressed));
+ if (!lzma2_lzma(s, b))
+ return XZ_DATA_ERROR;
+
+ s->lzma2.uncompressed -= dict_flush(&s->dict, b);
+
+ if (s->lzma2.uncompressed == 0) {
+ if (s->lzma2.compressed > 0 || s->lzma.len > 0
+ || !rc_is_finished(&s->rc))
+ return XZ_DATA_ERROR;
+
+ rc_reset(&s->rc);
+ s->lzma2.sequence = SEQ_CONTROL;
+
+ } else if (b->out_pos == b->out_size
+ || (b->in_pos == b->in_size
+ && s->temp.size
+ < s->lzma2.compressed)) {
+ return XZ_OK;
+ }
+
+ break;
+
+ case SEQ_COPY:
+ dict_uncompressed(&s->dict, b, &s->lzma2.compressed);
+ if (s->lzma2.compressed > 0)
+ return XZ_OK;
+
+ s->lzma2.sequence = SEQ_CONTROL;
+ break;
+ }
+ }
+
+ return XZ_OK;
}
XZ_EXTERN struct xz_dec_lzma2 * XZ_FUNC xz_dec_lzma2_create(
- enum xz_mode mode, uint32_t dict_max)
+ enum xz_mode mode, uint32_t dict_max)
{
- struct xz_dec_lzma2 *s = kmalloc(sizeof(*s), GFP_KERNEL);
- if (s == NULL)
- return NULL;
-
- s->dict.mode = mode;
- s->dict.size_max = dict_max;
-
- if (DEC_IS_PREALLOC(mode)) {
- s->dict.buf = vmalloc(dict_max);
- if (s->dict.buf == NULL) {
- kfree(s);
- return NULL;
- }
- } else if (DEC_IS_DYNALLOC(mode)) {
- s->dict.buf = NULL;
- s->dict.allocated = 0;
- }
-
- return s;
+ struct xz_dec_lzma2 *s = kmalloc(sizeof(*s), GFP_KERNEL);
+ if (s == NULL)
+ return NULL;
+
+ s->dict.mode = mode;
+ s->dict.size_max = dict_max;
+
+ if (DEC_IS_PREALLOC(mode)) {
+ s->dict.buf = vmalloc(dict_max);
+ if (s->dict.buf == NULL) {
+ kfree(s);
+ return NULL;
+ }
+ } else if (DEC_IS_DYNALLOC(mode)) {
+ s->dict.buf = NULL;
+ s->dict.allocated = 0;
+ }
+
+ return s;
}
XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_reset(
- struct xz_dec_lzma2 *s, uint8_t props)
+ struct xz_dec_lzma2 *s, uint8_t props)
{
- /* This limits dictionary size to 3 GiB to keep parsing simpler. */
- if (props > 39)
- return XZ_OPTIONS_ERROR;
+ /* This limits dictionary size to 3 GiB to keep parsing simpler. */
+ if (props > 39)
+ return XZ_OPTIONS_ERROR;
- s->dict.size = 2 + (props & 1);
- s->dict.size <<= (props >> 1) + 11;
+ s->dict.size = 2 + (props & 1);
+ s->dict.size <<= (props >> 1) + 11;
- if (DEC_IS_MULTI(s->dict.mode)) {
- if (s->dict.size > s->dict.size_max)
- return XZ_MEMLIMIT_ERROR;
+ if (DEC_IS_MULTI(s->dict.mode)) {
+ if (s->dict.size > s->dict.size_max)
+ return XZ_MEMLIMIT_ERROR;
- s->dict.end = s->dict.size;
+ s->dict.end = s->dict.size;
- if (DEC_IS_DYNALLOC(s->dict.mode)) {
- if (s->dict.allocated < s->dict.size) {
- vfree(s->dict.buf);
- s->dict.buf = vmalloc(s->dict.size);
- if (s->dict.buf == NULL) {
- s->dict.allocated = 0;
- return XZ_MEM_ERROR;
- }
- }
- }
- }
+ if (DEC_IS_DYNALLOC(s->dict.mode)) {
+ if (s->dict.allocated < s->dict.size) {
+ vfree(s->dict.buf);
+ s->dict.buf = vmalloc(s->dict.size);
+ if (s->dict.buf == NULL) {
+ s->dict.allocated = 0;
+ return XZ_MEM_ERROR;
+ }
+ }
+ }
+ }
- s->lzma.len = 0;
+ s->lzma.len = 0;
- s->lzma2.sequence = SEQ_CONTROL;
- s->lzma2.need_dict_reset = true;
+ s->lzma2.sequence = SEQ_CONTROL;
+ s->lzma2.need_dict_reset = true;
- s->temp.size = 0;
+ s->temp.size = 0;
- return XZ_OK;
+ return XZ_OK;
}
XZ_EXTERN void XZ_FUNC xz_dec_lzma2_end(struct xz_dec_lzma2 *s)
{
- if (DEC_IS_MULTI(s->dict.mode))
- vfree(s->dict.buf);
+ if (DEC_IS_MULTI(s->dict.mode))
+ vfree(s->dict.buf);
- kfree(s);
+ kfree(s);
}
diff --git a/lib/qt-tar-xz/xz_dec_stream.c b/lib/qt-tar-xz/xz_dec_stream.c
index bdcbf1b..d240348 100644
--- a/lib/qt-tar-xz/xz_dec_stream.c
+++ b/lib/qt-tar-xz/xz_dec_stream.c
@@ -12,139 +12,139 @@
/* Hash used to validate the Index field */
struct xz_dec_hash {
- vli_type unpadded;
- vli_type uncompressed;
- uint32_t crc32;
+ vli_type unpadded;
+ vli_type uncompressed;
+ uint32_t crc32;
};
struct xz_dec {
- /* Position in dec_main() */
- enum {
- SEQ_STREAM_HEADER,
- SEQ_BLOCK_START,
- SEQ_BLOCK_HEADER,
- SEQ_BLOCK_UNCOMPRESS,
- SEQ_BLOCK_PADDING,
- SEQ_BLOCK_CHECK,
- SEQ_INDEX,
- SEQ_INDEX_PADDING,
- SEQ_INDEX_CRC32,
- SEQ_STREAM_FOOTER
- } sequence;
-
- /* Position in variable-length integers and Check fields */
- uint32_t pos;
-
- /* Variable-length integer decoded by dec_vli() */
- vli_type vli;
-
- /* Saved in_pos and out_pos */
- size_t in_start;
- size_t out_start;
-
- /* CRC32 value in Block or Index */
- uint32_t crc32;
-
- /* Type of the integrity check calculated from uncompressed data */
- enum xz_check check_type;
-
- /* Operation mode */
- enum xz_mode mode;
-
- /*
- * True if the next call to xz_dec_run() is allowed to return
- * XZ_BUF_ERROR.
- */
- bool allow_buf_error;
-
- /* Information stored in Block Header */
- struct {
- /*
- * Value stored in the Compressed Size field, or
- * VLI_UNKNOWN if Compressed Size is not present.
- */
- vli_type compressed;
-
- /*
- * Value stored in the Uncompressed Size field, or
- * VLI_UNKNOWN if Uncompressed Size is not present.
- */
- vli_type uncompressed;
-
- /* Size of the Block Header field */
- uint32_t size;
- } block_header;
-
- /* Information collected when decoding Blocks */
- struct {
- /* Observed compressed size of the current Block */
- vli_type compressed;
-
- /* Observed uncompressed size of the current Block */
- vli_type uncompressed;
-
- /* Number of Blocks decoded so far */
- vli_type count;
-
- /*
- * Hash calculated from the Block sizes. This is used to
- * validate the Index field.
- */
- struct xz_dec_hash hash;
- } block;
-
- /* Variables needed when verifying the Index field */
- struct {
- /* Position in dec_index() */
- enum {
- SEQ_INDEX_COUNT,
- SEQ_INDEX_UNPADDED,
- SEQ_INDEX_UNCOMPRESSED
- } sequence;
-
- /* Size of the Index in bytes */
- vli_type size;
-
- /* Number of Records (matches block.count in valid files) */
- vli_type count;
-
- /*
- * Hash calculated from the Records (matches block.hash in
- * valid files).
- */
- struct xz_dec_hash hash;
- } index;
-
- /*
- * Temporary buffer needed to hold Stream Header, Block Header,
- * and Stream Footer. The Block Header is the biggest (1 KiB)
- * so we reserve space according to that. buf[] has to be aligned
- * to a multiple of four bytes; the size_t variables before it
- * should guarantee this.
- */
- struct {
- size_t pos;
- size_t size;
- uint8_t buf[1024];
- } temp;
-
- struct xz_dec_lzma2 *lzma2;
+ /* Position in dec_main() */
+ enum {
+ SEQ_STREAM_HEADER,
+ SEQ_BLOCK_START,
+ SEQ_BLOCK_HEADER,
+ SEQ_BLOCK_UNCOMPRESS,
+ SEQ_BLOCK_PADDING,
+ SEQ_BLOCK_CHECK,
+ SEQ_INDEX,
+ SEQ_INDEX_PADDING,
+ SEQ_INDEX_CRC32,
+ SEQ_STREAM_FOOTER
+ } sequence;
+
+ /* Position in variable-length integers and Check fields */
+ uint32_t pos;
+
+ /* Variable-length integer decoded by dec_vli() */
+ vli_type vli;
+
+ /* Saved in_pos and out_pos */
+ size_t in_start;
+ size_t out_start;
+
+ /* CRC32 value in Block or Index */
+ uint32_t crc32;
+
+ /* Type of the integrity check calculated from uncompressed data */
+ enum xz_check check_type;
+
+ /* Operation mode */
+ enum xz_mode mode;
+
+ /*
+ * True if the next call to xz_dec_run() is allowed to return
+ * XZ_BUF_ERROR.
+ */
+ bool allow_buf_error;
+
+ /* Information stored in Block Header */
+ struct {
+ /*
+ * Value stored in the Compressed Size field, or
+ * VLI_UNKNOWN if Compressed Size is not present.
+ */
+ vli_type compressed;
+
+ /*
+ * Value stored in the Uncompressed Size field, or
+ * VLI_UNKNOWN if Uncompressed Size is not present.
+ */
+ vli_type uncompressed;
+
+ /* Size of the Block Header field */
+ uint32_t size;
+ } block_header;
+
+ /* Information collected when decoding Blocks */
+ struct {
+ /* Observed compressed size of the current Block */
+ vli_type compressed;
+
+ /* Observed uncompressed size of the current Block */
+ vli_type uncompressed;
+
+ /* Number of Blocks decoded so far */
+ vli_type count;
+
+ /*
+ * Hash calculated from the Block sizes. This is used to
+ * validate the Index field.
+ */
+ struct xz_dec_hash hash;
+ } block;
+
+ /* Variables needed when verifying the Index field */
+ struct {
+ /* Position in dec_index() */
+ enum {
+ SEQ_INDEX_COUNT,
+ SEQ_INDEX_UNPADDED,
+ SEQ_INDEX_UNCOMPRESSED
+ } sequence;
+
+ /* Size of the Index in bytes */
+ vli_type size;
+
+ /* Number of Records (matches block.count in valid files) */
+ vli_type count;
+
+ /*
+ * Hash calculated from the Records (matches block.hash in
+ * valid files).
+ */
+ struct xz_dec_hash hash;
+ } index;
+
+ /*
+ * Temporary buffer needed to hold Stream Header, Block Header,
+ * and Stream Footer. The Block Header is the biggest (1 KiB)
+ * so we reserve space according to that. buf[] has to be aligned
+ * to a multiple of four bytes; the size_t variables before it
+ * should guarantee this.
+ */
+ struct {
+ size_t pos;
+ size_t size;
+ uint8_t buf[1024];
+ } temp;
+
+ struct xz_dec_lzma2 *lzma2;
#ifdef XZ_DEC_BCJ
- struct xz_dec_bcj *bcj;
- bool bcj_active;
+ struct xz_dec_bcj *bcj;
+ bool bcj_active;
#endif
};
#ifdef XZ_DEC_ANY_CHECK
/* Sizes of the Check field with different Check IDs */
static const uint8_t check_sizes[16] = {
- 0,
- 4, 4, 4,
- 8, 8, 8,
- 16, 16, 16,
- 32, 32, 32,
- 64, 64, 64
+ 0,
+ 4, 4, 4,
+ 8, 8, 8,
+ 16, 16, 16,
+ 32, 32, 32,
+ 64, 64, 64
};
#endif
@@ -156,51 +156,51 @@ static const uint8_t check_sizes[16] = {
*/
static bool XZ_FUNC fill_temp(struct xz_dec *s, struct xz_buf *b)
{
- size_t copy_size = min_t(size_t,
- b->in_size - b->in_pos, s->temp.size - s->temp.pos);
+ size_t copy_size = min_t(size_t,
+ b->in_size - b->in_pos, s->temp.size - s->temp.pos);
- memcpy(s->temp.buf + s->temp.pos, b->in + b->in_pos, copy_size);
- b->in_pos += copy_size;
- s->temp.pos += copy_size;
+ memcpy(s->temp.buf + s->temp.pos, b->in + b->in_pos, copy_size);
+ b->in_pos += copy_size;
+ s->temp.pos += copy_size;
- if (s->temp.pos == s->temp.size) {
- s->temp.pos = 0;
- return true;
- }
+ if (s->temp.pos == s->temp.size) {
+ s->temp.pos = 0;
+ return true;
+ }
- return false;
+ return false;
}
/* Decode a variable-length integer (little-endian base-128 encoding) */
static enum xz_ret XZ_FUNC dec_vli(struct xz_dec *s,
- const uint8_t *in, size_t *in_pos, size_t in_size)
+ const uint8_t *in, size_t *in_pos, size_t in_size)
{
- uint8_t byte;
+ uint8_t byte;
- if (s->pos == 0)
- s->vli = 0;
+ if (s->pos == 0)
+ s->vli = 0;
- while (*in_pos < in_size) {
- byte = in[*in_pos];
- ++*in_pos;
+ while (*in_pos < in_size) {
+ byte = in[*in_pos];
+ ++*in_pos;
- s->vli |= (vli_type)(byte & 0x7F) << s->pos;
+ s->vli |= (vli_type)(byte & 0x7F) << s->pos;
- if ((byte & 0x80) == 0) {
- /* Don't allow non-minimal encodings. */
- if (byte == 0 && s->pos != 0)
- return XZ_DATA_ERROR;
+ if ((byte & 0x80) == 0) {
+ /* Don't allow non-minimal encodings. */
+ if (byte == 0 && s->pos != 0)
+ return XZ_DATA_ERROR;
- s->pos = 0;
- return XZ_STREAM_END;
- }
+ s->pos = 0;
+ return XZ_STREAM_END;
+ }
- s->pos += 7;
- if (s->pos == 7 * VLI_BYTES_MAX)
- return XZ_DATA_ERROR;
- }
+ s->pos += 7;
+ if (s->pos == 7 * VLI_BYTES_MAX)
+ return XZ_DATA_ERROR;
+ }
- return XZ_OK;
+ return XZ_OK;
}
/*
@@ -217,72 +217,72 @@ static enum xz_ret XZ_FUNC dec_vli(struct xz_dec *s,
*/
static enum xz_ret XZ_FUNC dec_block(struct xz_dec *s, struct xz_buf *b)
{
- enum xz_ret ret;
+ enum xz_ret ret;
- s->in_start = b->in_pos;
- s->out_start = b->out_pos;
+ s->in_start = b->in_pos;
+ s->out_start = b->out_pos;
#ifdef XZ_DEC_BCJ
- if (s->bcj_active)
- ret = xz_dec_bcj_run(s->bcj, s->lzma2, b);
- else
+ if (s->bcj_active)
+ ret = xz_dec_bcj_run(s->bcj, s->lzma2, b);
+ else
#endif
- ret = xz_dec_lzma2_run(s->lzma2, b);
-
- s->block.compressed += b->in_pos - s->in_start;
- s->block.uncompressed += b->out_pos - s->out_start;
-
- /*
- * There is no need to separately check for VLI_UNKNOWN, since
- * the observed sizes are always smaller than VLI_UNKNOWN.
- */
- if (s->block.compressed > s->block_header.compressed
- || s->block.uncompressed
- > s->block_header.uncompressed)
- return XZ_DATA_ERROR;
-
- if (s->check_type == XZ_CHECK_CRC32)
- s->crc32 = xz_crc32(b->out + s->out_start,
- b->out_pos - s->out_start, s->crc32);
-
- if (ret == XZ_STREAM_END) {
- if (s->block_header.compressed != VLI_UNKNOWN
- && s->block_header.compressed
- != s->block.compressed)
- return XZ_DATA_ERROR;
-
- if (s->block_header.uncompressed != VLI_UNKNOWN
- && s->block_header.uncompressed
- != s->block.uncompressed)
- return XZ_DATA_ERROR;
-
- s->block.hash.unpadded += s->block_header.size
- + s->block.compressed;
+ ret = xz_dec_lzma2_run(s->lzma2, b);
+
+ s->block.compressed += b->in_pos - s->in_start;
+ s->block.uncompressed += b->out_pos - s->out_start;
+
+ /*
+ * There is no need to separately check for VLI_UNKNOWN, since
+ * the observed sizes are always smaller than VLI_UNKNOWN.
+ */
+ if (s->block.compressed > s->block_header.compressed
+ || s->block.uncompressed
+ > s->block_header.uncompressed)
+ return XZ_DATA_ERROR;
+
+ if (s->check_type == XZ_CHECK_CRC32)
+ s->crc32 = xz_crc32(b->out + s->out_start,
+ b->out_pos - s->out_start, s->crc32);
+
+ if (ret == XZ_STREAM_END) {
+ if (s->block_header.compressed != VLI_UNKNOWN
+ && s->block_header.compressed
+ != s->block.compressed)
+ return XZ_DATA_ERROR;
+
+ if (s->block_header.uncompressed != VLI_UNKNOWN
+ && s->block_header.uncompressed
+ != s->block.uncompressed)
+ return XZ_DATA_ERROR;
+
+ s->block.hash.unpadded += s->block_header.size
+ + s->block.compressed;
#ifdef XZ_DEC_ANY_CHECK
- s->block.hash.unpadded += check_sizes[s->check_type];
+ s->block.hash.unpadded += check_sizes[s->check_type];
#else
- if (s->check_type == XZ_CHECK_CRC32)
- s->block.hash.unpadded += 4;
+ if (s->check_type == XZ_CHECK_CRC32)
+ s->block.hash.unpadded += 4;
#endif
- s->block.hash.uncompressed += s->block.uncompressed;
- s->block.hash.crc32 = xz_crc32(
- (const uint8_t *)&s->block.hash,
- sizeof(s->block.hash), s->block.hash.crc32);
+ s->block.hash.uncompressed += s->block.uncompressed;
+ s->block.hash.crc32 = xz_crc32(
+ (const uint8_t *)&s->block.hash,
+ sizeof(s->block.hash), s->block.hash.crc32);
- ++s->block.count;
- }
+ ++s->block.count;
+ }
- return ret;
+ return ret;
}
/* Update the Index size and the CRC32 value. */
static void XZ_FUNC index_update(struct xz_dec *s, const struct xz_buf *b)
{
- size_t in_used = b->in_pos - s->in_start;
- s->index.size += in_used;
- s->crc32 = xz_crc32(b->in + s->in_start, in_used, s->crc32);
+ size_t in_used = b->in_pos - s->in_start;
+ s->index.size += in_used;
+ s->crc32 = xz_crc32(b->in + s->in_start, in_used, s->crc32);
}
/*
@@ -295,48 +295,48 @@ static void XZ_FUNC index_update(struct xz_dec *s, const struct xz_buf *b)
*/
static enum xz_ret XZ_FUNC dec_index(struct xz_dec *s, struct xz_buf *b)
{
- enum xz_ret ret;
-
- do {
- ret = dec_vli(s, b->in, &b->in_pos, b->in_size);
- if (ret != XZ_STREAM_END) {
- index_update(s, b);
- return ret;
- }
-
- switch (s->index.sequence) {
- case SEQ_INDEX_COUNT:
- s->index.count = s->vli;
-
- /*
- * Validate that the Number of Records field
- * indicates the same number of Records as
- * there were Blocks in the Stream.
- */
- if (s->index.count != s->block.count)
- return XZ_DATA_ERROR;
-
- s->index.sequence = SEQ_INDEX_UNPADDED;
- break;
-
- case SEQ_INDEX_UNPADDED:
- s->index.hash.unpadded += s->vli;
- s->index.sequence = SEQ_INDEX_UNCOMPRESSED;
- break;
-
- case SEQ_INDEX_UNCOMPRESSED:
- s->index.hash.uncompressed += s->vli;
- s->index.hash.crc32 = xz_crc32(
- (const uint8_t *)&s->index.hash,
- sizeof(s->index.hash),
- s->index.hash.crc32);
- --s->index.count;
- s->index.sequence = SEQ_INDEX_UNPADDED;
- break;
- }
- } while (s->index.count > 0);
-
- return XZ_STREAM_END;
+ enum xz_ret ret;
+
+ do {
+ ret = dec_vli(s, b->in, &b->in_pos, b->in_size);
+ if (ret != XZ_STREAM_END) {
+ index_update(s, b);
+ return ret;
+ }
+
+ switch (s->index.sequence) {
+ case SEQ_INDEX_COUNT:
+ s->index.count = s->vli;
+
+ /*
+ * Validate that the Number of Records field
+ * indicates the same number of Records as
+ * there were Blocks in the Stream.
+ */
+ if (s->index.count != s->block.count)
+ return XZ_DATA_ERROR;
+
+ s->index.sequence = SEQ_INDEX_UNPADDED;
+ break;
+
+ case SEQ_INDEX_UNPADDED:
+ s->index.hash.unpadded += s->vli;
+ s->index.sequence = SEQ_INDEX_UNCOMPRESSED;
+ break;
+
+ case SEQ_INDEX_UNCOMPRESSED:
+ s->index.hash.uncompressed += s->vli;
+ s->index.hash.crc32 = xz_crc32(
+ (const uint8_t *)&s->index.hash,
+ sizeof(s->index.hash),
+ s->index.hash.crc32);
+ --s->index.count;
+ s->index.sequence = SEQ_INDEX_UNPADDED;
+ break;
+ }
+ } while (s->index.count > 0);
+
+ return XZ_STREAM_END;
}
/*
@@ -345,21 +345,21 @@ static enum xz_ret XZ_FUNC dec_index(struct xz_dec *s, struct xz_buf *b)
*/
static enum xz_ret XZ_FUNC crc32_validate(struct xz_dec *s, struct xz_buf *b)
{
- do {
- if (b->in_pos == b->in_size)
- return XZ_OK;
+ do {
+ if (b->in_pos == b->in_size)
+ return XZ_OK;
- if (((s->crc32 >> s->pos) & 0xFF) != b->in[b->in_pos++])
- return XZ_DATA_ERROR;
+ if (((s->crc32 >> s->pos) & 0xFF) != b->in[b->in_pos++])
+ return XZ_DATA_ERROR;
- s->pos += 8;
+ s->pos += 8;
- } while (s->pos < 32);
+ } while (s->pos < 32);
- s->crc32 = 0;
- s->pos = 0;
+ s->crc32 = 0;
+ s->pos = 0;
- return XZ_STREAM_END;
+ return XZ_STREAM_END;
}
#ifdef XZ_DEC_ANY_CHECK
@@ -369,341 +369,354 @@ static enum xz_ret XZ_FUNC crc32_validate(struct xz_dec *s, struct xz_buf *b)
*/
static bool XZ_FUNC check_skip(struct xz_dec *s, struct xz_buf *b)
{
- while (s->pos < check_sizes[s->check_type]) {
- if (b->in_pos == b->in_size)
- return false;
+ while (s->pos < check_sizes[s->check_type]) {
+ if (b->in_pos == b->in_size)
+ return false;
- ++b->in_pos;
- ++s->pos;
- }
+ ++b->in_pos;
+ ++s->pos;
+ }
- s->pos = 0;
+ s->pos = 0;
- return true;
+ return true;
}
#endif
/* Decode the Stream Header field (the first 12 bytes of the .xz Stream). */
static enum xz_ret XZ_FUNC dec_stream_header(struct xz_dec *s)
{
- if (!memeq(s->temp.buf, HEADER_MAGIC, HEADER_MAGIC_SIZE))
- return XZ_FORMAT_ERROR;
+ if (!memeq(s->temp.buf, HEADER_MAGIC, HEADER_MAGIC_SIZE))
+ return XZ_FORMAT_ERROR;
- if (xz_crc32(s->temp.buf + HEADER_MAGIC_SIZE, 2, 0)
- != get_le32(s->temp.buf + HEADER_MAGIC_SIZE + 2))
- return XZ_DATA_ERROR;
+ if (xz_crc32(s->temp.buf + HEADER_MAGIC_SIZE, 2, 0)
+ != get_le32(s->temp.buf + HEADER_MAGIC_SIZE + 2))
+ return XZ_DATA_ERROR;
- if (s->temp.buf[HEADER_MAGIC_SIZE] != 0)
- return XZ_OPTIONS_ERROR;
+ if (s->temp.buf[HEADER_MAGIC_SIZE] != 0)
+ return XZ_OPTIONS_ERROR;
- /*
- * Of integrity checks, we support only none (Check ID = 0) and
- * CRC32 (Check ID = 1). However, if XZ_DEC_ANY_CHECK is defined,
- * we will accept other check types too, but then the check won't
- * be verified and a warning (XZ_UNSUPPORTED_CHECK) will be given.
- */
- s->check_type = s->temp.buf[HEADER_MAGIC_SIZE + 1];
+ /*
+ * Of integrity checks, we support only none (Check ID = 0) and
+ * CRC32 (Check ID = 1). However, if XZ_DEC_ANY_CHECK is defined,
+ * we will accept other check types too, but then the check won't
+ * be verified and a warning (XZ_UNSUPPORTED_CHECK) will be given.
+ */
+ s->check_type = s->temp.buf[HEADER_MAGIC_SIZE + 1];
#ifdef XZ_DEC_ANY_CHECK
- if (s->check_type > XZ_CHECK_MAX)
- return XZ_OPTIONS_ERROR;
+ if (s->check_type > XZ_CHECK_MAX)
+ return XZ_OPTIONS_ERROR;
- if (s->check_type > XZ_CHECK_CRC32)
- return XZ_UNSUPPORTED_CHECK;
+ if (s->check_type > XZ_CHECK_CRC32)
+ return XZ_UNSUPPORTED_CHECK;
#else
- if (s->check_type > XZ_CHECK_CRC32)
- return XZ_OPTIONS_ERROR;
+ if (s->check_type > XZ_CHECK_CRC32)
+ return XZ_OPTIONS_ERROR;
#endif
- return XZ_OK;
+ return XZ_OK;
}
/* Decode the Stream Footer field (the last 12 bytes of the .xz Stream) */
static enum xz_ret XZ_FUNC dec_stream_footer(struct xz_dec *s)
{
- if (!memeq(s->temp.buf + 10, FOOTER_MAGIC, FOOTER_MAGIC_SIZE))
- return XZ_DATA_ERROR;
-
- if (xz_crc32(s->temp.buf + 4, 6, 0) != get_le32(s->temp.buf))
- return XZ_DATA_ERROR;
-
- /*
- * Validate Backward Size. Note that we never added the size of the
- * Index CRC32 field to s->index.size, thus we use s->index.size / 4
- * instead of s->index.size / 4 - 1.
- */
- if ((s->index.size >> 2) != get_le32(s->temp.buf + 4))
- return XZ_DATA_ERROR;
-
- if (s->temp.buf[8] != 0 || s->temp.buf[9] != s->check_type)
- return XZ_DATA_ERROR;
-
- /*
- * Use XZ_STREAM_END instead of XZ_OK to be more convenient
- * for the caller.
- */
- return XZ_STREAM_END;
+ if (!memeq(s->temp.buf + 10, FOOTER_MAGIC, FOOTER_MAGIC_SIZE))
+ return XZ_DATA_ERROR;
+
+ if (xz_crc32(s->temp.buf + 4, 6, 0) != get_le32(s->temp.buf))
+ return XZ_DATA_ERROR;
+
+ /*
+ * Validate Backward Size. Note that we never added the size of the
+ * Index CRC32 field to s->index.size, thus we use s->index.size / 4
+ * instead of s->index.size / 4 - 1.
+ */
+ if ((s->index.size >> 2) != get_le32(s->temp.buf + 4))
+ return XZ_DATA_ERROR;
+
+ if (s->temp.buf[8] != 0 || s->temp.buf[9] != s->check_type)
+ return XZ_DATA_ERROR;
+
+ /*
+ * Use XZ_STREAM_END instead of XZ_OK to be more convenient
+ * for the caller.
+ */
+ return XZ_STREAM_END;
}
/* Decode the Block Header and initialize the filter chain. */
static enum xz_ret XZ_FUNC dec_block_header(struct xz_dec *s)
{
- enum xz_ret ret;
-
- /*
- * Validate the CRC32. We know that the temp buffer is at least
- * eight bytes so this is safe.
- */
- s->temp.size -= 4;
- if (xz_crc32(s->temp.buf, s->temp.size, 0)
- != get_le32(s->temp.buf + s->temp.size))
- return XZ_DATA_ERROR;
-
- s->temp.pos = 2;
-
- /*
- * Catch unsupported Block Flags. We support only one or two filters
- * in the chain, so we catch that with the same test.
- */
+ enum xz_ret ret;
+
+ /*
+ * Validate the CRC32. We know that the temp buffer is at least
+ * eight bytes so this is safe.
+ */
+ s->temp.size -= 4;
+ if (xz_crc32(s->temp.buf, s->temp.size, 0)
+ != get_le32(s->temp.buf + s->temp.size))
+ return XZ_DATA_ERROR;
+
+ s->temp.pos = 2;
+
+ /*
+ * Catch unsupported Block Flags. We support only one or two filters
+ * in the chain, so we catch that with the same test.
+ */
#ifdef XZ_DEC_BCJ
- if (s->temp.buf[1] & 0x3E)
+ if (s->temp.buf[1] & 0x3E)
#else
- if (s->temp.buf[1] & 0x3F)
+ if (s->temp.buf[1] & 0x3F)
#endif
- return XZ_OPTIONS_ERROR;
-
- /* Compressed Size */
- if (s->temp.buf[1] & 0x40) {
- if (dec_vli(s, s->temp.buf, &s->temp.pos, s->temp.size)
- != XZ_STREAM_END)
- return XZ_DATA_ERROR;
-
- s->block_header.compressed = s->vli;
- } else {
- s->block_header.compressed = VLI_UNKNOWN;
- }
-
- /* Uncompressed Size */
- if (s->temp.buf[1] & 0x80) {
- if (dec_vli(s, s->temp.buf, &s->temp.pos, s->temp.size)
- != XZ_STREAM_END)
- return XZ_DATA_ERROR;
-
- s->block_header.uncompressed = s->vli;
- } else {
- s->block_header.uncompressed = VLI_UNKNOWN;
- }
+ return XZ_OPTIONS_ERROR;
+
+ /* Compressed Size */
+ if (s->temp.buf[1] & 0x40) {
+ if (dec_vli(s, s->temp.buf, &s->temp.pos, s->temp.size)
+ != XZ_STREAM_END)
+ return XZ_DATA_ERROR;
+
+ s->block_header.compressed = s->vli;
+ } else {
+ s->block_header.compressed = VLI_UNKNOWN;
+ }
+
+ /* Uncompressed Size */
+ if (s->temp.buf[1] & 0x80) {
+ if (dec_vli(s, s->temp.buf, &s->temp.pos, s->temp.size)
+ != XZ_STREAM_END)
+ return XZ_DATA_ERROR;
+
+ s->block_header.uncompressed = s->vli;
+ } else {
+ s->block_header.uncompressed = VLI_UNKNOWN;
+ }
#ifdef XZ_DEC_BCJ
- /* If there are two filters, the first one must be a BCJ filter. */
- s->bcj_active = s->temp.buf[1] & 0x01;
- if (s->bcj_active) {
- if (s->temp.size - s->temp.pos < 2)
- return XZ_OPTIONS_ERROR;
-
- ret = xz_dec_bcj_reset(s->bcj, s->temp.buf[s->temp.pos++]);
- if (ret != XZ_OK)
- return ret;
-
- /*
- * We don't support custom start offset,
- * so Size of Properties must be zero.
- */
- if (s->temp.buf[s->temp.pos++] != 0x00)
- return XZ_OPTIONS_ERROR;
- }
+ /* If there are two filters, the first one must be a BCJ filter. */
+ s->bcj_active = s->temp.buf[1] & 0x01;
+ if (s->bcj_active) {
+ if (s->temp.size - s->temp.pos < 2)
+ return XZ_OPTIONS_ERROR;
+
+ ret = xz_dec_bcj_reset(s->bcj, s->temp.buf[s->temp.pos++]);
+ if (ret != XZ_OK)
+ return ret;
+
+ /*
+ * We don't support custom start offset,
+ * so Size of Properties must be zero.
+ */
+ if (s->temp.buf[s->temp.pos++] != 0x00)
+ return XZ_OPTIONS_ERROR;
+ }
#endif
- /* Valid Filter Flags always take at least two bytes. */
- if (s->temp.size - s->temp.pos < 2)
- return XZ_DATA_ERROR;
+ /* Valid Filter Flags always take at least two bytes. */
+ if (s->temp.size - s->temp.pos < 2)
+ return XZ_DATA_ERROR;
- /* Filter ID = LZMA2 */
- if (s->temp.buf[s->temp.pos++] != 0x21)
- return XZ_OPTIONS_ERROR;
+ /* Filter ID = LZMA2 */
+ if (s->temp.buf[s->temp.pos++] != 0x21)
+ return XZ_OPTIONS_ERROR;
- /* Size of Properties = 1-byte Filter Properties */
- if (s->temp.buf[s->temp.pos++] != 0x01)
- return XZ_OPTIONS_ERROR;
+ /* Size of Properties = 1-byte Filter Properties */
+ if (s->temp.buf[s->temp.pos++] != 0x01)
+ return XZ_OPTIONS_ERROR;
- /* Filter Properties contains LZMA2 dictionary size. */
- if (s->temp.size - s->temp.pos < 1)
- return XZ_DATA_ERROR;
+ /* Filter Properties contains LZMA2 dictionary size. */
+ if (s->temp.size - s->temp.pos < 1)
+ return XZ_DATA_ERROR;
- ret = xz_dec_lzma2_reset(s->lzma2, s->temp.buf[s->temp.pos++]);
- if (ret != XZ_OK)
- return ret;
+ ret = xz_dec_lzma2_reset(s->lzma2, s->temp.buf[s->temp.pos++]);
+ if (ret != XZ_OK)
+ return ret;
- /* The rest must be Header Padding. */
- while (s->temp.pos < s->temp.size)
- if (s->temp.buf[s->temp.pos++] != 0x00)
- return XZ_OPTIONS_ERROR;
+ /* The rest must be Header Padding. */
+ while (s->temp.pos < s->temp.size)
+ if (s->temp.buf[s->temp.pos++] != 0x00)
+ return XZ_OPTIONS_ERROR;
- s->temp.pos = 0;
- s->block.compressed = 0;
- s->block.uncompressed = 0;
+ s->temp.pos = 0;
+ s->block.compressed = 0;
+ s->block.uncompressed = 0;
- return XZ_OK;
+ return XZ_OK;
}
static enum xz_ret XZ_FUNC dec_main(struct xz_dec *s, struct xz_buf *b)
{
- enum xz_ret ret;
-
- /*
- * Store the start position for the case when we are in the middle
- * of the Index field.
- */
- s->in_start = b->in_pos;
-
- while (true) {
- switch (s->sequence) {
- case SEQ_STREAM_HEADER:
- /*
- * Stream Header is copied to s->temp, and then
- * decoded from there. This way if the caller
- * gives us only little input at a time, we can
- * still keep the Stream Header decoding code
- * simple. Similar approach is used in many places
- * in this file.
- */
- if (!fill_temp(s, b))
- return XZ_OK;
-
- /*
- * If dec_stream_header() returns
- * XZ_UNSUPPORTED_CHECK, it is still possible
- * to continue decoding if working in multi-call
- * mode. Thus, update s->sequence before calling
- * dec_stream_header().
- */
- s->sequence = SEQ_BLOCK_START;
-
- ret = dec_stream_header(s);
- if (ret != XZ_OK)
- return ret;
-
- case SEQ_BLOCK_START:
- /* We need one byte of input to continue. */
- if (b->in_pos == b->in_size)
- return XZ_OK;
-
- /* See if this is the beginning of the Index field. */
- if (b->in[b->in_pos] == 0) {
- s->in_start = b->in_pos++;
- s->sequence = SEQ_INDEX;
- break;
- }
-
- /*
- * Calculate the size of the Block Header and
- * prepare to decode it.
- */
- s->block_header.size
- = ((uint32_t)b->in[b->in_pos] + 1) * 4;
-
- s->temp.size = s->block_header.size;
- s->temp.pos = 0;
- s->sequence = SEQ_BLOCK_HEADER;
-
- case SEQ_BLOCK_HEADER:
- if (!fill_temp(s, b))
- return XZ_OK;
-
- ret = dec_block_header(s);
- if (ret != XZ_OK)
- return ret;
-
- s->sequence = SEQ_BLOCK_UNCOMPRESS;
-
- case SEQ_BLOCK_UNCOMPRESS:
- ret = dec_block(s, b);
- if (ret != XZ_STREAM_END)
- return ret;
-
- s->sequence = SEQ_BLOCK_PADDING;
-
- case SEQ_BLOCK_PADDING:
- /*
- * Size of Compressed Data + Block Padding
- * must be a multiple of four. We don't need
- * s->block.compressed for anything else
- * anymore, so we use it here to test the size
- * of the Block Padding field.
- */
- while (s->block.compressed & 3) {
- if (b->in_pos == b->in_size)
- return XZ_OK;
-
- if (b->in[b->in_pos++] != 0)
- return XZ_DATA_ERROR;
-
- ++s->block.compressed;
- }
-
- s->sequence = SEQ_BLOCK_CHECK;
-
- case SEQ_BLOCK_CHECK:
- if (s->check_type == XZ_CHECK_CRC32) {
- ret = crc32_validate(s, b);
- if (ret != XZ_STREAM_END)
- return ret;
- }
+ enum xz_ret ret;
+
+ /*
+ * Store the start position for the case when we are in the middle
+ * of the Index field.
+ */
+ s->in_start = b->in_pos;
+
+ while (true) {
+ switch (s->sequence) {
+ case SEQ_STREAM_HEADER:
+ /*
+ * Stream Header is copied to s->temp, and then
+ * decoded from there. This way if the caller
+ * gives us only little input at a time, we can
+ * still keep the Stream Header decoding code
+ * simple. Similar approach is used in many places
+ * in this file.
+ */
+ if (!fill_temp(s, b))
+ return XZ_OK;
+
+ /*
+ * If dec_stream_header() returns
+ * XZ_UNSUPPORTED_CHECK, it is still possible
+ * to continue decoding if working in multi-call
+ * mode. Thus, update s->sequence before calling
+ * dec_stream_header().
+ */
+ s->sequence = SEQ_BLOCK_START;
+
+ ret = dec_stream_header(s);
+ if (ret != XZ_OK)
+ return ret;
+ #ifndef __clang__
+ __attribute__ ((fallthrough));
+ #endif
+ case SEQ_BLOCK_START:
+ /* We need one byte of input to continue. */
+ if (b->in_pos == b->in_size)
+ return XZ_OK;
+
+ /* See if this is the beginning of the Index field. */
+ if (b->in[b->in_pos] == 0) {
+ s->in_start = b->in_pos++;
+ s->sequence = SEQ_INDEX;
+ break;
+ }
+
+ /*
+ * Calculate the size of the Block Header and
+ * prepare to decode it.
+ */
+ s->block_header.size
+ = ((uint32_t)b->in[b->in_pos] + 1) * 4;
+
+ s->temp.size = s->block_header.size;
+ s->temp.pos = 0;
+ s->sequence = SEQ_BLOCK_HEADER;
+ #ifndef __clang__
+ __attribute__ ((fallthrough));
+ #endif
+ case SEQ_BLOCK_HEADER:
+ if (!fill_temp(s, b))
+ return XZ_OK;
+
+ ret = dec_block_header(s);
+ if (ret != XZ_OK)
+ return ret;
+
+ s->sequence = SEQ_BLOCK_UNCOMPRESS;
+ #ifndef __clang__
+ __attribute__ ((fallthrough));
+ #endif
+ case SEQ_BLOCK_UNCOMPRESS:
+ ret = dec_block(s, b);
+ if (ret != XZ_STREAM_END)
+ return ret;
+
+ s->sequence = SEQ_BLOCK_PADDING;
+
+ case SEQ_BLOCK_PADDING:
+ /*
+ * Size of Compressed Data + Block Padding
+ * must be a multiple of four. We don't need
+ * s->block.compressed for anything else
+ * anymore, so we use it here to test the size
+ * of the Block Padding field.
+ */
+ while (s->block.compressed & 3) {
+ if (b->in_pos == b->in_size)
+ return XZ_OK;
+
+ if (b->in[b->in_pos++] != 0)
+ return XZ_DATA_ERROR;
+
+ ++s->block.compressed;
+ }
+
+ s->sequence = SEQ_BLOCK_CHECK;
+ #ifndef __clang__
+ __attribute__ ((fallthrough));
+ #endif
+ case SEQ_BLOCK_CHECK:
+ if (s->check_type == XZ_CHECK_CRC32) {
+ ret = crc32_validate(s, b);
+ if (ret != XZ_STREAM_END)
+ return ret;
+ }
#ifdef XZ_DEC_ANY_CHECK
- else if (!check_skip(s, b)) {
- return XZ_OK;
- }
+ else if (!check_skip(s, b)) {
+ return XZ_OK;
+ }
#endif
- s->sequence = SEQ_BLOCK_START;
- break;
-
- case SEQ_INDEX:
- ret = dec_index(s, b);
- if (ret != XZ_STREAM_END)
- return ret;
-
- s->sequence = SEQ_INDEX_PADDING;
-
- case SEQ_INDEX_PADDING:
- while ((s->index.size + (b->in_pos - s->in_start))
- & 3) {
- if (b->in_pos == b->in_size) {
- index_update(s, b);
- return XZ_OK;
- }
-
- if (b->in[b->in_pos++] != 0)
- return XZ_DATA_ERROR;
- }
-
- /* Finish the CRC32 value and Index size. */
- index_update(s, b);
-
- /* Compare the hashes to validate the Index field. */
- if (!memeq(&s->block.hash, &s->index.hash,
- sizeof(s->block.hash)))
- return XZ_DATA_ERROR;
-
- s->sequence = SEQ_INDEX_CRC32;
-
- case SEQ_INDEX_CRC32:
- ret = crc32_validate(s, b);
- if (ret != XZ_STREAM_END)
- return ret;
-
- s->temp.size = STREAM_HEADER_SIZE;
- s->sequence = SEQ_STREAM_FOOTER;
-
- case SEQ_STREAM_FOOTER:
- if (!fill_temp(s, b))
- return XZ_OK;
-
- return dec_stream_footer(s);
- }
- }
-
- /* Never reached */
+ s->sequence = SEQ_BLOCK_START;
+ break;
+ case SEQ_INDEX:
+ ret = dec_index(s, b);
+ if (ret != XZ_STREAM_END)
+ return ret;
+
+ s->sequence = SEQ_INDEX_PADDING;
+ #ifndef __clang__
+ __attribute__ ((fallthrough));
+ #endif
+ case SEQ_INDEX_PADDING:
+ while ((s->index.size + (b->in_pos - s->in_start))
+ & 3) {
+ if (b->in_pos == b->in_size) {
+ index_update(s, b);
+ return XZ_OK;
+ }
+
+ if (b->in[b->in_pos++] != 0)
+ return XZ_DATA_ERROR;
+ }
+
+ /* Finish the CRC32 value and Index size. */
+ index_update(s, b);
+
+ /* Compare the hashes to validate the Index field. */
+ if (!memeq(&s->block.hash, &s->index.hash,
+ sizeof(s->block.hash)))
+ return XZ_DATA_ERROR;
+
+ s->sequence = SEQ_INDEX_CRC32;
+ #ifndef __clang__
+ __attribute__ ((fallthrough));
+ #endif
+ case SEQ_INDEX_CRC32:
+ ret = crc32_validate(s, b);
+ if (ret != XZ_STREAM_END)
+ return ret;
+
+ s->temp.size = STREAM_HEADER_SIZE;
+ s->sequence = SEQ_STREAM_FOOTER;
+ #ifndef __clang__
+ __attribute__ ((fallthrough));
+ #endif
+ case SEQ_STREAM_FOOTER:
+ if (!fill_temp(s, b))
+ return XZ_OK;
+
+ return dec_stream_footer(s);
+ }
+ }
+
+ /* Never reached */
}
/*
@@ -733,90 +746,90 @@ static enum xz_ret XZ_FUNC dec_main(struct xz_dec *s, struct xz_buf *b)
*/
XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_run(struct xz_dec *s, struct xz_buf *b)
{
- size_t in_start;
- size_t out_start;
- enum xz_ret ret;
-
- if (DEC_IS_SINGLE(s->mode))
- xz_dec_reset(s);
-
- in_start = b->in_pos;
- out_start = b->out_pos;
- ret = dec_main(s, b);
-
- if (DEC_IS_SINGLE(s->mode)) {
- if (ret == XZ_OK)
- ret = b->in_pos == b->in_size
- ? XZ_DATA_ERROR : XZ_BUF_ERROR;
-
- if (ret != XZ_STREAM_END) {
- b->in_pos = in_start;
- b->out_pos = out_start;
- }
-
- } else if (ret == XZ_OK && in_start == b->in_pos
- && out_start == b->out_pos) {
- if (s->allow_buf_error)
- ret = XZ_BUF_ERROR;
-
- s->allow_buf_error = true;
- } else {
- s->allow_buf_error = false;
- }
-
- return ret;
+ size_t in_start;
+ size_t out_start;
+ enum xz_ret ret;
+
+ if (DEC_IS_SINGLE(s->mode))
+ xz_dec_reset(s);
+
+ in_start = b->in_pos;
+ out_start = b->out_pos;
+ ret = dec_main(s, b);
+
+ if (DEC_IS_SINGLE(s->mode)) {
+ if (ret == XZ_OK)
+ ret = b->in_pos == b->in_size
+ ? XZ_DATA_ERROR : XZ_BUF_ERROR;
+
+ if (ret != XZ_STREAM_END) {
+ b->in_pos = in_start;
+ b->out_pos = out_start;
+ }
+
+ } else if (ret == XZ_OK && in_start == b->in_pos
+ && out_start == b->out_pos) {
+ if (s->allow_buf_error)
+ ret = XZ_BUF_ERROR;
+
+ s->allow_buf_error = true;
+ } else {
+ s->allow_buf_error = false;
+ }
+
+ return ret;
}
XZ_EXTERN struct xz_dec * XZ_FUNC xz_dec_init(
- enum xz_mode mode, uint32_t dict_max)
+ enum xz_mode mode, uint32_t dict_max)
{
- struct xz_dec *s = kmalloc(sizeof(*s), GFP_KERNEL);
- if (s == NULL)
- return NULL;
+ struct xz_dec *s = kmalloc(sizeof(*s), GFP_KERNEL);
+ if (s == NULL)
+ return NULL;
- s->mode = mode;
+ s->mode = mode;
#ifdef XZ_DEC_BCJ
- s->bcj = xz_dec_bcj_create(DEC_IS_SINGLE(mode));
- if (s->bcj == NULL)
- goto error_bcj;
+ s->bcj = xz_dec_bcj_create(DEC_IS_SINGLE(mode));
+ if (s->bcj == NULL)
+ goto error_bcj;
#endif
- s->lzma2 = xz_dec_lzma2_create(mode, dict_max);
- if (s->lzma2 == NULL)
- goto error_lzma2;
+ s->lzma2 = xz_dec_lzma2_create(mode, dict_max);
+ if (s->lzma2 == NULL)
+ goto error_lzma2;
- xz_dec_reset(s);
- return s;
+ xz_dec_reset(s);
+ return s;
error_lzma2:
#ifdef XZ_DEC_BCJ
- xz_dec_bcj_end(s->bcj);
+ xz_dec_bcj_end(s->bcj);
error_bcj:
#endif
- kfree(s);
- return NULL;
+ kfree(s);
+ return NULL;
}
XZ_EXTERN void XZ_FUNC xz_dec_reset(struct xz_dec *s)
{
- s->sequence = SEQ_STREAM_HEADER;
- s->allow_buf_error = false;
- s->pos = 0;
- s->crc32 = 0;
- memzero(&s->block, sizeof(s->block));
- memzero(&s->index, sizeof(s->index));
- s->temp.pos = 0;
- s->temp.size = STREAM_HEADER_SIZE;
+ s->sequence = SEQ_STREAM_HEADER;
+ s->allow_buf_error = false;
+ s->pos = 0;
+ s->crc32 = 0;
+ memzero(&s->block, sizeof(s->block));
+ memzero(&s->index, sizeof(s->index));
+ s->temp.pos = 0;
+ s->temp.size = STREAM_HEADER_SIZE;
}
XZ_EXTERN void XZ_FUNC xz_dec_end(struct xz_dec *s)
{
- if (s != NULL) {
- xz_dec_lzma2_end(s->lzma2);
+ if (s != NULL) {
+ xz_dec_lzma2_end(s->lzma2);
#ifdef XZ_DEC_BCJ
- xz_dec_bcj_end(s->bcj);
+ xz_dec_bcj_end(s->bcj);
#endif
- kfree(s);
- }
+ kfree(s);
+ }
}
diff --git a/libfm-qt-ultracopier/README b/libfm-qt-ultracopier/README
new file mode 100644
index 0000000..b3f7dd6
--- /dev/null
+++ b/libfm-qt-ultracopier/README
@@ -0,0 +1 @@
+LD_LIBRARY_PATH=/home/user/Desktop/ultracopier/sources/build-libfm-qt-ultracopier-Desktop-Debug/libfm-qt.so.1.0.0 pcmanfm-qt
diff --git a/libfm-qt-ultracopier/libfm-qt-ultracopier.pro b/libfm-qt-ultracopier/libfm-qt-ultracopier.pro
new file mode 100644
index 0000000..19cedba
--- /dev/null
+++ b/libfm-qt-ultracopier/libfm-qt-ultracopier.pro
@@ -0,0 +1,14 @@
+CONFIG += c++11
+
+TEMPLATE = lib
+QT += network widgets
+TARGET = $$qtLibraryTarget(fm-qt)
+LIBS += -Llibfm-qt
+INCLUDEPATH += /usr/include/glib-2.0/ /usr/lib64/glib-2.0/include/
+DEFINES += QT_NO_KEYWORDS
+
+HEADERS += \
+ utilities.h
+
+SOURCES += \
+ utilities.cpp
diff --git a/libfm-qt-ultracopier/utilities.cpp b/libfm-qt-ultracopier/utilities.cpp
new file mode 100644
index 0000000..38b87f6
--- /dev/null
+++ b/libfm-qt-ultracopier/utilities.cpp
@@ -0,0 +1,89 @@
+#include "utilities.h"
+#include <QClipboard>
+#include <QApplication>
+#include <libfm-qt/foldermodel.h>
+#include <libfm-qt/fileoperation.h>
+#include <dlfcn.h>
+
+namespace Fm {
+
+void sendRawOrderList(const QStringList & order, QLocalSocket &socket, int idNextOrder)
+{
+ QByteArray block;
+ QDataStream out(&block, QIODevice::WriteOnly);
+ out.setVersion(QDataStream::Qt_4_4);
+ out << int(0);
+ out << idNextOrder;
+ out << order;
+ out.device()->seek(0);
+ out << block.size();
+ do //cut string list and send it as block of 32KB
+ {
+ QByteArray blockToSend;
+ int byteWriten;
+ blockToSend=block.left(32*1024);//32KB
+ block.remove(0,blockToSend.size());
+ byteWriten = socket.write(blockToSend);
+ }
+ while(block.size());
+}
+
+void pasteFilesFromClipboard(const Fm::FilePath& destPath, QWidget* parent) {
+ //https://gist.github.com/mooware/1174572
+ typedef std::pair<Fm::FilePathList, bool> (*methodType)(const QMimeData& data);
+
+ static methodType origMethod = 0;
+
+ // use the mangled method name here. RTLD_NEXT means something like
+ // "search this symbol in any libraries loaded after the current one".
+ void *tmpPtr = dlsym(RTLD_NEXT, "pasteFilesFromClipboard");
+
+ // not even reinterpret_cast can convert between void* and a method ptr,
+ // so i'm doing the worst hack i've ever seen.
+ memcpy(&origMethod, &tmpPtr, sizeof(tmpPtr));
+
+ QClipboard* clipboard = QApplication::clipboard();
+ const QMimeData* data = clipboard->mimeData();
+ Fm::FilePathList paths;
+ bool isCut = false;
+
+ std::tie(paths, isCut) = (*origMethod)(*data);
+
+ if(!paths.empty()) {
+ QLocalSocket socket;
+ socket.connectToServer(QString::fromStdString("advanced-copier-"+std::to_string(getuid())));
+ socket.waitForConnected();
+ if(socket.state()==QLocalSocket::ConnectedState)
+ {
+ sendRawOrderList(QStringList() << "protocol" << "0002", socket, 1);
+ socket.waitForReadyRead();
+ socket.readAll();
+ QStringList l;
+ if(isCut) {
+ l << "mv";
+ clipboard->clear(QClipboard::Clipboard);
+ }
+ else {
+ l << "cp";
+ }
+ for(const FilePath &n : paths)
+ l << n.toString().get();
+ l << destPath.toString().get();
+ sendRawOrderList(l, socket, 2);
+ socket.waitForBytesWritten();
+ socket.close();
+ }
+ else
+ {
+ if(isCut) {
+ FileOperation::moveFiles(paths, destPath, parent);
+ clipboard->clear(QClipboard::Clipboard);
+ }
+ else {
+ FileOperation::copyFiles(paths, destPath, parent);
+ }
+ }
+ }
+}
+
+} // namespace Fm
diff --git a/libfm-qt-ultracopier/utilities.h b/libfm-qt-ultracopier/utilities.h
new file mode 100644
index 0000000..e96e0d4
--- /dev/null
+++ b/libfm-qt-ultracopier/utilities.h
@@ -0,0 +1,21 @@
+#include <QWidget>
+#include <QStringList>
+#include <QLocalSocket>
+
+#include <libfm-qt/utilities.h>
+#include <libfm-qt/core/filepath.h>
+
+#ifndef FM_UTILITIESUC_H
+#define FM_UTILITIESUC_H
+
+namespace Fm {
+
+__attribute__((visibility("default"))) void pasteFilesFromClipboard(const Fm::FilePath& destPath, QWidget* parent);
+
+std::string pathSocket();
+char * toHex(const char *str);
+void sendRawOrderList(const QStringList & order, QLocalSocket &socket);
+
+}
+
+#endif // FM_UTILITIESUC_H
diff --git a/libogg/COPYING b/libogg/COPYING
new file mode 100644
index 0000000..6111c6c
--- /dev/null
+++ b/libogg/COPYING
@@ -0,0 +1,28 @@
+Copyright (c) 2002, Xiph.org Foundation
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+- Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+- Neither the name of the Xiph.org Foundation nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/libogg/bitwise.c b/libogg/bitwise.c
new file mode 100644
index 0000000..4ef3c5e
--- /dev/null
+++ b/libogg/bitwise.c
@@ -0,0 +1,1088 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg CONTAINER SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
+ * *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2014 *
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: packing variable sized words into an octet stream
+ last mod: $Id$
+
+ ********************************************************************/
+
+/* We're 'LSb' endian; if we write a word but read individual bits,
+ then we'll read the lsb first */
+
+#include <string.h>
+#include <stdlib.h>
+#include <limits.h>
+#include "ogg.h"
+
+#define BUFFER_INCREMENT 256
+
+static const unsigned long mask[]=
+{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,
+ 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,
+ 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,
+ 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff,
+ 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff,
+ 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff,
+ 0x3fffffff,0x7fffffff,0xffffffff };
+
+static const unsigned int mask8B[]=
+{0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff};
+
+void oggpack_writeinit(oggpack_buffer *b){
+ memset(b,0,sizeof(*b));
+ b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT);
+ b->buffer[0]='\0';
+ b->storage=BUFFER_INCREMENT;
+}
+
+void oggpackB_writeinit(oggpack_buffer *b){
+ oggpack_writeinit(b);
+}
+
+int oggpack_writecheck(oggpack_buffer *b){
+ if(!b->ptr || !b->storage)return -1;
+ return 0;
+}
+
+int oggpackB_writecheck(oggpack_buffer *b){
+ return oggpack_writecheck(b);
+}
+
+void oggpack_writetrunc(oggpack_buffer *b,long bits){
+ long bytes=bits>>3;
+ if(b->ptr){
+ bits-=bytes*8;
+ b->ptr=b->buffer+bytes;
+ b->endbit=bits;
+ b->endbyte=bytes;
+ *b->ptr&=mask[bits];
+ }
+}
+
+void oggpackB_writetrunc(oggpack_buffer *b,long bits){
+ long bytes=bits>>3;
+ if(b->ptr){
+ bits-=bytes*8;
+ b->ptr=b->buffer+bytes;
+ b->endbit=bits;
+ b->endbyte=bytes;
+ *b->ptr&=mask8B[bits];
+ }
+}
+
+/* Takes only up to 32 bits. */
+void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){
+ if(bits<0 || bits>32) goto err;
+ if(b->endbyte>=b->storage-4){
+ void *ret;
+ if(!b->ptr)return;
+ if(b->storage>LONG_MAX-BUFFER_INCREMENT) goto err;
+ ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
+ if(!ret) goto err;
+ b->buffer=ret;
+ b->storage+=BUFFER_INCREMENT;
+ b->ptr=b->buffer+b->endbyte;
+ }
+
+ value&=mask[bits];
+ bits+=b->endbit;
+
+ b->ptr[0]|=value<<b->endbit;
+
+ if(bits>=8){
+ b->ptr[1]=(unsigned char)(value>>(8-b->endbit));
+ if(bits>=16){
+ b->ptr[2]=(unsigned char)(value>>(16-b->endbit));
+ if(bits>=24){
+ b->ptr[3]=(unsigned char)(value>>(24-b->endbit));
+ if(bits>=32){
+ if(b->endbit)
+ b->ptr[4]=(unsigned char)(value>>(32-b->endbit));
+ else
+ b->ptr[4]=0;
+ }
+ }
+ }
+ }
+
+ b->endbyte+=bits/8;
+ b->ptr+=bits/8;
+ b->endbit=bits&7;
+ return;
+ err:
+ oggpack_writeclear(b);
+}
+
+/* Takes only up to 32 bits. */
+void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits){
+ if(bits<0 || bits>32) goto err;
+ if(b->endbyte>=b->storage-4){
+ void *ret;
+ if(!b->ptr)return;
+ if(b->storage>LONG_MAX-BUFFER_INCREMENT) goto err;
+ ret=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT);
+ if(!ret) goto err;
+ b->buffer=ret;
+ b->storage+=BUFFER_INCREMENT;
+ b->ptr=b->buffer+b->endbyte;
+ }
+
+ value=(value&mask[bits])<<(32-bits);
+ bits+=b->endbit;
+
+ b->ptr[0]|=value>>(24+b->endbit);
+
+ if(bits>=8){
+ b->ptr[1]=(unsigned char)(value>>(16+b->endbit));
+ if(bits>=16){
+ b->ptr[2]=(unsigned char)(value>>(8+b->endbit));
+ if(bits>=24){
+ b->ptr[3]=(unsigned char)(value>>(b->endbit));
+ if(bits>=32){
+ if(b->endbit)
+ b->ptr[4]=(unsigned char)(value<<(8-b->endbit));
+ else
+ b->ptr[4]=0;
+ }
+ }
+ }
+ }
+
+ b->endbyte+=bits/8;
+ b->ptr+=bits/8;
+ b->endbit=bits&7;
+ return;
+ err:
+ oggpack_writeclear(b);
+}
+
+void oggpack_writealign(oggpack_buffer *b){
+ int bits=8-b->endbit;
+ if(bits<8)
+ oggpack_write(b,0,bits);
+}
+
+void oggpackB_writealign(oggpack_buffer *b){
+ int bits=8-b->endbit;
+ if(bits<8)
+ oggpackB_write(b,0,bits);
+}
+
+static void oggpack_writecopy_helper(oggpack_buffer *b,
+ void *source,
+ long bits,
+ void (*w)(oggpack_buffer *,
+ unsigned long,
+ int),
+ int msb){
+ unsigned char *ptr=(unsigned char *)source;
+
+ long bytes=bits/8;
+ long pbytes=(b->endbit+bits)/8;
+ bits-=bytes*8;
+
+ /* expand storage up-front */
+ if(b->endbyte+pbytes>=b->storage){
+ void *ret;
+ if(!b->ptr) goto err;
+ if(b->storage>b->endbyte+pbytes+BUFFER_INCREMENT) goto err;
+ b->storage=b->endbyte+pbytes+BUFFER_INCREMENT;
+ ret=_ogg_realloc(b->buffer,b->storage);
+ if(!ret) goto err;
+ b->buffer=ret;
+ b->ptr=b->buffer+b->endbyte;
+ }
+
+ /* copy whole octets */
+ if(b->endbit){
+ int i;
+ /* unaligned copy. Do it the hard way. */
+ for(i=0;i<bytes;i++)
+ w(b,(unsigned long)(ptr[i]),8);
+ }else{
+ /* aligned block copy */
+ memmove(b->ptr,source,bytes);
+ b->ptr+=bytes;
+ b->endbyte+=bytes;
+ *b->ptr=0;
+ }
+
+ /* copy trailing bits */
+ if(bits){
+ if(msb)
+ w(b,(unsigned long)(ptr[bytes]>>(8-bits)),bits);
+ else
+ w(b,(unsigned long)(ptr[bytes]),bits);
+ }
+ return;
+ err:
+ oggpack_writeclear(b);
+}
+
+void oggpack_writecopy(oggpack_buffer *b,void *source,long bits){
+ oggpack_writecopy_helper(b,source,bits,oggpack_write,0);
+}
+
+void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits){
+ oggpack_writecopy_helper(b,source,bits,oggpackB_write,1);
+}
+
+void oggpack_reset(oggpack_buffer *b){
+ if(!b->ptr)return;
+ b->ptr=b->buffer;
+ b->buffer[0]=0;
+ b->endbit=b->endbyte=0;
+}
+
+void oggpackB_reset(oggpack_buffer *b){
+ oggpack_reset(b);
+}
+
+void oggpack_writeclear(oggpack_buffer *b){
+ if(b->buffer)_ogg_free(b->buffer);
+ memset(b,0,sizeof(*b));
+}
+
+void oggpackB_writeclear(oggpack_buffer *b){
+ oggpack_writeclear(b);
+}
+
+void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){
+ memset(b,0,sizeof(*b));
+ b->buffer=b->ptr=buf;
+ b->storage=bytes;
+}
+
+void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes){
+ oggpack_readinit(b,buf,bytes);
+}
+
+/* Read in bits without advancing the bitptr; bits <= 32 */
+long oggpack_look(oggpack_buffer *b,int bits){
+ unsigned long ret;
+ unsigned long m;
+
+ if(bits<0 || bits>32) return -1;
+ m=mask[bits];
+ bits+=b->endbit;
+
+ if(b->endbyte >= b->storage-4){
+ /* not the main path */
+ if(b->endbyte > b->storage-((bits+7)>>3)) return -1;
+ /* special case to avoid reading b->ptr[0], which might be past the end of
+ the buffer; also skips some useless accounting */
+ else if(!bits)return(0L);
+ }
+
+ ret=b->ptr[0]>>b->endbit;
+ if(bits>8){
+ ret|=b->ptr[1]<<(8-b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(16-b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(24-b->endbit);
+ if(bits>32 && b->endbit)
+ ret|=b->ptr[4]<<(32-b->endbit);
+ }
+ }
+ }
+ return(m&ret);
+}
+
+/* Read in bits without advancing the bitptr; bits <= 32 */
+long oggpackB_look(oggpack_buffer *b,int bits){
+ unsigned long ret;
+ int m=32-bits;
+
+ if(m<0 || m>32) return -1;
+ bits+=b->endbit;
+
+ if(b->endbyte >= b->storage-4){
+ /* not the main path */
+ if(b->endbyte > b->storage-((bits+7)>>3)) return -1;
+ /* special case to avoid reading b->ptr[0], which might be past the end of
+ the buffer; also skips some useless accounting */
+ else if(!bits)return(0L);
+ }
+
+ ret=b->ptr[0]<<(24+b->endbit);
+ if(bits>8){
+ ret|=b->ptr[1]<<(16+b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(8+b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(b->endbit);
+ if(bits>32 && b->endbit)
+ ret|=b->ptr[4]>>(8-b->endbit);
+ }
+ }
+ }
+ return ((ret&0xffffffff)>>(m>>1))>>((m+1)>>1);
+}
+
+long oggpack_look1(oggpack_buffer *b){
+ if(b->endbyte>=b->storage)return(-1);
+ return((b->ptr[0]>>b->endbit)&1);
+}
+
+long oggpackB_look1(oggpack_buffer *b){
+ if(b->endbyte>=b->storage)return(-1);
+ return((b->ptr[0]>>(7-b->endbit))&1);
+}
+
+void oggpack_adv(oggpack_buffer *b,int bits){
+ bits+=b->endbit;
+
+ if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow;
+
+ b->ptr+=bits/8;
+ b->endbyte+=bits/8;
+ b->endbit=bits&7;
+ return;
+
+ overflow:
+ b->ptr=NULL;
+ b->endbyte=b->storage;
+ b->endbit=1;
+}
+
+void oggpackB_adv(oggpack_buffer *b,int bits){
+ oggpack_adv(b,bits);
+}
+
+void oggpack_adv1(oggpack_buffer *b){
+ if(++(b->endbit)>7){
+ b->endbit=0;
+ b->ptr++;
+ b->endbyte++;
+ }
+}
+
+void oggpackB_adv1(oggpack_buffer *b){
+ oggpack_adv1(b);
+}
+
+/* bits <= 32 */
+long oggpack_read(oggpack_buffer *b,int bits){
+ long ret;
+ unsigned long m;
+
+ if(bits<0 || bits>32) goto err;
+ m=mask[bits];
+ bits+=b->endbit;
+
+ if(b->endbyte >= b->storage-4){
+ /* not the main path */
+ if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow;
+ /* special case to avoid reading b->ptr[0], which might be past the end of
+ the buffer; also skips some useless accounting */
+ else if(!bits)return(0L);
+ }
+
+ ret=b->ptr[0]>>b->endbit;
+ if(bits>8){
+ ret|=b->ptr[1]<<(8-b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(16-b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(24-b->endbit);
+ if(bits>32 && b->endbit){
+ ret|=b->ptr[4]<<(32-b->endbit);
+ }
+ }
+ }
+ }
+ ret&=m;
+ b->ptr+=bits/8;
+ b->endbyte+=bits/8;
+ b->endbit=bits&7;
+ return ret;
+
+ overflow:
+ err:
+ b->ptr=NULL;
+ b->endbyte=b->storage;
+ b->endbit=1;
+ return -1L;
+}
+
+/* bits <= 32 */
+long oggpackB_read(oggpack_buffer *b,int bits){
+ long ret;
+ long m=32-bits;
+
+ if(m<0 || m>32) goto err;
+ bits+=b->endbit;
+
+ if(b->endbyte+4>=b->storage){
+ /* not the main path */
+ if(b->endbyte > b->storage-((bits+7)>>3)) goto overflow;
+ /* special case to avoid reading b->ptr[0], which might be past the end of
+ the buffer; also skips some useless accounting */
+ else if(!bits)return(0L);
+ }
+
+ ret=b->ptr[0]<<(24+b->endbit);
+ if(bits>8){
+ ret|=b->ptr[1]<<(16+b->endbit);
+ if(bits>16){
+ ret|=b->ptr[2]<<(8+b->endbit);
+ if(bits>24){
+ ret|=b->ptr[3]<<(b->endbit);
+ if(bits>32 && b->endbit)
+ ret|=b->ptr[4]>>(8-b->endbit);
+ }
+ }
+ }
+ ret=((ret&0xffffffffUL)>>(m>>1))>>((m+1)>>1);
+
+ b->ptr+=bits/8;
+ b->endbyte+=bits/8;
+ b->endbit=bits&7;
+ return ret;
+
+ overflow:
+ err:
+ b->ptr=NULL;
+ b->endbyte=b->storage;
+ b->endbit=1;
+ return -1L;
+}
+
+long oggpack_read1(oggpack_buffer *b){
+ long ret;
+
+ if(b->endbyte >= b->storage) goto overflow;
+ ret=(b->ptr[0]>>b->endbit)&1;
+
+ b->endbit++;
+ if(b->endbit>7){
+ b->endbit=0;
+ b->ptr++;
+ b->endbyte++;
+ }
+ return ret;
+
+ overflow:
+ b->ptr=NULL;
+ b->endbyte=b->storage;
+ b->endbit=1;
+ return -1L;
+}
+
+long oggpackB_read1(oggpack_buffer *b){
+ long ret;
+
+ if(b->endbyte >= b->storage) goto overflow;
+ ret=(b->ptr[0]>>(7-b->endbit))&1;
+
+ b->endbit++;
+ if(b->endbit>7){
+ b->endbit=0;
+ b->ptr++;
+ b->endbyte++;
+ }
+ return ret;
+
+ overflow:
+ b->ptr=NULL;
+ b->endbyte=b->storage;
+ b->endbit=1;
+ return -1L;
+}
+
+long oggpack_bytes(oggpack_buffer *b){
+ return(b->endbyte+(b->endbit+7)/8);
+}
+
+long oggpack_bits(oggpack_buffer *b){
+ return(b->endbyte*8+b->endbit);
+}
+
+long oggpackB_bytes(oggpack_buffer *b){
+ return oggpack_bytes(b);
+}
+
+long oggpackB_bits(oggpack_buffer *b){
+ return oggpack_bits(b);
+}
+
+unsigned char *oggpack_get_buffer(oggpack_buffer *b){
+ return(b->buffer);
+}
+
+unsigned char *oggpackB_get_buffer(oggpack_buffer *b){
+ return oggpack_get_buffer(b);
+}
+
+/* Self test of the bitwise routines; everything else is based on
+ them, so they damned well better be solid. */
+
+#ifdef _V_SELFTEST
+#include <stdio.h>
+
+static int ilog(unsigned int v){
+ int ret=0;
+ while(v){
+ ret++;
+ v>>=1;
+ }
+ return(ret);
+}
+
+oggpack_buffer o;
+oggpack_buffer r;
+
+void report(char *in){
+ fprintf(stderr,"%s",in);
+ exit(1);
+}
+
+void cliptest(unsigned long *b,int vals,int bits,int *comp,int compsize){
+ long bytes,i;
+ unsigned char *buffer;
+
+ oggpack_reset(&o);
+ for(i=0;i<vals;i++)
+ oggpack_write(&o,b[i],bits?bits:ilog(b[i]));
+ buffer=oggpack_get_buffer(&o);
+ bytes=oggpack_bytes(&o);
+ if(bytes!=compsize)report("wrong number of bytes!\n");
+ for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
+ for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
+ report("wrote incorrect value!\n");
+ }
+ oggpack_readinit(&r,buffer,bytes);
+ for(i=0;i<vals;i++){
+ int tbit=bits?bits:ilog(b[i]);
+ if(oggpack_look(&r,tbit)==-1)
+ report("out of data!\n");
+ if(oggpack_look(&r,tbit)!=(b[i]&mask[tbit]))
+ report("looked at incorrect value!\n");
+ if(tbit==1)
+ if(oggpack_look1(&r)!=(b[i]&mask[tbit]))
+ report("looked at single bit incorrect value!\n");
+ if(tbit==1){
+ if(oggpack_read1(&r)!=(b[i]&mask[tbit]))
+ report("read incorrect single bit value!\n");
+ }else{
+ if(oggpack_read(&r,tbit)!=(b[i]&mask[tbit]))
+ report("read incorrect value!\n");
+ }
+ }
+ if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+}
+
+void cliptestB(unsigned long *b,int vals,int bits,int *comp,int compsize){
+ long bytes,i;
+ unsigned char *buffer;
+
+ oggpackB_reset(&o);
+ for(i=0;i<vals;i++)
+ oggpackB_write(&o,b[i],bits?bits:ilog(b[i]));
+ buffer=oggpackB_get_buffer(&o);
+ bytes=oggpackB_bytes(&o);
+ if(bytes!=compsize)report("wrong number of bytes!\n");
+ for(i=0;i<bytes;i++)if(buffer[i]!=comp[i]){
+ for(i=0;i<bytes;i++)fprintf(stderr,"%x %x\n",(int)buffer[i],(int)comp[i]);
+ report("wrote incorrect value!\n");
+ }
+ oggpackB_readinit(&r,buffer,bytes);
+ for(i=0;i<vals;i++){
+ int tbit=bits?bits:ilog(b[i]);
+ if(oggpackB_look(&r,tbit)==-1)
+ report("out of data!\n");
+ if(oggpackB_look(&r,tbit)!=(b[i]&mask[tbit]))
+ report("looked at incorrect value!\n");
+ if(tbit==1)
+ if(oggpackB_look1(&r)!=(b[i]&mask[tbit]))
+ report("looked at single bit incorrect value!\n");
+ if(tbit==1){
+ if(oggpackB_read1(&r)!=(b[i]&mask[tbit]))
+ report("read incorrect single bit value!\n");
+ }else{
+ if(oggpackB_read(&r,tbit)!=(b[i]&mask[tbit]))
+ report("read incorrect value!\n");
+ }
+ }
+ if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+}
+
+void copytest(int prefill, int copy){
+ oggpack_buffer source_write;
+ oggpack_buffer dest_write;
+ oggpack_buffer source_read;
+ oggpack_buffer dest_read;
+ unsigned char *source;
+ unsigned char *dest;
+ long source_bytes,dest_bytes;
+ int i;
+
+ oggpack_writeinit(&source_write);
+ oggpack_writeinit(&dest_write);
+
+ for(i=0;i<(prefill+copy+7)/8;i++)
+ oggpack_write(&source_write,(i^0x5a)&0xff,8);
+ source=oggpack_get_buffer(&source_write);
+ source_bytes=oggpack_bytes(&source_write);
+
+ /* prefill */
+ oggpack_writecopy(&dest_write,source,prefill);
+
+ /* check buffers; verify end byte masking */
+ dest=oggpack_get_buffer(&dest_write);
+ dest_bytes=oggpack_bytes(&dest_write);
+ if(dest_bytes!=(prefill+7)/8){
+ fprintf(stderr,"wrong number of bytes after prefill! %ld!=%d\n",dest_bytes,(prefill+7)/8);
+ exit(1);
+ }
+ oggpack_readinit(&source_read,source,source_bytes);
+ oggpack_readinit(&dest_read,dest,dest_bytes);
+
+ for(i=0;i<prefill;i+=8){
+ int s=oggpack_read(&source_read,prefill-i<8?prefill-i:8);
+ int d=oggpack_read(&dest_read,prefill-i<8?prefill-i:8);
+ if(s!=d){
+ fprintf(stderr,"prefill=%d mismatch! byte %d, %x!=%x\n",prefill,i/8,s,d);
+ exit(1);
+ }
+ }
+ if(prefill<dest_bytes){
+ if(oggpack_read(&dest_read,dest_bytes-prefill)!=0){
+ fprintf(stderr,"prefill=%d mismatch! trailing bits not zero\n",prefill);
+ exit(1);
+ }
+ }
+
+ /* second copy */
+ oggpack_writecopy(&dest_write,source,copy);
+
+ /* check buffers; verify end byte masking */
+ dest=oggpack_get_buffer(&dest_write);
+ dest_bytes=oggpack_bytes(&dest_write);
+ if(dest_bytes!=(copy+prefill+7)/8){
+ fprintf(stderr,"wrong number of bytes after prefill+copy! %ld!=%d\n",dest_bytes,(copy+prefill+7)/8);
+ exit(1);
+ }
+ oggpack_readinit(&source_read,source,source_bytes);
+ oggpack_readinit(&dest_read,dest,dest_bytes);
+
+ for(i=0;i<prefill;i+=8){
+ int s=oggpack_read(&source_read,prefill-i<8?prefill-i:8);
+ int d=oggpack_read(&dest_read,prefill-i<8?prefill-i:8);
+ if(s!=d){
+ fprintf(stderr,"prefill=%d mismatch! byte %d, %x!=%x\n",prefill,i/8,s,d);
+ exit(1);
+ }
+ }
+
+ oggpack_readinit(&source_read,source,source_bytes);
+ for(i=0;i<copy;i+=8){
+ int s=oggpack_read(&source_read,copy-i<8?copy-i:8);
+ int d=oggpack_read(&dest_read,copy-i<8?copy-i:8);
+ if(s!=d){
+ fprintf(stderr,"prefill=%d copy=%d mismatch! byte %d, %x!=%x\n",prefill,copy,i/8,s,d);
+ exit(1);
+ }
+ }
+
+ if(copy+prefill<dest_bytes){
+ if(oggpack_read(&dest_read,dest_bytes-copy-prefill)!=0){
+ fprintf(stderr,"prefill=%d copy=%d mismatch! trailing bits not zero\n",prefill,copy);
+ exit(1);
+ }
+ }
+
+ oggpack_writeclear(&source_write);
+ oggpack_writeclear(&dest_write);
+
+
+}
+
+void copytestB(int prefill, int copy){
+ oggpack_buffer source_write;
+ oggpack_buffer dest_write;
+ oggpack_buffer source_read;
+ oggpack_buffer dest_read;
+ unsigned char *source;
+ unsigned char *dest;
+ long source_bytes,dest_bytes;
+ int i;
+
+ oggpackB_writeinit(&source_write);
+ oggpackB_writeinit(&dest_write);
+
+ for(i=0;i<(prefill+copy+7)/8;i++)
+ oggpackB_write(&source_write,(i^0x5a)&0xff,8);
+ source=oggpackB_get_buffer(&source_write);
+ source_bytes=oggpackB_bytes(&source_write);
+
+ /* prefill */
+ oggpackB_writecopy(&dest_write,source,prefill);
+
+ /* check buffers; verify end byte masking */
+ dest=oggpackB_get_buffer(&dest_write);
+ dest_bytes=oggpackB_bytes(&dest_write);
+ if(dest_bytes!=(prefill+7)/8){
+ fprintf(stderr,"wrong number of bytes after prefill! %ld!=%d\n",dest_bytes,(prefill+7)/8);
+ exit(1);
+ }
+ oggpackB_readinit(&source_read,source,source_bytes);
+ oggpackB_readinit(&dest_read,dest,dest_bytes);
+
+ for(i=0;i<prefill;i+=8){
+ int s=oggpackB_read(&source_read,prefill-i<8?prefill-i:8);
+ int d=oggpackB_read(&dest_read,prefill-i<8?prefill-i:8);
+ if(s!=d){
+ fprintf(stderr,"prefill=%d mismatch! byte %d, %x!=%x\n",prefill,i/8,s,d);
+ exit(1);
+ }
+ }
+ if(prefill<dest_bytes){
+ if(oggpackB_read(&dest_read,dest_bytes-prefill)!=0){
+ fprintf(stderr,"prefill=%d mismatch! trailing bits not zero\n",prefill);
+ exit(1);
+ }
+ }
+
+ /* second copy */
+ oggpackB_writecopy(&dest_write,source,copy);
+
+ /* check buffers; verify end byte masking */
+ dest=oggpackB_get_buffer(&dest_write);
+ dest_bytes=oggpackB_bytes(&dest_write);
+ if(dest_bytes!=(copy+prefill+7)/8){
+ fprintf(stderr,"wrong number of bytes after prefill+copy! %ld!=%d\n",dest_bytes,(copy+prefill+7)/8);
+ exit(1);
+ }
+ oggpackB_readinit(&source_read,source,source_bytes);
+ oggpackB_readinit(&dest_read,dest,dest_bytes);
+
+ for(i=0;i<prefill;i+=8){
+ int s=oggpackB_read(&source_read,prefill-i<8?prefill-i:8);
+ int d=oggpackB_read(&dest_read,prefill-i<8?prefill-i:8);
+ if(s!=d){
+ fprintf(stderr,"prefill=%d mismatch! byte %d, %x!=%x\n",prefill,i/8,s,d);
+ exit(1);
+ }
+ }
+
+ oggpackB_readinit(&source_read,source,source_bytes);
+ for(i=0;i<copy;i+=8){
+ int s=oggpackB_read(&source_read,copy-i<8?copy-i:8);
+ int d=oggpackB_read(&dest_read,copy-i<8?copy-i:8);
+ if(s!=d){
+ fprintf(stderr,"prefill=%d copy=%d mismatch! byte %d, %x!=%x\n",prefill,copy,i/8,s,d);
+ exit(1);
+ }
+ }
+
+ if(copy+prefill<dest_bytes){
+ if(oggpackB_read(&dest_read,dest_bytes-copy-prefill)!=0){
+ fprintf(stderr,"prefill=%d copy=%d mismatch! trailing bits not zero\n",prefill,copy);
+ exit(1);
+ }
+ }
+
+ oggpackB_writeclear(&source_write);
+ oggpackB_writeclear(&dest_write);
+
+}
+
+int main(void){
+ unsigned char *buffer;
+ long bytes,i,j;
+ static unsigned long testbuffer1[]=
+ {18,12,103948,4325,543,76,432,52,3,65,4,56,32,42,34,21,1,23,32,546,456,7,
+ 567,56,8,8,55,3,52,342,341,4,265,7,67,86,2199,21,7,1,5,1,4};
+ int test1size=43;
+
+ static unsigned long testbuffer2[]=
+ {216531625L,1237861823,56732452,131,3212421,12325343,34547562,12313212,
+ 1233432,534,5,346435231,14436467,7869299,76326614,167548585,
+ 85525151,0,12321,1,349528352};
+ int test2size=21;
+
+ static unsigned long testbuffer3[]=
+ {1,0,14,0,1,0,12,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,0,0,1,
+ 0,1,30,1,1,1,0,0,1,0,0,0,12,0,11,0,1,0,0,1};
+ int test3size=56;
+
+ static unsigned long large[]=
+ {2136531625L,2137861823,56732452,131,3212421,12325343,34547562,12313212,
+ 1233432,534,5,2146435231,14436467,7869299,76326614,167548585,
+ 85525151,0,12321,1,2146528352};
+
+ int onesize=33;
+ static int one[33]={146,25,44,151,195,15,153,176,233,131,196,65,85,172,47,40,
+ 34,242,223,136,35,222,211,86,171,50,225,135,214,75,172,
+ 223,4};
+ static int oneB[33]={150,101,131,33,203,15,204,216,105,193,156,65,84,85,222,
+ 8,139,145,227,126,34,55,244,171,85,100,39,195,173,18,
+ 245,251,128};
+
+ int twosize=6;
+ static int two[6]={61,255,255,251,231,29};
+ static int twoB[6]={247,63,255,253,249,120};
+
+ int threesize=54;
+ static int three[54]={169,2,232,252,91,132,156,36,89,13,123,176,144,32,254,
+ 142,224,85,59,121,144,79,124,23,67,90,90,216,79,23,83,
+ 58,135,196,61,55,129,183,54,101,100,170,37,127,126,10,
+ 100,52,4,14,18,86,77,1};
+ static int threeB[54]={206,128,42,153,57,8,183,251,13,89,36,30,32,144,183,
+ 130,59,240,121,59,85,223,19,228,180,134,33,107,74,98,
+ 233,253,196,135,63,2,110,114,50,155,90,127,37,170,104,
+ 200,20,254,4,58,106,176,144,0};
+
+ int foursize=38;
+ static int four[38]={18,6,163,252,97,194,104,131,32,1,7,82,137,42,129,11,72,
+ 132,60,220,112,8,196,109,64,179,86,9,137,195,208,122,169,
+ 28,2,133,0,1};
+ static int fourB[38]={36,48,102,83,243,24,52,7,4,35,132,10,145,21,2,93,2,41,
+ 1,219,184,16,33,184,54,149,170,132,18,30,29,98,229,67,
+ 129,10,4,32};
+
+ int fivesize=45;
+ static int five[45]={169,2,126,139,144,172,30,4,80,72,240,59,130,218,73,62,
+ 241,24,210,44,4,20,0,248,116,49,135,100,110,130,181,169,
+ 84,75,159,2,1,0,132,192,8,0,0,18,22};
+ static int fiveB[45]={1,84,145,111,245,100,128,8,56,36,40,71,126,78,213,226,
+ 124,105,12,0,133,128,0,162,233,242,67,152,77,205,77,
+ 172,150,169,129,79,128,0,6,4,32,0,27,9,0};
+
+ int sixsize=7;
+ static int six[7]={17,177,170,242,169,19,148};
+ static int sixB[7]={136,141,85,79,149,200,41};
+
+ /* Test read/write together */
+ /* Later we test against pregenerated bitstreams */
+ oggpack_writeinit(&o);
+
+ fprintf(stderr,"\nSmall preclipped packing (LSb): ");
+ cliptest(testbuffer1,test1size,0,one,onesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nNull bit call (LSb): ");
+ cliptest(testbuffer3,test3size,0,two,twosize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge preclipped packing (LSb): ");
+ cliptest(testbuffer2,test2size,0,three,threesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\n32 bit preclipped packing (LSb): ");
+ oggpack_reset(&o);
+ for(i=0;i<test2size;i++)
+ oggpack_write(&o,large[i],32);
+ buffer=oggpack_get_buffer(&o);
+ bytes=oggpack_bytes(&o);
+ oggpack_readinit(&r,buffer,bytes);
+ for(i=0;i<test2size;i++){
+ if(oggpack_look(&r,32)==-1)report("out of data. failed!");
+ if(oggpack_look(&r,32)!=large[i]){
+ fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpack_look(&r,32),large[i],
+ oggpack_look(&r,32),large[i]);
+ report("read incorrect value!\n");
+ }
+ oggpack_adv(&r,32);
+ }
+ if(oggpack_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSmall unclipped packing (LSb): ");
+ cliptest(testbuffer1,test1size,7,four,foursize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge unclipped packing (LSb): ");
+ cliptest(testbuffer2,test2size,17,five,fivesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSingle bit unclipped packing (LSb): ");
+ cliptest(testbuffer3,test3size,1,six,sixsize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nTesting read past end (LSb): ");
+ oggpack_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
+ for(i=0;i<64;i++){
+ if(oggpack_read(&r,1)!=0){
+ fprintf(stderr,"failed; got -1 prematurely.\n");
+ exit(1);
+ }
+ }
+ if(oggpack_look(&r,1)!=-1 ||
+ oggpack_read(&r,1)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpack_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
+ if(oggpack_read(&r,30)!=0 || oggpack_read(&r,16)!=0){
+ fprintf(stderr,"failed 2; got -1 prematurely.\n");
+ exit(1);
+ }
+
+ if(oggpack_look(&r,18)!=0 ||
+ oggpack_look(&r,18)!=0){
+ fprintf(stderr,"failed 3; got -1 prematurely.\n");
+ exit(1);
+ }
+ if(oggpack_look(&r,19)!=-1 ||
+ oggpack_look(&r,19)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ if(oggpack_look(&r,32)!=-1 ||
+ oggpack_look(&r,32)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpack_writeclear(&o);
+ fprintf(stderr,"ok.");
+
+ /* this is partly glassbox; we're mostly concerned about the allocation boundaries */
+
+ fprintf(stderr,"\nTesting aligned writecopies (LSb): ");
+ for(i=0;i<71;i++)
+ for(j=0;j<5;j++)
+ copytest(j*8,i);
+ for(i=BUFFER_INCREMENT*8-71;i<BUFFER_INCREMENT*8+71;i++)
+ for(j=0;j<5;j++)
+ copytest(j*8,i);
+ fprintf(stderr,"ok. ");
+
+ fprintf(stderr,"\nTesting unaligned writecopies (LSb): ");
+ for(i=0;i<71;i++)
+ for(j=1;j<40;j++)
+ if(j&0x7)
+ copytest(j,i);
+ for(i=BUFFER_INCREMENT*8-71;i<BUFFER_INCREMENT*8+71;i++)
+ for(j=1;j<40;j++)
+ if(j&0x7)
+ copytest(j,i);
+
+ fprintf(stderr,"ok. \n");
+
+
+ /********** lazy, cut-n-paste retest with MSb packing ***********/
+
+ /* Test read/write together */
+ /* Later we test against pregenerated bitstreams */
+ oggpackB_writeinit(&o);
+
+ fprintf(stderr,"\nSmall preclipped packing (MSb): ");
+ cliptestB(testbuffer1,test1size,0,oneB,onesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nNull bit call (MSb): ");
+ cliptestB(testbuffer3,test3size,0,twoB,twosize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge preclipped packing (MSb): ");
+ cliptestB(testbuffer2,test2size,0,threeB,threesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\n32 bit preclipped packing (MSb): ");
+ oggpackB_reset(&o);
+ for(i=0;i<test2size;i++)
+ oggpackB_write(&o,large[i],32);
+ buffer=oggpackB_get_buffer(&o);
+ bytes=oggpackB_bytes(&o);
+ oggpackB_readinit(&r,buffer,bytes);
+ for(i=0;i<test2size;i++){
+ if(oggpackB_look(&r,32)==-1)report("out of data. failed!");
+ if(oggpackB_look(&r,32)!=large[i]){
+ fprintf(stderr,"%ld != %ld (%lx!=%lx):",oggpackB_look(&r,32),large[i],
+ oggpackB_look(&r,32),large[i]);
+ report("read incorrect value!\n");
+ }
+ oggpackB_adv(&r,32);
+ }
+ if(oggpackB_bytes(&r)!=bytes)report("leftover bytes after read!\n");
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSmall unclipped packing (MSb): ");
+ cliptestB(testbuffer1,test1size,7,fourB,foursize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nLarge unclipped packing (MSb): ");
+ cliptestB(testbuffer2,test2size,17,fiveB,fivesize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nSingle bit unclipped packing (MSb): ");
+ cliptestB(testbuffer3,test3size,1,sixB,sixsize);
+ fprintf(stderr,"ok.");
+
+ fprintf(stderr,"\nTesting read past end (MSb): ");
+ oggpackB_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
+ for(i=0;i<64;i++){
+ if(oggpackB_read(&r,1)!=0){
+ fprintf(stderr,"failed; got -1 prematurely.\n");
+ exit(1);
+ }
+ }
+ if(oggpackB_look(&r,1)!=-1 ||
+ oggpackB_read(&r,1)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ oggpackB_readinit(&r,(unsigned char *)"\0\0\0\0\0\0\0\0",8);
+ if(oggpackB_read(&r,30)!=0 || oggpackB_read(&r,16)!=0){
+ fprintf(stderr,"failed 2; got -1 prematurely.\n");
+ exit(1);
+ }
+
+ if(oggpackB_look(&r,18)!=0 ||
+ oggpackB_look(&r,18)!=0){
+ fprintf(stderr,"failed 3; got -1 prematurely.\n");
+ exit(1);
+ }
+ if(oggpackB_look(&r,19)!=-1 ||
+ oggpackB_look(&r,19)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ if(oggpackB_look(&r,32)!=-1 ||
+ oggpackB_look(&r,32)!=-1){
+ fprintf(stderr,"failed; read past end without -1.\n");
+ exit(1);
+ }
+ fprintf(stderr,"ok.");
+ oggpackB_writeclear(&o);
+
+ /* this is partly glassbox; we're mostly concerned about the allocation boundaries */
+
+ fprintf(stderr,"\nTesting aligned writecopies (MSb): ");
+ for(i=0;i<71;i++)
+ for(j=0;j<5;j++)
+ copytestB(j*8,i);
+ for(i=BUFFER_INCREMENT*8-71;i<BUFFER_INCREMENT*8+71;i++)
+ for(j=0;j<5;j++)
+ copytestB(j*8,i);
+ fprintf(stderr,"ok. ");
+
+ fprintf(stderr,"\nTesting unaligned writecopies (MSb): ");
+ for(i=0;i<71;i++)
+ for(j=1;j<40;j++)
+ if(j&0x7)
+ copytestB(j,i);
+ for(i=BUFFER_INCREMENT*8-71;i<BUFFER_INCREMENT*8+71;i++)
+ for(j=1;j<40;j++)
+ if(j&0x7)
+ copytestB(j,i);
+
+ fprintf(stderr,"ok. \n\n");
+
+ return(0);
+}
+#endif /* _V_SELFTEST */
+
+#undef BUFFER_INCREMENT
diff --git a/libogg/framing.c b/libogg/framing.c
new file mode 100644
index 0000000..685538f
--- /dev/null
+++ b/libogg/framing.c
@@ -0,0 +1,2140 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg CONTAINER SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
+ * *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 *
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: code raw packets into framed OggSquish stream and
+ decode Ogg streams back into raw packets
+ last mod: $Id$
+
+ note: The CRC code is directly derived from public domain code by
+ Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html
+ for details.
+
+ ********************************************************************/
+
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+#include "ogg.h"
+
+/* A complete description of Ogg framing exists in docs/framing.html */
+
+int ogg_page_version(const ogg_page *og){
+ return((int)(og->header[4]));
+}
+
+int ogg_page_continued(const ogg_page *og){
+ return((int)(og->header[5]&0x01));
+}
+
+int ogg_page_bos(const ogg_page *og){
+ return((int)(og->header[5]&0x02));
+}
+
+int ogg_page_eos(const ogg_page *og){
+ return((int)(og->header[5]&0x04));
+}
+
+ogg_int64_t ogg_page_granulepos(const ogg_page *og){
+ unsigned char *page=og->header;
+ ogg_int64_t granulepos=page[13]&(0xff);
+ granulepos= (granulepos<<8)|(page[12]&0xff);
+ granulepos= (granulepos<<8)|(page[11]&0xff);
+ granulepos= (granulepos<<8)|(page[10]&0xff);
+ granulepos= (granulepos<<8)|(page[9]&0xff);
+ granulepos= (granulepos<<8)|(page[8]&0xff);
+ granulepos= (granulepos<<8)|(page[7]&0xff);
+ granulepos= (granulepos<<8)|(page[6]&0xff);
+ return(granulepos);
+}
+
+int ogg_page_serialno(const ogg_page *og){
+ return(og->header[14] |
+ (og->header[15]<<8) |
+ (og->header[16]<<16) |
+ (og->header[17]<<24));
+}
+
+long ogg_page_pageno(const ogg_page *og){
+ return(og->header[18] |
+ (og->header[19]<<8) |
+ (og->header[20]<<16) |
+ (og->header[21]<<24));
+}
+
+
+
+/* returns the number of packets that are completed on this page (if
+ the leading packet is begun on a previous page, but ends on this
+ page, it's counted */
+
+/* NOTE:
+ If a page consists of a packet begun on a previous page, and a new
+ packet begun (but not completed) on this page, the return will be:
+ ogg_page_packets(page) ==1,
+ ogg_page_continued(page) !=0
+
+ If a page happens to be a single packet that was begun on a
+ previous page, and spans to the next page (in the case of a three or
+ more page packet), the return will be:
+ ogg_page_packets(page) ==0,
+ ogg_page_continued(page) !=0
+*/
+
+int ogg_page_packets(const ogg_page *og){
+ int i,n=og->header[26],count=0;
+ for(i=0;i<n;i++)
+ if(og->header[27+i]<255)count++;
+ return(count);
+}
+
+
+#if 0
+/* helper to initialize lookup for direct-table CRC (illustrative; we
+ use the static init below) */
+
+static ogg_uint32_t _ogg_crc_entry(unsigned long index){
+ int i;
+ unsigned long r;
+
+ r = index << 24;
+ for (i=0; i<8; i++)
+ if (r & 0x80000000UL)
+ r = (r << 1) ^ 0x04c11db7; /* The same as the ethernet generator
+ polynomial, although we use an
+ unreflected alg and an init/final
+ of 0, not 0xffffffff */
+ else
+ r<<=1;
+ return (r & 0xffffffffUL);
+}
+#endif
+
+static const ogg_uint32_t crc_lookup[256]={
+ 0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
+ 0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
+ 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,
+ 0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd,
+ 0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9,
+ 0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75,
+ 0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011,
+ 0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd,
+ 0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039,
+ 0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5,
+ 0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81,
+ 0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d,
+ 0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49,
+ 0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95,
+ 0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1,
+ 0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d,
+ 0x34867077,0x30476dc0,0x3d044b19,0x39c556ae,
+ 0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072,
+ 0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16,
+ 0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca,
+ 0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde,
+ 0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02,
+ 0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066,
+ 0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba,
+ 0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e,
+ 0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692,
+ 0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6,
+ 0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a,
+ 0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e,
+ 0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2,
+ 0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686,
+ 0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a,
+ 0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637,
+ 0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb,
+ 0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f,
+ 0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53,
+ 0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47,
+ 0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b,
+ 0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff,
+ 0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623,
+ 0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7,
+ 0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b,
+ 0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f,
+ 0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3,
+ 0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7,
+ 0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b,
+ 0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f,
+ 0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3,
+ 0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640,
+ 0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c,
+ 0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8,
+ 0x68860bfd,0x6c47164a,0x61043093,0x65c52d24,
+ 0x119b4be9,0x155a565e,0x18197087,0x1cd86d30,
+ 0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec,
+ 0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088,
+ 0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654,
+ 0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0,
+ 0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c,
+ 0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18,
+ 0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4,
+ 0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0,
+ 0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c,
+ 0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668,
+ 0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4};
+
+/* init the encode/decode logical stream state */
+
+int ogg_stream_init(ogg_stream_state *os,int serialno){
+ if(os){
+ memset(os,0,sizeof(*os));
+ os->body_storage=16*1024;
+ os->lacing_storage=1024;
+
+ os->body_data=_ogg_malloc(os->body_storage*sizeof(*os->body_data));
+ os->lacing_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->lacing_vals));
+ os->granule_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->granule_vals));
+
+ if(!os->body_data || !os->lacing_vals || !os->granule_vals){
+ ogg_stream_clear(os);
+ return -1;
+ }
+
+ os->serialno=serialno;
+
+ return(0);
+ }
+ return(-1);
+}
+
+/* async/delayed error detection for the ogg_stream_state */
+int ogg_stream_check(ogg_stream_state *os){
+ if(!os || !os->body_data) return -1;
+ return 0;
+}
+
+/* _clear does not free os, only the non-flat storage within */
+int ogg_stream_clear(ogg_stream_state *os){
+ if(os){
+ if(os->body_data)_ogg_free(os->body_data);
+ if(os->lacing_vals)_ogg_free(os->lacing_vals);
+ if(os->granule_vals)_ogg_free(os->granule_vals);
+
+ memset(os,0,sizeof(*os));
+ }
+ return(0);
+}
+
+int ogg_stream_destroy(ogg_stream_state *os){
+ if(os){
+ ogg_stream_clear(os);
+ _ogg_free(os);
+ }
+ return(0);
+}
+
+/* Helpers for ogg_stream_encode; this keeps the structure and
+ what's happening fairly clear */
+
+static int _os_body_expand(ogg_stream_state *os,long needed){
+ if(os->body_storage-needed<=os->body_fill){
+ long body_storage;
+ void *ret;
+ if(os->body_storage>LONG_MAX-needed){
+ ogg_stream_clear(os);
+ return -1;
+ }
+ body_storage=os->body_storage+needed;
+ if(body_storage<LONG_MAX-1024)body_storage+=1024;
+ ret=_ogg_realloc(os->body_data,body_storage*sizeof(*os->body_data));
+ if(!ret){
+ ogg_stream_clear(os);
+ return -1;
+ }
+ os->body_storage=body_storage;
+ os->body_data=ret;
+ }
+ return 0;
+}
+
+static int _os_lacing_expand(ogg_stream_state *os,long needed){
+ if(os->lacing_storage-needed<=os->lacing_fill){
+ long lacing_storage;
+ void *ret;
+ if(os->lacing_storage>LONG_MAX-needed){
+ ogg_stream_clear(os);
+ return -1;
+ }
+ lacing_storage=os->lacing_storage+needed;
+ if(lacing_storage<LONG_MAX-32)lacing_storage+=32;
+ ret=_ogg_realloc(os->lacing_vals,lacing_storage*sizeof(*os->lacing_vals));
+ if(!ret){
+ ogg_stream_clear(os);
+ return -1;
+ }
+ os->lacing_vals=ret;
+ ret=_ogg_realloc(os->granule_vals,lacing_storage*
+ sizeof(*os->granule_vals));
+ if(!ret){
+ ogg_stream_clear(os);
+ return -1;
+ }
+ os->granule_vals=ret;
+ os->lacing_storage=lacing_storage;
+ }
+ return 0;
+}
+
+/* checksum the page */
+/* Direct table CRC; note that this will be faster in the future if we
+ perform the checksum simultaneously with other copies */
+
+void ogg_page_checksum_set(ogg_page *og){
+ if(og){
+ ogg_uint32_t crc_reg=0;
+ int i;
+
+ /* safety; needed for API behavior, but not framing code */
+ og->header[22]=0;
+ og->header[23]=0;
+ og->header[24]=0;
+ og->header[25]=0;
+
+ for(i=0;i<og->header_len;i++)
+ crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
+ for(i=0;i<og->body_len;i++)
+ crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
+
+ og->header[22]=(unsigned char)(crc_reg&0xff);
+ og->header[23]=(unsigned char)((crc_reg>>8)&0xff);
+ og->header[24]=(unsigned char)((crc_reg>>16)&0xff);
+ og->header[25]=(unsigned char)((crc_reg>>24)&0xff);
+ }
+}
+
+/* submit data to the internal buffer of the framing engine */
+int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count,
+ long e_o_s, ogg_int64_t granulepos){
+
+ long bytes = 0, lacing_vals;
+ int i;
+
+ if(ogg_stream_check(os)) return -1;
+ if(!iov) return 0;
+
+ for (i = 0; i < count; ++i){
+ if(iov[i].iov_len>LONG_MAX) return -1;
+ if(bytes>LONG_MAX-(long)iov[i].iov_len) return -1;
+ bytes += (long)iov[i].iov_len;
+ }
+ lacing_vals=bytes/255+1;
+
+ if(os->body_returned){
+ /* advance packet data according to the body_returned pointer. We
+ had to keep it around to return a pointer into the buffer last
+ call */
+
+ os->body_fill-=os->body_returned;
+ if(os->body_fill)
+ memmove(os->body_data,os->body_data+os->body_returned,
+ os->body_fill);
+ os->body_returned=0;
+ }
+
+ /* make sure we have the buffer storage */
+ if(_os_body_expand(os,bytes) || _os_lacing_expand(os,lacing_vals))
+ return -1;
+
+ /* Copy in the submitted packet. Yes, the copy is a waste; this is
+ the liability of overly clean abstraction for the time being. It
+ will actually be fairly easy to eliminate the extra copy in the
+ future */
+
+ for (i = 0; i < count; ++i) {
+ memcpy(os->body_data+os->body_fill, iov[i].iov_base, iov[i].iov_len);
+ os->body_fill += (int)iov[i].iov_len;
+ }
+
+ /* Store lacing vals for this packet */
+ for(i=0;i<lacing_vals-1;i++){
+ os->lacing_vals[os->lacing_fill+i]=255;
+ os->granule_vals[os->lacing_fill+i]=os->granulepos;
+ }
+ os->lacing_vals[os->lacing_fill+i]=bytes%255;
+ os->granulepos=os->granule_vals[os->lacing_fill+i]=granulepos;
+
+ /* flag the first segment as the beginning of the packet */
+ os->lacing_vals[os->lacing_fill]|= 0x100;
+
+ os->lacing_fill+=lacing_vals;
+
+ /* for the sake of completeness */
+ os->packetno++;
+
+ if(e_o_s)os->e_o_s=1;
+
+ return(0);
+}
+
+int ogg_stream_packetin(ogg_stream_state *os,ogg_packet *op){
+ ogg_iovec_t iov;
+ iov.iov_base = op->packet;
+ iov.iov_len = op->bytes;
+ return ogg_stream_iovecin(os, &iov, 1, op->e_o_s, op->granulepos);
+}
+
+/* Conditionally flush a page; force==0 will only flush nominal-size
+ pages, force==1 forces us to flush a page regardless of page size
+ so long as there's any data available at all. */
+static int ogg_stream_flush_i(ogg_stream_state *os,ogg_page *og, int force, int nfill){
+ int i;
+ int vals=0;
+ int maxvals=(os->lacing_fill>255?255:os->lacing_fill);
+ int bytes=0;
+ long acc=0;
+ ogg_int64_t granule_pos=-1;
+
+ if(ogg_stream_check(os)) return(0);
+ if(maxvals==0) return(0);
+
+ /* construct a page */
+ /* decide how many segments to include */
+
+ /* If this is the initial header case, the first page must only include
+ the initial header packet */
+ if(os->b_o_s==0){ /* 'initial header page' case */
+ granule_pos=0;
+ for(vals=0;vals<maxvals;vals++){
+ if((os->lacing_vals[vals]&0x0ff)<255){
+ vals++;
+ break;
+ }
+ }
+ }else{
+
+ /* The extra packets_done, packet_just_done logic here attempts to do two things:
+ 1) Don't unneccessarily span pages.
+ 2) Unless necessary, don't flush pages if there are less than four packets on
+ them; this expands page size to reduce unneccessary overhead if incoming packets
+ are large.
+ These are not necessary behaviors, just 'always better than naive flushing'
+ without requiring an application to explicitly request a specific optimized
+ behavior. We'll want an explicit behavior setup pathway eventually as well. */
+
+ int packets_done=0;
+ int packet_just_done=0;
+ for(vals=0;vals<maxvals;vals++){
+ if(acc>nfill && packet_just_done>=4){
+ force=1;
+ break;
+ }
+ acc+=os->lacing_vals[vals]&0x0ff;
+ if((os->lacing_vals[vals]&0xff)<255){
+ granule_pos=os->granule_vals[vals];
+ packet_just_done=++packets_done;
+ }else
+ packet_just_done=0;
+ }
+ if(vals==255)force=1;
+ }
+
+ if(!force) return(0);
+
+ /* construct the header in temp storage */
+ memcpy(os->header,"OggS",4);
+
+ /* stream structure version */
+ os->header[4]=0x00;
+
+ /* continued packet flag? */
+ os->header[5]=0x00;
+ if((os->lacing_vals[0]&0x100)==0)os->header[5]|=0x01;
+ /* first page flag? */
+ if(os->b_o_s==0)os->header[5]|=0x02;
+ /* last page flag? */
+ if(os->e_o_s && os->lacing_fill==vals)os->header[5]|=0x04;
+ os->b_o_s=1;
+
+ /* 64 bits of PCM position */
+ for(i=6;i<14;i++){
+ os->header[i]=(unsigned char)(granule_pos&0xff);
+ granule_pos>>=8;
+ }
+
+ /* 32 bits of stream serial number */
+ {
+ long serialno=os->serialno;
+ for(i=14;i<18;i++){
+ os->header[i]=(unsigned char)(serialno&0xff);
+ serialno>>=8;
+ }
+ }
+
+ /* 32 bits of page counter (we have both counter and page header
+ because this val can roll over) */
+ if(os->pageno==-1)os->pageno=0; /* because someone called
+ stream_reset; this would be a
+ strange thing to do in an
+ encode stream, but it has
+ plausible uses */
+ {
+ long pageno=os->pageno++;
+ for(i=18;i<22;i++){
+ os->header[i]=(unsigned char)(pageno&0xff);
+ pageno>>=8;
+ }
+ }
+
+ /* zero for computation; filled in later */
+ os->header[22]=0;
+ os->header[23]=0;
+ os->header[24]=0;
+ os->header[25]=0;
+
+ /* segment table */
+ os->header[26]=(unsigned char)(vals&0xff);
+ for(i=0;i<vals;i++)
+ bytes+=os->header[i+27]=(unsigned char)(os->lacing_vals[i]&0xff);
+
+ /* set pointers in the ogg_page struct */
+ og->header=os->header;
+ og->header_len=os->header_fill=vals+27;
+ og->body=os->body_data+os->body_returned;
+ og->body_len=bytes;
+
+ /* advance the lacing data and set the body_returned pointer */
+
+ os->lacing_fill-=vals;
+ memmove(os->lacing_vals,os->lacing_vals+vals,os->lacing_fill*sizeof(*os->lacing_vals));
+ memmove(os->granule_vals,os->granule_vals+vals,os->lacing_fill*sizeof(*os->granule_vals));
+ os->body_returned+=bytes;
+
+ /* calculate the checksum */
+
+ ogg_page_checksum_set(og);
+
+ /* done */
+ return(1);
+}
+
+/* This will flush remaining packets into a page (returning nonzero),
+ even if there is not enough data to trigger a flush normally
+ (undersized page). If there are no packets or partial packets to
+ flush, ogg_stream_flush returns 0. Note that ogg_stream_flush will
+ try to flush a normal sized page like ogg_stream_pageout; a call to
+ ogg_stream_flush does not guarantee that all packets have flushed.
+ Only a return value of 0 from ogg_stream_flush indicates all packet
+ data is flushed into pages.
+
+ since ogg_stream_flush will flush the last page in a stream even if
+ it's undersized, you almost certainly want to use ogg_stream_pageout
+ (and *not* ogg_stream_flush) unless you specifically need to flush
+ a page regardless of size in the middle of a stream. */
+
+int ogg_stream_flush(ogg_stream_state *os,ogg_page *og){
+ return ogg_stream_flush_i(os,og,1,4096);
+}
+
+/* Like the above, but an argument is provided to adjust the nominal
+ page size for applications which are smart enough to provide their
+ own delay based flushing */
+
+int ogg_stream_flush_fill(ogg_stream_state *os,ogg_page *og, int nfill){
+ return ogg_stream_flush_i(os,og,1,nfill);
+}
+
+/* This constructs pages from buffered packet segments. The pointers
+returned are to static buffers; do not free. The returned buffers are
+good only until the next call (using the same ogg_stream_state) */
+
+int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og){
+ int force=0;
+ if(ogg_stream_check(os)) return 0;
+
+ if((os->e_o_s&&os->lacing_fill) || /* 'were done, now flush' case */
+ (os->lacing_fill&&!os->b_o_s)) /* 'initial header page' case */
+ force=1;
+
+ return(ogg_stream_flush_i(os,og,force,4096));
+}
+
+/* Like the above, but an argument is provided to adjust the nominal
+page size for applications which are smart enough to provide their
+own delay based flushing */
+
+int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill){
+ int force=0;
+ if(ogg_stream_check(os)) return 0;
+
+ if((os->e_o_s&&os->lacing_fill) || /* 'were done, now flush' case */
+ (os->lacing_fill&&!os->b_o_s)) /* 'initial header page' case */
+ force=1;
+
+ return(ogg_stream_flush_i(os,og,force,nfill));
+}
+
+int ogg_stream_eos(ogg_stream_state *os){
+ if(ogg_stream_check(os)) return 1;
+ return os->e_o_s;
+}
+
+/* DECODING PRIMITIVES: packet streaming layer **********************/
+
+/* This has two layers to place more of the multi-serialno and paging
+ control in the application's hands. First, we expose a data buffer
+ using ogg_sync_buffer(). The app either copies into the
+ buffer, or passes it directly to read(), etc. We then call
+ ogg_sync_wrote() to tell how many bytes we just added.
+
+ Pages are returned (pointers into the buffer in ogg_sync_state)
+ by ogg_sync_pageout(). The page is then submitted to
+ ogg_stream_pagein() along with the appropriate
+ ogg_stream_state* (ie, matching serialno). We then get raw
+ packets out calling ogg_stream_packetout() with a
+ ogg_stream_state. */
+
+/* initialize the struct to a known state */
+int ogg_sync_init(ogg_sync_state *oy){
+ if(oy){
+ oy->storage = -1; /* used as a readiness flag */
+ memset(oy,0,sizeof(*oy));
+ }
+ return(0);
+}
+
+/* clear non-flat storage within */
+int ogg_sync_clear(ogg_sync_state *oy){
+ if(oy){
+ if(oy->data)_ogg_free(oy->data);
+ memset(oy,0,sizeof(*oy));
+ }
+ return(0);
+}
+
+int ogg_sync_destroy(ogg_sync_state *oy){
+ if(oy){
+ ogg_sync_clear(oy);
+ _ogg_free(oy);
+ }
+ return(0);
+}
+
+int ogg_sync_check(ogg_sync_state *oy){
+ if(oy->storage<0) return -1;
+ return 0;
+}
+
+char *ogg_sync_buffer(ogg_sync_state *oy, long size){
+ if(ogg_sync_check(oy)) return NULL;
+
+ /* first, clear out any space that has been previously returned */
+ if(oy->returned){
+ oy->fill-=oy->returned;
+ if(oy->fill>0)
+ memmove(oy->data,oy->data+oy->returned,oy->fill);
+ oy->returned=0;
+ }
+
+ if(size>oy->storage-oy->fill){
+ /* We need to extend the internal buffer */
+ long newsize=size+oy->fill+4096; /* an extra page to be nice */
+ void *ret;
+
+ if(oy->data)
+ ret=_ogg_realloc(oy->data,newsize);
+ else
+ ret=_ogg_malloc(newsize);
+ if(!ret){
+ ogg_sync_clear(oy);
+ return NULL;
+ }
+ oy->data=ret;
+ oy->storage=newsize;
+ }
+
+ /* expose a segment at least as large as requested at the fill mark */
+ return((char *)oy->data+oy->fill);
+}
+
+int ogg_sync_wrote(ogg_sync_state *oy, long bytes){
+ if(ogg_sync_check(oy))return -1;
+ if(oy->fill+bytes>oy->storage)return -1;
+ oy->fill+=bytes;
+ return(0);
+}
+
+/* sync the stream. This is meant to be useful for finding page
+ boundaries.
+
+ return values for this:
+ -n) skipped n bytes
+ 0) page not ready; more data (no bytes skipped)
+ n) page synced at current location; page length n bytes
+
+*/
+
+long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
+ unsigned char *page=oy->data+oy->returned;
+ unsigned char *next;
+ long bytes=oy->fill-oy->returned;
+
+ if(ogg_sync_check(oy))return 0;
+
+ if(oy->headerbytes==0){
+ int headerbytes,i;
+ if(bytes<27)return(0); /* not enough for a header */
+
+ /* verify capture pattern */
+ if(memcmp(page,"OggS",4))goto sync_fail;
+
+ headerbytes=page[26]+27;
+ if(bytes<headerbytes)return(0); /* not enough for header + seg table */
+
+ /* count up body length in the segment table */
+
+ for(i=0;i<page[26];i++)
+ oy->bodybytes+=page[27+i];
+ oy->headerbytes=headerbytes;
+ }
+
+ if(oy->bodybytes+oy->headerbytes>bytes)return(0);
+
+ /* The whole test page is buffered. Verify the checksum */
+ {
+ /* Grab the checksum bytes, set the header field to zero */
+ char chksum[4];
+ ogg_page log;
+
+ memcpy(chksum,page+22,4);
+ memset(page+22,0,4);
+
+ /* set up a temp page struct and recompute the checksum */
+ log.header=page;
+ log.header_len=oy->headerbytes;
+ log.body=page+oy->headerbytes;
+ log.body_len=oy->bodybytes;
+ ogg_page_checksum_set(&log);
+
+ /* Compare */
+ if(memcmp(chksum,page+22,4)){
+ /* D'oh. Mismatch! Corrupt page (or miscapture and not a page
+ at all) */
+ /* replace the computed checksum with the one actually read in */
+ memcpy(page+22,chksum,4);
+
+ /* Bad checksum. Lose sync */
+ goto sync_fail;
+ }
+ }
+
+ /* yes, have a whole page all ready to go */
+ {
+ unsigned char *page=oy->data+oy->returned;
+ long bytes;
+
+ if(og){
+ og->header=page;
+ og->header_len=oy->headerbytes;
+ og->body=page+oy->headerbytes;
+ og->body_len=oy->bodybytes;
+ }
+
+ oy->unsynced=0;
+ oy->returned+=(bytes=oy->headerbytes+oy->bodybytes);
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+ return(bytes);
+ }
+
+ sync_fail:
+
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+
+ /* search for possible capture */
+ next=memchr(page+1,'O',bytes-1);
+ if(!next)
+ next=oy->data+oy->fill;
+
+ oy->returned=(int)(next-oy->data);
+ return((long)-(next-page));
+}
+
+/* sync the stream and get a page. Keep trying until we find a page.
+ Suppress 'sync errors' after reporting the first.
+
+ return values:
+ -1) recapture (hole in data)
+ 0) need more data
+ 1) page returned
+
+ Returns pointers into buffered data; invalidated by next call to
+ _stream, _clear, _init, or _buffer */
+
+int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
+
+ if(ogg_sync_check(oy))return 0;
+
+ /* all we need to do is verify a page at the head of the stream
+ buffer. If it doesn't verify, we look for the next potential
+ frame */
+
+ for(;;){
+ long ret=ogg_sync_pageseek(oy,og);
+ if(ret>0){
+ /* have a page */
+ return(1);
+ }
+ if(ret==0){
+ /* need more data */
+ return(0);
+ }
+
+ /* head did not start a synced page... skipped some bytes */
+ if(!oy->unsynced){
+ oy->unsynced=1;
+ return(-1);
+ }
+
+ /* loop. keep looking */
+
+ }
+}
+
+/* add the incoming page to the stream state; we decompose the page
+ into packet segments here as well. */
+
+int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
+ unsigned char *header=og->header;
+ unsigned char *body=og->body;
+ long bodysize=og->body_len;
+ int segptr=0;
+
+ int version=ogg_page_version(og);
+ int continued=ogg_page_continued(og);
+ int bos=ogg_page_bos(og);
+ int eos=ogg_page_eos(og);
+ ogg_int64_t granulepos=ogg_page_granulepos(og);
+ int serialno=ogg_page_serialno(og);
+ long pageno=ogg_page_pageno(og);
+ int segments=header[26];
+
+ if(ogg_stream_check(os)) return -1;
+
+ /* clean up 'returned data' */
+ {
+ long lr=os->lacing_returned;
+ long br=os->body_returned;
+
+ /* body data */
+ if(br){
+ os->body_fill-=br;
+ if(os->body_fill)
+ memmove(os->body_data,os->body_data+br,os->body_fill);
+ os->body_returned=0;
+ }
+
+ if(lr){
+ /* segment table */
+ if(os->lacing_fill-lr){
+ memmove(os->lacing_vals,os->lacing_vals+lr,
+ (os->lacing_fill-lr)*sizeof(*os->lacing_vals));
+ memmove(os->granule_vals,os->granule_vals+lr,
+ (os->lacing_fill-lr)*sizeof(*os->granule_vals));
+ }
+ os->lacing_fill-=lr;
+ os->lacing_packet-=lr;
+ os->lacing_returned=0;
+ }
+ }
+
+ /* check the serial number */
+ if(serialno!=os->serialno)return(-1);
+ if(version>0)return(-1);
+
+ if(_os_lacing_expand(os,segments+1)) return -1;
+
+ /* are we in sequence? */
+ if(pageno!=os->pageno){
+ int i;
+
+ /* unroll previous partial packet (if any) */
+ for(i=os->lacing_packet;i<os->lacing_fill;i++)
+ os->body_fill-=os->lacing_vals[i]&0xff;
+ os->lacing_fill=os->lacing_packet;
+
+ /* make a note of dropped data in segment table */
+ if(os->pageno!=-1){
+ os->lacing_vals[os->lacing_fill++]=0x400;
+ os->lacing_packet++;
+ }
+ }
+
+ /* are we a 'continued packet' page? If so, we may need to skip
+ some segments */
+ if(continued){
+ if(os->lacing_fill<1 ||
+ (os->lacing_vals[os->lacing_fill-1]&0xff)<255 ||
+ os->lacing_vals[os->lacing_fill-1]==0x400){
+ bos=0;
+ for(;segptr<segments;segptr++){
+ int val=header[27+segptr];
+ body+=val;
+ bodysize-=val;
+ if(val<255){
+ segptr++;
+ break;
+ }
+ }
+ }
+ }
+
+ if(bodysize){
+ if(_os_body_expand(os,bodysize)) return -1;
+ memcpy(os->body_data+os->body_fill,body,bodysize);
+ os->body_fill+=bodysize;
+ }
+
+ {
+ int saved=-1;
+ while(segptr<segments){
+ int val=header[27+segptr];
+ os->lacing_vals[os->lacing_fill]=val;
+ os->granule_vals[os->lacing_fill]=-1;
+
+ if(bos){
+ os->lacing_vals[os->lacing_fill]|=0x100;
+ bos=0;
+ }
+
+ if(val<255)saved=os->lacing_fill;
+
+ os->lacing_fill++;
+ segptr++;
+
+ if(val<255)os->lacing_packet=os->lacing_fill;
+ }
+
+ /* set the granulepos on the last granuleval of the last full packet */
+ if(saved!=-1){
+ os->granule_vals[saved]=granulepos;
+ }
+
+ }
+
+ if(eos){
+ os->e_o_s=1;
+ if(os->lacing_fill>0)
+ os->lacing_vals[os->lacing_fill-1]|=0x200;
+ }
+
+ os->pageno=pageno+1;
+
+ return(0);
+}
+
+/* clear things to an initial state. Good to call, eg, before seeking */
+int ogg_sync_reset(ogg_sync_state *oy){
+ if(ogg_sync_check(oy))return -1;
+
+ oy->fill=0;
+ oy->returned=0;
+ oy->unsynced=0;
+ oy->headerbytes=0;
+ oy->bodybytes=0;
+ return(0);
+}
+
+int ogg_stream_reset(ogg_stream_state *os){
+ if(ogg_stream_check(os)) return -1;
+
+ os->body_fill=0;
+ os->body_returned=0;
+
+ os->lacing_fill=0;
+ os->lacing_packet=0;
+ os->lacing_returned=0;
+
+ os->header_fill=0;
+
+ os->e_o_s=0;
+ os->b_o_s=0;
+ os->pageno=-1;
+ os->packetno=0;
+ os->granulepos=0;
+
+ return(0);
+}
+
+int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno){
+ if(ogg_stream_check(os)) return -1;
+ ogg_stream_reset(os);
+ os->serialno=serialno;
+ return(0);
+}
+
+static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){
+
+ /* The last part of decode. We have the stream broken into packet
+ segments. Now we need to group them into packets (or return the
+ out of sync markers) */
+
+ int ptr=os->lacing_returned;
+
+ if(os->lacing_packet<=ptr)return(0);
+
+ if(os->lacing_vals[ptr]&0x400){
+ /* we need to tell the codec there's a gap; it might need to
+ handle previous packet dependencies. */
+ os->lacing_returned++;
+ os->packetno++;
+ return(-1);
+ }
+
+ if(!op && !adv)return(1); /* just using peek as an inexpensive way
+ to ask if there's a whole packet
+ waiting */
+
+ /* Gather the whole packet. We'll have no holes or a partial packet */
+ {
+ int size=os->lacing_vals[ptr]&0xff;
+ long bytes=size;
+ int eos=os->lacing_vals[ptr]&0x200; /* last packet of the stream? */
+ int bos=os->lacing_vals[ptr]&0x100; /* first packet of the stream? */
+
+ while(size==255){
+ int val=os->lacing_vals[++ptr];
+ size=val&0xff;
+ if(val&0x200)eos=0x200;
+ bytes+=size;
+ }
+
+ if(op){
+ op->e_o_s=eos;
+ op->b_o_s=bos;
+ op->packet=os->body_data+os->body_returned;
+ op->packetno=os->packetno;
+ op->granulepos=os->granule_vals[ptr];
+ op->bytes=bytes;
+ }
+
+ if(adv){
+ os->body_returned+=bytes;
+ os->lacing_returned=ptr+1;
+ os->packetno++;
+ }
+ }
+ return(1);
+}
+
+int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){
+ if(ogg_stream_check(os)) return 0;
+ return _packetout(os,op,1);
+}
+
+int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){
+ if(ogg_stream_check(os)) return 0;
+ return _packetout(os,op,0);
+}
+
+void ogg_packet_clear(ogg_packet *op) {
+ _ogg_free(op->packet);
+ memset(op, 0, sizeof(*op));
+}
+
+#ifdef _V_SELFTEST
+#include <stdio.h>
+
+ogg_stream_state os_en, os_de;
+ogg_sync_state oy;
+
+void checkpacket(ogg_packet *op,long len, int no, long pos){
+ long j;
+ static int sequence=0;
+ static int lastno=0;
+
+ if(op->bytes!=len){
+ fprintf(stderr,"incorrect packet length (%ld != %ld)!\n",op->bytes,len);
+ exit(1);
+ }
+ if(op->granulepos!=pos){
+ fprintf(stderr,"incorrect packet granpos (%ld != %ld)!\n",(long)op->granulepos,pos);
+ exit(1);
+ }
+
+ /* packet number just follows sequence/gap; adjust the input number
+ for that */
+ if(no==0){
+ sequence=0;
+ }else{
+ sequence++;
+ if(no>lastno+1)
+ sequence++;
+ }
+ lastno=no;
+ if(op->packetno!=sequence){
+ fprintf(stderr,"incorrect packet sequence %ld != %d\n",
+ (long)(op->packetno),sequence);
+ exit(1);
+ }
+
+ /* Test data */
+ for(j=0;j<op->bytes;j++)
+ if(op->packet[j]!=((j+no)&0xff)){
+ fprintf(stderr,"body data mismatch (1) at pos %ld: %x!=%lx!\n\n",
+ j,op->packet[j],(j+no)&0xff);
+ exit(1);
+ }
+}
+
+void check_page(unsigned char *data,const int *header,ogg_page *og){
+ long j;
+ /* Test data */
+ for(j=0;j<og->body_len;j++)
+ if(og->body[j]!=data[j]){
+ fprintf(stderr,"body data mismatch (2) at pos %ld: %x!=%x!\n\n",
+ j,data[j],og->body[j]);
+ exit(1);
+ }
+
+ /* Test header */
+ for(j=0;j<og->header_len;j++){
+ if(og->header[j]!=header[j]){
+ fprintf(stderr,"header content mismatch at pos %ld:\n",j);
+ for(j=0;j<header[26]+27;j++)
+ fprintf(stderr," (%ld)%02x:%02x",j,header[j],og->header[j]);
+ fprintf(stderr,"\n");
+ exit(1);
+ }
+ }
+ if(og->header_len!=header[26]+27){
+ fprintf(stderr,"header length incorrect! (%ld!=%d)\n",
+ og->header_len,header[26]+27);
+ exit(1);
+ }
+}
+
+void print_header(ogg_page *og){
+ int j;
+ fprintf(stderr,"\nHEADER:\n");
+ fprintf(stderr," capture: %c %c %c %c version: %d flags: %x\n",
+ og->header[0],og->header[1],og->header[2],og->header[3],
+ (int)og->header[4],(int)og->header[5]);
+
+ fprintf(stderr," granulepos: %d serialno: %d pageno: %ld\n",
+ (og->header[9]<<24)|(og->header[8]<<16)|
+ (og->header[7]<<8)|og->header[6],
+ (og->header[17]<<24)|(og->header[16]<<16)|
+ (og->header[15]<<8)|og->header[14],
+ ((long)(og->header[21])<<24)|(og->header[20]<<16)|
+ (og->header[19]<<8)|og->header[18]);
+
+ fprintf(stderr," checksum: %02x:%02x:%02x:%02x\n segments: %d (",
+ (int)og->header[22],(int)og->header[23],
+ (int)og->header[24],(int)og->header[25],
+ (int)og->header[26]);
+
+ for(j=27;j<og->header_len;j++)
+ fprintf(stderr,"%d ",(int)og->header[j]);
+ fprintf(stderr,")\n\n");
+}
+
+void copy_page(ogg_page *og){
+ unsigned char *temp=_ogg_malloc(og->header_len);
+ memcpy(temp,og->header,og->header_len);
+ og->header=temp;
+
+ temp=_ogg_malloc(og->body_len);
+ memcpy(temp,og->body,og->body_len);
+ og->body=temp;
+}
+
+void free_page(ogg_page *og){
+ _ogg_free (og->header);
+ _ogg_free (og->body);
+}
+
+void error(void){
+ fprintf(stderr,"error!\n");
+ exit(1);
+}
+
+/* 17 only */
+const int head1_0[] = {0x4f,0x67,0x67,0x53,0,0x06,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x15,0xed,0xec,0x91,
+ 1,
+ 17};
+
+/* 17, 254, 255, 256, 500, 510, 600 byte, pad */
+const int head1_1[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x59,0x10,0x6c,0x2c,
+ 1,
+ 17};
+const int head2_1[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x89,0x33,0x85,0xce,
+ 13,
+ 254,255,0,255,1,255,245,255,255,0,
+ 255,255,90};
+
+/* nil packets; beginning,middle,end */
+const int head1_2[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+const int head2_2[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x28,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x5c,0x3f,0x66,0xcb,
+ 17,
+ 17,254,255,0,0,255,1,0,255,245,255,255,0,
+ 255,255,90,0};
+
+/* large initial packet */
+const int head1_3[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0x01,0x27,0x31,0xaa,
+ 18,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,10};
+
+const int head2_3[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x7f,0x4e,0x8a,0xd2,
+ 4,
+ 255,4,255,0};
+
+
+/* continuing packet test */
+const int head1_4[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+
+const int head2_4[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0xf8,0x3c,0x19,0x79,
+ 255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255};
+
+const int head3_4[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0x38,0xe6,0xb6,0x28,
+ 6,
+ 255,220,255,4,255,0};
+
+
+/* spill expansion test */
+const int head1_4b[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+
+const int head2_4b[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0xce,0x8f,0x17,0x1a,
+ 23,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,255,10,255,4,255,0,0};
+
+
+const int head3_4b[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x14,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0x9b,0xb2,0x50,0xa1,
+ 1,
+ 0};
+
+/* page with the 255 segment limit */
+const int head1_5[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+
+const int head2_5[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0xfc,0x03,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0xed,0x2a,0x2e,0xa7,
+ 255,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10};
+
+const int head3_5[] = {0x4f,0x67,0x67,0x53,0,0x04,
+ 0x07,0x00,0x04,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0x6c,0x3b,0x82,0x3d,
+ 1,
+ 50};
+
+
+/* packet that overspans over an entire page */
+const int head1_6[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+
+const int head2_6[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x68,0x22,0x7c,0x3d,
+ 255,
+ 100,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255};
+
+const int head3_6[] = {0x4f,0x67,0x67,0x53,0,0x01,
+ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0xf4,0x87,0xba,0xf3,
+ 255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255};
+
+const int head4_6[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,3,0,0,0,
+ 0xf7,0x2f,0x6c,0x60,
+ 5,
+ 254,255,4,255,0};
+
+/* packet that overspans over an entire page */
+const int head1_7[] = {0x4f,0x67,0x67,0x53,0,0x02,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,0,0,0,0,
+ 0xff,0x7b,0x23,0x17,
+ 1,
+ 0};
+
+const int head2_7[] = {0x4f,0x67,0x67,0x53,0,0x00,
+ 0x07,0x04,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,1,0,0,0,
+ 0x68,0x22,0x7c,0x3d,
+ 255,
+ 100,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255,255,255,
+ 255,255,255,255,255,255};
+
+const int head3_7[] = {0x4f,0x67,0x67,0x53,0,0x05,
+ 0x07,0x08,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x02,0x03,0x04,2,0,0,0,
+ 0xd4,0xe0,0x60,0xe5,
+ 1,
+ 0};
+
+int compare_packet(const ogg_packet *op1, const ogg_packet *op2){
+ if(op1->packet!=op2->packet){
+ fprintf(stderr,"op1->packet != op2->packet\n");
+ return(1);
+ }
+ if(op1->bytes!=op2->bytes){
+ fprintf(stderr,"op1->bytes != op2->bytes\n");
+ return(1);
+ }
+ if(op1->b_o_s!=op2->b_o_s){
+ fprintf(stderr,"op1->b_o_s != op2->b_o_s\n");
+ return(1);
+ }
+ if(op1->e_o_s!=op2->e_o_s){
+ fprintf(stderr,"op1->e_o_s != op2->e_o_s\n");
+ return(1);
+ }
+ if(op1->granulepos!=op2->granulepos){
+ fprintf(stderr,"op1->granulepos != op2->granulepos\n");
+ return(1);
+ }
+ if(op1->packetno!=op2->packetno){
+ fprintf(stderr,"op1->packetno != op2->packetno\n");
+ return(1);
+ }
+ return(0);
+}
+
+void test_pack(const int *pl, const int **headers, int byteskip,
+ int pageskip, int packetskip){
+ unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */
+ long inptr=0;
+ long outptr=0;
+ long deptr=0;
+ long depacket=0;
+ long granule_pos=7,pageno=0;
+ int i,j,packets,pageout=pageskip;
+ int eosflag=0;
+ int bosflag=0;
+
+ int byteskipcount=0;
+
+ ogg_stream_reset(&os_en);
+ ogg_stream_reset(&os_de);
+ ogg_sync_reset(&oy);
+
+ for(packets=0;packets<packetskip;packets++)
+ depacket+=pl[packets];
+
+ for(packets=0;;packets++)if(pl[packets]==-1)break;
+
+ for(i=0;i<packets;i++){
+ /* construct a test packet */
+ ogg_packet op;
+ int len=pl[i];
+
+ op.packet=data+inptr;
+ op.bytes=len;
+ op.e_o_s=(pl[i+1]<0?1:0);
+ op.granulepos=granule_pos;
+
+ granule_pos+=1024;
+
+ for(j=0;j<len;j++)data[inptr++]=i+j;
+
+ /* submit the test packet */
+ ogg_stream_packetin(&os_en,&op);
+
+ /* retrieve any finished pages */
+ {
+ ogg_page og;
+
+ while(ogg_stream_pageout(&os_en,&og)){
+ /* We have a page. Check it carefully */
+
+ fprintf(stderr,"%ld, ",pageno);
+
+ if(headers[pageno]==NULL){
+ fprintf(stderr,"coded too many pages!\n");
+ exit(1);
+ }
+
+ check_page(data+outptr,headers[pageno],&og);
+
+ outptr+=og.body_len;
+ pageno++;
+ if(pageskip){
+ bosflag=1;
+ pageskip--;
+ deptr+=og.body_len;
+ }
+
+ /* have a complete page; submit it to sync/decode */
+
+ {
+ ogg_page og_de;
+ ogg_packet op_de,op_de2;
+ char *buf=ogg_sync_buffer(&oy,og.header_len+og.body_len);
+ char *next=buf;
+ byteskipcount+=og.header_len;
+ if(byteskipcount>byteskip){
+ memcpy(next,og.header,byteskipcount-byteskip);
+ next+=byteskipcount-byteskip;
+ byteskipcount=byteskip;
+ }
+
+ byteskipcount+=og.body_len;
+ if(byteskipcount>byteskip){
+ memcpy(next,og.body,byteskipcount-byteskip);
+ next+=byteskipcount-byteskip;
+ byteskipcount=byteskip;
+ }
+
+ ogg_sync_wrote(&oy,next-buf);
+
+ while(1){
+ int ret=ogg_sync_pageout(&oy,&og_de);
+ if(ret==0)break;
+ if(ret<0)continue;
+ /* got a page. Happy happy. Verify that it's good. */
+
+ fprintf(stderr,"(%d), ",pageout);
+
+ check_page(data+deptr,headers[pageout],&og_de);
+ deptr+=og_de.body_len;
+ pageout++;
+
+ /* submit it to deconstitution */
+ ogg_stream_pagein(&os_de,&og_de);
+
+ /* packets out? */
+ while(ogg_stream_packetpeek(&os_de,&op_de2)>0){
+ ogg_stream_packetpeek(&os_de,NULL);
+ ogg_stream_packetout(&os_de,&op_de); /* just catching them all */
+
+ /* verify peek and out match */
+ if(compare_packet(&op_de,&op_de2)){
+ fprintf(stderr,"packetout != packetpeek! pos=%ld\n",
+ depacket);
+ exit(1);
+ }
+
+ /* verify the packet! */
+ /* check data */
+ if(memcmp(data+depacket,op_de.packet,op_de.bytes)){
+ fprintf(stderr,"packet data mismatch in decode! pos=%ld\n",
+ depacket);
+ exit(1);
+ }
+ /* check bos flag */
+ if(bosflag==0 && op_de.b_o_s==0){
+ fprintf(stderr,"b_o_s flag not set on packet!\n");
+ exit(1);
+ }
+ if(bosflag && op_de.b_o_s){
+ fprintf(stderr,"b_o_s flag incorrectly set on packet!\n");
+ exit(1);
+ }
+ bosflag=1;
+ depacket+=op_de.bytes;
+
+ /* check eos flag */
+ if(eosflag){
+ fprintf(stderr,"Multiple decoded packets with eos flag!\n");
+ exit(1);
+ }
+
+ if(op_de.e_o_s)eosflag=1;
+
+ /* check granulepos flag */
+ if(op_de.granulepos!=-1){
+ fprintf(stderr," granule:%ld ",(long)op_de.granulepos);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ _ogg_free(data);
+ if(headers[pageno]!=NULL){
+ fprintf(stderr,"did not write last page!\n");
+ exit(1);
+ }
+ if(headers[pageout]!=NULL){
+ fprintf(stderr,"did not decode last page!\n");
+ exit(1);
+ }
+ if(inptr!=outptr){
+ fprintf(stderr,"encoded page data incomplete!\n");
+ exit(1);
+ }
+ if(inptr!=deptr){
+ fprintf(stderr,"decoded page data incomplete!\n");
+ exit(1);
+ }
+ if(inptr!=depacket){
+ fprintf(stderr,"decoded packet data incomplete!\n");
+ exit(1);
+ }
+ if(!eosflag){
+ fprintf(stderr,"Never got a packet with EOS set!\n");
+ exit(1);
+ }
+ fprintf(stderr,"ok.\n");
+}
+
+int main(void){
+
+ ogg_stream_init(&os_en,0x04030201);
+ ogg_stream_init(&os_de,0x04030201);
+ ogg_sync_init(&oy);
+
+ /* Exercise each code path in the framing code. Also verify that
+ the checksums are working. */
+
+ {
+ /* 17 only */
+ const int packets[]={17, -1};
+ const int *headret[]={head1_0,NULL};
+
+ fprintf(stderr,"testing single page encoding... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* 17, 254, 255, 256, 500, 510, 600 byte, pad */
+ const int packets[]={17, 254, 255, 256, 500, 510, 600, -1};
+ const int *headret[]={head1_1,head2_1,NULL};
+
+ fprintf(stderr,"testing basic page encoding... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* nil packets; beginning,middle,end */
+ const int packets[]={0,17, 254, 255, 0, 256, 0, 500, 510, 600, 0, -1};
+ const int *headret[]={head1_2,head2_2,NULL};
+
+ fprintf(stderr,"testing basic nil packets... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* large initial packet */
+ const int packets[]={4345,259,255,-1};
+ const int *headret[]={head1_3,head2_3,NULL};
+
+ fprintf(stderr,"testing initial-packet lacing > 4k... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* continuing packet test; with page spill expansion, we have to
+ overflow the lacing table. */
+ const int packets[]={0,65500,259,255,-1};
+ const int *headret[]={head1_4,head2_4,head3_4,NULL};
+
+ fprintf(stderr,"testing single packet page span... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* spill expand packet test */
+ const int packets[]={0,4345,259,255,0,0,-1};
+ const int *headret[]={head1_4b,head2_4b,head3_4b,NULL};
+
+ fprintf(stderr,"testing page spill expansion... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ /* page with the 255 segment limit */
+ {
+
+ const int packets[]={0,10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,10,
+ 10,10,10,10,10,10,10,50,-1};
+ const int *headret[]={head1_5,head2_5,head3_5,NULL};
+
+ fprintf(stderr,"testing max packet segments... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* packet that overspans over an entire page */
+ const int packets[]={0,100,130049,259,255,-1};
+ const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL};
+
+ fprintf(stderr,"testing very large packets... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+ {
+ /* test for the libogg 1.1.1 resync in large continuation bug
+ found by Josh Coalson) */
+ const int packets[]={0,100,130049,259,255,-1};
+ const int *headret[]={head1_6,head2_6,head3_6,head4_6,NULL};
+
+ fprintf(stderr,"testing continuation resync in very large packets... ");
+ test_pack(packets,headret,100,2,3);
+ }
+
+ {
+ /* term only page. why not? */
+ const int packets[]={0,100,64770,-1};
+ const int *headret[]={head1_7,head2_7,head3_7,NULL};
+
+ fprintf(stderr,"testing zero data page (1 nil packet)... ");
+ test_pack(packets,headret,0,0,0);
+ }
+
+
+
+ {
+ /* build a bunch of pages for testing */
+ unsigned char *data=_ogg_malloc(1024*1024);
+ int pl[]={0, 1,1,98,4079, 1,1,2954,2057, 76,34,912,0,234,1000,1000, 1000,300,-1};
+ int inptr=0,i,j;
+ ogg_page og[5];
+
+ ogg_stream_reset(&os_en);
+
+ for(i=0;pl[i]!=-1;i++){
+ ogg_packet op;
+ int len=pl[i];
+
+ op.packet=data+inptr;
+ op.bytes=len;
+ op.e_o_s=(pl[i+1]<0?1:0);
+ op.granulepos=(i+1)*1000;
+
+ for(j=0;j<len;j++)data[inptr++]=i+j;
+ ogg_stream_packetin(&os_en,&op);
+ }
+
+ _ogg_free(data);
+
+ /* retrieve finished pages */
+ for(i=0;i<5;i++){
+ if(ogg_stream_pageout(&os_en,&og[i])==0){
+ fprintf(stderr,"Too few pages output building sync tests!\n");
+ exit(1);
+ }
+ copy_page(&og[i]);
+ }
+
+ /* Test lost pages on pagein/packetout: no rollback */
+ {
+ ogg_page temp;
+ ogg_packet test;
+
+ fprintf(stderr,"Testing loss of pages... ");
+
+ ogg_sync_reset(&oy);
+ ogg_stream_reset(&os_de);
+ for(i=0;i<5;i++){