From f6f5938fe793ad36bf4008a4abc0f1835fcbaff9 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Tue, 5 May 2020 20:22:56 +0200 Subject: [PATCH] v0.61 --- UnAlz.cpp | 66 +++++--- UnAlz.h | 12 +- UnAlzUtils.cpp | 29 +--- main.cpp | 7 +- readme.txt | 4 +- unalz.sln | 29 ---- unalz.vcproj | 397 ------------------------------------------------- 7 files changed, 71 insertions(+), 473 deletions(-) delete mode 100755 unalz.sln delete mode 100755 unalz.vcproj diff --git a/UnAlz.cpp b/UnAlz.cpp index 296e5f2..6bd9ff3 100755 --- a/UnAlz.cpp +++ b/UnAlz.cpp @@ -104,25 +104,6 @@ static BOOL IsBigEndian(void) return TRUE; } -// ¾ÈÀüÇÑ strcpy -static void safe_strcpy(char* dst, const char* src, size_t dst_size) -{ -#ifdef _WIN32 - lstrcpynA(dst, src, dst_size); -#else - strlcpy(dst, src, dst_size); -#endif -} - -static void safe_strcat(char* dst, const char* src, size_t dst_size) -{ -#ifdef _WIN32 - StringCchCatExA(dst, dst_size, src, NULL, NULL, STRSAFE_FILL_BEHIND_NULL); - //lstrcatA(dst, src); // not safe!! -#else - strlcat(dst, src, dst_size); -#endif -} #ifdef _WIN32 # define safe_sprintf StringCbPrintfA @@ -1928,3 +1909,50 @@ void CUnAlz::SetDestCodepage(const char* szToCodepage) #endif + +//////////////////////////////////////////////////////////////////////////////////////////////////// +/// ¹®ÀÚ¿­ ó¸® ÇÔ¼öµé +/// @param l +/// @param c +/// @return +/// @date 2007-02 +//////////////////////////////////////////////////////////////////////////////////////////////////// +unsigned int CUnAlz::_strlcpy (char *dest, const char *src, unsigned int size) +{ + register unsigned int i = 0; + if (size > 0) { + size--; + for (i=0; size > 0 && src[i] != '\0'; ++i, size--) + dest[i] = src[i]; + dest[i] = '\0'; + } + while (src[i++]); + return i; +} +unsigned int CUnAlz::_strlcat (char *dest, const char *src, unsigned int size) +{ + register char *d = dest; + for (; size > 0 && *d != '\0'; size--, d++); + return (d - dest) + _strlcpy(d, src, size); +} + +// ¾ÈÀüÇÑ strcpy +void CUnAlz::safe_strcpy(char* dst, const char* src, size_t dst_size) +{ +#ifdef _WIN32 + lstrcpynA(dst, src, dst_size); +#else + _strlcpy(dst, src, dst_size); +#endif +} + +void CUnAlz::safe_strcat(char* dst, const char* src, size_t dst_size) +{ +#ifdef _WIN32 + StringCchCatExA(dst, dst_size, src, NULL, NULL, STRSAFE_FILL_BEHIND_NULL); + //lstrcatA(dst, src); // not safe!! +#else + _strlcat(dst, src, dst_size); +#endif +} + diff --git a/UnAlz.h b/UnAlz.h index b976a9b..61053d8 100755 --- a/UnAlz.h +++ b/UnAlz.h @@ -107,6 +107,8 @@ 2006/04/23 - ¿£µð¾È 󸮸¦ ·±Å¸ÀÓ¿¡ Çϵµ·Ï ¼öÁ¤ 2006/12/31 - strcpy/strcat/sprintf ¿Í °°Àº ¹öÆÛ ¿À¹öÇÃ·Î¿ì °¡´É¼ºÀÌ ÀÖ´Â ÇÔ¼ö Á¦°Å (by liam.joo@gmail) - unalz 0.60 + 2007/02/10 - ¸®´ª½ºµî¿¡¼­ strlcpy, strlcat ÄÄÆÄÀÏ ¿¡·¯ ¼öÁ¤ + - unalz 0.61 ±â´É : - alz ÆÄÀÏÀÇ ¾ÐÃà ÇØÁ¦ (deflate/º¯Çü bzip2/raw) @@ -210,8 +212,8 @@ namespace UNALZ # pragma pack(1) #endif -static const char UNALZ_VERSION[] = "CUnAlz0.60"; -static const char UNALZ_COPYRIGHT[] = "Copyright(C) 2004-2006 by hardkoder@gmail ( http://www.kipple.pe.kr ) "; +static const char UNALZ_VERSION[] = "CUnAlz0.61"; +static const char UNALZ_COPYRIGHT[] = "Copyright(C) 2004-2007 by hardkoder@gmail ( http://www.kipple.pe.kr ) "; enum {ENCR_HEADER_LEN=12}; // xf86 // ¸Ç ÆÄÀÏ ¾Õ.. @@ -483,6 +485,12 @@ public : static const char* GetCopyright() { return UNALZ_COPYRIGHT; } BOOL IsHalted() { return m_bHalt; } // by xf86 +public : + static void safe_strcpy(char* dst, const char* src, size_t dst_size); + static void safe_strcat(char* dst, const char* src, size_t dst_size); + static unsigned int _strlcpy (char *dest, const char *src, unsigned int size); + static unsigned int _strlcat (char *dest, const char *src, unsigned int size); + private : SIGNATURE ReadSignature(); BOOL ReadAlzFileHeader(); diff --git a/UnAlzUtils.cpp b/UnAlzUtils.cpp index bea22f2..6b16f89 100755 --- a/UnAlzUtils.cpp +++ b/UnAlzUtils.cpp @@ -2,10 +2,6 @@ #include #include "UnAlzUtils.h" -#ifdef _WIN32 // safe string ó¸® -# include "strsafe.h" -#endif - #ifdef _WIN32 # define I64FORM(x) "%"#x"I64d" # define U64FORM(x) "%"#x"I64u" @@ -29,15 +25,6 @@ time_t dosTime2TimeT(UINT32 dostime) // from INFO-ZIP src return mktime(&t); } -static void safe_strcat(char* dst, const char* src, size_t dst_size) -{ -#ifdef _WIN32 - StringCchCatExA(dst, dst_size, src, NULL, NULL, STRSAFE_FILL_BEHIND_NULL); - //lstrcatA(dst, src); // not safe!! -#else - strlcat(dst, src, dst_size); -#endif -} //////////////////////////////////////////////////////////////////////////////////////////////////// /// fileAttribute ¸¦ ½ºÆ®¸µÀ¸·Î ¹Ù²ãÁØ´Ù. @@ -51,24 +38,24 @@ void FileAttr2Str(char szAttr[LEN_ATTR], BYTE fileAttribute) szAttr[0] = 0; if(fileAttribute&ALZ_FILEATTR_FILE) - safe_strcat(szAttr, "A", LEN_ATTR); + CUnAlz::safe_strcat(szAttr, "A", LEN_ATTR); else - safe_strcat(szAttr, "_", LEN_ATTR); + CUnAlz::safe_strcat(szAttr, "_", LEN_ATTR); if(fileAttribute&ALZ_FILEATTR_DIRECTORY) - safe_strcat(szAttr, "D", LEN_ATTR); + CUnAlz::safe_strcat(szAttr, "D", LEN_ATTR); else - safe_strcat(szAttr, "_", LEN_ATTR); + CUnAlz::safe_strcat(szAttr, "_", LEN_ATTR); if(fileAttribute&ALZ_FILEATTR_READONLY) - safe_strcat(szAttr, "R", LEN_ATTR); + CUnAlz::safe_strcat(szAttr, "R", LEN_ATTR); else - safe_strcat(szAttr, "_", LEN_ATTR); + CUnAlz::safe_strcat(szAttr, "_", LEN_ATTR); if(fileAttribute&ALZ_FILEATTR_HIDDEN) - safe_strcat(szAttr, "H", LEN_ATTR); + CUnAlz::safe_strcat(szAttr, "H", LEN_ATTR); else - safe_strcat(szAttr, "_", LEN_ATTR); + CUnAlz::safe_strcat(szAttr, "_", LEN_ATTR); } diff --git a/main.cpp b/main.cpp index 574beac..2b77f42 100755 --- a/main.cpp +++ b/main.cpp @@ -29,8 +29,9 @@ void Copyright() // printf("unalz v0.53 (2005/10/15) \n"); // printf("unalz v0.54 (2005/11/21) \n"); // printf("unalz v0.55 (2006/03/10) \n"); - printf("unalz v0.60 (2006/12/31) \n"); - printf("Copyright(C) 2004-2006 by hardkoder@gmail (http://www.kipple.pe.kr) \n"); +// printf("unalz v0.60 (2006/12/31) \n"); + printf("unalz v0.61 (2007/02/10) \n"); + printf("Copyright(C) 2004-2007 by hardkoder@gmail (http://www.kipple.pe.kr) \n"); } @@ -93,7 +94,7 @@ void UnAlzCallback(const char* szFileName, INT64 nCurrent, INT64 nRange, void* p INT64 percent; // ÆÄÀϸí Ãâ·Â.. - if(szMessage) + if(szFileName) { printf("\n"); #ifdef _WIN32 diff --git a/readme.txt b/readme.txt index 864a138..237bcb8 100755 --- a/readme.txt +++ b/readme.txt @@ -1,8 +1,8 @@ - unalz v0.60 + unalz v0.61 - Copyright(C) 2004-2006 by hardkoder (http://www.kipple.pe.kr) + Copyright(C) 2004-2007 by hardkoder (http://www.kipple.pe.kr) - ÃÖÃÊ ÀÛ¼ºÀÏ : v0.20 - 2004/10/22 diff --git a/unalz.sln b/unalz.sln deleted file mode 100755 index 3862ee4..0000000 --- a/unalz.sln +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unalz", "unalz.vcproj", "{E92968E8-DF95-411B-80E2-23F17B3DDFF8}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SourceCodeControl) = preSolution - SccNumberOfProjects = 1 - SccProjectUniqueName0 = unalz.vcproj - SccProjectName0 = \u0022$/Home/unalz\u0022,\u0020VXBAAAAA - SccLocalPath0 = . - SccProvider0 = MSSCCI:Microsoft\u0020Visual\u0020SourceSafe - CanCheckoutShared = false - EndGlobalSection - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {E92968E8-DF95-411B-80E2-23F17B3DDFF8}.Debug.ActiveCfg = Debug|Win32 - {E92968E8-DF95-411B-80E2-23F17B3DDFF8}.Debug.Build.0 = Debug|Win32 - {E92968E8-DF95-411B-80E2-23F17B3DDFF8}.Release.ActiveCfg = Release|Win32 - {E92968E8-DF95-411B-80E2-23F17B3DDFF8}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/unalz.vcproj b/unalz.vcproj deleted file mode 100755 index 5fed447..0000000 --- a/unalz.vcproj +++ /dev/null @@ -1,397 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -