diff --git a/archivers/unrar-iconv/Makefile b/archivers/unrar-iconv/Makefile index 2a1e0896312d..a3f068b97b89 100644 --- a/archivers/unrar-iconv/Makefile +++ b/archivers/unrar-iconv/Makefile @@ -11,9 +11,9 @@ EXTRA_PATCHES= ${.CURDIR}/files/patch-iconv CPPFLAGS+= -DWITH_ICONV -I${LOCALBASE}/include LDFLAGS+= -L${LOCALBASE}/lib ${ICONV_LIB} -USES+= iconv +USES= iconv -CONFLICTS= unrar-[0-9]* zh-unrar-[0-9]* +CONFLICTS_INSTALL= unrar-[0-9]* zh-unrar-[0-9]* post-install: @${ECHO_MSG} "===> Added iconv support, see new switches:" diff --git a/archivers/unrar-iconv/files/patch-iconv b/archivers/unrar-iconv/files/patch-iconv index 5c90e0e6838a..b96c59df9258 100644 --- a/archivers/unrar-iconv/files/patch-iconv +++ b/archivers/unrar-iconv/files/patch-iconv @@ -1,9 +1,9 @@ ---- cmddata.cpp.orig 2011-01-04 20:28:47.000000000 +0800 -+++ cmddata.cpp 2011-01-18 11:21:35.000000000 +0800 -@@ -153,6 +153,34 @@ - if (Test && Extract) - Test=false; // Switch '-t' is senseless for 'X', 'E', 'P' commands. - BareOutput=(CmdChar=='L' || CmdChar=='V') && Command[1]=='B'; +--- cmddata.cpp.orig 2013-12-01 16:10:14.000000000 +0800 ++++ cmddata.cpp 2014-02-04 09:29:52.919682515 +0800 +@@ -179,6 +179,34 @@ + // Suppress the copyright message and final end of line for 'lb' and 'vb'. + if ((CmdChar=='L' || CmdChar=='V') && Command[1]=='B') + BareOutput=true; +#ifdef WITH_ICONV + if ( (encInt[0] != '\0') || (encExt[0] != '\0') ) { + char fullEncInt[ENC_MAXLEN + OPT_MAXLEN + 1]; @@ -35,31 +35,31 @@ } -@@ -877,6 +905,22 @@ - break; - } +@@ -872,6 +900,22 @@ + else + wcsncpyz(CommentFile,Switch+1,ASIZE(CommentFile)); break; +#ifdef WITH_ICONV + case 'L': -+ switch(toupper(Switch[1])) ++ switch(toupperw(Switch[1])) + { + case 'L': -+ strncpy(encExt, Switch+2, sizeof(encExt)-1); ++ strncpyz(encExt, (const char *)Switch+2, ASIZE(encExt)); + break; + case 'A': -+ strncpy(encInt, Switch+2, sizeof(encInt)-1); ++ strncpyz(encInt, (const char *)Switch+2, ASIZE(encInt)); + break; + case 'O': -+ strncpy(encOpt, Switch+2, sizeof(encOpt)-1); ++ strncpyz(encOpt, (const char *)Switch+2, ASIZE(encOpt)); + break; + } + break; +#endif #ifndef GUI case '?' : - OutHelp(); -@@ -955,7 +999,11 @@ - MCHelpSwm,MCHelpSwAC,MCHelpSwAD,MCHelpSwAI,MCHelpSwAP, + OutHelp(RARX_SUCCESS); +@@ -950,7 +994,11 @@ + MCHelpSwAT,MCHelpSwAC,MCHelpSwAD,MCHelpSwAG,MCHelpSwAI,MCHelpSwAP, MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU, MCHelpSwDH,MCHelpSwEP,MCHelpSwEP3,MCHelpSwF,MCHelpSwIDP,MCHelpSwIERR, - MCHelpSwINUL,MCHelpSwIOFF,MCHelpSwKB,MCHelpSwN,MCHelpSwNa,MCHelpSwNal, @@ -71,8 +71,8 @@ MCHelpSwO,MCHelpSwOC,MCHelpSwOR,MCHelpSwOW,MCHelpSwP, MCHelpSwPm,MCHelpSwR,MCHelpSwRI,MCHelpSwSL,MCHelpSwSM,MCHelpSwTA, MCHelpSwTB,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU,MCHelpSwVUnr, ---- global.hpp.orig 2011-01-04 20:28:47.000000000 +0800 -+++ global.hpp 2011-01-18 11:21:35.000000000 +0800 +--- global.hpp.orig 2013-12-01 16:10:14.000000000 +0800 ++++ global.hpp 2014-02-04 15:14:20.104268441 +0800 @@ -9,6 +9,19 @@ EXTVAR ErrorHandler ErrHandler; @@ -93,8 +93,8 @@ +#endif #endif ---- loclang.hpp.orig 2012-05-02 17:34:19.000000000 +0800 -+++ loclang.hpp 2012-05-15 15:25:33.520723073 +0800 +--- loclang.hpp.orig 2013-12-01 16:10:14.000000000 +0800 ++++ loclang.hpp 2014-02-04 15:14:20.105262904 +0800 @@ -7,7 +7,7 @@ #define MCopyright "\nRAR %s Copyright (c) 1993-%d Alexander Roshal %d %s %d" #define MRegTo "\nRegistered to %s\n" @@ -104,7 +104,7 @@ #define MBeta "beta" #define MMonthJan "Jan" #define MMonthFeb "Feb" -@@ -321,7 +321,7 @@ +@@ -332,7 +332,7 @@ #define MSyncScanError "\nFile search errors, cannot synchronize archive" #define MCorrectingName "\nWARNING: Attempting to correct the invalid file name" #define MUnpCannotMerge "\nWARNING: You need to start extraction from a previous volume to unpack %s" @@ -113,9 +113,9 @@ #define MSubHeadCorrupt "\nERROR: Corrupt data header found, ignored" #define MSubHeadUnknown "\nWARNING: Unknown data header format, ignored" #define MSubHeadDataCRC "\nERROR: Corrupt %s data block" -@@ -349,6 +349,12 @@ +@@ -360,6 +360,12 @@ #define MMaxPathLimit "\nTotal path and file name length must not exceed %d characters" - #define MRecVolLimit "\nTotal number of usual and recovery volumes must not exceed 255" + #define MRecVolLimit "\nTotal number of usual and recovery volumes must not exceed %d" #define MVolumeNumber "volume %d" +#ifdef WITH_ICONV +#define MCHelpSwLA "\n la Archive internal filenames encoding" @@ -124,11 +124,11 @@ +#define MIconvCannotOpen "\nCannot open iconv to convert between '%s' and '%s' with option '%s'" +#endif #define MCannotDelete "\nCannot delete %s" - #define MCalcCRC "\nCalculating the control sum" + #define MCalcCRC "\nCalculating the checksum" #define MTooLargeSFXArc "\nWARNING: Too large SFX archive. Windows cannot run the executable file exceeding 4 GB." ---- os.hpp.orig 2011-01-04 20:28:47.000000000 +0800 -+++ os.hpp 2011-01-18 11:21:35.000000000 +0800 -@@ -192,6 +192,10 @@ +--- os.hpp.orig 2013-12-01 16:10:14.000000000 +0800 ++++ os.hpp 2014-02-04 15:16:02.730256100 +0800 +@@ -151,6 +151,10 @@ #include #include @@ -139,35 +139,11 @@ #ifdef S_IFLNK #define SAVE_LINKS #endif ---- strfn.cpp.orig 2011-01-04 20:28:47.000000000 +0800 -+++ strfn.cpp 2011-01-18 11:29:00.000000000 +0800 -@@ -22,23 +22,49 @@ +--- strfn.cpp.orig 2013-12-01 16:10:14.000000000 +0800 ++++ strfn.cpp 2014-02-04 09:35:08.461664945 +0800 +@@ -14,6 +14,19 @@ - void ExtToInt(const char *Src,char *Dest) - { -+#ifdef WITH_ICONV -+ static size_t ret; -+ ret = (size_t)(-1); -+ if (h_E2I != (iconv_t)(-1)) { -+ static size_t inbytesleft, outbytesleft; -+ inbytesleft = strlen(Src)+1; -+ outbytesleft = NM; -+ ret = iconv(h_E2I, &Src, &inbytesleft, &Dest, &outbytesleft); -+ Dest[outbytesleft-inbytesleft]=NULL; -+ } -+ if (ret == (size_t)(-1)) strcpy(Dest, Src); -+#else /* !WITH_ICONV */ - #ifdef _WIN_ALL - CharToOemA(Src,Dest); - #else - if (Dest!=Src) - strcpy(Dest,Src); - #endif -+#endif /* !WITH_ICONV */ - } - - - void IntToExt(const char *Src,char *Dest) + void IntToExt(const char *Src,char *Dest,size_t DestSize) { +#ifdef WITH_ICONV + static size_t ret; @@ -179,13 +155,15 @@ + ret = iconv(h_I2E, &Src, &inbytesleft, &Dest, &outbytesleft); + Dest[outbytesleft-inbytesleft]=NULL; + } -+ if (ret == (size_t)(-1)) strcpy(Dest,Src); ++ if (ret == (size_t)(-1)) ++ strncpyz(Dest,Src,DestSize); +#else /* !WITH_ICONV */ #ifdef _WIN_ALL - OemToCharA(Src,Dest); - #else + OemToCharBuffA(Src,Dest,(DWORD)DestSize); + Dest[DestSize-1]=0; +@@ -21,6 +34,7 @@ if (Dest!=Src) - strcpy(Dest,Src); + strncpyz(Dest,Src,DestSize); #endif +#endif /* !WITH_ICONV */ }