summaryrefslogtreecommitdiffstats
path: root/app-arch/p7zip/files/p7zip_4.57-ds-rusxmms.patch
diff options
context:
space:
mode:
Diffstat (limited to 'app-arch/p7zip/files/p7zip_4.57-ds-rusxmms.patch')
-rw-r--r--app-arch/p7zip/files/p7zip_4.57-ds-rusxmms.patch336
1 files changed, 336 insertions, 0 deletions
diff --git a/app-arch/p7zip/files/p7zip_4.57-ds-rusxmms.patch b/app-arch/p7zip/files/p7zip_4.57-ds-rusxmms.patch
new file mode 100644
index 0000000..0913c13
--- /dev/null
+++ b/app-arch/p7zip/files/p7zip_4.57-ds-rusxmms.patch
@@ -0,0 +1,336 @@
+diff -dPNur p7zip_4.57/C/rccrecode.c p7zip_4.57-new/C/rccrecode.c
+--- p7zip_4.57/C/rccrecode.c 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/C/rccrecode.c 2008-04-11 20:23:42.000000000 +0200
+@@ -0,0 +1,71 @@
++#include <pthread.h>
++#include <librcc.h>
++
++static rcc_class_default_charset default_oem[] = {
++ { "ru", "IBM866" },
++ { NULL, NULL }
++};
++
++static rcc_class_default_charset default_iso[] = {
++ { "ru", "CP1251" },
++ { NULL, NULL }
++};
++
++#define ARC_CLASS 0
++#define OUT_CLASS 1
++#define ARCOUT_CLASS 0
++static rcc_class classes[] = {
++ { "oem", RCC_CLASS_STANDARD, NULL, default_oem, "OEM Encoding", 0 },
++ { "out", RCC_CLASS_STANDARD, "LC_CTYPE", NULL, "Output", 0 },
++ { NULL, RCC_CLASS_STANDARD, NULL, NULL, NULL, 0 }
++};
++
++static int initialized = 0;
++static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
++
++void *rcc_init() {
++ rcc_context ctx;
++
++ pthread_mutex_lock(&mutex);
++ if (!initialized) {
++ rccInit();
++ rccInitDefaultContext(NULL, 0, 0, classes, 0);
++ rccLoad(NULL, "zip");
++ rccInitDb4(NULL, NULL, 0);
++ }
++ initialized++;
++ pthread_mutex_unlock(&mutex);
++
++ ctx = rccCreateContext(NULL, 0, 0, classes, 0);
++ if (ctx) rccInitDb4(ctx, NULL, 0);
++ if (ctx) rccLoad(ctx, "zip");
++
++ return ctx;
++}
++
++
++void rcc_free(void *ctx) {
++ if (ctx) rccFreeContext((rcc_context)ctx);
++
++ pthread_mutex_lock(&mutex);
++ if (initialized == 1) rccFree();
++ initialized--;
++ pthread_mutex_unlock(&mutex);
++}
++
++
++char *rcc_read(void *ctx, const char *string, size_t size) {
++ if (!initialized) {
++ rcc_init();
++ if (!initialized) return NULL;
++ }
++ return rccSizedRecode((rcc_context)ctx, ARC_CLASS, OUT_CLASS, string, size, NULL);
++}
++
++char *rcc_write(rcc_context ctx, const char *string, size_t size) {
++ if (!initialized) {
++ rcc_init();
++ if (!initialized) return NULL;
++ }
++ return rccSizedRecode((rcc_context)ctx, OUT_CLASS, ARCOUT_CLASS, string, size, NULL);
++}
+diff -dPNur p7zip_4.57/C/rccrecode.h p7zip_4.57-new/C/rccrecode.h
+--- p7zip_4.57/C/rccrecode.h 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/C/rccrecode.h 2008-04-11 20:23:42.000000000 +0200
+@@ -0,0 +1,17 @@
++#ifndef _RCC_RECODE_H
++#define _RCC_RECODE_H
++
++# ifdef __cplusplus
++extern "C" {
++# endif
++
++ void *rcc_init();
++ void rcc_free(void *ctx);
++ char *rcc_read(void *ctx, const char *string, size_t size);
++ char *rcc_write(void *ctx, const char *string, size_t size);
++
++# ifdef __cplusplus
++}
++# endif
++
++#endif /* _RCC_RECODE_H */
+diff -dPNur p7zip_4.57/CPP/7zip/Archive/Zip/ZipIn.cpp p7zip_4.57-new/CPP/7zip/Archive/Zip/ZipIn.cpp
+--- p7zip_4.57/CPP/7zip/Archive/Zip/ZipIn.cpp 2007-12-08 11:19:00.000000000 +0100
++++ p7zip_4.57-new/CPP/7zip/Archive/Zip/ZipIn.cpp 2008-04-11 20:23:42.000000000 +0200
+@@ -9,11 +9,22 @@
+ #include "../../Common/LimitedStreams.h"
+ #include "../../Common/StreamUtils.h"
+
++#include "../../../../C/rccrecode.h"
++
+ namespace NArchive {
+ namespace NZip {
++
++CInArchive::CInArchive() {
++ rccctx = rcc_init();
++}
++
++CInArchive::~CInArchive() {
++ rcc_free(rccctx);
++}
++
+
+ // static const char kEndOfString = '\0';
+-
++
+ bool CInArchive::Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit)
+ {
+ m_Stream = inStream;
+@@ -196,10 +207,18 @@
+
+ AString CInArchive::ReadFileName(UInt32 nameSize)
+ {
++ char *rccrec;
+ if (nameSize == 0)
+ return AString();
+ SafeReadBytes(m_NameBuffer.GetBuffer(nameSize), nameSize);
+ m_NameBuffer.ReleaseBuffer(nameSize);
++
++ rccrec = rcc_read(rccctx, (LPCSTR)m_NameBuffer, 0);
++ if (rccrec) {
++ m_NameBuffer = rccrec;
++ free(rccrec);
++ }
++
+ return m_NameBuffer;
+ }
+
+diff -dPNur p7zip_4.57/CPP/7zip/Archive/Zip/ZipIn.h p7zip_4.57-new/CPP/7zip/Archive/Zip/ZipIn.h
+--- p7zip_4.57/CPP/7zip/Archive/Zip/ZipIn.h 2007-12-08 11:19:00.000000000 +0100
++++ p7zip_4.57-new/CPP/7zip/Archive/Zip/ZipIn.h 2008-04-11 20:23:42.000000000 +0200
+@@ -106,6 +106,10 @@
+ bool SeekInArchive(UInt64 position);
+ ISequentialInStream *CreateLimitedStream(UInt64 position, UInt64 size);
+ IInStream* CreateStream();
++
++ void *rccctx;
++ CInArchive();
++ ~CInArchive();
+ };
+
+ }}
+diff -dPNur p7zip_4.57/CPP/7zip/Archive/Zip/ZipOut.cpp p7zip_4.57-new/CPP/7zip/Archive/Zip/ZipOut.cpp
+--- p7zip_4.57/CPP/7zip/Archive/Zip/ZipOut.cpp 2007-06-26 20:06:23.000000000 +0200
++++ p7zip_4.57-new/CPP/7zip/Archive/Zip/ZipOut.cpp 2008-04-11 20:23:42.000000000 +0200
+@@ -7,9 +7,19 @@
+ #include "../../Common/OffsetStream.h"
+ #include "../../Common/StreamUtils.h"
+
++#include "../../../../C/rccrecode.h"
++
+ namespace NArchive {
+ namespace NZip {
+
++COutArchive::COutArchive() {
++ rccctx = rcc_init();
++}
++
++COutArchive::~COutArchive() {
++ rcc_free(rccctx);
++}
++
+ void COutArchive::Create(IOutStream *outStream)
+ {
+ if (!m_OutBuffer.Create(1 << 16))
+@@ -112,6 +122,7 @@
+ {
+ SeekTo(m_BasePosition);
+
++ char *rccrec;
+ bool isZip64 = m_IsZip64 || item.PackSize >= 0xFFFFFFFF || item.UnPackSize >= 0xFFFFFFFF;
+
+ WriteUInt32(NSignature::kLocalFileHeader);
+@@ -130,6 +141,12 @@
+ throw CSystemException(E_FAIL);
+ }
+ WriteUInt16((UInt16)m_ExtraSize); // test it;
++ rccrec = rcc_write(rccctx, (const char *)item.Name, item.Name.Length());
++ if (rccrec) {
++ printf("%u, %s.\n", item.Name.Length(), rccrec);
++ WriteBytes(rccrec, strlen(rccrec));
++ free(rccrec);
++ } else
+ WriteBytes((const char *)item.Name, item.Name.Length());
+
+ UInt32 extraPos = 0;
+@@ -154,6 +171,7 @@
+
+ void COutArchive::WriteCentralHeader(const CItem &item)
+ {
++ char *rccrec;
+ bool isUnPack64 = item.UnPackSize >= 0xFFFFFFFF;
+ bool isPack64 = item.PackSize >= 0xFFFFFFFF;
+ bool isPosition64 = item.LocalHeaderPosition >= 0xFFFFFFFF;
+@@ -180,6 +198,13 @@
+ WriteUInt16(item.InternalAttributes);
+ WriteUInt32(item.ExternalAttributes);
+ WriteUInt32(isPosition64 ? 0xFFFFFFFF: (UInt32)item.LocalHeaderPosition);
++
++ rccrec = rcc_write(rccctx, (const char *)item.Name, item.Name.Length());
++ if (rccrec) {
++ printf("C: %u, %s.\n", item.Name.Length(), rccrec);
++ WriteBytes(rccrec, strlen(rccrec));
++ free(rccrec);
++ } else
+ WriteBytes((const char *)item.Name, item.Name.Length());
+ if (isZip64)
+ {
+diff -dPNur p7zip_4.57/CPP/7zip/Archive/Zip/ZipOut.h p7zip_4.57-new/CPP/7zip/Archive/Zip/ZipOut.h
+--- p7zip_4.57/CPP/7zip/Archive/Zip/ZipOut.h 2007-06-26 20:06:22.000000000 +0200
++++ p7zip_4.57-new/CPP/7zip/Archive/Zip/ZipOut.h 2008-04-11 20:23:42.000000000 +0200
+@@ -49,6 +49,11 @@
+ void CreateStreamForCompressing(IOutStream **outStream);
+ void CreateStreamForCopying(ISequentialOutStream **outStream);
+ void SeekToPackedDataPosition();
++
++ void *rccctx;
++ COutArchive();
++ ~COutArchive();
++
+ };
+
+ }}
+diff -dPNur p7zip_4.57/CPP/7zip/Bundles/Alone/makefile p7zip_4.57-new/CPP/7zip/Bundles/Alone/makefile
+--- p7zip_4.57/CPP/7zip/Bundles/Alone/makefile 2007-07-24 20:55:33.000000000 +0200
++++ p7zip_4.57-new/CPP/7zip/Bundles/Alone/makefile 2008-04-11 20:23:42.000000000 +0200
+@@ -15,6 +15,7 @@
+ LIBS=$(LOCAL_LIBS)
+
+ OBJS=\
++rccrecode.o \
+ myGetTickCount.o \
+ wine_date_and_time.o \
+ myAddExeFlag.o \
+diff -dPNur p7zip_4.57/CPP/7zip/Bundles/Alone/makefile.list p7zip_4.57-new/CPP/7zip/Bundles/Alone/makefile.list
+--- p7zip_4.57/CPP/7zip/Bundles/Alone/makefile.list 2007-07-24 20:56:10.000000000 +0200
++++ p7zip_4.57-new/CPP/7zip/Bundles/Alone/makefile.list 2008-04-11 20:23:42.000000000 +0200
+@@ -196,6 +196,7 @@
+ ../../../../C/Compress/Branch/BranchPPC.c \
+ ../../../../C/Compress/Branch/BranchSPARC.c \
+ ../../../../C/Compress/Branch/BranchX86.c \
++ ../../../../C/rccrecode.c \
+ ../../../../C/7zCrc.c \
+ ../../../../C/Sort.c \
+ ../../../../C/Threads.c \
+@@ -237,6 +238,8 @@
+ $(CXX) $(CFLAGS) ../../../Common/IntToString.cpp
+ ListFileUtils.o : ../../../Common/ListFileUtils.cpp
+ $(CXX) $(CFLAGS) ../../../Common/ListFileUtils.cpp
++rccrecode.o : ../../../../C/rccrecode.c
++ $(CC) $(CFLAGS) ../../../../C/rccrecode.c
+ MyWindows.o : ../../../Common/MyWindows.cpp
+ $(CXX) $(CFLAGS) ../../../Common/MyWindows.cpp
+ Random.o : ../../../Common/Random.cpp
+diff -dPNur p7zip_4.57/CPP/7zip/Bundles/Format7zFree/makefile p7zip_4.57-new/CPP/7zip/Bundles/Format7zFree/makefile
+--- p7zip_4.57/CPP/7zip/Bundles/Format7zFree/makefile 2007-08-03 20:16:04.000000000 +0200
++++ p7zip_4.57-new/CPP/7zip/Bundles/Format7zFree/makefile 2008-04-11 20:30:53.000000000 +0200
+@@ -14,6 +14,7 @@
+ LIBS=$(LOCAL_LIBS_DLL)
+
+ OBJS = \
++rccrecode.o \
+ wine_date_and_time.o \
+ myGetTickCount.o \
+ CRC.o \
+diff -dPNur p7zip_4.57/CPP/7zip/Bundles/Format7zFree/makefile.list p7zip_4.57-new/CPP/7zip/Bundles/Format7zFree/makefile.list
+--- p7zip_4.57/CPP/7zip/Bundles/Format7zFree/makefile.list 2007-08-03 20:17:57.000000000 +0200
++++ p7zip_4.57-new/CPP/7zip/Bundles/Format7zFree/makefile.list 2008-04-11 20:32:11.000000000 +0200
+@@ -218,6 +218,7 @@
+ ../../../../C/Compress/Branch/BranchPPC.c \
+ ../../../../C/Compress/Branch/BranchSPARC.c \
+ ../../../../C/Compress/Branch/BranchX86.c \
++ ../../../../C/rccrecode.c \
+ ../../../../C/7zCrc.c \
+ ../../../../C/Sort.c \
+ ../../../../C/Threads.c \
+@@ -237,6 +238,8 @@
+ $(CXX) $(CC_SHARED) $(CFLAGS) ../../../Common/ListFileUtils.cpp
+ MyWindows.o : ../../../Common/MyWindows.cpp
+ $(CXX) $(CC_SHARED) $(CFLAGS) ../../../Common/MyWindows.cpp
++rccrecode.o : ../../../../C/rccrecode.c
++ $(CC) $(CC_SHARED) $(CFLAGS) ../../../../C/rccrecode.c
+ Random.o : ../../../Common/Random.cpp
+ $(CXX) $(CC_SHARED) $(CFLAGS) ../../../Common/Random.cpp
+ StdInStream.o : ../../../Common/StdInStream.cpp
+diff -dPNur p7zip_4.57/makefile.machine p7zip_4.57-new/makefile.machine
+--- p7zip_4.57/makefile.machine 2007-12-15 18:19:48.000000000 +0100
++++ p7zip_4.57-new/makefile.machine 2008-04-11 20:23:42.000000000 +0200
+@@ -14,7 +14,7 @@
+ CC_SHARED=-fPIC
+ LINK_SHARED=-fPIC -shared
+
+-LOCAL_LIBS=-lpthread
++LOCAL_LIBS=-lpthread -lrcc
+ LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
+
+ OBJ_CRC32=$(OBJ_CRC32_C)
+diff -dPNur p7zip_4.57/makefile.machine.orig p7zip_4.57-new/makefile.machine.orig
+--- p7zip_4.57/makefile.machine.orig 1970-01-01 01:00:00.000000000 +0100
++++ p7zip_4.57-new/makefile.machine.orig 2007-12-15 18:19:48.000000000 +0100
+@@ -0,0 +1,21 @@
++#
++# makefile for Linux (x86, PPC, alpha ...)
++#
++
++OPTFLAGS=-O
++
++ALLFLAGS=${OPTFLAGS} -s \
++ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \
++ -DNDEBUG -D_REENTRANT -DENV_UNIX \
++ $(LOCAL_FLAGS)
++
++CXX=g++ $(ALLFLAGS)
++CC=gcc $(ALLFLAGS)
++CC_SHARED=-fPIC
++LINK_SHARED=-fPIC -shared
++
++LOCAL_LIBS=-lpthread
++LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
++
++OBJ_CRC32=$(OBJ_CRC32_C)
++