summaryrefslogtreecommitdiffstats
path: root/app-arch/p7zip/files/p7zip_4.65-libun7zip.patch
diff options
context:
space:
mode:
Diffstat (limited to 'app-arch/p7zip/files/p7zip_4.65-libun7zip.patch')
-rw-r--r--app-arch/p7zip/files/p7zip_4.65-libun7zip.patch550
1 files changed, 550 insertions, 0 deletions
diff --git a/app-arch/p7zip/files/p7zip_4.65-libun7zip.patch b/app-arch/p7zip/files/p7zip_4.65-libun7zip.patch
new file mode 100644
index 0000000..7646c3f
--- /dev/null
+++ b/app-arch/p7zip/files/p7zip_4.65-libun7zip.patch
@@ -0,0 +1,550 @@
+diff -dPNur p7zip_4.65/CPP/7zip/Bundles/Un7Zip/makefile p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/makefile
+--- p7zip_4.65/CPP/7zip/Bundles/Un7Zip/makefile 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/makefile 2009-06-14 23:15:12.000000000 +0200
+@@ -0,0 +1,137 @@
++PROG=libun7zip.so
++
++LOCAL_FLAGS= \
++ -DEXTRACT_ONLY \
++ -DNO_READ_FROM_CODER \
++ -D_SFX
++
++include ../../../../makefile.crc32
++include ../../../../makefile.machine
++
++LOCAL_SHARED=$(LINK_SHARED)
++LIBS=$(LOCAL_LIBS_DLL)
++
++SFX_CONSOLE_OBJS = \
++ Un7Zip.o
++
++CONSOLE_OBJS = \
++ ConsoleClose.o \
++ ExtractCallbackConsole.o \
++ ExtractCallbackNULL.o \
++ List.o \
++ OpenCallbackConsole.o \
++ UserInputUtils.o \
++
++# NewHandler.o
++COMMON_OBJS = \
++ CommandLineParser.o \
++ CRC.o \
++ IntToString.o \
++ StdInStream.o \
++ StdOutStream.o \
++ MyString.o \
++ MyWindows.o\
++ StringConvert.o \
++ MyVector.o \
++ Wildcard.o \
++
++# DLL.o
++WIN_OBJS = \
++ Error.o \
++ FileDir.o \
++ FileFind.o \
++ FileIO.o \
++ FileName.o \
++ PropVariant.o \
++ PropVariantConversions.o \
++ Synchronization.o \
++ System.o
++
++7ZIP_COMMON_OBJS = \
++ CreateCoder.o \
++ FilePathAutoRename.o \
++ FileStreams.o \
++ InBuffer.o \
++ FilterCoder.o \
++ LimitedStreams.o \
++ LockedStream.o \
++ OutBuffer.o \
++ ProgressUtils.o \
++ StreamBinder.o \
++ StreamObjects.o \
++ StreamUtils.o \
++ VirtThread.o \
++
++UI_COMMON_OBJS = \
++ ArchiveExtractCallback.o \
++ ArchiveOpenCallback.o \
++ DefaultName.o \
++ LoadCodecs.o \
++ Extract.o \
++ ExtractingFilePath.o \
++ OpenArchive.o \
++ PropIDUtils.o \
++
++AR_COMMON_OBJS = \
++ CoderMixer2.o \
++ CoderMixer2MT.o \
++ CrossThreadProgress.o \
++ ItemNameUtils.o \
++ OutStreamWithCRC.o \
++
++
++7Z_OBJS = \
++ 7zDecode.o \
++ 7zExtract.o \
++ 7zFolderOutStream.o \
++ 7zHandler.o \
++ 7zHeader.o \
++ 7zIn.o \
++ 7zRegister.o \
++
++COMPRESS_OBJS = \
++ BranchCoder.o \
++ Bcj2Coder.o \
++ Bcj2Register.o \
++ BcjCoder.o \
++ BcjRegister.o \
++ CopyCoder.o \
++ CopyRegister.o \
++ LzmaDecoder.o \
++ LzmaRegister.o \
++ PpmdDecoder.o \
++ PpmdRegister.o \
++
++CRYPTO_OBJS = \
++ 7zAes.o \
++ 7zAesRegister.o \
++ MyAes.o \
++
++# Alloc.o
++C_OBJS = \
++ Bra86.o \
++ LzmaDec.o \
++ Threads.o \
++ Aes.o \
++ Sha256.o \
++
++OBJS = \
++ myGetTickCount.o\
++ wine_date_and_time.o\
++ mySplitCommandLine.o\
++ $(SFX_CONSOLE_OBJS) \
++ $(CONSOLE_OBJS) \
++ $(COMMON_OBJS) \
++ $(WIN_OBJS) \
++ $(7ZIP_COMMON_OBJS) \
++ $(UI_COMMON_OBJS) \
++ $(AR_COMMON_OBJS) \
++ $(7Z_OBJS) \
++ $(COMPRESS_OBJS) \
++ $(CRYPTO_OBJS) \
++ $(C_OBJS) \
++ $(OBJ_CRC32)
++
++
++include ../../../../makefile.glb
++
+diff -dPNur p7zip_4.65/CPP/7zip/Bundles/Un7Zip/makefile.depend p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/makefile.depend
+--- p7zip_4.65/CPP/7zip/Bundles/Un7Zip/makefile.depend 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/makefile.depend 2009-06-14 23:15:12.000000000 +0200
+@@ -0,0 +1 @@
++
+\ No newline at end of file
+diff -dPNur p7zip_4.65/CPP/7zip/Bundles/Un7Zip/makefile.list p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/makefile.list
+--- p7zip_4.65/CPP/7zip/Bundles/Un7Zip/makefile.list 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/makefile.list 2009-06-14 23:16:37.000000000 +0200
+@@ -0,0 +1,10 @@
++CXXFLAGS += $(CC_SHARED)
++CFLAGS += $(CC_SHARED)
++
++include ../../../../makefile.rules
++
++ExtractCallbackNULL.o : ../../UI/Console/ExtractCallbackNULL.cpp
++ $(CXX) $(CFLAGS) ../../UI/Console/ExtractCallbackNULL.cpp
++
++Un7Zip.o : ./Un7Zip.cpp
++ $(CXX) $(CFLAGS) ./Un7Zip.cpp
+diff -dPNur p7zip_4.65/CPP/7zip/Bundles/Un7Zip/testlib.c p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/testlib.c
+--- p7zip_4.65/CPP/7zip/Bundles/Un7Zip/testlib.c 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/testlib.c 2009-06-14 23:15:12.000000000 +0200
+@@ -0,0 +1,7 @@
++
++#include "u7zip.h"
++
++int main(int argc, char *argv[])
++{
++ return un7zip(argv[1], "/tmp", 0);
++}
+diff -dPNur p7zip_4.65/CPP/7zip/Bundles/Un7Zip/u7zip.h p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/u7zip.h
+--- p7zip_4.65/CPP/7zip/Bundles/Un7Zip/u7zip.h 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/u7zip.h 2009-06-14 23:15:12.000000000 +0200
+@@ -0,0 +1,19 @@
++#ifndef __UN7ZIP_H
++#define __UN7ZIP_H
++
++#define LIST_7Z 0
++#define TEST_7Z 1
++#define EXTRACT_7Z 2
++
++#define S_OK 0x00000000L
++#define S_FALSE 0x00000001L
++#define E_NOTIMPL 0x80004001L
++#define E_NOINTERFACE 0x80004002L
++#define E_ABORT 0x80004004L
++#define E_FAIL 0x80004005L
++#define E_OUTOFMEMORY 0x8007000EL
++#define E_INVALIDARG 0x80070057L
++
++int un7zip(char *name, char *dir, int command);
++
++#endif
+diff -dPNur p7zip_4.65/CPP/7zip/Bundles/Un7Zip/Un7Zip.cpp p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/Un7Zip.cpp
+--- p7zip_4.65/CPP/7zip/Bundles/Un7Zip/Un7Zip.cpp 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.65-new/CPP/7zip/Bundles/Un7Zip/Un7Zip.cpp 2009-06-14 23:15:12.000000000 +0200
+@@ -0,0 +1,148 @@
++// Un7Zip.cpp
++
++#include "StdAfx.h"
++
++#include "Common/MyInitGuid.h"
++
++#include "Common/StdOutStream.h"
++#include "Common/Wildcard.h"
++#include "Common/StringConvert.h"
++#include "Common/MyCom.h"
++#include "Common/MyException.h"
++
++#include "Windows/FileDir.h"
++#include "Windows/FileName.h"
++#include "Windows/Defs.h"
++
++#include "../../IPassword.h"
++#include "../../ICoder.h"
++
++#include "../../UI/Common/OpenArchive.h"
++#include "../../UI/Common/DefaultName.h"
++#include "../../UI/Common/ExitCode.h"
++#include "../../UI/Common/Extract.h"
++
++#include "../../UI/Console/List.h"
++#include "../../UI/Console/OpenCallbackConsole.h"
++#include "../../UI/Console/ExtractCallbackNULL.h"
++
++
++static int Un7Zip(char *name, char *dir, int command);
++
++extern "C" {
++
++int un7zip(char *name, char *dir, int command)
++{
++ return Un7Zip(name, dir, command);
++}
++
++}
++
++using namespace NWindows;
++using namespace NFile;
++
++static const wchar_t *kUniversalWildcard = L"*";
++static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor)
++{
++ wildcardCensor.AddItem(true, kUniversalWildcard, false);
++ return true;
++}
++
++static int Un7Zip(char *name, char *dir, int commands)
++{
++
++ CStdOutStream *g_StdStream = &g_StdOut;
++
++ NWildcard::CCensor wildcardCensor;
++ AddNameToCensor(wildcardCensor);
++ bool passwordEnabled = 1;
++ UString password = L"null";
++
++ UString outputDir= MultiByteToUnicodeString(dir);
++ UString archiveName = MultiByteToUnicodeString(name);
++
++ NFind::CFileInfoW archiveFileInfo;
++
++ if (!NFind::FindFile(archiveName, archiveFileInfo))
++ return S_FALSE;
++ if (archiveFileInfo.IsDir())
++ return S_FALSE;
++
++ {
++
++ UStringVector v1, v2;
++ v1.Add(archiveName);
++ v2.Add(archiveName);
++
++
++ CCodecs *codecs = new CCodecs;
++ CMyComPtr<
++ #ifdef EXTERNAL_CODECS
++ ICompressCodecsInfo
++ #else
++ IUnknown
++ #endif
++ > compressCodecsInfo = codecs;
++ HRESULT result = codecs->Load();
++ if (result != S_OK)
++ throw CSystemException(result);
++
++ const NWildcard::CCensorNode &wildcardCensorHead =
++ wildcardCensor.Pairs.Front().Head;
++
++ if(commands > 0)
++ {
++ CExtractCallbackNULL *ecs = new CExtractCallbackNULL;
++ CMyComPtr<IFolderArchiveExtractCallback> extractCallback = ecs;
++ ecs->OutStream = g_StdStream;
++ ecs->PasswordIsDefined = passwordEnabled;
++ ecs->Password = password;
++ ecs->Init();
++
++ COpenCallbackConsole openCallback;
++ openCallback.OutStream = g_StdStream;
++ openCallback.PasswordIsDefined = passwordEnabled;
++ openCallback.Password = password;
++
++ CExtractOptions eo;
++ eo.StdOutMode = false;
++ eo.PathMode = NExtract::NPathMode::kFullPathnames;
++ if(commands == 1)
++ eo.TestMode = 1;
++ else
++ eo.TestMode = 0;
++ eo.OverwriteMode = NExtract::NOverwriteMode::kWithoutPrompt;
++ eo.OutputDir = outputDir;
++ eo.YesToAll = 1;
++
++ UString errorMessage;
++ CDecompressStat stat;
++
++ HRESULT result = DecompressArchives(
++ codecs, CIntVector(),
++ v1, v2,
++ wildcardCensorHead,
++ eo, &openCallback, ecs, errorMessage, stat);
++
++ if (ecs->NumArchiveErrors != 0 || ecs->NumFileErrors != 0)
++ return S_FALSE;
++ if (result != S_OK)
++ return S_FALSE;
++ }
++ else
++ {
++ UInt64 numErrors = 0;
++ HRESULT result = ListArchives(
++ codecs, CIntVector(),
++ v1, v2,
++ wildcardCensorHead,
++ true, false,
++ passwordEnabled,
++ password, numErrors);
++
++ if (result != S_OK)
++ return S_FALSE;;
++ }
++ }
++ return S_OK;
++}
+diff -dPNur p7zip_4.65/CPP/7zip/UI/Console/ExtractCallbackNULL.cpp p7zip_4.65-new/CPP/7zip/UI/Console/ExtractCallbackNULL.cpp
+--- p7zip_4.65/CPP/7zip/UI/Console/ExtractCallbackNULL.cpp 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.65-new/CPP/7zip/UI/Console/ExtractCallbackNULL.cpp 2009-06-14 23:15:12.000000000 +0200
+@@ -0,0 +1,130 @@
++// ExtractCallbackNULL.cpp
++
++#include "StdAfx.h"
++
++#include "ExtractCallbackNULL.h"
++#include "UserInputUtils.h"
++#include "ConsoleClose.h"
++
++#include "Common/Wildcard.h"
++
++#include "Windows/FileDir.h"
++#include "Windows/FileFind.h"
++#include "Windows/Time.h"
++#include "Windows/Defs.h"
++#include "Windows/PropVariant.h"
++#include "Windows/Error.h"
++#include "Windows/PropVariantConversions.h"
++
++#include "../../Common/FilePathAutoRename.h"
++
++#include "../Common/ExtractingFilePath.h"
++
++using namespace NWindows;
++using namespace NFile;
++using namespace NDirectory;
++
++STDMETHODIMP CExtractCallbackNULL::SetTotal(UInt64 size)
++{
++ if (NConsoleClose::TestBreakSignal())
++ return E_ABORT;
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::SetCompleted(const UInt64 *completeValue)
++{
++ if (NConsoleClose::TestBreakSignal())
++ return E_ABORT;
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::AskOverwrite(
++ const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
++ const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
++ Int32 *answer)
++{
++
++ NUserAnswerMode::EEnum overwriteAnswer = ScanUserYesNoAllQuit(OutStream);
++
++ switch(overwriteAnswer)
++ {
++ case NUserAnswerMode::kQuit:
++ return E_ABORT;
++ case NUserAnswerMode::kNo:
++ *answer = NOverwriteAnswer::kNo;
++ break;
++ case NUserAnswerMode::kNoAll:
++ *answer = NOverwriteAnswer::kNoToAll;
++ break;
++ case NUserAnswerMode::kYesAll:
++ *answer = NOverwriteAnswer::kYesToAll;
++ break;
++ case NUserAnswerMode::kYes:
++ *answer = NOverwriteAnswer::kYes;
++ break;
++ case NUserAnswerMode::kAutoRenameAll:
++ *answer = NOverwriteAnswer::kAutoRename;
++ break;
++ default:
++ return E_FAIL;
++ }
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::PrepareOperation(const wchar_t *name, bool /* isFolder */, Int32 askExtractMode, const UInt64 *position)
++{
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::MessageError(const wchar_t *message)
++{
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::SetOperationResult(Int32 operationResult, bool encrypted)
++{
++ return S_OK;
++}
++
++STDMETHODIMP CExtractCallbackNULL::CryptoGetTextPassword(BSTR *password)
++{
++ if (!PasswordIsDefined)
++ {
++ Password = GetPassword(OutStream);
++ PasswordIsDefined = true;
++ }
++ return StringToBstr(Password, password);
++}
++
++HRESULT CExtractCallbackNULL::BeforeOpen(const wchar_t *name)
++{
++ return S_OK;
++}
++
++HRESULT CExtractCallbackNULL::OpenResult(const wchar_t *name, HRESULT result, bool encrypted)
++{
++ return S_OK;
++}
++
++HRESULT CExtractCallbackNULL::ThereAreNoFiles()
++{
++ return S_OK;
++}
++
++HRESULT CExtractCallbackNULL::ExtractResult(HRESULT result)
++{
++ if (result == S_OK)
++ return result;
++ if (result == E_ABORT)
++ return result;
++ if (result == E_OUTOFMEMORY)
++ return result;
++ return S_OK;
++}
++
++HRESULT CExtractCallbackNULL::SetPassword(const UString &password)
++{
++ PasswordIsDefined = true;
++ Password = password;
++ return S_OK;
++}
+diff -dPNur p7zip_4.65/CPP/7zip/UI/Console/ExtractCallbackNULL.h p7zip_4.65-new/CPP/7zip/UI/Console/ExtractCallbackNULL.h
+--- p7zip_4.65/CPP/7zip/UI/Console/ExtractCallbackNULL.h 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.65-new/CPP/7zip/UI/Console/ExtractCallbackNULL.h 2009-06-14 23:15:12.000000000 +0200
+@@ -0,0 +1,65 @@
++// ExtractCallbackNULL.h
++
++#ifndef __EXTRACTCALLBACKCONSOLE_H
++#define __EXTRACTCALLBACKCONSOLE_H
++
++#include "Common/MyString.h"
++#include "Common/StdOutStream.h"
++#include "../../Common/FileStreams.h"
++#include "../../IPassword.h"
++#include "../../Archive/IArchive.h"
++#include "../Common/ArchiveExtractCallback.h"
++
++class CExtractCallbackNULL:
++ public IExtractCallbackUI,
++ public ICryptoGetTextPassword,
++ public CMyUnknownImp
++{
++public:
++ MY_UNKNOWN_IMP2(IFolderArchiveExtractCallback, ICryptoGetTextPassword)
++
++ STDMETHOD(SetTotal)(UInt64 total);
++ STDMETHOD(SetCompleted)(const UInt64 *completeValue);
++
++ // IFolderArchiveExtractCallback
++ STDMETHOD(AskOverwrite)(
++ const wchar_t *existName, const FILETIME *existTime, const UInt64 *existSize,
++ const wchar_t *newName, const FILETIME *newTime, const UInt64 *newSize,
++ Int32 *answer);
++ STDMETHOD (PrepareOperation)(const wchar_t *name, bool isFolder, Int32 askExtractMode, const UInt64 *position);
++
++ STDMETHOD(MessageError)(const wchar_t *message);
++ STDMETHOD(SetOperationResult)(Int32 operationResult, bool encrypted);
++
++ // ICryptoGetTextPassword
++ STDMETHOD(CryptoGetTextPassword)(BSTR *password);
++
++ HRESULT BeforeOpen(const wchar_t *name);
++ HRESULT OpenResult(const wchar_t *name, HRESULT result, bool encrypted);
++ HRESULT ThereAreNoFiles();
++ HRESULT ExtractResult(HRESULT result);
++
++ HRESULT SetPassword(const UString &password);
++
++public:
++ bool PasswordIsDefined;
++ UString Password;
++
++ UInt64 NumArchives;
++ UInt64 NumArchiveErrors;
++ UInt64 NumFileErrors;
++ UInt64 NumFileErrorsInCurrentArchive;
++
++ CStdOutStream *OutStream;
++
++ void Init()
++ {
++ NumArchives = 0;
++ NumArchiveErrors = 0;
++ NumFileErrors = 0;
++ NumFileErrorsInCurrentArchive = 0;
++ }
++
++};
++
++#endif