From: <lab...@us...> - 2015-05-27 17:17:11
|
Revision: 1533 http://sourceforge.net/p/opengtoolkit/svn/1533 Author: labviewer Date: 2015-05-27 17:17:08 +0000 (Wed, 27 May 2015) Log Message: ----------- Some cosmetic changes from the Mac Modified Paths: -------------- trunk/lvzip/c_source/iomem.c trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj trunk/lvzip/c_source/unzip.h trunk/lvzip/c_source/zip.c Modified: trunk/lvzip/c_source/iomem.c =================================================================== --- trunk/lvzip/c_source/iomem.c 2015-05-27 15:22:25 UTC (rev 1532) +++ trunk/lvzip/c_source/iomem.c 2015-05-27 17:17:08 UTC (rev 1533) @@ -58,10 +58,7 @@ int error; } MEMORY_IO; -voidpf ZCALLBACK mem_open_file_func (opaque, filename, mode) - voidpf opaque; - const void* filename; - int mode; +voidpf ZCALLBACK mem_open_file_func (voidpf opaque, const void* filename, int mode) { MEMORY_IO *memio = malloc(sizeof(MEMORY_IO)); Unused(opaque); @@ -72,18 +69,17 @@ memio->mode = mode; memio->error = 0; -/* if (opaque && !(mode & ZLIB_FILEFUNC_MODE_CREATE)) - memio->pos = LStrLen(*(LStrHandle)opaque); */ + if (opaque && !(mode & ZLIB_FILEFUNC_MODE_CREATE)) + memio->pos = LStrLen(*(LStrHandle)opaque); } return memio; } -voidpf ZCALLBACK mem_opendisk_file_func (opaque, stream, number_disk, mode) - voidpf opaque; - voidpf stream; - int number_disk; - int mode; +voidpf ZCALLBACK mem_opendisk_file_func (voidpf opaque, voidpf stream, int number_disk, int mode) { + Unused(opaque); + Unused(number_disk); + Unused(mode); if (stream) { MEMORY_IO* mem = (MEMORY_IO*)stream; @@ -92,11 +88,7 @@ return NULL; } -uLong ZCALLBACK mem_read_file_func (opaque, stream, buf, size) - voidpf opaque; - voidpf stream; - void* buf; - uLong size; +uLong ZCALLBACK mem_read_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) { if (stream && opaque) { @@ -152,11 +144,7 @@ return mgNoErr; } -uLong ZCALLBACK mem_write_file_func (opaque, stream, buf, size) - voidpf opaque; - voidpf stream; - const void* buf; - uLong size; +uLong ZCALLBACK mem_write_file_func (voidpf opaque, voidpf stream, const void* buf, uLong size) { MEMORY_IO* mem = (MEMORY_IO*)stream; ZPOS64_T len = size; @@ -175,9 +163,7 @@ return 0; } -ZPOS64_T ZCALLBACK mem_tell_file_func (opaque, stream) - voidpf opaque; - voidpf stream; +ZPOS64_T ZCALLBACK mem_tell_file_func (voidpf opaque, voidpf stream) { Unused(opaque); if (stream != NULL) @@ -187,11 +173,7 @@ return -1; } -long ZCALLBACK mem_seek_file_func (opaque, stream, offset, origin) - voidpf opaque; - voidpf stream; - ZPOS64_T offset; - int origin; +long ZCALLBACK mem_seek_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin) { if (stream != NULL) { @@ -224,10 +206,7 @@ return -1; } -int ZCALLBACK mem_close_file_func (opaque, stream, output) - voidpf opaque; - voidpf stream; - voidpf output; +int ZCALLBACK mem_close_file_func (voidpf opaque, voidpf stream, voidpf output) { int ret = -1; UHandle s = (UHandle)opaque; @@ -257,22 +236,18 @@ return ret; } -int ZCALLBACK mem_error_file_func (opaque, stream) - voidpf opaque; - voidpf stream; +int ZCALLBACK mem_error_file_func (voidpf opaque, voidpf stream) { - int ret=-1; + int ret = -1; Unused(opaque); - if (stream!=NULL) + if (stream != NULL) { ret = ((MEMORY_IO*)stream)->error; } return ret; } -void fill_mem_filefunc (pzlib_filefunc_def, memory) - zlib_filefunc64_def* pzlib_filefunc_def; - LStrHandle *memory; +void fill_mem_filefunc (zlib_filefunc64_def* pzlib_filefunc_def, LStrHandle *memory) { pzlib_filefunc_def->zopen64_file = mem_open_file_func; pzlib_filefunc_def->zopendisk64_file = mem_opendisk_file_func; Modified: trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj =================================================================== --- trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2015-05-27 15:22:25 UTC (rev 1532) +++ trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2015-05-27 17:17:08 UTC (rev 1533) @@ -210,9 +210,9 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 83D3E1AE080D116E00DE332C /* OSX DLL */ = { + 83D3E1AE080D116E00DE332C /* LVZIP Framework */ = { isa = PBXNativeTarget; - buildConfigurationList = C77CC6B40C9C7C6500886AB2 /* Build configuration list for PBXNativeTarget "OSX DLL" */; + buildConfigurationList = C77CC6B40C9C7C6500886AB2 /* Build configuration list for PBXNativeTarget "LVZIP Framework" */; buildPhases = ( 83D3E1A9080D116E00DE332C /* Headers */, 83D3E1AA080D116E00DE332C /* Sources */, @@ -223,7 +223,7 @@ ); dependencies = ( ); - name = "OSX DLL"; + name = "LVZIP Framework"; productName = "OSX DLL"; productReference = 83D3E1AF080D116E00DE332C /* lvzlib.framework */; productType = "com.apple.product-type.framework"; @@ -247,7 +247,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 83D3E1AE080D116E00DE332C /* OSX DLL */, + 83D3E1AE080D116E00DE332C /* LVZIP Framework */, ); }; /* End PBXProject section */ @@ -487,7 +487,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - C77CC6B40C9C7C6500886AB2 /* Build configuration list for PBXNativeTarget "OSX DLL" */ = { + C77CC6B40C9C7C6500886AB2 /* Build configuration list for PBXNativeTarget "LVZIP Framework" */ = { isa = XCConfigurationList; buildConfigurations = ( C77CC6B50C9C7C6500886AB2 /* Development */, Modified: trunk/lvzip/c_source/unzip.h =================================================================== --- trunk/lvzip/c_source/unzip.h 2015-05-27 15:22:25 UTC (rev 1532) +++ trunk/lvzip/c_source/unzip.h 2015-05-27 17:17:08 UTC (rev 1533) @@ -229,12 +229,16 @@ /* Unzip package allow you browse the directory of the zipfile */ ZEXTERN int ZEXPORT unzGoToFirstFile OF((unzFile file)); +ZEXTERN int ZEXPORT unzGoToFirstFile2 OF((unzFile file, unz_file_info64 *pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char *comment, uLong comment_size)); /* Set the current file of the zipfile to the first file. return UNZ_OK if there is no problem */ ZEXTERN int ZEXPORT unzGoToNextFile OF((unzFile file)); +ZEXTERN int ZEXPORT unzGoToNextFile2 OF((unzFile file, unz_file_info64 *pfile_info, char *filename, + uLong filename_size, void *extrafield, uLong extrafield_size, char *comment, uLong comment_size)); /* Set the current file of the zipfile to the next file. return UNZ_OK if there is no problem Modified: trunk/lvzip/c_source/zip.c =================================================================== --- trunk/lvzip/c_source/zip.c 2015-05-27 15:22:25 UTC (rev 1532) +++ trunk/lvzip/c_source/zip.c 2015-05-27 17:17:08 UTC (rev 1533) @@ -1852,7 +1852,7 @@ #endif if (!zi->ci.raw) { - if ((zi->ci.compression_method == Z_DEFLATED)) + if (zi->ci.compression_method == Z_DEFLATED) { int tmp_err = deflateEnd(&zi->ci.stream); if (err == ZIP_OK) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2016-12-08 11:05:39
|
Revision: 1543 http://sourceforge.net/p/opengtoolkit/svn/1543 Author: labviewer Date: 2016-12-08 11:05:37 +0000 (Thu, 08 Dec 2016) Log Message: ----------- Allow for dynamic loading of SymbolicLink API Modified Paths: -------------- trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/lvutil.h trunk/lvzip/c_source/zlibvc.vcproj Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2016-12-04 23:36:48 UTC (rev 1542) +++ trunk/lvzip/c_source/lvutil.c 2016-12-08 11:05:37 UTC (rev 1543) @@ -6,9 +6,9 @@ */ #define ZLIB_INTERNAL +#include "lvutil.h" #include "zlib.h" #include "ioapi.h" -#include "lvutil.h" #include "iomem.h" #include "utf.h" #if Unix @@ -381,6 +381,7 @@ case ERROR_SHARING_VIOLATION: return fNoPerm; case ERROR_ALREADY_EXISTS: case ERROR_FILE_EXISTS: return fDupPath; + case ERROR_NOT_SUPPORTED: return mgNotSupported; case ERROR_NO_MORE_FILES: return mgNoErr; } return fIOErr; /* fIOErr generally signifies some unknown file error */ @@ -1595,6 +1596,48 @@ return err; } +#if Win32 +typedef BOOL (WINAPI *tCreateHardLinkW)(LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes); +BOOL Win32CreateHardLinkW(LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes) +{ + static tCreateHardLinkW pCreateHardLinkW = NULL; + if (!pCreateHardLinkW) + { + HMODULE hLib = LoadLibrary("kernel32.dll"); + if (hLib) + { + pCreateHardLinkW = (tCreateHardLinkW)GetProcAddress(hLib, "CreateHardLinkW"); + } + } + if (pCreateHardLinkW) + { + return pCreateHardLinkW(lpFileName, lpExistingFileName, lpSecurityAttributes); + } + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; +} + +typedef BOOL (WINAPI *tCreateSymbolicLinkW)(LPCWSTR lpSymlinkFileName, LPCWSTR lpTargetFileName, DWORD dwFlags); +BOOL Win32CreateSymbolicLinkW(LPCWSTR lpSymlinkFileName, LPCWSTR lpTargetFileName, DWORD dwFlags) +{ + static tCreateSymbolicLinkW pCreateSymbolicLinkW = NULL; + if (!pCreateSymbolicLinkW) + { + HMODULE hLib = LoadLibrary("kernel32.dll"); + if (hLib) + { + pCreateSymbolicLinkW = (tCreateSymbolicLinkW)GetProcAddress(hLib, "CreateSymbolicLinkW"); + } + } + if (pCreateSymbolicLinkW) + { + return pCreateSymbolicLinkW(lpSymlinkFileName, lpTargetFileName, dwFlags); + } + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; +} +#endif + LibAPI(MgErr) LVPath_CreateLink(Path path, uInt32 flags, Path target) { MgErr err = mgNoErr; @@ -1621,7 +1664,7 @@ if (symlink((const char*)LStrBuf(src), (const char*)LStrBuf(tgt))) err = UnixToLVFileErr(); } -#elif Win32 +#elif Win32 && !EMBEDDED if (FExists(target)) { FInfoRec finfo; @@ -1636,13 +1679,15 @@ if (flags & kLinkHard) { if (flags & kLinkDir) + { err = mgNotSupported; - else if (!CreateHardLinkW(UStrBuf(src), UStrBuf(tgt), NULL)) + } + else if (!Win32CreateHardLinkW(UStrBuf(src), UStrBuf(tgt), NULL)) { err = Win32ToLVFileErr(); } } - else if (!CreateSymbolicLinkW(UStrBuf(src), UStrBuf(tgt), flags & kLinkDir ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0)) + else if (!Win32CreateSymbolicLinkW(UStrBuf(src), UStrBuf(tgt), flags & kLinkDir ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0)) { err = Win32ToLVFileErr(); } @@ -1774,7 +1819,7 @@ if (!err) { LStrHandle handle = NULL; - err = WideCStrToMultiByte((LPCWCHAR)wTgt, -1, &handle, CP_ACP, 0, NULL); + err = WideCStrToMultiByte((LPCWSTR)wTgt, -1, &handle, CP_ACP, 0, NULL); if (!err) err = FTextToPath(LStrBuf(*handle), LStrLen(*handle), target); if (handle) @@ -2566,7 +2611,7 @@ #endif } -LibAPI(uInt32) determine_codepage(uLong *flags, LStrHandle string) +LibAPI(uInt32) determine_codepage(uInt32 *flags, LStrHandle string) { uInt32 cp = Hi16(*flags); if (!cp) Modified: trunk/lvzip/c_source/lvutil.h =================================================================== --- trunk/lvzip/c_source/lvutil.h 2016-12-04 23:36:48 UTC (rev 1542) +++ trunk/lvzip/c_source/lvutil.h 2016-12-08 11:05:37 UTC (rev 1543) @@ -65,6 +65,7 @@ #define DEBUG 1 #endif #define BigEndian 0 + #define _WIN32_WINNT 0x0501 #elif defined(linux) || defined(__linux) || defined(__linux__) #if defined(i386) #define ProcessorType kX86 @@ -618,7 +619,7 @@ /**************************/ /* Version string of the zlib library */ -LibAPI(void) DLLVersion OF((uChar* Version)); +LibAPI(void) DLLVersion(uChar* Version); /* Convert the path into a string representation for the current platform */ LibAPI(MgErr) LVPath_ToText(Path path, LStrHandle *str); @@ -680,14 +681,14 @@ uInt16 str[1]; } UString, *UStrPtr, **UStrHandle; -#define UStrLen(s) LStrLen(s) * sizeof(uInt16) / sizeof(wchar_t) +#define UStrLen(s) (int32)(LStrLen(s) * sizeof(uInt16) / sizeof(wchar_t)) #define UStrLenSet(s, l) LStrLen(s) = l * sizeof(wchar_t) / sizeof(uInt16) #define UStrBuf(s) ((wchar_t*)(LStrBuf(s))) LibAPI(MgErr) ZeroTerminateLString(LStrHandle *dest); LibAPI(uInt32) GetCurrentCodePage(LVBoolean acp); -LibAPI(uInt32) determine_codepage(uLong *flags, LStrHandle string); +LibAPI(uInt32) determine_codepage(uInt32 *flags, LStrHandle string); LibAPI(MgErr) MultiByteCStrToWideString(ConstCStr src, int32 srclen, UStrHandle *dest, uInt32 codePage); LibAPI(MgErr) MultiByteToWideString(const LStrHandle src, UStrHandle *dest, uInt32 codePage); LibAPI(MgErr) WideStringToMultiByte(const UStrHandle src, LStrHandle *dest, uInt32 codePage, char defaultChar, LVBoolean *defaultCharWasUsed); Modified: trunk/lvzip/c_source/zlibvc.vcproj =================================================================== --- trunk/lvzip/c_source/zlibvc.vcproj 2016-12-04 23:36:48 UTC (rev 1542) +++ trunk/lvzip/c_source/zlibvc.vcproj 2016-12-08 11:05:37 UTC (rev 1543) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="8.00" + Version="8,00" Name="zlibvc" ProjectGUID="{FF990D80-DB65-4107-B10C-5F7ACEF6F01B}" RootNamespace="zlibvc" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-09 16:15:04
|
Revision: 1553 http://sourceforge.net/p/opengtoolkit/svn/1553 Author: labviewer Date: 2018-12-09 16:15:03 +0000 (Sun, 09 Dec 2018) Log Message: ----------- Fix several small errors caused by new code Modified Paths: -------------- trunk/lvzip/c_source/compress.c trunk/lvzip/c_source/deflate.c trunk/lvzip/c_source/inflate.c trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvapi.h trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/trees.c trunk/lvzip/c_source/uncompr.c trunk/lvzip/c_source/zalias.h trunk/lvzip/c_source/zlib.h trunk/lvzip/c_source/zlibvc.vcproj Modified: trunk/lvzip/c_source/compress.c =================================================================== --- trunk/lvzip/c_source/compress.c 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/compress.c 2018-12-09 16:15:03 UTC (rev 1553) @@ -53,7 +53,7 @@ err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH); } while (err == Z_OK); - *destLen = stream.total_out; + *destLen = (uLongf)stream.total_out; deflateEnd(&stream); return err == Z_STREAM_END ? Z_OK : err; } Modified: trunk/lvzip/c_source/deflate.c =================================================================== --- trunk/lvzip/c_source/deflate.c 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/deflate.c 2018-12-09 16:15:03 UTC (rev 1553) @@ -198,8 +198,7 @@ * bit values at the expense of memory usage). We slide even when level == 0 to * keep the hash table consistent if we switch back to level > 0 later. */ -local void slide_hash(s) - deflate_state *s; +local void slide_hash(deflate_state *s) { unsigned n, m; Posf *p; @@ -338,8 +337,7 @@ /* ========================================================================= * Check for a valid deflate stream state. Return 0 if ok, 1 if not. */ -local int deflateStateCheck (strm) - z_streamp strm; +local int deflateStateCheck(z_streamp strm) { deflate_state *s; if (strm == Z_NULL || Modified: trunk/lvzip/c_source/inflate.c =================================================================== --- trunk/lvzip/c_source/inflate.c 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/inflate.c 2018-12-09 16:15:03 UTC (rev 1553) @@ -115,8 +115,7 @@ return 0; } -int ZEXPORT inflateResetKeep(strm) -z_streamp strm; +int ZEXPORT inflateResetKeep(z_streamp strm) { struct inflate_state FAR *state; @@ -140,8 +139,7 @@ return Z_OK; } -int ZEXPORT inflateReset(strm) -z_streamp strm; +int ZEXPORT inflateReset(z_streamp strm) { struct inflate_state FAR *state; @@ -153,9 +151,7 @@ return inflateResetKeep(strm); } -int ZEXPORT inflateReset2(strm, windowBits) -z_streamp strm; -int windowBits; +int ZEXPORT inflateReset2(z_streamp strm, int windowBits) { int wrap; struct inflate_state FAR *state; @@ -191,11 +187,7 @@ return inflateReset(strm); } -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) -z_streamp strm; -int windowBits; -const char *version; -int stream_size; +int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, int stream_size) { int ret; struct inflate_state FAR *state; @@ -235,18 +227,12 @@ return ret; } -int ZEXPORT inflateInit_(strm, version, stream_size) -z_streamp strm; -const char *version; -int stream_size; +int ZEXPORT inflateInit_(z_streamp strm, const char *version, int stream_size) { return inflateInit2_(strm, DEF_WBITS, version, stream_size); } -int ZEXPORT inflatePrime(strm, bits, value) -z_streamp strm; -int bits; -int value; +int ZEXPORT inflatePrime(z_streamp strm, int bits, int value) { struct inflate_state FAR *state; @@ -274,8 +260,7 @@ used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ -local void fixedtables(state) -struct inflate_state FAR *state; +local void fixedtables(struct inflate_state FAR *state) { #ifdef BUILDFIXED static int virgin = 1; @@ -392,10 +377,7 @@ output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ -local int updatewindow(strm, end, copy) -z_streamp strm; -const Bytef *end; -unsigned copy; +local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) { struct inflate_state FAR *state; unsigned dist; @@ -618,9 +600,7 @@ will return Z_BUF_ERROR if it has not reached the end of the stream. */ -int ZEXPORT inflate(strm, flush) -z_streamp strm; -int flush; +int ZEXPORT inflate(z_streamp strm, int flush) { struct inflate_state FAR *state; z_const unsigned char FAR *next; /* next input */ @@ -1273,8 +1253,7 @@ return ret; } -int ZEXPORT inflateEnd(strm) -z_streamp strm; +int ZEXPORT inflateEnd(z_streamp strm) { struct inflate_state FAR *state; if (inflateStateCheck(strm)) @@ -1287,10 +1266,7 @@ return Z_OK; } -int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) -z_streamp strm; -Bytef *dictionary; -uInt *dictLength; +int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength) { struct inflate_state FAR *state; @@ -1310,10 +1286,7 @@ return Z_OK; } -int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) -z_streamp strm; -const Bytef *dictionary; -uInt dictLength; +int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength) { struct inflate_state FAR *state; unsigned long dictid; @@ -1345,9 +1318,7 @@ return Z_OK; } -int ZEXPORT inflateGetHeader(strm, head) -z_streamp strm; -gz_headerp head; +int ZEXPORT inflateGetHeader(z_streamp strm, gz_headerp head) { struct inflate_state FAR *state; @@ -1373,10 +1344,7 @@ called again with more data and the *have state. *have is initialized to zero for the first call. */ -local unsigned syncsearch(have, buf, len) -unsigned FAR *have; -const unsigned char FAR *buf; -unsigned len; +local unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf, unsigned len) { unsigned got; unsigned next; @@ -1396,11 +1364,10 @@ return next; } -int ZEXPORT inflateSync(strm) -z_streamp strm; +int ZEXPORT inflateSync(z_streamp strm) { unsigned len; /* number of bytes to look at or looked at */ - unsigned long in, out; /* temporary to save total_in and total_out */ + uint64_t in, out; /* temporary to save total_in and total_out */ unsigned char buf[4]; /* to restore bit buffer to byte string */ struct inflate_state FAR *state; @@ -1447,8 +1414,7 @@ block. When decompressing, PPP checks that at the end of input packet, inflate is waiting for these length bytes. */ -int ZEXPORT inflateSyncPoint(strm) -z_streamp strm; +int ZEXPORT inflateSyncPoint(z_streamp strm) { struct inflate_state FAR *state; @@ -1457,9 +1423,7 @@ return state->mode == STORED && state->bits == 0; } -int ZEXPORT inflateCopy(dest, source) -z_streamp dest; -z_streamp source; +int ZEXPORT inflateCopy(z_streamp dest, z_streamp source) { struct inflate_state FAR *state; struct inflate_state FAR *copy; @@ -1504,9 +1468,7 @@ return Z_OK; } -int ZEXPORT inflateUndermine(strm, subvert) -z_streamp strm; -int subvert; +int ZEXPORT inflateUndermine(z_streamp strm, int subvert) { struct inflate_state FAR *state; Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/lvapi.c 2018-12-09 16:15:03 UTC (rev 1553) @@ -2,12 +2,13 @@ Copyright (C) 2009-2015 Rolf Kalbermatter */ +#include <string.h> +#include <mbstring.h> #define ZLIB_INTERNAL #include "zlib.h" #include "lvutil.h" #include "zip.h" #include "unzip.h" -#include <string.h> #include "lvapi.h" #ifndef VERSIONMADEBY @@ -180,7 +181,7 @@ LibAPI(MgErr) lvzlib_zipOpen(const void *pathname, int append, LStrHandle *globalcomment, zlib_filefunc64_def* filefuncs, LVRefNum *refnum) { - zipcharpc comment; + const char *comment; zipFile node = zipOpen3_64(pathname, append, 0, &comment, filefuncs); *refnum = kNotARefNum; @@ -229,10 +230,10 @@ if (!err) { err = LibToMgErr(zipOpenNewFileInZip4_64(node, (const char*)LStrBufH(filename), zipfi, - LStrBufH(extrafield_local), LStrLenH(extrafield_local), - LStrBufH(extrafield_global), LStrLenH(extrafield_global), - (const char*)LStrBufH(comment), method, level, raw, windowBits, memLevel, - strategy, password[0] ? password : NULL, crcForCrypting, version, flags, zip64)); + LStrBufH(extrafield_local), (uint16_t)LStrLenH(extrafield_local), + LStrBufH(extrafield_global), (uint16_t)LStrLenH(extrafield_global), + (const char*)LStrBufH(comment), (uint16_t)method, level, raw, windowBits, memLevel, + strategy, password[0] ? password : NULL, crcForCrypting, (uint16_t)version, (uint16_t)flags, zip64)); } } } @@ -291,7 +292,7 @@ if (err) comment = globalComment; } - retval = zipClose2(node, (const char*)LStrBufH(comment), stream); + retval = zipClose2(node, (const char*)LStrBufH(comment), VERSIONMADEBY, (voidpf*)stream); if (comment) DSDisposeHandle((UHandle)comment); if (!err && retval) @@ -334,7 +335,7 @@ * refnum: An archive extraction file reference * ****************************************************************************************************/ -LibAPI(MgErr) lvzlib_unzClose(LVRefNum *refnum) +LibAPI(MgErr) lvzlib_unzClose(LVRefNum *refnum, LStrHandle *stream) { unzFile node; MgErr err = lvzlibDisposeRefnum(refnum, &node, UnzMagic); @@ -341,7 +342,7 @@ if (!err) { *refnum = kNotARefNum; - err = LibToMgErr(unzClose(node)); + err = LibToMgErr(unzClose2(node, (voidpf*)stream)); } return err; } @@ -423,6 +424,11 @@ * characters or multibyte characters. * ****************************************************************************************************/ +static int caseInsensitiveNameComparer(unzFile file, const char *filename1, const char *filename2) +{ + return _mbsicmp((const unsigned char*)filename1, (const unsigned char*)filename2); +} + LibAPI(MgErr) lvzlib_unzLocateFile(LVRefNum *refnum, LStrHandle fileName, int iCaseSensitivity) { unzFile node; @@ -432,7 +438,7 @@ err = ZeroTerminateLString(&fileName); if (!err) { - err = LibToMgErr(unzLocateFile(node, (const char*)LStrBufH(fileName), iCaseSensitivity)); + err = LibToMgErr(unzLocateFile(node, (const char*)LStrBufH(fileName), iCaseSensitivity ? caseInsensitiveNameComparer : NULL)); } } return err; Modified: trunk/lvzip/c_source/lvapi.h =================================================================== --- trunk/lvzip/c_source/lvapi.h 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/lvapi.h 2018-12-09 16:15:03 UTC (rev 1553) @@ -23,7 +23,7 @@ LibAPI(MgErr) lvzlib_zipCloseFileInZipRaw64(LVRefNum *refnum, uInt64 uncompressedSize, uInt32 crc32); LibAPI(MgErr) lvzlib_zipClose(LVRefNum *refnum, const LStrHandle globalComment, LStrHandle *stream); LibAPI(MgErr) lvzlib_unzOpen(const void *pathname, zlib_filefunc64_def* filefuncs, LVRefNum *refnum); -LibAPI(MgErr) lvzlib_unzClose(LVRefNum *refnum); +LibAPI(MgErr) lvzlib_unzClose(LVRefNum *refnum, LStrHandle *stream); LibAPI(MgErr) lvzlib_unzGetGlobalInfo32(LVRefNum *refnum, LStrHandle *comment, uInt32 *nEntry); LibAPI(MgErr) lvzlib_unzGetGlobalInfo64(LVRefNum *refnum, LStrHandle *comment, uInt64 *nEntry); LibAPI(MgErr) lvzlib_unzLocateFile(LVRefNum *refnum, LStrHandle fileName, int iCaseSensitivity); Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/lvutil.c 2018-12-09 16:15:03 UTC (rev 1553) @@ -1706,7 +1706,7 @@ } if (hFile != INVALID_HANDLE_VALUE) { - int32 length = wcslen(lpTargetFileName) + 1, offset = 0; + int32 length = (int32)wcslen(lpTargetFileName) + 1, offset = 0; WCHAR namebuf[MAX_PATH + 6]; DWORD bytes = (DWORD)(REPARSE_DATA_BUFFER_HEADER_SIZE + length * sizeof(WCHAR) * 2 + 20); PREPARSE_DATA_BUFFER buffer = (PREPARSE_DATA_BUFFER)DSNewPClr(bytes); Modified: trunk/lvzip/c_source/trees.c =================================================================== --- trunk/lvzip/c_source/trees.c 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/trees.c 2018-12-09 16:15:03 UTC (rev 1553) @@ -376,8 +376,7 @@ /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ -void ZLIB_INTERNAL _tr_init(s) - deflate_state *s; +void ZLIB_INTERNAL _tr_init(deflate_state *s) { tr_static_init(); @@ -404,8 +403,7 @@ /* =========================================================================== * Initialize a new block. */ -local void init_block(s) - deflate_state *s; +local void init_block(deflate_state *s) { int n; /* iterates over tree elements */ @@ -448,10 +446,7 @@ * when the heap property is re-established (each father smaller than its * two sons). */ -local void pqdownheap(s, tree, k) - deflate_state *s; - ct_data *tree; /* the tree to restore */ - int k; /* node to move down */ +local void pqdownheap(deflate_state *s, ct_data *tree /* the tree to restore */, int k /* node to move down */) { int v = s->heap[k]; int j = k << 1; /* left son of k */ @@ -483,9 +478,7 @@ * The length opt_len is updated; static_len is also updated if stree is * not null. */ -local void gen_bitlen(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ +local void gen_bitlen(deflate_state *s, tree_desc *desc /* the tree descriptor */) { ct_data *tree = desc->dyn_tree; int max_code = desc->max_code; @@ -569,10 +562,11 @@ * OUT assertion: the field code is set for all tree elements of non * zero code length. */ -local void gen_codes (tree, max_code, bl_count) - ct_data *tree; /* the tree to decorate */ - int max_code; /* largest code with non zero frequency */ - ushf *bl_count; /* number of codes at each bit length */ +local void gen_codes ( + ct_data *tree, /* the tree to decorate */ + int max_code, /* largest code with non zero frequency */ + ushf *bl_count /* number of codes at each bit length */ +) { ush next_code[MAX_BITS+1]; /* next code value for each bit length */ unsigned code = 0; /* running code value */ @@ -612,9 +606,7 @@ * and corresponding code. The length opt_len is updated; static_len is * also updated if stree is not null. The field max_code is set. */ -local void build_tree(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ +local void build_tree(deflate_state *s, tree_desc *desc /* the tree descriptor */) { ct_data *tree = desc->dyn_tree; const ct_data *stree = desc->stat_desc->static_tree; @@ -700,10 +692,11 @@ * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ -local void scan_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ +local void scan_tree ( + deflate_state *s, + ct_data *tree, /* the tree to be scanned */ + int max_code /* and its largest code of non zero frequency */ +) { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ @@ -745,10 +738,11 @@ * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ -local void send_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ +local void send_tree ( + deflate_state *s, + ct_data *tree, /* the tree to be scanned */ + int max_code /* and its largest code of non zero frequency */ +) { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ @@ -796,8 +790,7 @@ * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ -local int build_bl_tree(s) - deflate_state *s; +local int build_bl_tree(deflate_state *s) { int max_blindex; /* index of last bit length code of non zero freq */ @@ -831,9 +824,7 @@ * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ -local void send_all_trees(s, lcodes, dcodes, blcodes) - deflate_state *s; - int lcodes, dcodes, blcodes; /* number of codes for each tree */ +local void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes /* number of codes for each tree */) { int rank; /* index in bl_order */ @@ -860,13 +851,14 @@ /* =========================================================================== * Send a stored block */ -void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) - deflate_state *s; - charf *buf; /* input block */ - ulg stored_len; /* length of input block */ - int last; /* one if this is the last block for a file */ +void ZLIB_INTERNAL _tr_stored_block( + deflate_state *s, + charf *buf, /* input block */ + ulg stored_len, /* length of input block */ + int last /* one if this is the last block for a file */ +) { - send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ + send_bits(s, (STORED_BLOCK << 1) + last, 3); /* send block type */ bi_windup(s); /* align on byte boundary */ put_short(s, (ush)stored_len); put_short(s, (ush)~stored_len); @@ -883,8 +875,7 @@ /* =========================================================================== * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) */ -void ZLIB_INTERNAL _tr_flush_bits(s) - deflate_state *s; +void ZLIB_INTERNAL _tr_flush_bits(deflate_state *s) { bi_flush(s); } @@ -893,8 +884,7 @@ * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. */ -void ZLIB_INTERNAL _tr_align(s) - deflate_state *s; +void ZLIB_INTERNAL _tr_align(deflate_state *s) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); @@ -908,11 +898,12 @@ * Determine the best encoding for the current block: dynamic trees, static * trees or store, and write out the encoded block. */ -void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) - deflate_state *s; - charf *buf; /* input block, or NULL if too old */ - ulg stored_len; /* length of input block */ - int last; /* one if this is the last block for a file */ +void ZLIB_INTERNAL _tr_flush_block( + deflate_state *s, + charf *buf, /* input block, or NULL if too old */ + ulg stored_len, /* length of input block */ + int last /* one if this is the last block for a file */ +) { ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ int max_blindex = 0; /* index of last bit length code of non zero freq */ @@ -1011,10 +1002,11 @@ * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ -int ZLIB_INTERNAL _tr_tally (s, dist, lc) - deflate_state *s; - unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +int ZLIB_INTERNAL _tr_tally ( + deflate_state *s, + unsigned dist, /* distance of matched string */ + unsigned lc /* match length-MIN_MATCH or unmatched char (if dist==0) */ +) { s->d_buf[s->last_lit] = (ush)dist; s->l_buf[s->last_lit++] = (uch)lc; @@ -1061,10 +1053,11 @@ /* =========================================================================== * Send the block data compressed using the given Huffman trees */ -local void compress_block(s, ltree, dtree) - deflate_state *s; - const ct_data *ltree; /* literal tree */ - const ct_data *dtree; /* distance tree */ +local void compress_block( + deflate_state *s, + const ct_data *ltree, /* literal tree */ + const ct_data *dtree /* distance tree */ +) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ @@ -1121,8 +1114,7 @@ * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). * IN assertion: the fields Freq of dyn_ltree are set. */ -local int detect_data_type(s) - deflate_state *s; +local int detect_data_type(deflate_state *s) { /* black_mask is the bit mask of black-listed bytes * set bits 0..6, 14..25, and 28..31 @@ -1155,9 +1147,10 @@ * method would use a table) * IN assertion: 1 <= len <= 15 */ -local unsigned bi_reverse(code, len) - unsigned code; /* the value to invert */ - int len; /* its bit length */ +local unsigned bi_reverse( + unsigned code, /* the value to invert */ + int len /* its bit length */ +) { register unsigned res = 0; do { @@ -1170,8 +1163,7 @@ /* =========================================================================== * Flush the bit buffer, keeping at most 7 bits in it. */ -local void bi_flush(s) - deflate_state *s; +local void bi_flush(deflate_state *s) { if (s->bi_valid == 16) { put_short(s, s->bi_buf); @@ -1187,8 +1179,7 @@ /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ -local void bi_windup(s) - deflate_state *s; +local void bi_windup(deflate_state *s) { if (s->bi_valid > 8) { put_short(s, s->bi_buf); Modified: trunk/lvzip/c_source/uncompr.c =================================================================== --- trunk/lvzip/c_source/uncompr.c 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/uncompr.c 2018-12-09 16:15:03 UTC (rev 1553) @@ -68,7 +68,7 @@ *sourceLen -= len + stream.avail_in; if (dest != buf) - *destLen = stream.total_out; + *destLen = (uLongf)stream.total_out; else if (stream.total_out && err == Z_BUF_ERROR) left = 1; Modified: trunk/lvzip/c_source/zalias.h =================================================================== --- trunk/lvzip/c_source/zalias.h 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/zalias.h 2018-12-09 16:15:03 UTC (rev 1553) @@ -58,6 +58,7 @@ #define zlibVersion lvzip_zlibVersion #define unzClose lvzip_unzClose +#define unzClose2 lvzip_unzClose2 #define unzCloseCurrentFile lvzip_unzCloseCurrentFile #define unzGetCurrentFileInfo lvzip_unzGetCurrentFileInfo #define unzGetCurrentFileInfo64 lvzip_unzGetCurrentFileInfo64 Modified: trunk/lvzip/c_source/zlib.h =================================================================== --- trunk/lvzip/c_source/zlib.h 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/zlib.h 2018-12-09 16:15:03 UTC (rev 1553) @@ -31,6 +31,8 @@ #ifndef ZLIB_H #define ZLIB_H +#include <stdint.h> + #include "zalias.h" #include "zconf.h" @@ -45,6 +47,10 @@ #define ZLIB_VER_REVISION 11 #define ZLIB_VER_SUBREVISION 0 +#if defined(_MSC_VER) +#pragma warning(disable: 4100 4101 4127) +#endif + /* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. @@ -87,11 +93,11 @@ typedef struct z_stream_s { z_const Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total number of input bytes read so far */ + uint64_t total_in; /* total number of input bytes read so far */ Bytef *next_out; /* next output byte will go here */ uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total number of bytes output so far */ + uint64_t total_out; /* total number of bytes output so far */ z_const char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ Modified: trunk/lvzip/c_source/zlibvc.vcproj =================================================================== --- trunk/lvzip/c_source/zlibvc.vcproj 2018-12-09 16:12:42 UTC (rev 1552) +++ trunk/lvzip/c_source/zlibvc.vcproj 2018-12-09 16:15:03 UTC (rev 1553) @@ -294,6 +294,7 @@ Optimization="0" AdditionalIncludeDirectories="bzip2" PreprocessorDefinitions="WIN32;_DEBUG;NO_vsnprintf;HAVE_AES;HAVE_BZIP2;BZ_NO_STDIO;_CRT_SECURE_NO_WARNINGS" + GeneratePreprocessedFile="0" RuntimeLibrary="3" PrecompiledHeaderFile="$(IntDir)\zlibvc.pch" AssemblerListingLocation="$(IntDir)\" @@ -1658,10 +1659,6 @@ </FileConfiguration> </File> <File - RelativePath=".\minishared.c" - > - </File> - <File RelativePath="mztools.c" > <FileConfiguration @@ -1938,7 +1935,6 @@ > <FileConfiguration Name="DLL Release|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1946,7 +1942,6 @@ </FileConfiguration> <FileConfiguration Name="DLL Release|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1954,7 +1949,6 @@ </FileConfiguration> <FileConfiguration Name="DLL Embedded|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1962,7 +1956,6 @@ </FileConfiguration> <FileConfiguration Name="DLL Embedded|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -2231,10 +2224,6 @@ > </File> <File - RelativePath=".\minishared.h" - > - </File> - <File RelativePath="mztools.h" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-09 21:01:19
|
Revision: 1557 http://sourceforge.net/p/opengtoolkit/svn/1557 Author: labviewer Date: 2018-12-09 21:01:17 +0000 (Sun, 09 Dec 2018) Log Message: ----------- Optimize Add GotToFirstFile2 and GoToNextFile2 function Modified Paths: -------------- trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvapi.h trunk/lvzip/c_source/unzip.h trunk/lvzip/c_source/zalias.h Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2018-12-09 16:18:48 UTC (rev 1556) +++ trunk/lvzip/c_source/lvapi.c 2018-12-09 21:01:17 UTC (rev 1557) @@ -444,6 +444,30 @@ return err; } +static MgErr RetrieveFileInfo(unzFile node, LStrHandle *fileName, uint16_t sizeFileName, LStrHandle *extraField, uint16_t sizeExtraField, LStrHandle *comment, uint16_t sizeComment) +{ + MgErr err = NumericArrayResize(uB, 1, (UHandle*)extraField, sizeExtraField); + if (!err) + { + err = NumericArrayResize(uB, 1, (UHandle*)fileName, sizeFileName); + if (!err) + { + err = NumericArrayResize(uB, 1, (UHandle*)comment, sizeComment); + if (!err) + { + err = LibToMgErr(unzGetCurrentFileInfo64(node, NULL, (char*)LStrBuf(**fileName), sizeFileName, LStrBuf(**extraField), sizeExtraField, (char*)LStrBuf(**comment), sizeComment)); + if (!err) + { + LStrLen(**extraField) = sizeExtraField; + LStrLen(**fileName) = sizeFileName; + LStrLen(**comment) = sizeComment; + } + } + } + } + return err; +} + /**************************************************************************************************** * * Retrieve the file information for the currently selected file entry @@ -468,26 +492,7 @@ err = LibToMgErr(unzGetCurrentFileInfo(node, pfile_info, NULL, 0, NULL, 0, NULL, 0)); if (!err) { - err = NumericArrayResize(uB, 1, (UHandle*)extraField, pfile_info->size_file_extra); - if (!err) - { - err = NumericArrayResize(uB, 1, (UHandle*)fileName, pfile_info->size_filename); - if (!err) - { - err = NumericArrayResize(uB, 1, (UHandle*)comment, pfile_info->size_file_comment); - if (!err) - { - err = LibToMgErr(unzGetCurrentFileInfo(node, pfile_info, (char*)LStrBuf(**fileName), pfile_info->size_filename, - LStrBuf(**extraField), pfile_info->size_file_extra, (char*)LStrBuf(**comment), pfile_info->size_file_comment)); - if (!err) - { - LStrLen(**extraField) = pfile_info->size_file_extra; - LStrLen(**fileName) = pfile_info->size_filename; - LStrLen(**comment) = pfile_info->size_file_comment; - } - } - } - } + err = RetrieveFileInfo(node, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); } } return err; @@ -503,26 +508,7 @@ err = LibToMgErr(unzGetCurrentFileInfo64(node, pfile_info, NULL, 0, NULL, 0, NULL, 0)); if (!err) { - err = NumericArrayResize(uB, 1, (UHandle*)extraField, pfile_info->size_file_extra); - if (!err) - { - err = NumericArrayResize(uB, 1, (UHandle*)fileName, pfile_info->size_filename); - if (!err) - { - err = NumericArrayResize(uB, 1, (UHandle*)comment, pfile_info->size_file_comment); - if (!err) - { - err = LibToMgErr(unzGetCurrentFileInfo64(node, pfile_info, (char*)LStrBuf(**fileName), pfile_info->size_filename, - LStrBuf(**extraField), pfile_info->size_file_extra, (char*)LStrBuf(**comment), pfile_info->size_file_comment)); - if (!err) - { - LStrLen(**extraField) = pfile_info->size_file_extra; - LStrLen(**fileName) = pfile_info->size_filename; - LStrLen(**comment) = pfile_info->size_file_comment; - } - } - } - } + err = RetrieveFileInfo(node, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); } } return err; @@ -647,6 +633,21 @@ return err; } +LibAPI(MgErr) lvzlib_unzGoToFirstFile2(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment) +{ + unzFile node; + MgErr err = lvzlibGetRefnum(refnum, &node, UnzMagic); + if (!err) + { + err = LibToMgErr(unzGoToFirstFile2(node, pfile_info, NULL, 0, NULL, 0, NULL, 0)); + if (!err) + { + err = RetrieveFileInfo(node, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); + } + } + return err; +} + /**************************************************************************************************** * * Positions the pointer to the next file entre in the archive @@ -666,6 +667,21 @@ return err; } +LibAPI(MgErr) lvzlib_unzGoToNextFile2(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment) +{ + unzFile node; + MgErr err = lvzlibGetRefnum(refnum, &node, UnzMagic); + if (!err) + { + err = LibToMgErr(unzGoToNextFile2(node, pfile_info, NULL, 0, NULL, 0, NULL, 0)); + if (!err) + { + err = RetrieveFileInfo(node, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); + } + } + return err; +} + /**************************************************************************************************** * * Low level function to position the current read pointer at a specific location inside the archive Modified: trunk/lvzip/c_source/lvapi.h =================================================================== --- trunk/lvzip/c_source/lvapi.h 2018-12-09 16:18:48 UTC (rev 1556) +++ trunk/lvzip/c_source/lvapi.h 2018-12-09 21:01:17 UTC (rev 1557) @@ -34,7 +34,9 @@ LibAPI(MgErr) lvzlib_unzReadCurrentFile(LVRefNum *refnum, LStrHandle buffer); LibAPI(MgErr) lvzlib_unzCloseCurrentFile(LVRefNum *refnum); LibAPI(MgErr) lvzlib_unzGoToFirstFile(LVRefNum *refnum); +LibAPI(MgErr) lvzlib_unzGoToFirstFile64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); LibAPI(MgErr) lvzlib_unzGoToNextFile(LVRefNum *refnum); +LibAPI(MgErr) lvzlib_unzGoToNextFile64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); LibAPI(MgErr) lvzlib_unzGoToFilePos32(LVRefNum *refnum, unz_file_pos *pos); LibAPI(MgErr) lvzlib_unzGoToFilePos64(LVRefNum *refnum, unz64_file_pos *pos); LibAPI(MgErr) lvzlib_unzGetFilePos32(LVRefNum *refnum, unz_file_pos *pos); Modified: trunk/lvzip/c_source/unzip.h =================================================================== --- trunk/lvzip/c_source/unzip.h 2018-12-09 16:18:48 UTC (rev 1556) +++ trunk/lvzip/c_source/unzip.h 2018-12-09 21:01:17 UTC (rev 1557) @@ -75,46 +75,47 @@ /* unz_file_info contain information about a file in the zipfile */ typedef struct unz_file_info64_s { - uint16_t version; /* version made by 2 bytes */ - uint16_t version_needed; /* version needed to extract 2 bytes */ - uint16_t flag; /* general purpose bit flag 2 bytes */ - uint16_t compression_method; /* compression method 2 bytes */ - uint32_t dos_date; /* last mod file date in Dos fmt 4 bytes */ - uint32_t crc; /* crc-32 4 bytes */ - uint64_t compressed_size; /* compressed size 8 bytes */ - uint64_t uncompressed_size; /* uncompressed size 8 bytes */ - uint16_t size_filename; /* filename length 2 bytes */ - uint16_t size_file_extra; /* extra field length 2 bytes */ - uint16_t size_file_comment; /* file comment length 2 bytes */ - - uint32_t disk_num_start; /* disk number start 4 bytes */ - uint16_t internal_fa; /* internal file attributes 2 bytes */ - uint32_t external_fa; /* external file attributes 4 bytes */ - - uint64_t disk_offset; - - uint16_t size_file_extra_internal; + uint16_t version; /* version made by 2 bytes, 2 */ + uint16_t version_needed; /* version needed to extract 2 bytes, 4 */ + uint16_t flag; /* general purpose bit flag 2 bytes, 6 */ + uint16_t compression_method; /* compression method 2 bytes, 8 */ + uint32_t dos_date; /* last mod file date in Dos fmt 4 bytes, 12 */ + uint32_t crc; /* crc-32 4 bytes, 16 */ + uint64_t compressed_size; /* compressed size 8 bytes, 24 */ + uint64_t uncompressed_size; /* uncompressed size 8 bytes, 32 */ + uint16_t size_filename; /* filename length 2 bytes, 34 */ + uint16_t size_file_extra; /* extra field length 2 bytes, 36 */ + uint16_t size_file_comment; /* file comment length 2 bytes, 38 */ + uint16_t padding1; /* filler1 2 bytes, 40 */ + uint32_t disk_num_start; /* disk number start 4 bytes, 44 */ + uint16_t internal_fa; /* internal file attributes 2 bytes, 46 */ + uint16_t padding2; /* filler2 2 bytes, 48 */ + uint32_t external_fa; /* external file attributes 4 bytes, 52 */ + uint32_t padding3; /* filler3 4 bytes, 56 */ + uint64_t disk_offset; /* disk offset 8 bytes, 64 */ + uint16_t size_file_extra_internal; /* 2 bytes, 66 */ } unz_file_info64; typedef struct unz_file_info_s { - uint16_t version; /* version made by 2 bytes */ - uint16_t version_needed; /* version needed to extract 2 bytes */ - uint16_t flag; /* general purpose bit flag 2 bytes */ - uint16_t compression_method; /* compression method 2 bytes */ - uint32_t dos_date; /* last mod file date in Dos fmt 4 bytes */ - uint32_t crc; /* crc-32 4 bytes */ - uint32_t compressed_size; /* compressed size 4 bytes */ - uint32_t uncompressed_size; /* uncompressed size 4 bytes */ - uint16_t size_filename; /* filename length 2 bytes */ - uint16_t size_file_extra; /* extra field length 2 bytes */ - uint16_t size_file_comment; /* file comment length 2 bytes */ + uint16_t version; /* version made by 2 bytes, 2 */ + uint16_t version_needed; /* version needed to extract 2 bytes, 4 */ + uint16_t flag; /* general purpose bit flag 2 bytes, 6 */ + uint16_t compression_method; /* compression method 2 bytes, 8 */ + uint32_t dos_date; /* last mod file date in Dos fmt 4 bytes, 12 */ + uint32_t crc; /* crc-32 4 bytes, 16 */ + uint32_t compressed_size; /* compressed size 4 bytes, 20 */ + uint32_t uncompressed_size; /* uncompressed size 4 bytes, 24 */ + uint16_t size_filename; /* filename length 2 bytes, 26 */ + uint16_t size_file_extra; /* extra field length 2 bytes, 28 */ + uint16_t size_file_comment; /* file comment length 2 bytes, 30 */ + + uint16_t disk_num_start; /* disk number start 2 bytes, 32 */ + uint16_t internal_fa; /* internal file attributes 2 bytes, 34 */ + uint16_t padding1; /* filler1 2 bytes, 36 */ + uint32_t external_fa; /* external file attributes 4 bytes, 40 */ - uint16_t disk_num_start; /* disk number start 2 bytes */ - uint16_t internal_fa; /* internal file attributes 2 bytes */ - uint32_t external_fa; /* external file attributes 4 bytes */ - - uint64_t disk_offset; + uint64_t disk_offset; /* disk offset 8 bytes, 48 */ } unz_file_info; /***************************************************************************/ Modified: trunk/lvzip/c_source/zalias.h =================================================================== --- trunk/lvzip/c_source/zalias.h 2018-12-09 16:18:48 UTC (rev 1556) +++ trunk/lvzip/c_source/zalias.h 2018-12-09 21:01:17 UTC (rev 1557) @@ -74,7 +74,9 @@ #define unzGoToFilePos lvzip_unzGoToFilePos #define unzGoToFilePos64 lvzip_unzGoToFilePos64 #define unzGoToFirstFile lvzip_unzGoToFirstFile +#define unzGoToFirstFile2 lvzip_unzGoToFirstFile2 #define unzGoToNextFile lvzip_unzGoToNextFile +#define unzGoToNextFile2 lvzip_unzGoToNextFile2 #define unzLocateFile lvzip_unzLocateFile #define unzOpen lvzip_unzOpen #define unzOpen64 lvzip_unzOpen64 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-11 12:18:12
|
Revision: 1560 http://sourceforge.net/p/opengtoolkit/svn/1560 Author: labviewer Date: 2018-12-11 12:18:11 +0000 (Tue, 11 Dec 2018) Log Message: ----------- Some more updates to the C code to improve file information Modified Paths: -------------- trunk/lvzip/c_source/iomem.c trunk/lvzip/c_source/iomem.h trunk/lvzip/c_source/iowin.c trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvapi.h trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/lvutil.h trunk/lvzip/c_source/utf.c trunk/lvzip/c_source/zalias.h Modified: trunk/lvzip/c_source/iomem.c =================================================================== --- trunk/lvzip/c_source/iomem.c 2018-12-09 22:18:17 UTC (rev 1559) +++ trunk/lvzip/c_source/iomem.c 2018-12-11 12:18:11 UTC (rev 1560) @@ -1,7 +1,28 @@ -/* iomem.c -- Memory base function header for compress/uncompress .zip - files using zlib + zip or unzip API +/* + iomem.c -- Memory base function header for compress/uncompress .zip files + using zlib + zip or unzip API - Copyright (C) 2007 Rolf Kalbermatter + Copyright (C) 2007-2018 Rolf Kalbermatter + + All rights reserved. + + 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 SciWare, James Kring, Inc., 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 COPYRIGHT OWNER 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. */ #include "zutil.h" Modified: trunk/lvzip/c_source/iomem.h =================================================================== --- trunk/lvzip/c_source/iomem.h 2018-12-09 22:18:17 UTC (rev 1559) +++ trunk/lvzip/c_source/iomem.h 2018-12-11 12:18:11 UTC (rev 1560) @@ -1,5 +1,7 @@ /* iomem.h -- IO base function header for compress/uncompress .zip files using zlib + zip or unzip API + + Copyright (C) 2009-2018 Rolf Kalbermatter */ #include <stdlib.h> Modified: trunk/lvzip/c_source/iowin.c =================================================================== --- trunk/lvzip/c_source/iowin.c 2018-12-09 22:18:17 UTC (rev 1559) +++ trunk/lvzip/c_source/iowin.c 2018-12-11 12:18:11 UTC (rev 1560) @@ -1,14 +1,16 @@ -/* iowin32.c -- IO base function header for compress/uncompress .zip - Version 1.1, February 14h, 2010 - part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) +/* + iowin32.c -- IO base function header for compress/uncompress .zip + + Version 1.1, February 14h, 2010 - Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + part of the MiniZip project - ( http://www.winimage.com/zLibDll/minizip.html ) - Modifications for Zip64 support - Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) - For more info read MiniZip_info.txt + Modifications for Zip64 support + Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + For more info read MiniZip_info.txt */ #include <stdlib.h> Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2018-12-09 22:18:17 UTC (rev 1559) +++ trunk/lvzip/c_source/lvapi.c 2018-12-11 12:18:11 UTC (rev 1560) @@ -1,6 +1,27 @@ -/* lvapi.c -- LabVIEW interface for LabVIEW ZIP library +/* + lvapi.c -- LabVIEW interface for LabVIEW ZIP library - Copyright (C) 2009-2015 Rolf Kalbermatter + Copyright (C) 2009-2018 Rolf Kalbermatter + + All rights reserved. + + 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 SciWare, James Kring, Inc., 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 COPYRIGHT OWNER 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. */ #include <string.h> #include <mbstring.h> @@ -153,11 +174,16 @@ return err; } -static char version[250]; +static char version[250] = {0}; LibAPI(const char *) lvzlib_zlibVersion(void) { - snprintf(version, sizeof(version), "LabVIEW ZIP library, version: 4.1\nzlib version: %s", zlibVersion()); + if (!version[0]) + snprintf(version, sizeof(version), "LabVIEW ZIP library, version: 4.2, Dec 2018\n" + "zlib version: %s, build flags: 0x%lX\n" + "minizip version: 1.2.0, September 16th, 2017" + "aes version: 2013\n" + "bzip2 version: %s", lvzip_zlibVersion(), lvzip_zlibCompileFlags(), BZ2_bzlibVersion()); return version; } @@ -633,7 +659,7 @@ return err; } -LibAPI(MgErr) lvzlib_unzGoToFirstFile2(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment) +LibAPI(MgErr) lvzlib_unzGoToFirstFile2_64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment) { unzFile node; MgErr err = lvzlibGetRefnum(refnum, &node, UnzMagic); @@ -667,7 +693,7 @@ return err; } -LibAPI(MgErr) lvzlib_unzGoToNextFile2(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment) +LibAPI(MgErr) lvzlib_unzGoToNextFile2_64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment) { unzFile node; MgErr err = lvzlibGetRefnum(refnum, &node, UnzMagic); Modified: trunk/lvzip/c_source/lvapi.h =================================================================== --- trunk/lvzip/c_source/lvapi.h 2018-12-09 22:18:17 UTC (rev 1559) +++ trunk/lvzip/c_source/lvapi.h 2018-12-11 12:18:11 UTC (rev 1560) @@ -1,6 +1,27 @@ -/* lvapi.c -- LabVIEW interface for LabVIEW ZIP library +/* + lvapi.c -- LabVIEW interface for LabVIEW ZIP library - Copyright (C) 2009-2015 Rolf Kalbermatter + Copyright (C) 2009-2018 Rolf Kalbermatter + + All rights reserved. + + 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 SciWare, James Kring, Inc., 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 COPYRIGHT OWNER 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. */ #include "lvutil.h" #include "zlib.h" @@ -34,9 +55,9 @@ LibAPI(MgErr) lvzlib_unzReadCurrentFile(LVRefNum *refnum, LStrHandle buffer); LibAPI(MgErr) lvzlib_unzCloseCurrentFile(LVRefNum *refnum); LibAPI(MgErr) lvzlib_unzGoToFirstFile(LVRefNum *refnum); -LibAPI(MgErr) lvzlib_unzGoToFirstFile64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); +LibAPI(MgErr) lvzlib_unzGoToFirstFile2_64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); LibAPI(MgErr) lvzlib_unzGoToNextFile(LVRefNum *refnum); -LibAPI(MgErr) lvzlib_unzGoToNextFile64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); +LibAPI(MgErr) lvzlib_unzGoToNextFile2_64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); LibAPI(MgErr) lvzlib_unzGoToFilePos32(LVRefNum *refnum, unz_file_pos *pos); LibAPI(MgErr) lvzlib_unzGoToFilePos64(LVRefNum *refnum, unz64_file_pos *pos); LibAPI(MgErr) lvzlib_unzGetFilePos32(LVRefNum *refnum, unz_file_pos *pos); Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2018-12-09 22:18:17 UTC (rev 1559) +++ trunk/lvzip/c_source/lvutil.c 2018-12-11 12:18:11 UTC (rev 1560) @@ -1,9 +1,29 @@ -/* lvutil.c -- support functions for LabVIEW ZIP library +/* + lvutil.c -- support functions for LabVIEW ZIP library - Version 1.13, March 15, 2013 Version 1.25, Dec 07, 2018 Copyright (C) 2002-2018 Rolf Kalbermatter + + All rights reserved. + + 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 SciWare, James Kring, Inc., 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 COPYRIGHT OWNER 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. */ #define ZLIB_INTERNAL @@ -106,9 +126,9 @@ #endif #endif -#define usesHFSPath MacOS && ProcessorType!=kX64 -#define usesPosixPath Unix || (MacOSX && ProcessorType==kX64) -#define usesWinPath Win32 +#define usesHFSPath MacOS && ProcessorType != kX64 +#define usesPosixPath Unix || (MacOSX && ProcessorType == kX64) +#define usesWinPath Win32 #if usesHFSPath #define kPathSeperator ':' @@ -1246,7 +1266,7 @@ FInfoRec infoRec; #endif - if (!path || !comment) + if (!FIsAbsPath(path) || !comment) return mgArgErr; #if Win32 && !defined(EMBEDDED) @@ -1254,7 +1274,8 @@ if (err) return err; - if (FDepth(path) == 1) + /* Find First file fails with empty path (desktop) or volume letter alone */ + if (FDepth(path) <= 1) { *isDirectory = TRUE; fi.ftCreationTime.dwLowDateTime = fi.ftCreationTime.dwHighDateTime = 0; @@ -1278,18 +1299,29 @@ { if (write) { - Win32ConvertFromLVTime(fileInfo->cDate, &fi.ftCreationTime); + Win32ConvertFromLVTime(fileInfo->cDate, &fi.ftCreationTime); Win32ConvertFromLVTime(fileInfo->mDate, &fi.ftLastWriteTime); - if (!SetFileTime(handle, &fi.ftCreationTime, &fi.ftLastAccessTime, &fi.ftLastWriteTime)) + handle = CreateFileW(UStrBuf(lstr), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + if (handle != INVALID_HANDLE_VALUE) + { + if (!SetFileTime(handle, &fi.ftCreationTime, &fi.ftLastAccessTime, &fi.ftLastWriteTime)) + err = Win32GetLVFileErr(); + CloseHandle(handle); + } + else err = Win32GetLVFileErr(); - fi.dwFileAttributes = GetFileAttributesA((LPCSTR)lstr->str); - if (fi.dwFileAttributes != INVALID_FILE_ATTRIBUTES) + + if (!err) { - if (fileInfo->flags & 0x4000) - fi.dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN; - else - fi.dwFileAttributes &= ~FILE_ATTRIBUTE_HIDDEN; - SetFileAttributesW(UStrBuf(lstr), fi.dwFileAttributes); + fi.dwFileAttributes = GetFileAttributesW(UStrBuf(lstr)); + if (fi.dwFileAttributes != INVALID_FILE_ATTRIBUTES) + { + if (fileInfo->flags & 0x4000) + fi.dwFileAttributes |= FILE_ATTRIBUTE_HIDDEN; + else + fi.dwFileAttributes &= ~FILE_ATTRIBUTE_HIDDEN; + SetFileAttributesW(UStrBuf(lstr), fi.dwFileAttributes); + } } } else @@ -1302,27 +1334,55 @@ fileInfo->flags = (fi.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) ? 0x4000 : 0; if (*isDirectory) { - count = 1; + if (!FDepth(path)) + { + DWORD drives = GetLogicalDrives(); + int drive; - wcscpy(UStrBuf(lstr) + UStrLen(lstr), L"\\*.*"); - if (!err) + count = 0; + for (drive = 1; drive <= 26; drive++) + { + if (drives & 01) + { + count++; + } + drives /= 2; + } + } + else { - handle = FindFirstFileW(UStrBuf(lstr), &fi); - if (handle == INVALID_HANDLE_VALUE) - count = 0; - else - while (FindNextFileW(handle, &fi)) - count++; - FindClose(handle); + count = 1; - if (FDepth(path) == 1) - fileInfo->size = count; - else - fileInfo->size = count - 2; + wcscpy(UStrBuf(lstr) + UStrLen(lstr), L"\\*.*"); + if (!err) + { + handle = FindFirstFileW(UStrBuf(lstr), &fi); + if (handle == INVALID_HANDLE_VALUE) + count = 0; + else + while (FindNextFileW(handle, &fi)) + count++; + FindClose(handle); + } } + if (FDepth(path) <= 1) + fileInfo->size = count; + else + fileInfo->size = count - 2; } else { + uInt32 type = HasRezExt(path); + if (type) + { + fileInfo->type = type; + fileInfo->creator = kLVCreatorType; + } + else + { + fileInfo->type = kUnknownFileType; + fileInfo->creator = kUnknownCreator; + } fileInfo->size = Quad(fi.nFileSizeHigh, fi.nFileSizeLow); } } @@ -1484,8 +1544,17 @@ } else { - fileInfo->type = kUnknownFileType; - fileInfo->creator = kUnknownCreator; + int32 type = HasRezExt(path); + if (type) + { + fileInfo->type = type; + fileInfo->creator = kLVCreatorType; + } + else + { + fileInfo->type = kUnknownFileType; + fileInfo->creator = kUnknownCreator; + } UnixConvertToLVTime(statbuf.st_ctime, &fileInfo->cDate); UnixConvertToLVTime(statbuf.st_mtime, &fileInfo->mDate); fileInfo->rfSize = 0; @@ -1493,11 +1562,13 @@ { DIR *dirp; struct dirent *dp; + struct direntpath dppath; + struct dirent *dpp = (struct dirent *)&dppath; if (!(dirp = opendir((const char*)lstr->str))) return UnixToLVFileErr(); - for (dp = readdir(dirp); dp; dp = readdir(dirp)) + for (dp = readdir_r(dirp, dpp); dp; dp = readdir_r(dirp, dpp)) count++; closedir(dirp); fileInfo->size = count - 2; @@ -1504,6 +1575,9 @@ } else { + /* Try to determine LabVIEW file types based on file ending? */ + // fileInfo->type = kUnknownFileType; + // fileInfo->creator = kLVCreatorType; fileInfo->size = statbuf.st_size; } } Modified: trunk/lvzip/c_source/lvutil.h =================================================================== --- trunk/lvzip/c_source/lvutil.h 2018-12-09 22:18:17 UTC (rev 1559) +++ trunk/lvzip/c_source/lvutil.h 2018-12-11 12:18:11 UTC (rev 1560) @@ -1,8 +1,29 @@ -/* lvutil.h -- support functions for macbinary +/* + lvutil.h -- support functions for LabVIEW integration - Version 1.9, Sept 17th, 2007 + Version 1.17, Dec 8th, 2018 - Copyright (C) 2002-2007 Rolf Kalbermatter + Copyright (C) 2002-2018 Rolf Kalbermatter + + All rights reserved. + + 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 SciWare, James Kring, Inc., 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 COPYRIGHT OWNER 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. */ #define test #ifndef _lvUtil_H @@ -394,8 +415,8 @@ typedef struct { uInt32 type; /* handled by LabVIEW Type & Creator */ uInt32 creator; /* handled by LabVIEW Type & Creator */ - uInt64 size; /* not modified, use EOF */ - uInt64 rfSize; /* Mac only, not modified, use EOF */ + uInt64 size; + uInt64 rfSize; uInt32 cDate; uInt32 mDate; uInt16 flags; @@ -407,10 +428,10 @@ typedef enum _FMFileType { - kInvalidType =0, - kUnknownFileType=RTToL('?','?','?','?'), - kTextFileType =RTToL('T','E','X','T'), - kLinkFileType =RTToL('s','l','n','k'), + kInvalidType = 0, + kUnknownFileType= RTToL('?','?','?','?'), + kTextFileType = RTToL('T','E','X','T'), + kLinkFileType = RTToL('s','l','n','k'), /** Typical directory types */ kHardDiskDirType= RTToL('h','d','s','k'), kFloppyDirType = RTToL('f','l','p','y'), @@ -549,6 +570,7 @@ Path FNotAPath(Path); Bool32 FIsAPath(Path path); Bool32 FIsAbsPath(Path path); +Bool32 FIsEmptyPath(Path path); MgErr FTextToPath(UPtr str, int32 len, Path* path); MgErr FPathToText(Path path, LStrPtr lstr); MgErr FPathToPath(Path *p); @@ -572,7 +594,8 @@ MgErr FMRead(File fd, int32 inCount, int32* outCount, UPtr buffer); MgErr FMWrite(File fd, int32 inCount, int32* outCount, UPtr buffer); MgErr FListDir(ConstPath path, FDirEntHandle list, FMListDetails **); -int32 PStrHasRezExt(PStr str); +uInt32 PStrHasRezExt(PStr str); +uInt32 HasRezExt(Path path); int32 DbgPrintf(CStr fmt, ...); Modified: trunk/lvzip/c_source/utf.c =================================================================== --- trunk/lvzip/c_source/utf.c 2018-12-09 22:18:17 UTC (rev 1559) +++ trunk/lvzip/c_source/utf.c 2018-12-11 12:18:11 UTC (rev 1560) @@ -1,3 +1,28 @@ +/* + utf.c - Support routines for Unicode text format conversions between the different sizes + + Copyright (C) 2015-2018 Rolf Kalbermatter + + All rights reserved. + + 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 SciWare, James Kring, Inc., 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 COPYRIGHT OWNER 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. +*/ #include "zlib.h" #include "lvutil.h" #include "utf.h" Modified: trunk/lvzip/c_source/zalias.h =================================================================== --- trunk/lvzip/c_source/zalias.h 2018-12-09 22:18:17 UTC (rev 1559) +++ trunk/lvzip/c_source/zalias.h 2018-12-11 12:18:11 UTC (rev 1560) @@ -1,3 +1,33 @@ +/* + zalias.h -- name aliasing for all the zlib and minizip library functions to avoid name clashes in the VxWorks + implementation. VxWorks seems to only use a single gloabal symbol table where all the exported functions of the + process and any loaded shared library are placed into. Since the LabVIEW runtime contains a subset of the zlib + and minizip library for its own ZIP functionality, loading of this shared library silently fails if it uses the + same exported symbols. This was found and reported by some NI developer after I asked about why the cRIO shared + library would not work at all, so the solution is to rename all the symbols here to avoid any name clashes. + + Copyright (C) 2007-2018 Rolf Kalbermatter + + All rights reserved. + + 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 SciWare, James Kring, Inc., 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 COPYRIGHT OWNER 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. +*/ #define Z_PREFIX_SET #define _dist_code lvzip__dist_code #define _length_code lvzip__length_code @@ -60,6 +90,7 @@ #define unzClose lvzip_unzClose #define unzClose2 lvzip_unzClose2 #define unzCloseCurrentFile lvzip_unzCloseCurrentFile +#define unzEndOfFile lvzip_unzEndOfFile #define unzGetCurrentFileInfo lvzip_unzGetCurrentFileInfo #define unzGetCurrentFileInfo64 lvzip_unzGetCurrentFileInfo64 #define unzGetCurrentFileZStreamPos64 lvzip_unzGetCurrentFileZStreamPos64 @@ -91,9 +122,10 @@ #define unzSetOffset lvzip_unzSetOffset #define unzSetOffset64 lvzip_unzSetOffset64 #define unzStringFileNameCompare lvzip_unzStringFileNameCompare -#define unztell lvzip_unztell -#define unztell64 lvzip_unztell64 -#define unzeof lvzip_unzeof +#define unzSeek lvzip_unzSeek +#define unzSeek64 lvzip_unzSeek64 +#define unzTell lvzip_unzTell +#define unzTell64 lvzip_unzTell64 #define zipClose lvzip_zipClose #define zipClose2 lvzip_zipClose2 #define zipCloseFileInZip lvzip_zipCloseFileInZip @@ -104,6 +136,7 @@ #define zipOpen2 lvzip_zipOpen2 #define zipOpen2_64 lvzip_zipOpen2_64 #define zipOpen3 lvzip_zipOpen3 +#define zipOpen3_64 lvzip_zipOpen3_64 #define zipOpenNewFileInZip lvzip_zipOpenNewFileInZip #define zipOpenNewFileInZip64 lvzip_zipOpenNewFileInZip64 #define zipOpenNewFileInZip2 lvzip_zipOpenNewFileInZip2 @@ -112,6 +145,7 @@ #define zipOpenNewFileInZip3_64 lvzip_zipOpenNewFileInZip3_64 #define zipOpenNewFileInZip4 lvzip_zipOpenNewFileInZip4 #define zipOpenNewFileInZip4_64 lvzip_zipOpenNewFileInZip4_64 +#define zipOpenNewFileInZip5 lvzip_zipOpenNewFileInZip5 #define zipRemoveExtraInfoBlock lvzip_zipRemoveExtraInfoBlock #define zipWriteInFileInZip lvzip_zipWriteInFileInZip #define gzopen lvzip_gzopen @@ -142,5 +176,5 @@ #define gztell64 lvzip_gztell64 #define gzoffset lvzip_gzoffset #define gzoffset64 lvzip_gzoffset64 -#define gcrc32_combine lvzip_crc32_combine -#define gcrc32_combine64 lvzip_crc32_combine64 +#define gcrc32_combine lvzip_gcrc32_combine +#define gcrc32_combine64 lvzip_gcrc32_combine64 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-12 00:50:02
|
Revision: 1563 http://sourceforge.net/p/opengtoolkit/svn/1563 Author: labviewer Date: 2018-12-12 00:50:01 +0000 (Wed, 12 Dec 2018) Log Message: ----------- Some more platform specific corrections Modified Paths: -------------- trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvapi.h trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/lvutil.h trunk/lvzip/c_source/unzip.c trunk/lvzip/c_source/zlibvc.vcproj Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2018-12-11 20:26:07 UTC (rev 1562) +++ trunk/lvzip/c_source/lvapi.c 2018-12-12 00:50:01 UTC (rev 1563) @@ -24,7 +24,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <string.h> -#include <mbstring.h> #define ZLIB_INTERNAL #include "zlib.h" #include "lvutil.h" @@ -78,12 +77,6 @@ static MagicCookieJar gCookieJar = NULL; -#if 0 -LibAPI(const char *) lvzlib_disposeRefnum(uptr_t *refnum) -{ - -} -#endif static int32 lvzlipCleanup(UPtr ptr) { FileNode *pNode = (FileNode*)ptr; @@ -448,13 +441,24 @@ * always work as intended for case insensitive comparison since only the normal * ASCII 7Bit alpha characters will be compared case insensitive, not any extended * characters or multibyte characters. + * 0 - platform specific + * 1 - case sensitive + * 2 - case insensitive * ****************************************************************************************************/ +#if Win32 +#define strcasecmp _stricmp +#endif static int caseInsensitiveNameComparer(unzFile file, const char *filename1, const char *filename2) { - return _mbsicmp((const unsigned char*)filename1, (const unsigned char*)filename2); + return strcasecmp(filename1, filename2); } +static int caseSensitiveNameComparer(unzFile file, const char *filename1, const char *filename2) +{ + return strcmp(filename1, filename2); +} + LibAPI(MgErr) lvzlib_unzLocateFile(LVRefNum *refnum, LStrHandle fileName, int iCaseSensitivity) { unzFile node; @@ -464,13 +468,26 @@ err = ZeroTerminateLString(&fileName); if (!err) { - err = LibToMgErr(unzLocateFile(node, (const char*)LStrBufH(fileName), iCaseSensitivity ? caseInsensitiveNameComparer : NULL)); + unzFileNameComparer filename_compare_func = NULL; + if ( +#if Mac || MSWin || VxWorks + !iCaseSensitivity || +#endif + iCaseSensitivity == 2) + { + filename_compare_func = caseInsensitiveNameComparer; + } + else + { + filename_compare_func = caseSensitiveNameComparer; + } + err = LibToMgErr(unzLocateFile(node, (const char*)LStrBufH(fileName), filename_compare_func)); } } return err; } -static MgErr RetrieveFileInfo(unzFile node, LStrHandle *fileName, uint16_t sizeFileName, LStrHandle *extraField, uint16_t sizeExtraField, LStrHandle *comment, uint16_t sizeComment) +static MgErr RetrieveFileInfo(unzFile node, unz_file_info *pfile_info, LStrHandle *fileName, uint16_t sizeFileName, LStrHandle *extraField, uint16_t sizeExtraField, LStrHandle *comment, uint16_t sizeComment) { MgErr err = NumericArrayResize(uB, 1, (UHandle*)extraField, sizeExtraField); if (!err) @@ -481,7 +498,7 @@ err = NumericArrayResize(uB, 1, (UHandle*)comment, sizeComment); if (!err) { - err = LibToMgErr(unzGetCurrentFileInfo64(node, NULL, (char*)LStrBuf(**fileName), sizeFileName, LStrBuf(**extraField), sizeExtraField, (char*)LStrBuf(**comment), sizeComment)); + err = LibToMgErr(unzGetCurrentFileInfo(node, pfile_info, (char*)LStrBuf(**fileName), sizeFileName, LStrBuf(**extraField), sizeExtraField, (char*)LStrBuf(**comment), sizeComment)); if (!err) { LStrLen(**extraField) = sizeExtraField; @@ -518,7 +535,7 @@ err = LibToMgErr(unzGetCurrentFileInfo(node, pfile_info, NULL, 0, NULL, 0, NULL, 0)); if (!err) { - err = RetrieveFileInfo(node, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); + err = RetrieveFileInfo(node, NULL, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); } } return err; @@ -534,7 +551,7 @@ err = LibToMgErr(unzGetCurrentFileInfo64(node, pfile_info, NULL, 0, NULL, 0, NULL, 0)); if (!err) { - err = RetrieveFileInfo(node, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); + err = RetrieveFileInfo(node, NULL, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); } } return err; @@ -659,6 +676,22 @@ return err; } +LibAPI(MgErr) lvzlib_unzGoToFirstFile2_32(LVRefNum *refnum, unz_file_info *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment) +{ + unzFile node; + MgErr err = lvzlibGetRefnum(refnum, &node, UnzMagic); + if (!err) + { + unz_file_info64 file_info64; + err = LibToMgErr(unzGoToFirstFile2(node, &file_info64, NULL, 0, NULL, 0, NULL, 0)); + if (!err) + { + err = RetrieveFileInfo(node, pfile_info, fileName, file_info64.size_filename, extraField, file_info64.size_file_extra, comment, file_info64.size_file_comment); + } + } + return err; +} + LibAPI(MgErr) lvzlib_unzGoToFirstFile2_64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment) { unzFile node; @@ -668,7 +701,7 @@ err = LibToMgErr(unzGoToFirstFile2(node, pfile_info, NULL, 0, NULL, 0, NULL, 0)); if (!err) { - err = RetrieveFileInfo(node, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); + err = RetrieveFileInfo(node, NULL, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); } } return err; @@ -693,6 +726,22 @@ return err; } +LibAPI(MgErr) lvzlib_unzGoToNextFile2_32(LVRefNum *refnum, unz_file_info *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment) +{ + unzFile node; + MgErr err = lvzlibGetRefnum(refnum, &node, UnzMagic); + if (!err) + { + unz_file_info64 file_info64; + err = LibToMgErr(unzGoToNextFile2(node, &file_info64, NULL, 0, NULL, 0, NULL, 0)); + if (!err) + { + err = RetrieveFileInfo(node, pfile_info, fileName, file_info64.size_filename, extraField, file_info64.size_file_extra, comment, file_info64.size_file_comment); + } + } + return err; +} + LibAPI(MgErr) lvzlib_unzGoToNextFile2_64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment) { unzFile node; @@ -702,7 +751,7 @@ err = LibToMgErr(unzGoToNextFile2(node, pfile_info, NULL, 0, NULL, 0, NULL, 0)); if (!err) { - err = RetrieveFileInfo(node, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); + err = RetrieveFileInfo(node, NULL, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); } } return err; Modified: trunk/lvzip/c_source/lvapi.h =================================================================== --- trunk/lvzip/c_source/lvapi.h 2018-12-11 20:26:07 UTC (rev 1562) +++ trunk/lvzip/c_source/lvapi.h 2018-12-12 00:50:01 UTC (rev 1563) @@ -55,8 +55,10 @@ LibAPI(MgErr) lvzlib_unzReadCurrentFile(LVRefNum *refnum, LStrHandle buffer); LibAPI(MgErr) lvzlib_unzCloseCurrentFile(LVRefNum *refnum); LibAPI(MgErr) lvzlib_unzGoToFirstFile(LVRefNum *refnum); +LibAPI(MgErr) lvzlib_unzGoToFirstFile2_32(LVRefNum *refnum, unz_file_info *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); LibAPI(MgErr) lvzlib_unzGoToFirstFile2_64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); LibAPI(MgErr) lvzlib_unzGoToNextFile(LVRefNum *refnum); +LibAPI(MgErr) lvzlib_unzGoToNextFile2_32(LVRefNum *refnum, unz_file_info *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); LibAPI(MgErr) lvzlib_unzGoToNextFile2_64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); LibAPI(MgErr) lvzlib_unzGoToFilePos32(LVRefNum *refnum, unz_file_pos *pos); LibAPI(MgErr) lvzlib_unzGoToFilePos64(LVRefNum *refnum, unz64_file_pos *pos); Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2018-12-11 20:26:07 UTC (rev 1562) +++ trunk/lvzip/c_source/lvutil.c 2018-12-12 00:50:01 UTC (rev 1563) @@ -487,7 +487,7 @@ #if Unix || MacOSX || defined(EMBEDDED) #define LWStrPtr LStrPtr - +/* wstr is filled with an 8 bit local encoded string from the path, which could be UTF8 on Linux and MacOSX systems */ static int32 MakePathDSString(Path path, LWStrPtr *lstr, int32 reserve) { int32 pathLen = -1; @@ -507,7 +507,7 @@ } #elif usesWinPath #define LWStrPtr UStrPtr - +/* wstr is filled with a Windows UTF16LE string from the path */ static int32 MakePathDSString(Path path, LWStrPtr *wstr, int32 reserve) { int32 pathLen = -1; @@ -540,7 +540,7 @@ len = 6; off = 1; } - *wstr = (UStrPtr)DSNewPClr(sizeof(int32) + sizeof(wchar_t) * (len + pathLen + reserve + 1)); + *wstr = (LWStrPtr)DSNewPClr(sizeof(int32) + sizeof(wchar_t) * (len + pathLen + reserve + 1)); if (*wstr) { if (buf[0] && buf[1] == ':') @@ -1566,13 +1566,11 @@ { DIR *dirp; struct dirent *dp; - struct direntpath dppath; - struct dirent *dpp = (struct dirent *)&dppath; if (!(dirp = opendir((const char*)lstr->str))) return UnixToLVFileErr(); - for (dp = readdir_r(dirp, dpp); dp; dp = readdir_r(dirp, dpp)) + for (dp = readdir(dirp); dp; dp = readdir(dirp)) count++; closedir(dirp); fileInfo->size = count - 2; Modified: trunk/lvzip/c_source/lvutil.h =================================================================== --- trunk/lvzip/c_source/lvutil.h 2018-12-11 20:26:07 UTC (rev 1562) +++ trunk/lvzip/c_source/lvutil.h 2018-12-12 00:50:01 UTC (rev 1563) @@ -455,10 +455,10 @@ uInt32 cdate; /**< creation date */ uInt32 mdate; /**< last modification date */ Bool32 folder; /**< indicates whether path refers to a folder */ - Bool32 isInvisible; /**< indicates whether the file is visible in File Dialog */ + Bool32 isInvisible; /**< indicates whether the file is visible in File Dialog */ struct { int16 v, h; - } location; /**< system specific geographical location */ + } location; /**< system specific geographical location */ Str255 owner; /**< owner (in pascal string form) of file or folder */ Str255 group; /**< group (in pascal string form) of file or folder */ } FInfoRec, *FInfoPtr; Modified: trunk/lvzip/c_source/unzip.c =================================================================== --- trunk/lvzip/c_source/unzip.c 2018-12-11 20:26:07 UTC (rev 1562) +++ trunk/lvzip/c_source/unzip.c 2018-12-12 00:50:01 UTC (rev 1563) @@ -906,7 +906,7 @@ unz_file_info64 file_info64; int err = UNZ_OK; - err = unzGetCurrentFileInfoInternal(file, &file_info64, NULL, filename, filename_size, + err = unzGetCurrentFileInfoInternal(file, pfile_info ? &file_info64 : NULL, NULL, filename, filename_size, extrafield, extrafield_size, comment, comment_size); if ((err == UNZ_OK) && (pfile_info != NULL)) Modified: trunk/lvzip/c_source/zlibvc.vcproj =================================================================== --- trunk/lvzip/c_source/zlibvc.vcproj 2018-12-11 20:26:07 UTC (rev 1562) +++ trunk/lvzip/c_source/zlibvc.vcproj 2018-12-12 00:50:01 UTC (rev 1563) @@ -393,7 +393,7 @@ <Tool Name="VCCLCompilerTool" Optimization="2" - InlineFunctionExpansion="1" + InlineFunctionExpansion="0" AdditionalIncludeDirectories="bzip2" PreprocessorDefinitions="WIN32;NDEBUG;NO_vsnprintf;HAVE_AES;HAVE_BZIP2;BZ_NO_STDIO;_CRT_SECURE_NO_WARNINGS" StringPooling="true" @@ -491,7 +491,7 @@ <Tool Name="VCCLCompilerTool" Optimization="2" - InlineFunctionExpansion="1" + InlineFunctionExpansion="0" AdditionalIncludeDirectories="bzip2" PreprocessorDefinitions="WIN32;NDEBUG;NO_vsnprintf;HAVE_AES;HAVE_BZIP2;BZ_NO_STDIO;_CRT_SECURE_NO_WARNINGS" StringPooling="true" @@ -1933,34 +1933,6 @@ <File RelativePath=".\utf.c" > - <FileConfiguration - Name="DLL Release|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DLL Release|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DLL Embedded|Win32" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="DLL Embedded|x64" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> </File> <File RelativePath="zip.c" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-12 11:01:53
|
Revision: 1566 http://sourceforge.net/p/opengtoolkit/svn/1566 Author: labviewer Date: 2018-12-12 11:01:51 +0000 (Wed, 12 Dec 2018) Log Message: ----------- Various cleanups for to make everything compile in MSC 6.0 too Modified Paths: -------------- trunk/lvzip/c_source/crypt.c trunk/lvzip/c_source/ioapi.h trunk/lvzip/c_source/iomem.c trunk/lvzip/c_source/iowin.c trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvapi.h trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/mztools.c trunk/lvzip/c_source/mztools.h trunk/lvzip/c_source/unzip.c trunk/lvzip/c_source/zalias.h trunk/lvzip/c_source/zconf.h trunk/lvzip/c_source/zip.c trunk/lvzip/c_source/zlib.h trunk/lvzip/c_source/zlibvc.dsp trunk/lvzip/c_source/zlibvc.vcproj Modified: trunk/lvzip/c_source/crypt.c =================================================================== --- trunk/lvzip/c_source/crypt.c 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/crypt.c 2018-12-12 11:01:51 UTC (rev 1566) @@ -26,7 +26,6 @@ #include <stdio.h> #include <stdlib.h> -#include <stdint.h> #include <time.h> #ifdef _WIN32 Modified: trunk/lvzip/c_source/ioapi.h =================================================================== --- trunk/lvzip/c_source/ioapi.h 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/ioapi.h 2018-12-12 11:01:51 UTC (rev 1566) @@ -18,7 +18,6 @@ #include <stdio.h> #include <stdlib.h> -#include <stdint.h> #include "zlib.h" Modified: trunk/lvzip/c_source/iomem.c =================================================================== --- trunk/lvzip/c_source/iomem.c 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/iomem.c 2018-12-12 11:01:51 UTC (rev 1566) @@ -134,9 +134,9 @@ return mFullErr; if (offset + *size > 0x7FFFFFFF) - *size = (uLong)(0x7FFFFFFF - offset); + *size = 0x7FFFFFFF - offset; - if ((uint32_t)DSGetHandleSize((UHandle)handle) < (offset + *size + sizeof(int32))) + if ((uInt32)DSGetHandleSize((UHandle)handle) < (offset + *size + sizeof(int32))) { MgErr err = fEOF; Modified: trunk/lvzip/c_source/iowin.c =================================================================== --- trunk/lvzip/c_source/iowin.c 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/iowin.c 2018-12-12 11:01:51 UTC (rev 1566) @@ -157,7 +157,7 @@ { if (diskFilename[i] != '.') continue; - swprintf(&diskFilename[i], w32fiow->filenameLength - i, L".z%02d", number_disk + 1); + swnprintf(&diskFilename[i], w32fiow->filenameLength - i, L".z%02d", number_disk + 1); break; } if (i >= 0) Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/lvapi.c 2018-12-12 11:01:51 UTC (rev 1566) @@ -180,14 +180,14 @@ return version; } -LibAPI(int) lvzlib_compress(Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, int level) +LibAPI(int) lvzlib_compress(Bytef *dest, uInt32 *destLen, + const Bytef *source, uInt32 sourceLen, int level) { return compress2(dest, destLen, source, sourceLen, level); } -LibAPI(int) lvzlib_uncompress(Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen) +LibAPI(int) lvzlib_uncompress(Bytef *dest, uInt32 *destLen, + const Bytef *source, uInt32 sourceLen) { return uncompress(dest, destLen, source, sourceLen); } @@ -236,7 +236,7 @@ LibAPI(MgErr) lvzlib_zipOpenNewFileInZip(LVRefNum *refnum, LStrHandle filename, const zip_fileinfo* zipfi, const LStrHandle extrafield_local, const LStrHandle extrafield_global, LStrHandle comment, int method, int level, int raw, int windowBits, - int memLevel, int strategy, const char* password, uLong crcForCrypting, uLong version, uLong flags, int zip64) + int memLevel, int strategy, const char* password, uInt32 crcForCrypting, uInt32 version, uInt32 flags, int zip64) { zipFile node; MgErr err = lvzlibGetRefnum(refnum, &node, ZipMagic); Modified: trunk/lvzip/c_source/lvapi.h =================================================================== --- trunk/lvzip/c_source/lvapi.h 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/lvapi.h 2018-12-12 11:01:51 UTC (rev 1566) @@ -31,14 +31,14 @@ #ifndef lvzip_lvapi_h #define lvzip_lvapi_h LibAPI(const char *) lvzlib_zlibVersion(void); -LibAPI(int) lvzlib_compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level); -LibAPI(int) lvzlib_uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); +LibAPI(int) lvzlib_compress(Bytef *dest, uInt32 *destLen, const Bytef *source, uInt32 sourceLen, int level); +LibAPI(int) lvzlib_uncompress(Bytef *dest, uInt32 *destLen, const Bytef *source, uInt32 sourceLen); LibAPI(uInt32) lvzlib_crc32(uInt32 crc, const Bytef *buf, uInt32 len); LibAPI(MgErr) lvzlib_zipOpen(const void *pathname, int append, LStrHandle *globalcomment, zlib_filefunc64_def* filefuncs, LVRefNum *refnum); LibAPI(MgErr) lvzlib_zipOpenNewFileInZip(LVRefNum *refnum, LStrHandle filename, const zip_fileinfo* zipfi, const LStrHandle extrafield_local, const LStrHandle extrafield_global, LStrHandle comment, int method, int level, int raw, int windowBits, - int memLevel, int strategy, const char* password, uLong crcForCrypting, uLong version, uLong flags, int zip64); + int memLevel, int strategy, const char* password, uInt32 crcForCrypting, uInt32 version, uInt32 flags, int zip64); LibAPI(MgErr) lvzlib_zipWriteInFileInZip(LVRefNum *refnum, const LStrHandle buffer); LibAPI(MgErr) lvzlib_zipCloseFileInZipRaw32(LVRefNum *refnum, uInt32 uncompressedSize, uInt32 crc32); LibAPI(MgErr) lvzlib_zipCloseFileInZipRaw64(LVRefNum *refnum, uInt64 uncompressedSize, uInt32 crc32); Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/lvutil.c 2018-12-12 11:01:51 UTC (rev 1566) @@ -687,6 +687,7 @@ return noErr; } +#if !EMBEDDED LibAPI(MgErr) Win32ResolveShortCut(UStrPtr wStr, UStrPtr *wTgt, Bool32 recursive, DWORD *dwAttrs) { HRESULT err = noErr; @@ -940,6 +941,7 @@ return err; } #endif +#endif LibAPI(MgErr) LVPath_ListDirectory(Path folderPath, LStrArrHdl *nameArr, FileInfoArrHdl *typeArr) { Modified: trunk/lvzip/c_source/mztools.c =================================================================== --- trunk/lvzip/c_source/mztools.c 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/mztools.c 2018-12-12 11:01:51 UTC (rev 1566) @@ -28,7 +28,7 @@ WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \ } while(0) -ZEXTERN int ZEXPORT unzRepair(const char* file, const char* fileOut, const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered) +extern int ZEXPORT unzRepair(const char* file, const char* fileOut, const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered) { int err = Z_OK; FILE* fpZip = fopen(file, "rb"); Modified: trunk/lvzip/c_source/mztools.h =================================================================== --- trunk/lvzip/c_source/mztools.h 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/mztools.h 2018-12-12 11:01:51 UTC (rev 1566) @@ -22,7 +22,7 @@ fileOut: output file after recovery fileOutTmp: temporary file name used for recovery */ -ZEXTERN int ZEXPORT unzRepair OF((const char* file, const char* fileOut, const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered)); +extern int ZEXPORT unzRepair OF((const char* file, const char* fileOut, const char* fileOutTmp, uLong* nRecovered, uLong* bytesRecovered)); #ifdef __cplusplus Modified: trunk/lvzip/c_source/unzip.c =================================================================== --- trunk/lvzip/c_source/unzip.c 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/unzip.c 2018-12-12 11:01:51 UTC (rev 1566) @@ -19,7 +19,6 @@ #include <stdio.h> #include <stdlib.h> -#include <stdint.h> #include <string.h> #include <errno.h> Modified: trunk/lvzip/c_source/zalias.h =================================================================== --- trunk/lvzip/c_source/zalias.h 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/zalias.h 2018-12-12 11:01:51 UTC (rev 1566) @@ -50,8 +50,8 @@ #define deflateBound lvzip_deflateBound #define deflateCopy lvzip_deflateCopy #define deflateEnd lvzip_deflateEnd -#define deflateInit lvzip_deflateInit -#define deflateInit2 lvzip_deflateInit2 +#define deflateInit_ lvzip_deflateInit +#define deflateInit2_ lvzip_deflateInit2 #define deflateParams lvzip_deflateParams #define deflatePrime lvzip_deflatePrime #define deflateReset lvzip_deflateReset @@ -64,13 +64,13 @@ #define inflate_table lvzip_inflate_table #define inflateBack lvzip_inflateBack #define inflateBackEnd lvzip_inflateBackEnd -#define inflateBackInit lvzip_inflateBackInit +#define inflateBackInit_ lvzip_inflateBackInit #define inflateCopy lvzip_inflateCopy #define inflateEnd lvzip_inflateEnd #define inflateGetHeader lvzip_inflateGetHeader #define inflate_fast lvzip_inflate_fast -#define inflateInit lvzip_inflateInit -#define inflateInit2 lvzip_inflateInit2 +#define inflateInit_ lvzip_inflateInit +#define inflateInit2_ lvzip_inflateInit2 #define inflateMark lvzip_inflateMark #define inflatePrime lvzip_inflatePrime #define inflateReset lvzip_inflateReset @@ -178,3 +178,19 @@ #define gzoffset64 lvzip_gzoffset64 #define gcrc32_combine lvzip_gcrc32_combine #define gcrc32_combine64 lvzip_gcrc32_combine64 + +/* Do some standard C type finicking for compilers that do not support the _t standard types */ +#if defined(_MSC_VER) && (_MSC_VER < 1300) +typedef char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +typedef int ssize_t; +typedef unsigned int size_t; +#else +#include <stdint.h> +#endif Modified: trunk/lvzip/c_source/zconf.h =================================================================== --- trunk/lvzip/c_source/zconf.h 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/zconf.h 2018-12-12 11:01:51 UTC (rev 1566) @@ -512,7 +512,14 @@ # else # define z_off64_t z_off_t # endif -#endif +#endif + +/* Microsoft used a non standard function signature for old MSC compilers */ +#if defined(_MSC_VER) && (_MSC_VER < 1300) +#define swnprintf _snwprintf +#else +#define swnprintf swprintf +#endif /* MVS linker does not support external names larger than 8 bytes */ #if defined(__MVS__) Modified: trunk/lvzip/c_source/zip.c =================================================================== --- trunk/lvzip/c_source/zip.c 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/zip.c 2018-12-12 11:01:51 UTC (rev 1566) @@ -17,7 +17,6 @@ #include <stdio.h> #include <stdlib.h> -#include <stdint.h> #include <string.h> #include <errno.h> Modified: trunk/lvzip/c_source/zlib.h =================================================================== --- trunk/lvzip/c_source/zlib.h 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/zlib.h 2018-12-12 11:01:51 UTC (rev 1566) @@ -31,8 +31,6 @@ #ifndef ZLIB_H #define ZLIB_H -#include <stdint.h> - #include "zalias.h" #include "zconf.h" @@ -1782,21 +1780,21 @@ unsigned char FAR *window, const char *version, int stream_size)); -#ifdef Z_PREFIX_SET -# define lvzip_deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -# define lvzip_inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -# define lvzip_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -# define lvzip_inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ - (int)sizeof(z_stream)) -# define lvzip_inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, (int)sizeof(z_stream)) -#else +//#ifdef Z_PREFIX_SET +//# define lvzip_deflateInit(strm, level) \ +// deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +//# define lvzip_inflateInit(strm) \ +// inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +//# define lvzip_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ +// deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ +// (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +//# define lvzip_inflateInit2(strm, windowBits) \ +// inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ +// (int)sizeof(z_stream)) +//# define lvzip_inflateBackInit(strm, windowBits, window) \ +// inflateBackInit_((strm), (windowBits), (window), \ +// ZLIB_VERSION, (int)sizeof(z_stream)) +//#else # define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) # define inflateInit(strm) \ @@ -1810,7 +1808,7 @@ # define inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, (int)sizeof(z_stream)) -#endif +//#endif #ifndef Z_SOLO Modified: trunk/lvzip/c_source/zlibvc.dsp =================================================================== --- trunk/lvzip/c_source/zlibvc.dsp 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/zlibvc.dsp 2018-12-12 11:01:51 UTC (rev 1566) @@ -50,7 +50,7 @@ LIB32=link.exe -lib CPP=cl.exe # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "ZLIB_DLL" /FD /c +# ADD CPP /nologo /MD /W3 /O2 /I "bzip2" /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "ZLIB_DLL" /FD /c # SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -115,7 +115,7 @@ LIB32=link.exe -lib CPP=cl.exe # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "EMBEDDED" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "EMBEDDED" /D "ZLIB_DLL" /FD /c +# ADD CPP /nologo /MD /W3 /O2 /I "bzip2" /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_BZIP2" /D "HAVE_AES" /D "EMBEDDED" /D "ZLIB_DLL" /FR /FD /c # SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -128,7 +128,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /dll /pdb:none /machine:I386 -# ADD LINK32 user32.lib kernel32.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"Win32_DLL_Embedded\lvzlib.dll" +# ADD LINK32 advapi32.lib user32.lib kernel32.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"Win32_DLL_Embedded\lvzlib.dll" !ELSEIF "$(CFG)" == "zlibvc - Win32 DLL ASM Release" @@ -325,6 +325,10 @@ # End Source File # Begin Source File +SOURCE=.\crypt.c +# End Source File +# Begin Source File + SOURCE=.\deflate.c # End Source File # Begin Source File @@ -391,6 +395,10 @@ # End Source File # Begin Source File +SOURCE=.\utf.c +# End Source File +# Begin Source File + SOURCE=.\zip.c # End Source File # Begin Source File @@ -463,6 +471,10 @@ # End Source File # Begin Source File +SOURCE=.\utf.h +# End Source File +# Begin Source File + SOURCE=.\zalias.h # End Source File # Begin Source File @@ -509,6 +521,8 @@ # PROP Exclude_From_Build 1 +!ELSEIF "$(CFG)" == "zlibvc - Win32 DLL Embedded" + !ELSEIF "$(CFG)" == "zlibvc - Win32 DLL ASM Release" # Begin Custom Build - Assembling... @@ -574,6 +588,8 @@ # PROP Exclude_From_Build 1 +!ELSEIF "$(CFG)" == "zlibvc - Win32 DLL Embedded" + !ELSEIF "$(CFG)" == "zlibvc - Win32 DLL ASM Release" # PROP BASE Exclude_From_Build 1 @@ -608,6 +624,8 @@ # PROP Exclude_From_Build 1 +!ELSEIF "$(CFG)" == "zlibvc - Win32 DLL Embedded" + !ELSEIF "$(CFG)" == "zlibvc - Win32 DLL ASM Release" # Begin Custom Build - Assembling... @@ -662,8 +680,144 @@ # End Source File # End Group +# Begin Group "bzip2" + +# PROP Default_Filter "" # Begin Source File +SOURCE=.\bzip2\blocksort.c +# End Source File +# Begin Source File + +SOURCE=.\bzip2\bzcompress.c +# End Source File +# Begin Source File + +SOURCE=.\bzip2\bzlib.c +# End Source File +# Begin Source File + +SOURCE=.\bzip2\bzlib.h +# End Source File +# Begin Source File + +SOURCE=.\bzip2\bzlib_private.h +# End Source File +# Begin Source File + +SOURCE=.\bzip2\crctable.c +# End Source File +# Begin Source File + +SOURCE=.\bzip2\decompress.c +# End Source File +# Begin Source File + +SOURCE=.\bzip2\huffman.c +# End Source File +# Begin Source File + +SOURCE=.\bzip2\randtable.c +# End Source File +# End Group +# Begin Group "AES" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\aes\aes.h +# End Source File +# Begin Source File + +SOURCE=.\aes\aes_ni.c +# End Source File +# Begin Source File + +SOURCE=.\aes\aes_ni.h +# End Source File +# Begin Source File + +SOURCE=.\aes\aes_via_ace.h +# End Source File +# Begin Source File + +SOURCE=.\aes\aescrypt.c +# End Source File +# Begin Source File + +SOURCE=.\aes\aeskey.c +# End Source File +# Begin Source File + +SOURCE=.\aes\aesopt.h +# End Source File +# Begin Source File + +SOURCE=.\aes\aestab.c +# End Source File +# Begin Source File + +SOURCE=.\aes\aestab.h +# End Source File +# Begin Source File + +SOURCE=.\aes\brg_endian.h +# End Source File +# Begin Source File + +SOURCE=.\aes\brg_types.h +# End Source File +# Begin Source File + +SOURCE=.\aes\entropy.c +# End Source File +# Begin Source File + +SOURCE=.\aes\entropy.h +# End Source File +# Begin Source File + +SOURCE=.\aes\fileenc.c +# End Source File +# Begin Source File + +SOURCE=.\aes\fileenc.h +# End Source File +# Begin Source File + +SOURCE=.\aes\hmac.c +# End Source File +# Begin Source File + +SOURCE=.\aes\hmac.h +# End Source File +# Begin Source File + +SOURCE=.\aes\prng.c +# End Source File +# Begin Source File + +SOURCE=.\aes\prng.h +# End Source File +# Begin Source File + +SOURCE=.\aes\pwd2key.c +# End Source File +# Begin Source File + +SOURCE=.\aes\pwd2key.h +# End Source File +# Begin Source File + +SOURCE=.\aes\sha1.c +# End Source File +# Begin Source File + +SOURCE=.\aes\sha1.h +# End Source File +# End Group +# Begin Source File + SOURCE=..\..\cintools\labview.lib # End Source File # End Target Modified: trunk/lvzip/c_source/zlibvc.vcproj =================================================================== --- trunk/lvzip/c_source/zlibvc.vcproj 2018-12-12 11:00:57 UTC (rev 1565) +++ trunk/lvzip/c_source/zlibvc.vcproj 2018-12-12 11:01:51 UTC (rev 1566) @@ -590,7 +590,7 @@ Optimization="2" InlineFunctionExpansion="1" AdditionalIncludeDirectories="bzip2" - PreprocessorDefinitions="WIN32;NDEBUG;NO_vsnprintf;HAVE_BZIP2;BZ_NO_STDIO;EMBEDDED;_CRT_SECURE_NO_WARNINGS" + PreprocessorDefinitions="WIN32;NDEBUG;NO_vsnprintf;HAVE_AES;HAVE_BZIP2;BZ_NO_STDIO;EMBEDDED;_CRT_SECURE_NO_WARNINGS" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -2681,6 +2681,10 @@ > </File> <File + RelativePath=".\bzip2\bzcompress.c" + > + </File> + <File RelativePath=".\bzip2\bzlib.c" > </File> @@ -2693,82 +2697,6 @@ > </File> <File - RelativePath=".\bzip2\compress.c" - > - <FileConfiguration - Name="static Release|Win32" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)\$(InputName)1.obj" - XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" - /> - </FileConfiguration> - <FileConfiguration - Name="static Release|x64" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)\$(InputName)1.obj" - XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" - /> - </FileConfiguration> - <FileConfiguration - Name="DLL Debug|Win32" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)\$(InputName)1.obj" - XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" - /> - </FileConfiguration> - <FileConfiguration - Name="DLL Debug|x64" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)\$(InputName)1.obj" - XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" - /> - </FileConfiguration> - <FileConfiguration - Name="DLL Release|Win32" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)\$(InputName)1.obj" - XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" - /> - </FileConfiguration> - <FileConfiguration - Name="DLL Release|x64" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)\$(InputName)1.obj" - XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" - /> - </FileConfiguration> - <FileConfiguration - Name="DLL Embedded|Win32" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)\$(InputName)1.obj" - XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" - /> - </FileConfiguration> - <FileConfiguration - Name="DLL Embedded|x64" - > - <Tool - Name="VCCLCompilerTool" - ObjectFile="$(IntDir)\$(InputName)1.obj" - XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc" - /> - </FileConfiguration> - </File> - <File RelativePath=".\bzip2\crctable.c" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-12 11:22:04
|
Revision: 1567 http://sourceforge.net/p/opengtoolkit/svn/1567 Author: labviewer Date: 2018-12-12 11:22:02 +0000 (Wed, 12 Dec 2018) Log Message: ----------- minor edit for MSC 6 Modified Paths: -------------- trunk/lvzip/c_source/zlib.h trunk/lvzip/c_source/zlibvc.dsp Modified: trunk/lvzip/c_source/zlib.h =================================================================== --- trunk/lvzip/c_source/zlib.h 2018-12-12 11:01:51 UTC (rev 1566) +++ trunk/lvzip/c_source/zlib.h 2018-12-12 11:22:02 UTC (rev 1567) @@ -1780,21 +1780,6 @@ unsigned char FAR *window, const char *version, int stream_size)); -//#ifdef Z_PREFIX_SET -//# define lvzip_deflateInit(strm, level) \ -// deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -//# define lvzip_inflateInit(strm) \ -// inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -//# define lvzip_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ -// deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ -// (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -//# define lvzip_inflateInit2(strm, windowBits) \ -// inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ -// (int)sizeof(z_stream)) -//# define lvzip_inflateBackInit(strm, windowBits, window) \ -// inflateBackInit_((strm), (windowBits), (window), \ -// ZLIB_VERSION, (int)sizeof(z_stream)) -//#else # define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) # define inflateInit(strm) \ @@ -1808,7 +1793,6 @@ # define inflateBackInit(strm, windowBits, window) \ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, (int)sizeof(z_stream)) -//#endif #ifndef Z_SOLO Modified: trunk/lvzip/c_source/zlibvc.dsp =================================================================== --- trunk/lvzip/c_source/zlibvc.dsp 2018-12-12 11:01:51 UTC (rev 1566) +++ trunk/lvzip/c_source/zlibvc.dsp 2018-12-12 11:22:02 UTC (rev 1567) @@ -50,7 +50,7 @@ LIB32=link.exe -lib CPP=cl.exe # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "bzip2" /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "ZLIB_DLL" /FD /c +# ADD CPP /nologo /MD /W3 /O2 /I "bzip2" /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /FD /c # SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -63,7 +63,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /dll /pdb:none /machine:I386 -# ADD LINK32 user32.lib kernel32.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"Win32_DLL_Release\lvzlib.dll" +# ADD LINK32 advapi32.lib user32.lib kernel32.lib ole32.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"Win32_DLL_Release\lvzlib.dll" !ELSEIF "$(CFG)" == "zlibvc - Win32 DLL Debug" @@ -82,7 +82,7 @@ LIB32=link.exe -lib CPP=cl.exe # ADD BASE CPP /nologo /MDd /W3 /Od /D "WIN32" /D "_DEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /FD /c -# ADD CPP /nologo /MDd /W3 /ZI /Od /D "WIN32" /D "_DEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "ZLIB_DLL" /FR /FD /c +# ADD CPP /nologo /MDd /W3 /ZI /Od /I "bzip2" /D "WIN32" /D "_DEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /FR /FD /c # SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 @@ -95,7 +95,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386 -# ADD LINK32 user32.lib kernel32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"Win32_DLL_Debug\lvzlib.dll" +# ADD LINK32 advapi32.lib user32.lib kernel32.lib ole32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"msvcrt" /out:"Win32_DLL_Debug\lvzlib.dll" # SUBTRACT LINK32 /incremental:no !ELSEIF "$(CFG)" == "zlibvc - Win32 DLL Embedded" @@ -115,7 +115,7 @@ LIB32=link.exe -lib CPP=cl.exe # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "EMBEDDED" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "bzip2" /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_BZIP2" /D "HAVE_AES" /D "EMBEDDED" /D "ZLIB_DLL" /FR /FD /c +# ADD CPP /nologo /MD /W3 /O2 /I "bzip2" /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "EMBEDDED" /FR /FD /c # SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-12 23:32:47
|
Revision: 1568 http://sourceforge.net/p/opengtoolkit/svn/1568 Author: labviewer Date: 2018-12-12 23:32:45 +0000 (Wed, 12 Dec 2018) Log Message: ----------- Remove unneeded files and code from the project and make the code more multiplatform compatible Modified Paths: -------------- trunk/lvzip/c_source/Makefile trunk/lvzip/c_source/aes/brg_types.h trunk/lvzip/c_source/aes/entropy.c trunk/lvzip/c_source/aes/entropy.h trunk/lvzip/c_source/bzip2/bzlib.h trunk/lvzip/c_source/crypt.c trunk/lvzip/c_source/ioapi.c trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/unzip.c trunk/lvzip/c_source/unzip.h trunk/lvzip/c_source/zip.c trunk/lvzip/c_source/zip.h trunk/lvzip/c_source/zlibvc.dsp trunk/lvzip/c_source/zlibvc.vcproj Modified: trunk/lvzip/c_source/Makefile =================================================================== --- trunk/lvzip/c_source/Makefile 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/Makefile 2018-12-12 23:32:45 UTC (rev 1568) @@ -18,7 +18,7 @@ CC=gcc -CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN +CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -DHAVE_AES -DHAVE_BZIP2 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 #CFLAGS=-g -DDEBUG #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ @@ -25,7 +25,7 @@ # -Wstrict-prototypes -Wmissing-prototypes CINDIR=/usr/local/lv70/cintools -SFLAGS=-O3 -fPIC $(CC_ARCH_SPEC) -fvisibility=hidden -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -L$(CINDIR) +SFLAGS=-O3 -fPIC $(CC_ARCH_SPEC) -fvisibility=hidden -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -DHAVE_AES -DHAVE_BZIP2 -DBZ_NO_STDIO -Ibzip2 -L$(CINDIR) LDFLAGS=-Wl,-soname=$(SHAREDLIBM) TEST_LDFLAGS=-L. libz.a LDSHARED=gcc @@ -55,19 +55,19 @@ man3dir = ${mandir}/man3 pkgconfigdir = ${libdir}/pkgconfig -OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o +OBJZ = adler32.o crc32.o crypt.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o OBJL = lvutil.o ioapi.o iomem.o mztools.o unzip.o zip.o utf.o -OBJE = aes/aescrypt.o aes/aeskey.o aes/aestab.o aes/entropy.o aes/fileenc.o aes/hmac.o aes/prng.o aes/pwd2key.o aes/sha1.o -OBJ2 = bzip2/blocksort.o bzip2/huffman.o bzip2/crctable.o bzip2/randtable.o bzip2/compress.o bzip2/decompress.o bzip2/bzlib.o +OBJE = aes/aescrypt.o aes/aeskey.o aes/aestab.o aes/fileenc.o aes/hmac.o aes/prng.o aes/pwd2key.o aes/sha1.o +OBJ2 = bzip2/blocksort.o bzip2/huffman.o bzip2/crctable.o bzip2/randtable.o bzip2/bzcompress.o bzip2/decompress.o bzip2/bzlib.o OBJC = $(OBJZ) $(OBJL) $(OBJG) $(OBJ2) $(OBJE) -PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo +PIC_OBJZ = adler32.lo crc32.lo crypt.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo PIC_OBJL = lvapi.lo lvutil.lo ioapi.lo iomem.lo mztools.lo unzip.lo zip.lo utf.lo -PIC_OBJE = aes/aescrypt.lo aes/aeskey.lo aes/aestab.lo aes/entropy.lo aes/fileenc.lo aes/hmac.lo aes/prng.lo aes/pwd2key.lo aes/sha1.lo -PIC_OBJ2 = bzip2/blocksort.lo bzip2/huffman.lo bzip2/crctable.lo bzip2/randtable.lo bzip2/compress.lo bzip2/decompress.lo bzip2/bzlib.lo +PIC_OBJE = aes/aescrypt.lo aes/aeskey.lo aes/aestab.lo aes/fileenc.lo aes/hmac.lo aes/prng.lo aes/pwd2key.lo aes/sha1.lo +PIC_OBJ2 = bzip2/blocksort.lo bzip2/huffman.lo bzip2/crctable.lo bzip2/randtable.lo bzip2/bzcompress.lo bzip2/decompress.lo bzip2/bzlib.lo PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJL) $(PIC_OBJG) $(PIC_OBJ2) $(PIC_OBJE) # to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo @@ -282,6 +282,7 @@ gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h crc32.o: zutil.h zlib.h zconf.h crc32.h +crypt.o: zutil.h zlib.h zconf.h crypt.h deflate.o: deflate.h zutil.h zlib.h zconf.h infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h @@ -292,6 +293,7 @@ gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h crc32.lo: zutil.h zlib.h zconf.h crc32.h +crypt.lo: zutil.h zlib.h zconf.h crypt.h deflate.lo: deflate.h zutil.h zlib.h zconf.h infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h Modified: trunk/lvzip/c_source/aes/brg_types.h =================================================================== --- trunk/lvzip/c_source/aes/brg_types.h 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/aes/brg_types.h 2018-12-12 23:32:45 UTC (rev 1568) @@ -57,6 +57,7 @@ # define intptr_t unsigned int # define ptrint_t intptr_t #elif defined( __GNUC__ ) && ( __GNUC__ >= 3 ) +# include <stdint.h> # define ptrint_t intptr_t #else # define ptrint_t int Modified: trunk/lvzip/c_source/aes/entropy.c =================================================================== --- trunk/lvzip/c_source/aes/entropy.c 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/aes/entropy.c 2018-12-12 23:32:45 UTC (rev 1568) @@ -1,5 +1,21 @@ #ifdef _WIN32 -#include <windows.h> +/* `RtlGenRandom` is used over `CryptGenRandom` on Microsoft Windows based systems: + * - `CryptGenRandom` requires pulling in `CryptoAPI` which causes unnecessary + * memory overhead if this API is not being used for other purposes + * - `RtlGenRandom` is thus called directly instead. A detailed explanation + * can be found here: https://blogs.msdn.microsoft.com/michael_howard/2005/01/14/cryptographically-secure-random-number-on-windows-without-using-cryptoapi/ + * + * In spite of the disclaimer on the `RtlGenRandom` documentation page that was + * written back in the Windows XP days, this function is here to stay. The CRT + * function `rand_s()` directly depends on it, so touching it would break many + * applications released since Windows XP. + * + * Also note that Rust, Firefox and BoringSSL (thus, Google Chrome and everything + * based on Chromium) also depend on it, and that libsodium allows the RNG to be + * replaced without patching nor recompiling the library. + */ +# include <windows.h> +# define RtlGenRandom SystemFunction036 #else #include <stdio.h> #include <fcntl.h> @@ -12,21 +28,14 @@ #endif #ifdef _WIN32 +BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength); int entropy_fun(unsigned char buf[], unsigned int len) { - HCRYPTPROV provider; + unsigned int i; unsigned __int64 pentium_tsc[1]; - unsigned int i; - int result = 0; + if (RtlGenRandom(buf, len)) + return len; - if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) - { - result = CryptGenRandom(provider, len, buf); - CryptReleaseContext(provider, 0); - if (result) - return len; - } - QueryPerformanceCounter((LARGE_INTEGER *)pentium_tsc); for(i = 0; i < 8 && i < len; ++i) Modified: trunk/lvzip/c_source/aes/entropy.h =================================================================== --- trunk/lvzip/c_source/aes/entropy.h 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/aes/entropy.h 2018-12-12 23:32:45 UTC (rev 1568) @@ -7,7 +7,7 @@ { #endif -int entropy_fun(unsigned char buf[], unsigned int len); +int entropy_fun(unsigned char buf[], unsigned int len); #if defined(__cplusplus) } Modified: trunk/lvzip/c_source/bzip2/bzlib.h =================================================================== --- trunk/lvzip/c_source/bzip2/bzlib.h 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/bzip2/bzlib.h 2018-12-12 23:32:45 UTC (rev 1568) @@ -1,282 +1,282 @@ - -/*-------------------------------------------------------------*/ -/*--- Public header file for the library. ---*/ -/*--- bzlib.h ---*/ -/*-------------------------------------------------------------*/ - -/* ------------------------------------------------------------------ - This file is part of bzip2/libbzip2, a program and library for - lossless, block-sorting data compression. - - bzip2/libbzip2 version 1.0.6 of 6 September 2010 - Copyright (C) 1996-2010 Julian Seward <js...@bz...> - - Please read the WARNING, DISCLAIMER and PATENTS sections in the - README file. - - This program is released under the terms of the license contained - in the file LICENSE. - ------------------------------------------------------------------ */ - - -#ifndef _BZLIB_H -#define _BZLIB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define BZ_RUN 0 -#define BZ_FLUSH 1 -#define BZ_FINISH 2 - -#define BZ_OK 0 -#define BZ_RUN_OK 1 -#define BZ_FLUSH_OK 2 -#define BZ_FINISH_OK 3 -#define BZ_STREAM_END 4 -#define BZ_SEQUENCE_ERROR (-1) -#define BZ_PARAM_ERROR (-2) -#define BZ_MEM_ERROR (-3) -#define BZ_DATA_ERROR (-4) -#define BZ_DATA_ERROR_MAGIC (-5) -#define BZ_IO_ERROR (-6) -#define BZ_UNEXPECTED_EOF (-7) -#define BZ_OUTBUFF_FULL (-8) -#define BZ_CONFIG_ERROR (-9) - -typedef - struct { - char *next_in; - unsigned int avail_in; - unsigned int total_in_lo32; - unsigned int total_in_hi32; - - char *next_out; - unsigned int avail_out; - unsigned int total_out_lo32; - unsigned int total_out_hi32; - - void *state; - - void *(*bzalloc)(void *,int,int); - void (*bzfree)(void *,void *); - void *opaque; - } - bz_stream; - - -#ifndef BZ_IMPORT -#define BZ_EXPORT -#endif - -#ifndef BZ_NO_STDIO -/* Need a definitition for FILE */ -#include <stdio.h> -#endif - -#ifdef _WIN32 -# include <windows.h> -# ifdef small - /* windows.h define small to char */ -# undef small -# endif -# ifdef BZ_EXPORT -# define BZ_API(func) WINAPI func -# define BZ_EXTERN extern -# else - /* import windows dll dynamically */ -# define BZ_API(func) (WINAPI * func) -# define BZ_EXTERN -# endif -#else -# define BZ_API(func) func -# define BZ_EXTERN extern -#endif - - -/*-- Core (low-level) library functions --*/ - -BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( - bz_stream* strm, - int blockSize100k, - int verbosity, - int workFactor - ); - -BZ_EXTERN int BZ_API(BZ2_bzCompress) ( - bz_stream* strm, - int action - ); - -BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( - bz_stream* strm - ); - -BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( - bz_stream *strm, - int verbosity, - int small - ); - -BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( - bz_stream* strm - ); - -BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( - bz_stream *strm - ); - - - -/*-- High(er) level library functions --*/ -#ifndef BZ_NO_STDIO -#define BZ_MAX_UNUSED 5000 +/*-------------------------------------------------------------*/ +/*--- Public header file for the library. ---*/ +/*--- bzlib.h ---*/ +/*-------------------------------------------------------------*/ +/* ------------------------------------------------------------------ + This file is part of bzip2/libbzip2, a program and library for + lossless, block-sorting data compression. + + bzip2/libbzip2 version 1.0.6 of 6 September 2010 + Copyright (C) 1996-2010 Julian Seward <js...@bz...> + + Please read the WARNING, DISCLAIMER and PATENTS sections in the + README file. + + This program is released under the terms of the license contained + in the file LICENSE. + ------------------------------------------------------------------ */ + + +#ifndef _BZLIB_H +#define _BZLIB_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define BZ_RUN 0 +#define BZ_FLUSH 1 +#define BZ_FINISH 2 + +#define BZ_OK 0 +#define BZ_RUN_OK 1 +#define BZ_FLUSH_OK 2 +#define BZ_FINISH_OK 3 +#define BZ_STREAM_END 4 +#define BZ_SEQUENCE_ERROR (-1) +#define BZ_PARAM_ERROR (-2) +#define BZ_MEM_ERROR (-3) +#define BZ_DATA_ERROR (-4) +#define BZ_DATA_ERROR_MAGIC (-5) +#define BZ_IO_ERROR (-6) +#define BZ_UNEXPECTED_EOF (-7) +#define BZ_OUTBUFF_FULL (-8) +#define BZ_CONFIG_ERROR (-9) + +typedef + struct { + char *next_in; + unsigned int avail_in; + unsigned int total_in_lo32; + unsigned int total_in_hi32; + + char *next_out; + unsigned int avail_out; + unsigned int total_out_lo32; + unsigned int total_out_hi32; + + void *state; + + void *(*bzalloc)(void *,int,int); + void (*bzfree)(void *,void *); + void *opaque; + } + bz_stream; + + +#ifndef BZ_IMPORT +#define BZ_EXPORT +#endif + +#ifndef BZ_NO_STDIO +/* Need a definitition for FILE */ +#include <stdio.h> +#endif + +#ifdef _WIN32 +# include <windows.h> +# ifdef small + /* windows.h define small to char */ +# undef small +# endif +# ifdef BZ_EXPORT +# define BZ_API(func) WINAPI func +# define BZ_EXTERN extern +# else + /* import windows dll dynamically */ +# define BZ_API(func) (WINAPI * func) +# define BZ_EXTERN +# endif +#else +# define BZ_API(func) func +# define BZ_EXTERN extern +#endif + + +/*-- Core (low-level) library functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( + bz_stream* strm, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompress) ( + bz_stream* strm, + int action + ); + +BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( + bz_stream *strm, + int verbosity, + int small + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( + bz_stream* strm + ); + +BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( + bz_stream *strm + ); + + + +/*-- High(er) level library functions --*/ + +#ifndef BZ_NO_STDIO +#define BZ_MAX_UNUSED 5000 + typedef void BZFILE; - -BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( - int* bzerror, - FILE* f, - int verbosity, - int small, - void* unused, - int nUnused - ); - -BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( - int* bzerror, - BZFILE* b - ); - -BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( - int* bzerror, - BZFILE* b, - void** unused, - int* nUnused - ); - -BZ_EXTERN int BZ_API(BZ2_bzRead) ( - int* bzerror, - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( - int* bzerror, - FILE* f, - int blockSize100k, - int verbosity, - int workFactor - ); - -BZ_EXTERN void BZ_API(BZ2_bzWrite) ( - int* bzerror, - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( - int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in, - unsigned int* nbytes_out - ); - -BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( - int* bzerror, - BZFILE* b, - int abandon, - unsigned int* nbytes_in_lo32, - unsigned int* nbytes_in_hi32, - unsigned int* nbytes_out_lo32, - unsigned int* nbytes_out_hi32 - ); -#endif - - -/*-- Utility functions --*/ - -BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( - char* dest, - unsigned int* destLen, - char* source, - unsigned int sourceLen, - int blockSize100k, - int verbosity, - int workFactor - ); - -BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( - char* dest, - unsigned int* destLen, - char* source, - unsigned int sourceLen, - int small, - int verbosity - ); - - -/*-- - Code contributed by Yoshioka Tsuneo (ts...@rr...) - to support better zlib compatibility. - This code is not _officially_ part of libbzip2 (yet); - I haven't tested it, documented it, or considered the - threading-safeness of it. - If this code breaks, please contact both Yoshioka and me. ---*/ - -BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( - void - ); - -#ifndef BZ_NO_STDIO -BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( - const char *path, - const char *mode - ); - -BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( - int fd, - const char *mode - ); - -BZ_EXTERN int BZ_API(BZ2_bzread) ( - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN int BZ_API(BZ2_bzwrite) ( - BZFILE* b, - void* buf, - int len - ); - -BZ_EXTERN int BZ_API(BZ2_bzflush) ( - BZFILE* b - ); - -BZ_EXTERN void BZ_API(BZ2_bzclose) ( - BZFILE* b - ); - -BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( - BZFILE *b, - int *errnum - ); -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -/*-------------------------------------------------------------*/ -/*--- end bzlib.h ---*/ -/*-------------------------------------------------------------*/ + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( + int* bzerror, + FILE* f, + int verbosity, + int small, + void* unused, + int nUnused + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( + int* bzerror, + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( + int* bzerror, + BZFILE* b, + void** unused, + int* nUnused + ); + +BZ_EXTERN int BZ_API(BZ2_bzRead) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( + int* bzerror, + FILE* f, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN void BZ_API(BZ2_bzWrite) ( + int* bzerror, + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in, + unsigned int* nbytes_out + ); + +BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( + int* bzerror, + BZFILE* b, + int abandon, + unsigned int* nbytes_in_lo32, + unsigned int* nbytes_in_hi32, + unsigned int* nbytes_out_lo32, + unsigned int* nbytes_out_hi32 + ); +#endif + + +/*-- Utility functions --*/ + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int blockSize100k, + int verbosity, + int workFactor + ); + +BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( + char* dest, + unsigned int* destLen, + char* source, + unsigned int sourceLen, + int small, + int verbosity + ); + + +/*-- + Code contributed by Yoshioka Tsuneo (ts...@rr...) + to support better zlib compatibility. + This code is not _officially_ part of libbzip2 (yet); + I haven't tested it, documented it, or considered the + threading-safeness of it. + If this code breaks, please contact both Yoshioka and me. +--*/ + +BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( + void + ); + +#ifndef BZ_NO_STDIO +BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( + const char *path, + const char *mode + ); + +BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( + int fd, + const char *mode + ); + +BZ_EXTERN int BZ_API(BZ2_bzread) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzwrite) ( + BZFILE* b, + void* buf, + int len + ); + +BZ_EXTERN int BZ_API(BZ2_bzflush) ( + BZFILE* b + ); + +BZ_EXTERN void BZ_API(BZ2_bzclose) ( + BZFILE* b + ); + +BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( + BZFILE *b, + int *errnum + ); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/*-------------------------------------------------------------*/ +/*--- end bzlib.h ---*/ +/*-------------------------------------------------------------*/ Modified: trunk/lvzip/c_source/crypt.c =================================================================== --- trunk/lvzip/c_source/crypt.c 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/crypt.c 2018-12-12 23:32:45 UTC (rev 1568) @@ -30,7 +30,8 @@ #ifdef _WIN32 # include <windows.h> -# include <wincrypt.h> +# define RtlGenRandom SystemFunction036 +BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength); #else # include <sys/stat.h> # include <fcntl.h> @@ -87,32 +88,26 @@ int cryptrand(unsigned char *buf, unsigned int len) { #ifdef _WIN32 - HCRYPTPROV provider; - unsigned __int64 pentium_tsc[1]; - int rlen = 0; - int result = 0; +#if !EMBEDDED + BOOL result = RtlGenRandom(buf, len); + if (!result) +#endif + { + unsigned __int64 pentium_tsc[1]; + int rlen; - - if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) - { - result = CryptGenRandom(provider, len, buf); - CryptReleaseContext(provider, 0); - if (result) - return len; - } - - for (rlen = 0; rlen < (int)len; ++rlen) - { - if (rlen % 8 == 0) - QueryPerformanceCounter((LARGE_INTEGER *)pentium_tsc); - buf[rlen] = ((unsigned char*)pentium_tsc)[rlen % 8]; - } - - return rlen; + for (rlen = 0; rlen < (int)len; ++rlen) + { + if (rlen % 8 == 0) + QueryPerformanceCounter((LARGE_INTEGER *)pentium_tsc); + buf[rlen] = ((unsigned char*)pentium_tsc)[rlen % 8]; + } + return rlen; + } #else arc4random_buf(buf, len); +#endif return len; -#endif } int crypthead(const char *passwd, uint8_t *buf, int buf_size, uint32_t *pkeys, Modified: trunk/lvzip/c_source/ioapi.c =================================================================== --- trunk/lvzip/c_source/ioapi.c 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/ioapi.c 2018-12-12 23:32:45 UTC (rev 1568) @@ -63,6 +63,7 @@ return position; } +#ifndef WIN32 void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def *p_filefunc64_32, const zlib_filefunc_def *p_filefunc32) { p_filefunc64_32->zfile_func64.zopen64_file = NULL; @@ -352,3 +353,4 @@ pzlib_filefunc_def->zerror_file = ferror_file_func; pzlib_filefunc_def->opaque = NULL; } +#endif Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/lvapi.c 2018-12-12 23:32:45 UTC (rev 1568) @@ -183,13 +183,13 @@ LibAPI(int) lvzlib_compress(Bytef *dest, uInt32 *destLen, const Bytef *source, uInt32 sourceLen, int level) { - return compress2(dest, destLen, source, sourceLen, level); + return compress2(dest, (uLong*)destLen, source, (uLong)sourceLen, level); } LibAPI(int) lvzlib_uncompress(Bytef *dest, uInt32 *destLen, const Bytef *source, uInt32 sourceLen) { - return uncompress(dest, destLen, source, sourceLen); + return uncompress(dest, (uLong*)destLen, source, (uLong)sourceLen); } LibAPI(uInt32) lvzlib_crc32(uInt32 crc, const Bytef *buf, uInt32 len) Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/lvutil.c 2018-12-12 23:32:45 UTC (rev 1568) @@ -2810,7 +2810,7 @@ { zlib_filefunc64_def* pzlib_filefunc_def = (zlib_filefunc64_def*)LStrBuf(*filefunc_def); LStrLen(*filefunc_def) = sizeof(zlib_filefunc64_def); -#if Win32 && !defined(EMBEDDED) +#if Win32 fill_win32_filefunc64A(pzlib_filefunc_def); #else fill_fopen64_filefunc(pzlib_filefunc_def); Modified: trunk/lvzip/c_source/unzip.c =================================================================== --- trunk/lvzip/c_source/unzip.c 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/unzip.c 2018-12-12 23:32:45 UTC (rev 1568) @@ -356,7 +356,11 @@ us.z_filefunc.ztell32_file = NULL; if (pzlib_filefunc64_32_def == NULL) - fill_fopen64_filefunc(&us.z_filefunc.zfile_func64); +#if WIN32 + fill_win32_filefunc64A(&us.z_filefunc.zfile_func64); +#else + fill_fopen64_filefunc(&us.z_filefunc.zfile_func64); +#endif else us.z_filefunc = *pzlib_filefunc64_32_def; @@ -495,6 +499,7 @@ return (unzFile)s; } +#if 0 extern unzFile ZEXPORT unzOpen2(const char *path, zlib_filefunc_def *pzlib_filefunc32_def) { if (pzlib_filefunc32_def != NULL) @@ -505,6 +510,7 @@ } return unzOpenInternal(path, NULL); } +#endif extern unzFile ZEXPORT unzOpen2_64(const void *path, zlib_filefunc64_def *pzlib_filefunc_def) { @@ -905,7 +911,7 @@ unz_file_info64 file_info64; int err = UNZ_OK; - err = unzGetCurrentFileInfoInternal(file, pfile_info ? &file_info64 : NULL, NULL, filename, filename_size, + err = unzGetCurrentFileInfoInternal(file, &file_info64, NULL, filename, filename_size, extrafield, extrafield_size, comment, comment_size); if ((err == UNZ_OK) && (pfile_info != NULL)) Modified: trunk/lvzip/c_source/unzip.h =================================================================== --- trunk/lvzip/c_source/unzip.h 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/unzip.h 2018-12-12 23:32:45 UTC (rev 1568) @@ -29,7 +29,10 @@ #ifndef _ZLIBIOAPI_H #include "ioapi.h" +#if WIN32 +#include "iowin.h" #endif +#endif #ifdef HAVE_BZIP2 #include "bzlib.h" Modified: trunk/lvzip/c_source/zip.c =================================================================== --- trunk/lvzip/c_source/zip.c 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/zip.c 2018-12-12 23:32:45 UTC (rev 1568) @@ -622,8 +622,12 @@ ziinit.z_filefunc.ztell32_file = NULL; if (pzlib_filefunc64_32_def == NULL) +#if WIN32 + fill_win32_filefunc64A(&ziinit.z_filefunc.zfile_func64); +#else fill_fopen64_filefunc(&ziinit.z_filefunc.zfile_func64); - else +#endif + else ziinit.z_filefunc = *pzlib_filefunc64_32_def; if (append == APPEND_STATUS_CREATE) @@ -847,19 +851,7 @@ return(zipFile)zi; } -extern zipFile ZEXPORT zipOpen2(const char *path, int append, const char **globalcomment, - zlib_filefunc_def *pzlib_filefunc32_def) -{ - if (pzlib_filefunc32_def != NULL) - { - zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; - fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); - return zipOpen4(path, append, 0, globalcomment, &zlib_filefunc64_32_def_fill); - } - return zipOpen4(path, append, 0, globalcomment, NULL); -} - -extern zipFile ZEXPORT zipOpen2_64(const void *path, int append, const char **globalcomment, +extern zipFile ZEXPORT zipOpen3_64(const void *path, int append, uint64_t disk_size, const char **globalcomment, zlib_filefunc64_def *pzlib_filefunc_def) { if (pzlib_filefunc_def != NULL) @@ -868,11 +860,12 @@ zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def; zlib_filefunc64_32_def_fill.ztell32_file = NULL; zlib_filefunc64_32_def_fill.zseek32_file = NULL; - return zipOpen4(path, append, 0, globalcomment, &zlib_filefunc64_32_def_fill); + return zipOpen4(path, append, disk_size, globalcomment, &zlib_filefunc64_32_def_fill); } - return zipOpen4(path, append, 0, globalcomment, NULL); + return zipOpen4(path, append, disk_size, globalcomment, NULL); } +#if 0 extern zipFile ZEXPORT zipOpen3(const char *path, int append, uint64_t disk_size, const char **globalcomment, zlib_filefunc_def *pzlib_filefunc32_def) { @@ -885,7 +878,19 @@ return zipOpen4(path, append, disk_size, globalcomment, NULL); } -extern zipFile ZEXPORT zipOpen3_64(const void *path, int append, uint64_t disk_size, const char **globalcomment, +extern zipFile ZEXPORT zipOpen2(const char *path, int append, const char **globalcomment, + zlib_filefunc_def *pzlib_filefunc32_def) +{ + if (pzlib_filefunc32_def != NULL) + { + zlib_filefunc64_32_def zlib_filefunc64_32_def_fill; + fill_zlib_filefunc64_32_def_from_filefunc32(&zlib_filefunc64_32_def_fill,pzlib_filefunc32_def); + return zipOpen4(path, append, 0, globalcomment, &zlib_filefunc64_32_def_fill); + } + return zipOpen4(path, append, 0, globalcomment, NULL); +} + +extern zipFile ZEXPORT zipOpen2_64(const void *path, int append, const char **globalcomment, zlib_filefunc64_def *pzlib_filefunc_def) { if (pzlib_filefunc_def != NULL) @@ -894,9 +899,9 @@ zlib_filefunc64_32_def_fill.zfile_func64 = *pzlib_filefunc_def; zlib_filefunc64_32_def_fill.ztell32_file = NULL; zlib_filefunc64_32_def_fill.zseek32_file = NULL; - return zipOpen4(path, append, disk_size, globalcomment, &zlib_filefunc64_32_def_fill); + return zipOpen4(path, append, 0, globalcomment, &zlib_filefunc64_32_def_fill); } - return zipOpen4(path, append, disk_size, globalcomment, NULL); + return zipOpen4(path, append, 0, globalcomment, NULL); } extern zipFile ZEXPORT zipOpen(const char *path, int append) @@ -908,6 +913,7 @@ { return zipOpen3(path, append, 0, NULL, NULL); } +#endif extern int ZEXPORT zipOpenNewFileInZip_internal(zipFile file, const char *filename, Modified: trunk/lvzip/c_source/zip.h =================================================================== --- trunk/lvzip/c_source/zip.h 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/zip.h 2018-12-12 23:32:45 UTC (rev 1568) @@ -27,6 +27,9 @@ #ifndef _ZLIBIOAPI_H # include "ioapi.h" +# if WIN32 +# include "iowin.h" +# endif #endif #ifdef HAVE_BZIP2 Modified: trunk/lvzip/c_source/zlibvc.dsp =================================================================== --- trunk/lvzip/c_source/zlibvc.dsp 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/zlibvc.dsp 2018-12-12 23:32:45 UTC (rev 1568) @@ -115,7 +115,7 @@ LIB32=link.exe -lib CPP=cl.exe # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "EMBEDDED" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /I "bzip2" /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "EMBEDDED" /FR /FD /c +# ADD CPP /nologo /MT /W3 /O2 /I "bzip2" /D "WIN32" /D "NDEBUG" /D "NO_vsnprintf" /D "HAVE_AES" /D "HAVE_BZIP2" /D "BZ_NO_STDIO" /D "EMBEDDED" /FR /FD /c # SUBTRACT CPP /YX /Yc /Yu MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -128,7 +128,8 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 /nologo /subsystem:windows /dll /pdb:none /machine:I386 -# ADD LINK32 advapi32.lib user32.lib kernel32.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"Win32_DLL_Embedded\lvzlib.dll" +# ADD LINK32 advapi32.lib msvcrt.lib user32.lib kernel32.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /out:"Win32_DLL_Embedded\lvzlib.dll" +# SUBTRACT LINK32 /nodefaultlib !ELSEIF "$(CFG)" == "zlibvc - Win32 DLL ASM Release" @@ -423,6 +424,10 @@ # End Source File # Begin Source File +SOURCE=.\gzguts.h +# End Source File +# Begin Source File + SOURCE=.\inffast.h # End Source File # Begin Source File @@ -451,6 +456,10 @@ # End Source File # Begin Source File +SOURCE=.\lvapi.h +# End Source File +# Begin Source File + SOURCE=.\lvutil.h # End Source File # Begin Source File @@ -729,18 +738,6 @@ # End Source File # Begin Source File -SOURCE=.\aes\aes_ni.c -# End Source File -# Begin Source File - -SOURCE=.\aes\aes_ni.h -# End Source File -# Begin Source File - -SOURCE=.\aes\aes_via_ace.h -# End Source File -# Begin Source File - SOURCE=.\aes\aescrypt.c # End Source File # Begin Source File @@ -769,14 +766,6 @@ # End Source File # Begin Source File -SOURCE=.\aes\entropy.c -# End Source File -# Begin Source File - -SOURCE=.\aes\entropy.h -# End Source File -# Begin Source File - SOURCE=.\aes\fileenc.c # End Source File # Begin Source File Modified: trunk/lvzip/c_source/zlibvc.vcproj =================================================================== --- trunk/lvzip/c_source/zlibvc.vcproj 2018-12-12 11:22:02 UTC (rev 1567) +++ trunk/lvzip/c_source/zlibvc.vcproj 2018-12-12 23:32:45 UTC (rev 1568) @@ -2625,14 +2625,6 @@ > </File> <File - RelativePath=".\aes\entropy.c" - > - </File> - <File - RelativePath=".\aes\entropy.h" - > - </File> - <File RelativePath=".\aes\fileenc.c" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-14 11:19:50
|
Revision: 1570 http://sourceforge.net/p/opengtoolkit/svn/1570 Author: labviewer Date: 2018-12-14 11:19:48 +0000 (Fri, 14 Dec 2018) Log Message: ----------- Add fallback on Linux for when libbsd is not installed Modified Paths: -------------- trunk/lvzip/c_source/README trunk/lvzip/c_source/crypt.c Modified: trunk/lvzip/c_source/README =================================================================== --- trunk/lvzip/c_source/README 2018-12-13 11:34:58 UTC (rev 1569) +++ trunk/lvzip/c_source/README 2018-12-14 11:19:48 UTC (rev 1570) @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.2.8 is a general purpose data compression library. All the code is +zlib 1.2.11 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -84,7 +84,7 @@ Copyright notice: - (C) 1995-2013 Jean-loup Gailly and Mark Adler + (C) 1995-2017 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages Modified: trunk/lvzip/c_source/crypt.c =================================================================== --- trunk/lvzip/c_source/crypt.c 2018-12-13 11:34:58 UTC (rev 1569) +++ trunk/lvzip/c_source/crypt.c 2018-12-14 11:19:48 UTC (rev 1570) @@ -38,6 +38,7 @@ # include <sys/stat.h> # include <fcntl.h> # include <unistd.h> +# include <dlfcn.h> #endif #include "zlib.h" @@ -85,8 +86,13 @@ } /***************************************************************************/ - #ifndef NOCRYPT +#if Unix +#ifndef ZCR_SEED2 +# define ZCR_SEED2 3141592654UL /* use PI as default pattern */ +#endif +typedef void (*arc4random_func)(void *, unsigned int); +#endif unsigned int cryptrand(unsigned char *buf, unsigned int len) { #ifdef _WIN32 @@ -108,8 +114,46 @@ } #elif VxWorks return read_random(buf, len); -#else - arc4random_buf(buf, len); +#else // Unix + int frand; + unsigned int rlen; + static calls = 0; + static void *lib = NULL; + if (!lib) + lib = dlopen("libbsd.so", RTLD_LOCAL); + if (lib) + { + static arc4random_func func = NULL; + if (!func) + { + dlerror(); /* Clear any existing error */ + *(void**)(&func) = dlsym(lib, "arc4random"); + if (!func || dlerror()) + { + func = NULL; + } + } + if (func) + { + (*func)(buf, len); + return len; + } + } + /* arc4random could not be found */ + frand = open("/dev/urandom", O_RDONLY); + if (frand != -1) + { + rlen = (unsigned int)read(frand, buf, len); + close(frand); + } + if (rlen < len) + { + /* Ensure different random header each time */ + if (++calls == 1) + srand((unsigned int)(time(NULL) ^ ZCR_SEED2)); + while (rlen < len) + buf[rlen++] = (unsigned char)(rand() >> 7) & 0xff; + } #endif return len; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-15 23:21:02
|
Revision: 1576 http://sourceforge.net/p/opengtoolkit/svn/1576 Author: labviewer Date: 2018-12-15 23:21:00 +0000 (Sat, 15 Dec 2018) Log Message: ----------- Some more edits for compilation under Linux and VxWorks Modified Paths: -------------- trunk/lvzip/c_source/.cproject trunk/lvzip/c_source/Makefile.vxworks trunk/lvzip/c_source/aes/brg_endian.h trunk/lvzip/c_source/bzip2/decompress.c trunk/lvzip/c_source/crypt.c trunk/lvzip/c_source/inflate.c trunk/lvzip/c_source/ioapi.h trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/unzip.c trunk/lvzip/c_source/zip.c Modified: trunk/lvzip/c_source/.cproject =================================================================== --- trunk/lvzip/c_source/.cproject 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/.cproject 2018-12-15 23:21:00 UTC (rev 1576) @@ -40,6 +40,7 @@ <listOptionValue builtIn="false" value="_LARGEFILE64_SOURCE=1"/> <listOptionValue builtIn="false" value="HAVE_AES"/> <listOptionValue builtIn="false" value="HAVE_BZIP2"/> + <listOptionValue builtIn="false" value="BZ_NO_STDIO"/> </option> <option id="gnu.c.compiler.option.dialect.std.1246614591" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.c.compiler.dialect.default" valueType="enumerated"/> <option id="gnu.c.compiler.option.include.paths.338287776" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath"> @@ -110,6 +111,7 @@ <listOptionValue builtIn="false" value="_LARGEFILE64_SOURCE=1"/> <listOptionValue builtIn="false" value="HAVE_AES"/> <listOptionValue builtIn="false" value="HAVE_BZIP2"/> + <listOptionValue builtIn="false" value="BZ_NO_STDIO"/> </option> <option id="gnu.c.compiler.option.misc.other.362441626" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -march=armv7-a -mfpu=vfpv3 -mfloat-abi=softfp -fvisibility=hidden" valueType="string"/> <option id="gnu.c.compiler.option.misc.pic.717189032" name="Position Independent Code (-fPIC)" superClass="gnu.c.compiler.option.misc.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/> @@ -184,6 +186,7 @@ <listOptionValue builtIn="false" value="_LARGEFILE64_SOURCE=1"/> <listOptionValue builtIn="false" value="HAVE_AES"/> <listOptionValue builtIn="false" value="HAVE_BZIP2"/> + <listOptionValue builtIn="false" value="BZ_NO_STDIO"/> </option> <option id="gnu.c.compiler.option.misc.other.978532756" name="Other flags" superClass="gnu.c.compiler.option.misc.other" useByScannerDiscovery="false" value="-c -fmessage-length=0 -fvisibility=hidden" valueType="string"/> <option id="gnu.c.compiler.option.misc.pic.804388978" name="Position Independent Code (-fPIC)" superClass="gnu.c.compiler.option.misc.pic" useByScannerDiscovery="false" value="true" valueType="boolean"/> @@ -257,6 +260,7 @@ <listOptionValue builtIn="false" value="_LARGEFILE64_SOURCE=1"/> <listOptionValue builtIn="false" value="HAVE_AES"/> <listOptionValue builtIn="false" value="HAVE_BZIP2"/> + <listOptionValue builtIn="false" value="BZ_NO_STDIO"/> </option> <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1427234924" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/> </tool> Modified: trunk/lvzip/c_source/Makefile.vxworks =================================================================== --- trunk/lvzip/c_source/Makefile.vxworks 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/Makefile.vxworks 2018-12-15 23:21:00 UTC (rev 1576) @@ -19,12 +19,11 @@ # directory. Make will automatically locate the source file and # compile it. # $(OBJ_DIR)/gzclose.o $(OBJ_DIR)/gzlib.o $(OBJ_DIR)/gzread.o $(OBJ_DIR)/gzwrite.o -OBJECTS := $(OBJ_DIR)/aes/aescrypt.o $(OBJ_DIR)/aes/aeskey.o $(OBJ_DIR)/aes/aestab.o \ - $(OBJ_DIR)/aes/entropy.o $(OBJ_DIR)/aes/filenc.o $(OBJ_DIR)/aes/hmac.o \ - $(OBJ_DIR)/aes/prng.o $(OBJ_DIR)/aes/pwd2key.o $(OBJ_DIR)/aes/sha1.o \ +OBJECTS := $(OBJ_DIR)/aes/aescrypt.o $(OBJ_DIR)/aes/aeskey.o $(OBJ_DIR)/aes/aestab.o $(OBJ_DIR)/aes/fileenc.o \ + $(OBJ_DIR)/aes/hmac.o $(OBJ_DIR)/aes/prng.o $(OBJ_DIR)/aes/pwd2key.o $(OBJ_DIR)/aes/sha1.o \ $(OBJ_DIR)/bzip2/bzlib.o $(OBJ_DIR)/bzip2/blocksort.o $(OBJ_DIR)/bzip2/huffman.o $(OBJ_DIR)/bzip2/crctable.o \ - $(OBJ_DIR)/bzip2/randtable.o $(OBJ_DIR)/bzip2/compress.o $(OBJ_DIR)/bzip2/decompress.o \ - $(OBJ_DIR)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/deflate.o \ + $(OBJ_DIR)/bzip2/randtable.o $(OBJ_DIR)/bzip2/bzcompress.o $(OBJ_DIR)/bzip2/decompress.o \ + $(OBJ_DIR)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/crypt.o $(OBJ_DIR)/deflate.o \ $(OBJ_DIR)/inffast.o $(OBJ_DIR)/infback.o $(OBJ_DIR)/inflate.o $(OBJ_DIR)/inftrees.o \ $(OBJ_DIR)/ioapi.o $(OBJ_DIR)/iomem.o $(OBJ_DIR)/lvutil.o $(OBJ_DIR)/lvapi.o \ $(OBJ_DIR)/mztools.o $(OBJ_DIR)/trees.o $(OBJ_DIR)/uncompr.o $(OBJ_DIR)/utf.o \ @@ -75,6 +74,12 @@ @if [ ! -d "$(OBJ_DIR)" ]; then\ mkdir -p $(OBJ_DIR);\ fi + @if [ ! -d "$(OBJ_DIR)/aes" ]; then\ + mkdir -p $(OBJ_DIR)/aes;\ + fi + @if [ ! -d "$(OBJ_DIR)/bzip2" ]; then\ + mkdir -p $(OBJ_DIR)/bzip2;\ + fi clean : rm -f $(OBJECTS) $(PROJECT_TARGETS) $(wildcard $(OBJ_DIR)/*.unstripped) Modified: trunk/lvzip/c_source/aes/brg_endian.h =================================================================== --- trunk/lvzip/c_source/aes/brg_endian.h 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/aes/brg_endian.h 2018-12-15 23:21:00 UTC (rev 1576) @@ -34,7 +34,7 @@ defined(__pnacl__) # include <machine/endian.h> #elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ ) -# if !defined( __MINGW32__ ) && !defined( _AIX ) +# if !defined( __MINGW32__ ) && !defined( _AIX ) && !defined(__VXWORKS__) # include <endian.h> # if !defined( __BEOS__ ) # include <byteswap.h> Modified: trunk/lvzip/c_source/bzip2/decompress.c =================================================================== --- trunk/lvzip/c_source/bzip2/decompress.c 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/bzip2/decompress.c 2018-12-15 23:21:00 UTC (rev 1576) @@ -26,11 +26,11 @@ static void makeMaps_d ( DState* s ) { - UChar i; + int i; s->nInUse = 0; for (i = 0; i <= 255; i++) if (s->inUse[i]) { - s->seqToUnseq[s->nInUse] = i; + s->seqToUnseq[s->nInUse] = (UChar)i; s->nInUse++; } } Modified: trunk/lvzip/c_source/crypt.c =================================================================== --- trunk/lvzip/c_source/crypt.c 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/crypt.c 2018-12-15 23:21:00 UTC (rev 1576) @@ -32,7 +32,7 @@ # include <windows.h> # define RtlGenRandom SystemFunction036 BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength); -#elif VxWorks +#elif defined(__VXWORKS__) #include <random.h> #else # include <sys/stat.h> @@ -40,10 +40,9 @@ # include <unistd.h> # include <dlfcn.h> #endif - #include "zlib.h" #include "crypt.h" -#include "lvutil.h" + /***************************************************************************/ #define CRC32(c, b) ((*(pcrc_32_tab+(((uint32_t)(c) ^ (b)) & 0xff))) ^ ((c) >> 8)) @@ -86,7 +85,7 @@ /***************************************************************************/ #ifndef NOCRYPT -#if Unix +#if unix #ifndef ZCR_SEED2 # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ #endif @@ -111,11 +110,11 @@ } return rlen; } -#elif VxWorks +#elif defined(__VXWORKS__) return read_random(buf, len); #else // Unix int frand; - unsigned int rlen; + unsigned int rlen = 0; static int calls = 0; static void *lib = NULL; if (!lib) Modified: trunk/lvzip/c_source/inflate.c =================================================================== --- trunk/lvzip/c_source/inflate.c 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/inflate.c 2018-12-15 23:21:00 UTC (rev 1576) @@ -428,10 +428,10 @@ /* check function to use adler32() for zlib or crc32() for gzip */ #ifdef GUNZIP -# define UPDATE(check, buf, len) \ +# define UPDATE_CRC32(check, buf, len) \ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) #else -# define UPDATE(check, buf, len) adler32(check, buf, len) +# define UPDATE_CRC32(check, buf, len) adler32(check, buf, len) #endif /* check macros for header crc */ @@ -1201,7 +1201,7 @@ state->total += out; if ((state->wrap & 4) && out) strm->adler = state->check = - UPDATE(state->check, put - out, out); + UPDATE_CRC32(state->check, put - out, out); out = left; if ((state->wrap & 4) && ( #ifdef GUNZIP @@ -1265,8 +1265,7 @@ strm->total_out += out; state->total += out; if ((state->wrap & 4) && out) - strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); + strm->adler = state->check = UPDATE_CRC32(state->check, strm->next_out - out, out); strm->data_type = (int)state->bits + (state->last ? 64 : 0) + (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); Modified: trunk/lvzip/c_source/ioapi.h =================================================================== --- trunk/lvzip/c_source/ioapi.h 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/ioapi.h 2018-12-15 23:21:00 UTC (rev 1576) @@ -37,7 +37,7 @@ # define ZIP_UNUSED #endif -#if defined(USE_FILE32API) +#if defined(USE_FILE32API) || defined(__VXWORKS__) # define fopen64 fopen # define ftello64 ftell # define fseeko64 fseek Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/lvapi.c 2018-12-15 23:21:00 UTC (rev 1576) @@ -456,10 +456,22 @@ #if Win32 #define strcasecmp _stricmp #endif + static int caseInsensitiveNameComparer(unzFile file, const char *filename1, const char *filename2) { Unused(file); +#if VxWorks + int32 c1, c2; + + while (((c1 = *filename1++) == (c2 = *filename2++)) || (tolower(c1) == tolower(c2))) + if(c1 == '\0') + return 0; + c1 = tolower(c1); + c2 = tolower(c2); + return c1 - c2; +#else return strcasecmp(filename1, filename2); +#endif } static int caseSensitiveNameComparer(unzFile file, const char *filename1, const char *filename2) Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/lvutil.c 2018-12-15 23:21:00 UTC (rev 1576) @@ -95,8 +95,6 @@ #include <dirent.h> #include <fcntl.h> #include <unistd.h> - #define ftello64 ftello - #define fseeko64 fseeko #define ftruncate64 ftruncate #ifdef HAVE_ICONV #include <iconv.h> @@ -109,11 +107,8 @@ #endif #elif MacOSX #include <CoreFoundation/CoreFoundation.h> - #include "MacBinaryIII.h" #include <sys/stat.h> #include <sys/xattr.h> - #define ftello64 ftello - #define fseeko64 fseeko #define ftruncate64 ftruncate #if ProcessorType!=kX64 #define MacSpec FSRef @@ -1890,14 +1885,19 @@ LibAPI(MgErr) LVPath_CreateLink(Path path, Path target, uInt32 flags) { +#if !VxWorks MgErr err = mgNoErr; LWStrPtr src = NULL; LWStrPtr tgt = NULL; +#endif if (!FIsAbsPath(path)) return mgArgErr; - err = MakePathDSString(path, &src, 0); +#if VxWorks + return mgNotSupported; +#else + err = MakePathDSString(path, &src, 0); if (!err) { err = MakePathDSString(target, &tgt, 0); @@ -1937,16 +1937,22 @@ DSDisposePtr((UPtr)src); } return err; +#endif } LibAPI(MgErr) LVPath_ReadLink(Path path, Path *target, uInt32 recursive, uInt32 *fileType) { +#if !VxWorks MgErr err = mgNoErr; LWStrPtr src = NULL; +#endif if (!FIsAbsPath(path)) return mgArgErr; +#if VxWorks + return mgNotSupported; +#else err = MakePathDSString(path, &src, 0); if (!err) { @@ -2085,6 +2091,7 @@ DSDisposePtr((UPtr)src); } return err; +#endif } /* @@ -3272,12 +3279,14 @@ static MgErr unix_convert_wtomb(const wchar_t *src, int32 srclen, LStrHandle *dest, uInt32 codePage, char defaultChar, LVBoolean *defaultCharWasUsed) { - size_t dummy, length, size = 2 * srclength; + size_t dummy, length, size = 2 * srclen; wchar_t wdefChar; MgErr err = noErr; if (codePage == CP_UTF8) + { err = wchartoutf8(src, srclen, NULL, &size, 0); + } else { if (defaultChar) @@ -3290,7 +3299,7 @@ if (!err) { uChar *dbuf = LStrBuf(**dest), *dend = LStrBuf(**dest) + size; - wchar_t *sbuf = src, *send = sbuf + length; + const wchar_t *sbuf = src, *send = sbuf + srclen; #ifdef HAVE_WCRTOMB mbstate_t mbs; Modified: trunk/lvzip/c_source/unzip.c =================================================================== --- trunk/lvzip/c_source/unzip.c 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/unzip.c 2018-12-15 23:21:00 UTC (rev 1576) @@ -40,8 +40,8 @@ # include <compression.h> #endif +#define Z_BZIP2ED 12 #ifdef HAVE_BZIP2 -# define Z_BZIP2ED 12 # include "bzip2/bzlib.h" #endif Modified: trunk/lvzip/c_source/zip.c =================================================================== --- trunk/lvzip/c_source/zip.c 2018-12-15 17:11:39 UTC (rev 1575) +++ trunk/lvzip/c_source/zip.c 2018-12-15 23:21:00 UTC (rev 1576) @@ -39,8 +39,8 @@ # include <compression.h> #endif +#define Z_BZIP2ED 12 #ifdef HAVE_BZIP2 -# define Z_BZIP2ED 12 # include "bzip2/bzlib.h" #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-16 15:36:34
|
Revision: 1579 http://sourceforge.net/p/opengtoolkit/svn/1579 Author: labviewer Date: 2018-12-16 15:36:32 +0000 (Sun, 16 Dec 2018) Log Message: ----------- A few macintosh fixes Modified Paths: -------------- trunk/lvzip/c_source/crypt.c trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/lvutil.h Modified: trunk/lvzip/c_source/crypt.c =================================================================== --- trunk/lvzip/c_source/crypt.c 2018-12-15 23:26:06 UTC (rev 1578) +++ trunk/lvzip/c_source/crypt.c 2018-12-16 15:36:32 UTC (rev 1579) @@ -85,7 +85,7 @@ /***************************************************************************/ #ifndef NOCRYPT -#if unix +#if defined(unix) || defined(__APPLE_CC__) #ifndef ZCR_SEED2 # define ZCR_SEED2 3141592654UL /* use PI as default pattern */ #endif Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2018-12-15 23:26:06 UTC (rev 1578) +++ trunk/lvzip/c_source/lvapi.c 2018-12-16 15:36:32 UTC (rev 1579) @@ -31,7 +31,10 @@ #include "zip.h" #include "unzip.h" #include "lvapi.h" + +#ifdef HAVE_BZIP2 #include "bzip2/bzlib.h" +#endif #ifndef VERSIONMADEBY # define VERSIONMADEBY (0x0) /* platform depedent */ @@ -178,7 +181,14 @@ "zlib version: %s, build flags: 0x%lX\n" "minizip version: 1.2.0, September 16th, 2017" "aes version: 2013\n" - "bzip2 version: %s", lvzip_zlibVersion(), lvzip_zlibCompileFlags(), BZ2_bzlibVersion()); +#ifdef HAVE_BZIP2 + "bzip2 version: %s" +#endif + , lvzip_zlibVersion(), lvzip_zlibCompileFlags() +#ifdef HAVE_BZIP2 + , BZ2_bzlibVersion()) +#endif + ; return version; } Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2018-12-15 23:26:06 UTC (rev 1578) +++ trunk/lvzip/c_source/lvutil.c 2018-12-16 15:36:32 UTC (rev 1579) @@ -107,6 +107,7 @@ #endif #elif MacOSX #include <CoreFoundation/CoreFoundation.h> + #include <CoreServices/CoreServices.h> #include <sys/stat.h> #include <sys/xattr.h> #define ftruncate64 ftruncate Modified: trunk/lvzip/c_source/lvutil.h =================================================================== --- trunk/lvzip/c_source/lvutil.h 2018-12-15 23:26:06 UTC (rev 1578) +++ trunk/lvzip/c_source/lvutil.h 2018-12-16 15:36:32 UTC (rev 1579) @@ -29,8 +29,6 @@ #ifndef _lvUtil_H #define _lvUtil_H -//#include "zlib.h" - #ifdef __cplusplus extern "C" { #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2018-12-16 16:02:18
|
Revision: 1580 http://sourceforge.net/p/opengtoolkit/svn/1580 Author: labviewer Date: 2018-12-16 16:02:17 +0000 (Sun, 16 Dec 2018) Log Message: ----------- Fix another Macintosh issue and update XCode project file Modified Paths: -------------- trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj trunk/lvzip/c_source/zip.c Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2018-12-16 15:36:32 UTC (rev 1579) +++ trunk/lvzip/c_source/lvutil.c 2018-12-16 16:02:17 UTC (rev 1580) @@ -429,7 +429,7 @@ #include <string.h> #include <utime.h> -#if Unix || MacOSX +#if usesPosixPath /* seconds between Jan 1 1904 GMT and Jan 1 1970 GMT */ #define dt1970re1904 2082844800L @@ -445,7 +445,8 @@ { *time = sTime + dt1970re1904; } - +#endif +#if Unix || MacOSX static MgErr UnixToLVFileErr(void) { switch (errno) @@ -1520,12 +1521,12 @@ } else { - DEBUGPRINTF(("FSGetCatalogInfo: err = %ld", err)); + DEBUGPRINTF(((CStr)"FSGetCatalogInfo: err = %ld", err)); } } else { - DEBUGPRINTF(("FSMakePathRef: err = %ld", err)); + DEBUGPRINTF(((CStr)"FSMakePathRef: err = %ld", err)); } #elif usesPosixPath err = MakePathDSString(path, &lstr, 0); Modified: trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj =================================================================== --- trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2018-12-16 15:36:32 UTC (rev 1579) +++ trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2018-12-16 16:02:17 UTC (rev 1580) @@ -51,9 +51,6 @@ 883262811B163FAF003BB2F4 /* aestab.h in Headers */ = {isa = PBXBuildFile; fileRef = 8832626C1B163FAF003BB2F4 /* aestab.h */; }; 883262821B163FAF003BB2F4 /* brg_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = 8832626D1B163FAF003BB2F4 /* brg_endian.h */; }; 883262831B163FAF003BB2F4 /* brg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 8832626E1B163FAF003BB2F4 /* brg_types.h */; }; - 883262841B163FAF003BB2F4 /* entropy.c in Sources */ = {isa = PBXBuildFile; fileRef = 8832626F1B163FAF003BB2F4 /* entropy.c */; }; - 883262851B163FAF003BB2F4 /* entropy.h in Headers */ = {isa = PBXBuildFile; fileRef = 883262701B163FAF003BB2F4 /* entropy.h */; }; - 883262861B163FAF003BB2F4 /* fileenc.c in Sources */ = {isa = PBXBuildFile; fileRef = 883262711B163FAF003BB2F4 /* fileenc.c */; }; 883262871B163FAF003BB2F4 /* fileenc.h in Headers */ = {isa = PBXBuildFile; fileRef = 883262721B163FAF003BB2F4 /* fileenc.h */; }; 883262881B163FAF003BB2F4 /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 883262731B163FAF003BB2F4 /* hmac.c */; }; 883262891B163FAF003BB2F4 /* hmac.h in Headers */ = {isa = PBXBuildFile; fileRef = 883262741B163FAF003BB2F4 /* hmac.h */; }; @@ -67,7 +64,6 @@ 8832629A1B163FD6003BB2F4 /* bzlib_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 883262911B163FD6003BB2F4 /* bzlib_private.h */; }; 8832629B1B163FD6003BB2F4 /* bzlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 883262921B163FD6003BB2F4 /* bzlib.c */; }; 8832629C1B163FD6003BB2F4 /* bzlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 883262931B163FD6003BB2F4 /* bzlib.h */; }; - 8832629D1B163FD6003BB2F4 /* compress.c in Sources */ = {isa = PBXBuildFile; fileRef = 883262941B163FD6003BB2F4 /* compress.c */; }; 8832629E1B163FD6003BB2F4 /* crctable.c in Sources */ = {isa = PBXBuildFile; fileRef = 883262951B163FD6003BB2F4 /* crctable.c */; }; 8832629F1B163FD6003BB2F4 /* decompress.c in Sources */ = {isa = PBXBuildFile; fileRef = 883262961B163FD6003BB2F4 /* decompress.c */; }; 883262A01B163FD6003BB2F4 /* huffman.c in Sources */ = {isa = PBXBuildFile; fileRef = 883262971B163FD6003BB2F4 /* huffman.c */; }; @@ -75,6 +71,9 @@ 888E743A1ADD96A900C5AEFE /* utf.c in Sources */ = {isa = PBXBuildFile; fileRef = 888E74391ADD96A900C5AEFE /* utf.c */; }; 888E743C1ADD96C200C5AEFE /* utf.h in Headers */ = {isa = PBXBuildFile; fileRef = 888E743B1ADD96C200C5AEFE /* utf.h */; }; 888E743E1ADD96D700C5AEFE /* lvapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 888E743D1ADD96D700C5AEFE /* lvapi.c */; }; + 88FB252521C6954800DCE0D2 /* bzcompress.c in Sources */ = {isa = PBXBuildFile; fileRef = 88FB252421C6954800DCE0D2 /* bzcompress.c */; }; + 88FB252721C6A1CA00DCE0D2 /* crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 88FB252621C6A1CA00DCE0D2 /* crypt.c */; }; + 88FB252921C6A2A700DCE0D2 /* fileenc.c in Sources */ = {isa = PBXBuildFile; fileRef = 88FB252821C6A2A700DCE0D2 /* fileenc.c */; }; C79368AC0C9ED687006083BF /* iomem.c in Sources */ = {isa = PBXBuildFile; fileRef = C79368AA0C9ED687006083BF /* iomem.c */; }; C79368AD0C9ED687006083BF /* iomem.h in Headers */ = {isa = PBXBuildFile; fileRef = C79368AB0C9ED687006083BF /* iomem.h */; }; /* End PBXBuildFile section */ @@ -125,9 +124,6 @@ 8832626C1B163FAF003BB2F4 /* aestab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = aestab.h; path = aes/aestab.h; sourceTree = "<group>"; }; 8832626D1B163FAF003BB2F4 /* brg_endian.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = brg_endian.h; path = aes/brg_endian.h; sourceTree = "<group>"; }; 8832626E1B163FAF003BB2F4 /* brg_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = brg_types.h; path = aes/brg_types.h; sourceTree = "<group>"; }; - 8832626F1B163FAF003BB2F4 /* entropy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = entropy.c; path = aes/entropy.c; sourceTree = "<group>"; }; - 883262701B163FAF003BB2F4 /* entropy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = entropy.h; path = aes/entropy.h; sourceTree = "<group>"; }; - 883262711B163FAF003BB2F4 /* fileenc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fileenc.c; path = aes/fileenc.c; sourceTree = "<group>"; }; 883262721B163FAF003BB2F4 /* fileenc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fileenc.h; path = aes/fileenc.h; sourceTree = "<group>"; }; 883262731B163FAF003BB2F4 /* hmac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hmac.c; path = aes/hmac.c; sourceTree = "<group>"; }; 883262741B163FAF003BB2F4 /* hmac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hmac.h; path = aes/hmac.h; sourceTree = "<group>"; }; @@ -141,7 +137,6 @@ 883262911B163FD6003BB2F4 /* bzlib_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bzlib_private.h; path = bzip2/bzlib_private.h; sourceTree = "<group>"; }; 883262921B163FD6003BB2F4 /* bzlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bzlib.c; path = bzip2/bzlib.c; sourceTree = "<group>"; }; 883262931B163FD6003BB2F4 /* bzlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bzlib.h; path = bzip2/bzlib.h; sourceTree = "<group>"; }; - 883262941B163FD6003BB2F4 /* compress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = compress.c; path = bzip2/compress.c; sourceTree = "<group>"; }; 883262951B163FD6003BB2F4 /* crctable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = crctable.c; path = bzip2/crctable.c; sourceTree = "<group>"; }; 883262961B163FD6003BB2F4 /* decompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = decompress.c; path = bzip2/decompress.c; sourceTree = "<group>"; }; 883262971B163FD6003BB2F4 /* huffman.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = huffman.c; path = bzip2/huffman.c; sourceTree = "<group>"; }; @@ -150,6 +145,9 @@ 888E74391ADD96A900C5AEFE /* utf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utf.c; sourceTree = "<group>"; }; 888E743B1ADD96C200C5AEFE /* utf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utf.h; sourceTree = "<group>"; }; 888E743D1ADD96D700C5AEFE /* lvapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lvapi.c; sourceTree = "<group>"; }; + 88FB252421C6954800DCE0D2 /* bzcompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bzcompress.c; path = bzip2/bzcompress.c; sourceTree = "<group>"; }; + 88FB252621C6A1CA00DCE0D2 /* crypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crypt.c; sourceTree = "<group>"; }; + 88FB252821C6A2A700DCE0D2 /* fileenc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = fileenc.c; path = aes/fileenc.c; sourceTree = "<group>"; }; C79368AA0C9ED687006083BF /* iomem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = iomem.c; sourceTree = "<group>"; }; C79368AB0C9ED687006083BF /* iomem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = iomem.h; sourceTree = "<group>"; }; /* End PBXFileReference section */ @@ -189,6 +187,7 @@ 83D3E1B5080D116E00DE332C /* zlib Sources */ = { isa = PBXGroup; children = ( + 88FB252621C6A1CA00DCE0D2 /* crypt.c */, C79368AB0C9ED687006083BF /* iomem.h */, C79368AA0C9ED687006083BF /* iomem.c */, 88521A381AF4145000A9CDF7 /* lvapi.h */, @@ -244,6 +243,7 @@ 883262641B163F5C003BB2F4 /* aes */ = { isa = PBXGroup; children = ( + 88FB252821C6A2A700DCE0D2 /* fileenc.c */, 883262661B163FAF003BB2F4 /* aes_via_ace.h */, 883262671B163FAF003BB2F4 /* aes.h */, 883262681B163FAF003BB2F4 /* aescrypt.c */, @@ -253,9 +253,6 @@ 8832626C1B163FAF003BB2F4 /* aestab.h */, 8832626D1B163FAF003BB2F4 /* brg_endian.h */, 8832626E1B163FAF003BB2F4 /* brg_types.h */, - 8832626F1B163FAF003BB2F4 /* entropy.c */, - 883262701B163FAF003BB2F4 /* entropy.h */, - 883262711B163FAF003BB2F4 /* fileenc.c */, 883262721B163FAF003BB2F4 /* fileenc.h */, 883262731B163FAF003BB2F4 /* hmac.c */, 883262741B163FAF003BB2F4 /* hmac.h */, @@ -273,10 +270,10 @@ isa = PBXGroup; children = ( 883262901B163FD6003BB2F4 /* blocksort.c */, + 88FB252421C6954800DCE0D2 /* bzcompress.c */, 883262911B163FD6003BB2F4 /* bzlib_private.h */, 883262921B163FD6003BB2F4 /* bzlib.c */, 883262931B163FD6003BB2F4 /* bzlib.h */, - 883262941B163FD6003BB2F4 /* compress.c */, 883262951B163FD6003BB2F4 /* crctable.c */, 883262961B163FD6003BB2F4 /* decompress.c */, 883262971B163FD6003BB2F4 /* huffman.c */, @@ -391,22 +388,22 @@ 883262881B163FAF003BB2F4 /* hmac.c in Sources */, 839542C10894F2490020C3E2 /* lvutil.c in Sources */, 839542C30894F2490020C3E2 /* mztools.c in Sources */, + 88FB252721C6A1CA00DCE0D2 /* crypt.c in Sources */, 8832629F1B163FD6003BB2F4 /* decompress.c in Sources */, + 88FB252521C6954800DCE0D2 /* bzcompress.c in Sources */, 839542C70894F2490020C3E2 /* inffast.c in Sources */, 839542C80894F2490020C3E2 /* crc32.c in Sources */, 839542CA0894F2490020C3E2 /* deflate.c in Sources */, - 8832629D1B163FD6003BB2F4 /* compress.c in Sources */, 839542CC0894F2490020C3E2 /* inftrees.c in Sources */, 8832628E1B163FAF003BB2F4 /* sha1.c in Sources */, + 88FB252921C6A2A700DCE0D2 /* fileenc.c in Sources */, 839542D00894F2490020C3E2 /* zutil.c in Sources */, 839542D60894F2490020C3E2 /* compress.c in Sources */, - 883262861B163FAF003BB2F4 /* fileenc.c in Sources */, 888E743E1ADD96D700C5AEFE /* lvapi.c in Sources */, 883262A01B163FD6003BB2F4 /* huffman.c in Sources */, 8832628C1B163FAF003BB2F4 /* pwd2key.c in Sources */, 839542DA0894F2490020C3E2 /* ioapi.c in Sources */, 839542E00894F2490020C3E2 /* zip.c in Sources */, - 883262841B163FAF003BB2F4 /* entropy.c in Sources */, 839542E40894F2490020C3E2 /* unzip.c in Sources */, 839542E50894F2490020C3E2 /* uncompr.c in Sources */, 8832627E1B163FAF003BB2F4 /* aeskey.c in Sources */, @@ -445,6 +442,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( HAVE_AES, HAVE_BZIP2, + NO_BZ_STDIO, DEBUG, ); GCC_REUSE_STRINGS = NO; @@ -494,6 +492,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( HAVE_AES, HAVE_BZIP2, + NO_BZ_STDIO, ); GCC_REUSE_STRINGS = NO; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; @@ -540,6 +539,7 @@ GCC_PREPROCESSOR_DEFINITIONS = ( HAVE_AES, HAVE_BZIP2, + NO_BZ_STDIO, ); GCC_REUSE_STRINGS = NO; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; Modified: trunk/lvzip/c_source/zip.c =================================================================== --- trunk/lvzip/c_source/zip.c 2018-12-16 15:36:32 UTC (rev 1579) +++ trunk/lvzip/c_source/zip.c 2018-12-16 16:02:17 UTC (rev 1580) @@ -601,7 +601,7 @@ return offset; } -extern zipFile ZEXPORT zipOpen4(const void *path, int append, uint64_t disk_size, const char **globalcomment, +static zipFile ZEXPORT zipOpen4(const void *path, int append, uint64_t disk_size, const char **globalcomment, zlib_filefunc64_32_def *pzlib_filefunc64_32_def) { zip64_internal ziinit; @@ -920,7 +920,7 @@ } #endif -extern int ZEXPORT zipOpenNewFileInZip_internal(zipFile file, +static int ZEXPORT zipOpenNewFileInZip_internal(zipFile file, const char *filename, const zip_fileinfo *zipfi, const void *extrafield_local, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2019-07-15 21:33:28
|
Revision: 1585 http://sourceforge.net/p/opengtoolkit/svn/1585 Author: labviewer Date: 2019-07-15 21:33:27 +0000 (Mon, 15 Jul 2019) Log Message: ----------- Change globalCommet back to a normal C string Modified Paths: -------------- trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvapi.h Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2019-07-02 18:51:29 UTC (rev 1584) +++ trunk/lvzip/c_source/lvapi.c 2019-07-15 21:33:27 UTC (rev 1585) @@ -362,7 +362,7 @@ * stream: A handle to return the compresses zip archive for memory streams * ****************************************************************************************************/ -LibAPI(MgErr) lvzlib_zipClose(LVRefNum *refnum, const LStrHandle globalComment, LStrHandle *stream) +LibAPI(MgErr) lvzlib_zipClose(LVRefNum *refnum, const char *globalComment, LStrHandle *stream) { zipFile node; MgErr err = lvzlibDisposeRefnum(refnum, &node, ZipMagic); @@ -369,7 +369,7 @@ if (!err) { *refnum = kNotARefNum; - err = LibToMgErr(zipClose2(node, (const char*)LStrBufH(globalComment), VERSIONMADEBY, (voidpf*)stream)); + err = LibToMgErr(zipClose2(node, globalComment, VERSIONMADEBY, (voidpf*)stream)); } return err; } Modified: trunk/lvzip/c_source/lvapi.h =================================================================== --- trunk/lvzip/c_source/lvapi.h 2019-07-02 18:51:29 UTC (rev 1584) +++ trunk/lvzip/c_source/lvapi.h 2019-07-15 21:33:27 UTC (rev 1585) @@ -45,7 +45,7 @@ LibAPI(MgErr) lvzlib_zipWriteInFileInZip(LVRefNum *refnum, const LStrHandle buffer); LibAPI(MgErr) lvzlib_zipCloseFileInZipRaw32(LVRefNum *refnum, uInt32 uncompressedSize, uInt32 crc32); LibAPI(MgErr) lvzlib_zipCloseFileInZipRaw64(LVRefNum *refnum, uInt64 uncompressedSize, uInt32 crc32); -LibAPI(MgErr) lvzlib_zipClose(LVRefNum *refnum, const LStrHandle globalComment, LStrHandle *stream); +LibAPI(MgErr) lvzlib_zipClose(LVRefNum *refnum, const char *globalComment, LStrHandle *stream); /* exported unzip functions */ LibAPI(MgErr) lvzlib_unzOpen(const void *pathname, zlib_filefunc64_def* filefuncs, LVRefNum *refnum); LibAPI(MgErr) lvzlib_unzClose(LVRefNum *refnum, LStrHandle *stream); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2019-08-24 00:36:59
|
Revision: 1587 http://sourceforge.net/p/opengtoolkit/svn/1587 Author: labviewer Date: 2019-08-24 00:36:58 +0000 (Sat, 24 Aug 2019) Log Message: ----------- Fix a crash due to alignment issues in certain LabVIEW versions Modified Paths: -------------- trunk/lvzip/c_source/unzip.c trunk/lvzip/c_source/unzip.h Modified: trunk/lvzip/c_source/unzip.c =================================================================== --- trunk/lvzip/c_source/unzip.c 2019-07-15 21:34:47 UTC (rev 1586) +++ trunk/lvzip/c_source/unzip.c 2019-08-24 00:36:58 UTC (rev 1587) @@ -901,7 +901,6 @@ if (err == UNZ_OK) err = unzGetCurrentFileInfoField(file, &seek, comment, comment_size, file_info.size_file_comment, 1); - if ((err == UNZ_OK) && (pfile_info != NULL)) *pfile_info = file_info; if ((err == UNZ_OK) && (pfile_info_internal != NULL)) Modified: trunk/lvzip/c_source/unzip.h =================================================================== --- trunk/lvzip/c_source/unzip.h 2019-07-15 21:34:47 UTC (rev 1586) +++ trunk/lvzip/c_source/unzip.h 2019-08-24 00:36:58 UTC (rev 1587) @@ -83,14 +83,13 @@ uint16_t size_filename; /* filename length 2 bytes, 34 */ uint16_t size_file_extra; /* extra field length 2 bytes, 36 */ uint16_t size_file_comment; /* file comment length 2 bytes, 38 */ - uint16_t padding1; /* filler1 2 bytes, 40 */ + uint16_t size_file_extra_internal; /* 2 bytes, 40 */ uint32_t disk_num_start; /* disk number start 4 bytes, 44 */ uint16_t internal_fa; /* internal file attributes 2 bytes, 46 */ - uint16_t padding2; /* filler2 2 bytes, 48 */ +// uint16_t padding1; /* filler1 2 bytes, 48 */ uint32_t external_fa; /* external file attributes 4 bytes, 52 */ - uint32_t padding3; /* filler3 4 bytes, 56 */ +// uint32_t padding2; /* filler2 4 bytes, 56 */ uint64_t disk_offset; /* disk offset 8 bytes, 64 */ - uint16_t size_file_extra_internal; /* 2 bytes, 66 */ } unz_file_info64; typedef struct unz_file_info_s @@ -109,7 +108,7 @@ uint16_t disk_num_start; /* disk number start 2 bytes, 32 */ uint16_t internal_fa; /* internal file attributes 2 bytes, 34 */ - uint16_t padding1; /* filler1 2 bytes, 36 */ +// uint16_t padding1; /* filler1 2 bytes, 36 */ uint32_t external_fa; /* external file attributes 4 bytes, 40 */ uint64_t disk_offset; /* disk offset 8 bytes, 48 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2019-08-24 01:04:53
|
Revision: 1588 http://sourceforge.net/p/opengtoolkit/svn/1588 Author: labviewer Date: 2019-08-24 01:04:51 +0000 (Sat, 24 Aug 2019) Log Message: ----------- minor improvements trying to protect access to possible NULL pointers Modified Paths: -------------- trunk/lvzip/c_source/crypt.c trunk/lvzip/c_source/iomem.c trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvapi.h trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/zlib.rc Modified: trunk/lvzip/c_source/crypt.c =================================================================== --- trunk/lvzip/c_source/crypt.c 2019-08-24 00:36:58 UTC (rev 1587) +++ trunk/lvzip/c_source/crypt.c 2019-08-24 01:04:51 UTC (rev 1588) @@ -36,6 +36,7 @@ # include <stdio.h> # include <stdlib.h> # include <sys/stat.h> +# include <time.h> # include <fcntl.h> # include <unistd.h> # include <dlfcn.h> Modified: trunk/lvzip/c_source/iomem.c =================================================================== --- trunk/lvzip/c_source/iomem.c 2019-08-24 00:36:58 UTC (rev 1587) +++ trunk/lvzip/c_source/iomem.c 2019-08-24 01:04:51 UTC (rev 1588) @@ -89,7 +89,7 @@ memio->error = 0; if (opaque && !(mode & ZLIB_FILEFUNC_MODE_CREATE)) - memio->pos = LStrLen(*(LStrHandle)opaque); + memio->pos = LStrLenH((LStrHandle)opaque); } return memio; } @@ -115,8 +115,8 @@ if (mem->pos + size > 0x7FFFFFFF) size = (uint32_t)(0x7FFFFFFF - mem->pos); - if (mem->pos + size > (uint64_t)LStrLen(*(LStrHandle)opaque)) - size = (uint32_t)(LStrLen(*(LStrHandle)opaque) - mem->pos); + if (mem->pos + size > (uint64_t)LStrLenH((LStrHandle)opaque)) + size = (uint32_t)(LStrLenH((LStrHandle)opaque) - mem->pos); zmemcpy(buf, LStrBuf(*(LStrHandle)opaque) + mem->pos, size); mem->pos += size; @@ -206,9 +206,8 @@ start = mem->pos; break; case ZLIB_FILEFUNC_SEEK_END : - if (opaque) - start = LStrLen(*(LStrHandle)opaque); - /* no break */ + start = LStrLenH((LStrHandle)opaque); + /* no break */ case ZLIB_FILEFUNC_SEEK_SET : break; default: Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2019-08-24 00:36:58 UTC (rev 1587) +++ trunk/lvzip/c_source/lvapi.c 2019-08-24 01:04:51 UTC (rev 1588) @@ -247,16 +247,19 @@ if (!err && comment) { int32 len = (int32)strlen(comment); - err = NumericArrayResize(uB, 1, (UHandle*)globalcomment, len); - if (!err) + if (len > 0) { - MoveBlock((ConstUPtr)comment, LStrBuf(**globalcomment), len); - LStrLen(**globalcomment) = len; + err = NumericArrayResize(uB, 1, (UHandle*)globalcomment, len); + if (!err) + { + MoveBlock((ConstUPtr)comment, LStrBuf(**globalcomment), len); + LStrLen(**globalcomment) = len; + } + else + { + lvzlibDisposeRefnum(refnum, NULL, ZipMagic); + } } - else - { - lvzlibDisposeRefnum(refnum, NULL, ZipMagic); - } } if (err) { @@ -319,13 +322,18 @@ LibAPI(MgErr) lvzlib_zipWriteInFileInZip(LVRefNum *refnum, const LStrHandle buffer) { - zipFile node; - MgErr err = lvzlibGetRefnum(refnum, &node, ZipMagic); - if (!err) + MgErr err = mgNoErr; + int32 len = LStrLenH(buffer); + if (len > 0) { - int retval = zipWriteInFileInZip(node, LStrBuf(*buffer), LStrLen(*buffer)); - if (retval < 0) - return LibToMgErr(retval); + zipFile node; + err = lvzlibGetRefnum(refnum, &node, ZipMagic); + if (!err) + { + int retval = zipWriteInFileInZip(node, LStrBuf(*buffer), len); + if (retval < 0) + return LibToMgErr(retval); + } } return err; } @@ -442,16 +450,22 @@ err = LibToMgErr(unzGetGlobalInfo(node, &pglobal_info)); if (!err) { - err = NumericArrayResize(uB, 1, (UHandle*)comment, pglobal_info.size_comment); - if (!err) + if (pglobal_info.size_comment) { - err = LibToMgErr(unzGetGlobalComment(node, (char*)LStrBuf(**comment), pglobal_info.size_comment)); + err = NumericArrayResize(uB, 1, (UHandle*)comment, pglobal_info.size_comment + 1); if (!err) { - LStrLen(**comment) = pglobal_info.size_comment; - *nEntry = pglobal_info.number_entry; + err = LibToMgErr(unzGetGlobalComment(node, (char*)LStrBuf(**comment), pglobal_info.size_comment + 1)); } } + if (*comment) + { + LStrLen(**comment) = pglobal_info.size_comment; + } + if (!err) + { + *nEntry = pglobal_info.number_entry; + } } } return err; @@ -467,21 +481,54 @@ err = LibToMgErr(unzGetGlobalInfo64(node, &pglobal_info)); if (!err) { - err = NumericArrayResize(uB, 1, (UHandle*)comment, pglobal_info.size_comment); - if (!err) + if (pglobal_info.size_comment) { - err = LibToMgErr(unzGetGlobalComment(node, (char*)LStrBuf(**comment), pglobal_info.size_comment)); + err = NumericArrayResize(uB, 1, (UHandle*)comment, pglobal_info.size_comment); if (!err) { - LStrLen(**comment) = pglobal_info.size_comment; - *nEntry = pglobal_info.number_entry; + err = LibToMgErr(unzGetGlobalComment(node, (char*)LStrBuf(**comment), pglobal_info.size_comment)); } } + if (*comment) + { + LStrLen(**comment) = pglobal_info.size_comment; + } + if (!err) + { + *nEntry = pglobal_info.number_entry; + } } } return err; } +static MgErr RetrieveFileInfo(unzFile node, unz_file_info *pfile_info, LStrHandle *fileName, uint16_t sizeFileName, LStrHandle *extraField, uint16_t sizeExtraField, LStrHandle *comment, uint16_t sizeComment) +{ + MgErr err = NumericArrayResize(uB, 1, (UHandle*)extraField, sizeExtraField + 1); + if (!err) + { + err = NumericArrayResize(uB, 1, (UHandle*)fileName, sizeFileName + 1); + if (!err) + { + err = NumericArrayResize(uB, 1, (UHandle*)comment, sizeComment + 1); + if (!err) + { + err = LibToMgErr(unzGetCurrentFileInfo(node, pfile_info, (char*)LStrBufH(*fileName), sizeFileName + 1, LStrBufH(*extraField), sizeExtraField + 1, (char*)LStrBufH(*comment), sizeComment + 1)); + if (!err) + { + if (*extraField) + LStrLen(**extraField) = sizeExtraField; + if (*fileName) + LStrLen(**fileName) = sizeFileName; + if (*comment) + LStrLen(**comment) = sizeComment; + } + } + } + } + return err; +} + /**************************************************************************************************** * * Position the current file pointer to the file with fileName @@ -557,25 +604,37 @@ return err; } -static MgErr RetrieveFileInfo(unzFile node, unz_file_info *pfile_info, LStrHandle *fileName, uint16_t sizeFileName, LStrHandle *extraField, uint16_t sizeExtraField, LStrHandle *comment, uint16_t sizeComment) +MgErr lvzlib_unzLocateFile2_64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment, int iCaseSensitivity) { - MgErr err = NumericArrayResize(uB, 1, (UHandle*)extraField, sizeExtraField); + unzFile node; + MgErr err = lvzlibGetRefnum(refnum, &node, UnzMagic); if (!err) { - err = NumericArrayResize(uB, 1, (UHandle*)fileName, sizeFileName); + err = ZeroTerminateLString(fileName); if (!err) { - err = NumericArrayResize(uB, 1, (UHandle*)comment, sizeComment); + unzFileNameComparer filename_compare_func = NULL; + if ( +#if Mac || MSWin || VxWorks + !iCaseSensitivity || +#endif + iCaseSensitivity == 2) + { + filename_compare_func = caseInsensitiveNameComparer; + } + else + { + filename_compare_func = caseSensitiveNameComparer; + } + err = LibToMgErr(unzLocateFile(node, (const char*)LStrBufH(*fileName), filename_compare_func)); if (!err) { - err = LibToMgErr(unzGetCurrentFileInfo(node, pfile_info, (char*)LStrBuf(**fileName), sizeFileName, LStrBuf(**extraField), sizeExtraField, (char*)LStrBuf(**comment), sizeComment)); + err = LibToMgErr(unzGetCurrentFileInfo64(node, pfile_info, NULL, 0, NULL, 0, NULL, 0)); if (!err) { - LStrLen(**extraField) = sizeExtraField; - LStrLen(**fileName) = sizeFileName; - LStrLen(**comment) = sizeComment; + err = RetrieveFileInfo(node, NULL, fileName, pfile_info->size_filename, extraField, pfile_info->size_file_extra, comment, pfile_info->size_file_comment); } - } + } } } return err; @@ -673,13 +732,15 @@ err = NumericArrayResize(uB, 1, (UHandle*)extra, len); if (!err) { - err = LibToMgErr(unzGetLocalExtrafield(node, LStrBuf(**extra), len)); - if (!err) - LStrLen(**extra) = len; + LStrLen(**extra) = unzGetLocalExtrafield(node, LStrBuf(**extra), len); } - return err; } - err = LibToMgErr(len); + else + { + err = LibToMgErr(len); + } + if (*extra) + LStrLen(**extra) = 0; } return err; } @@ -698,7 +759,7 @@ { unzFile node; MgErr err = lvzlibGetRefnum(refnum, &node, UnzMagic); - if (!err) + if (!err && buffer) { int retval = unzReadCurrentFile(node, LStrBuf(*buffer), LStrLen(*buffer)); if (retval < 0) Modified: trunk/lvzip/c_source/lvapi.h =================================================================== --- trunk/lvzip/c_source/lvapi.h 2019-08-24 00:36:58 UTC (rev 1587) +++ trunk/lvzip/c_source/lvapi.h 2019-08-24 01:04:51 UTC (rev 1588) @@ -52,6 +52,7 @@ LibAPI(MgErr) lvzlib_unzGetGlobalInfo32(LVRefNum *refnum, LStrHandle *comment, uInt32 *nEntry); LibAPI(MgErr) lvzlib_unzGetGlobalInfo64(LVRefNum *refnum, LStrHandle *comment, uInt64 *nEntry); LibAPI(MgErr) lvzlib_unzLocateFile(LVRefNum *refnum, LStrHandle fileName, int iCaseSensitivity); +LibAPI(MgErr) lvzlib_unzLocateFile2_64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment, int iCaseSensitivity); LibAPI(MgErr) lvzlib_unzGetCurrentFileInfo32(LVRefNum *refnum, unz_file_info *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); LibAPI(MgErr) lvzlib_unzGetCurrentFileInfo64(LVRefNum *refnum, unz_file_info64 *pfile_info, LStrHandle *fileName, LStrHandle *extraField, LStrHandle *comment); LibAPI(MgErr) lvzlib_unzOpenCurrentFile(LVRefNum *refnum, int32* method, int32* level, int16 raw, const char* password); Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2019-08-24 00:36:58 UTC (rev 1587) +++ trunk/lvzip/c_source/lvutil.c 2019-08-24 01:04:51 UTC (rev 1588) @@ -1373,7 +1373,7 @@ { DEBUGPRINTF(("FSSetCatalogInfo: err = %ld", err)); } - else if (LStrLen(*comment) > 0) + else if (LStrLenH(comment) > 0) { /* Ignore error for getting Desktop comments */ ret = OSErrToLVErr(PBDTGetPath(&dtpb)); @@ -1629,7 +1629,7 @@ LStrHandle hfsPath = NULL; /* Convert the posix path to an HFS path */ err = ConvertFromPosixPath(str, len, CP_ACP, &hfsPath, CP_ACP, '?', NULL, isDir); - if (!err) + if (!err && hsfPath) { err = FTextToPath(LStrBuf(*hfsPath), LStrLen(*hfsPath), path); } @@ -2817,7 +2817,7 @@ LibAPI(MgErr) ConvertCString(ConstCStr src, int32 srclen, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed) { - MgErr err; + MgErr err = noErr; if (srccp != destcp) { UStrHandle ustr = NULL; @@ -2833,12 +2833,15 @@ { if (srclen == -1) srclen = StrLen(src); - err = NumericArrayResize(uB, 1, (UHandle*)dest, srclen); - if (!err) + if (srclen > 0) { - MoveBlock(src, LStrBuf(**dest), srclen); - LStrLen(**dest) = srclen; - return err; + err = NumericArrayResize(uB, 1, (UHandle*)dest, srclen); + if (!err) + { + MoveBlock(src, LStrBuf(**dest), srclen); + LStrLen(**dest) = srclen; + return err; + } } } if (*dest) @@ -2853,7 +2856,7 @@ #if usesWinPath Unused(isDir); err = ConvertCString(src, srclen, srccp, dest, destcp, defaultChar, defUsed); - if (!err) + if (!err && *dest) { int32 len = LStrLen(**dest); UPtr buf = LStrBuf(**dest); @@ -2979,7 +2982,7 @@ #if usesWinPath Unused(isDir); err = ConvertLString(src, srccp, dest, destcp, defaultChar, defUsed); - if (!err) + if (!err && *dest) { int32 len = LStrLen(**dest); UPtr buf = LStrBuf(**dest); @@ -3340,7 +3343,7 @@ LibAPI(MgErr) ZeroTerminateLString(LStrHandle *dest) { - int32 size = dest ? LStrLen(**dest) : 0; + int32 size = LStrLenH(*dest); MgErr err = NumericArrayResize(uB, 1, (UHandle*)dest, size + 1); if (!err) LStrBuf(**dest)[size] = 0; Modified: trunk/lvzip/c_source/zlib.rc =================================================================== --- trunk/lvzip/c_source/zlib.rc 2019-08-24 00:36:58 UTC (rev 1587) +++ trunk/lvzip/c_source/zlib.rc 2019-08-24 01:04:51 UTC (rev 1588) @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 4,1,0 - PRODUCTVERSION 4,1,0 + FILEVERSION 4,2,0 + PRODUCTVERSION 4,2,0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN VALUE "FileDescription", "LabVIEW zlib data compression library\0" - VALUE "FileVersion", "4.1.0.LV7\0" + VALUE "FileVersion", "4.2.0.LV7\0" VALUE "InternalName", "lvzlib\0" VALUE "OriginalFilename", "lvzlib.dll\0" VALUE "ProductName", "LVZLib.DLL\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\r\nZIP support by Gilles Vollant\r\nLabVIEW support by Rolf Kalbermatter\r\nBased on zlib 1.2.8 and minizip 1.1\0" - VALUE "LegalCopyright", "(C) 1995-2014 Jean-loup Gailly & Mark Adler\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\r\nZIP support by Gilles Vollant\r\nLabVIEW support by Rolf Kalbermatter\r\nBased on zlib 1.2.11 and minizip 1.2\0" + VALUE "LegalCopyright", "(C) 1995-2017 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2019-09-01 16:38:49
|
Revision: 1594 http://sourceforge.net/p/opengtoolkit/svn/1594 Author: labviewer Date: 2019-09-01 16:38:47 +0000 (Sun, 01 Sep 2019) Log Message: ----------- Update Macintosh framework Modified Paths: -------------- trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2019-08-31 22:52:12 UTC (rev 1593) +++ trunk/lvzip/c_source/lvutil.c 2019-09-01 16:38:47 UTC (rev 1594) @@ -1629,7 +1629,7 @@ LStrHandle hfsPath = NULL; /* Convert the posix path to an HFS path */ err = ConvertFromPosixPath(str, len, CP_ACP, &hfsPath, CP_ACP, '?', NULL, isDir); - if (!err && hsfPath) + if (!err && hfsPath) { err = FTextToPath(LStrBuf(*hfsPath), LStrLen(*hfsPath), path); } Modified: trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj =================================================================== --- trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2019-08-31 22:52:12 UTC (rev 1593) +++ trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2019-09-01 16:38:47 UTC (rev 1594) @@ -51,6 +51,7 @@ 883262811B163FAF003BB2F4 /* aestab.h in Headers */ = {isa = PBXBuildFile; fileRef = 8832626C1B163FAF003BB2F4 /* aestab.h */; }; 883262821B163FAF003BB2F4 /* brg_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = 8832626D1B163FAF003BB2F4 /* brg_endian.h */; }; 883262831B163FAF003BB2F4 /* brg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 8832626E1B163FAF003BB2F4 /* brg_types.h */; }; + 883262851B163FAF003BB2F4 /* entropy.h in Headers */ = {isa = PBXBuildFile; fileRef = 883262701B163FAF003BB2F4 /* entropy.h */; }; 883262871B163FAF003BB2F4 /* fileenc.h in Headers */ = {isa = PBXBuildFile; fileRef = 883262721B163FAF003BB2F4 /* fileenc.h */; }; 883262881B163FAF003BB2F4 /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 883262731B163FAF003BB2F4 /* hmac.c */; }; 883262891B163FAF003BB2F4 /* hmac.h in Headers */ = {isa = PBXBuildFile; fileRef = 883262741B163FAF003BB2F4 /* hmac.h */; }; @@ -124,6 +125,7 @@ 8832626C1B163FAF003BB2F4 /* aestab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = aestab.h; path = aes/aestab.h; sourceTree = "<group>"; }; 8832626D1B163FAF003BB2F4 /* brg_endian.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = brg_endian.h; path = aes/brg_endian.h; sourceTree = "<group>"; }; 8832626E1B163FAF003BB2F4 /* brg_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = brg_types.h; path = aes/brg_types.h; sourceTree = "<group>"; }; + 883262701B163FAF003BB2F4 /* entropy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = entropy.h; path = aes/entropy.h; sourceTree = "<group>"; }; 883262721B163FAF003BB2F4 /* fileenc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fileenc.h; path = aes/fileenc.h; sourceTree = "<group>"; }; 883262731B163FAF003BB2F4 /* hmac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hmac.c; path = aes/hmac.c; sourceTree = "<group>"; }; 883262741B163FAF003BB2F4 /* hmac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hmac.h; path = aes/hmac.h; sourceTree = "<group>"; }; @@ -253,6 +255,7 @@ 8832626C1B163FAF003BB2F4 /* aestab.h */, 8832626D1B163FAF003BB2F4 /* brg_endian.h */, 8832626E1B163FAF003BB2F4 /* brg_types.h */, + 883262701B163FAF003BB2F4 /* entropy.h */, 883262721B163FAF003BB2F4 /* fileenc.h */, 883262731B163FAF003BB2F4 /* hmac.c */, 883262741B163FAF003BB2F4 /* hmac.h */, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2019-09-02 20:05:58
|
Revision: 1596 http://sourceforge.net/p/opengtoolkit/svn/1596 Author: labviewer Date: 2019-09-02 20:05:56 +0000 (Mon, 02 Sep 2019) Log Message: ----------- Update to latest state from the nmoinvaz/minizip ver 1.2 github repository Modified Paths: -------------- trunk/lvzip/c_source/ioapi.h trunk/lvzip/c_source/unzip.c trunk/lvzip/c_source/zip.c Modified: trunk/lvzip/c_source/ioapi.h =================================================================== --- trunk/lvzip/c_source/ioapi.h 2019-09-01 16:39:24 UTC (rev 1595) +++ trunk/lvzip/c_source/ioapi.h 2019-09-02 20:05:56 UTC (rev 1596) @@ -42,13 +42,8 @@ # define ftello64 ftell # define fseeko64 fseek #else -# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__ANDROID__) +# if defined(_MSC_VER) # define fopen64 fopen -# define ftello64 ftello -# define fseeko64 fseeko -# endif -# ifdef _MSC_VER -# define fopen64 fopen # if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC))) # define ftello64 _ftelli64 # define fseeko64 _fseeki64 @@ -56,6 +51,10 @@ # define ftello64 ftell # define fseeko64 fseek # endif +# else +# define fopen64 fopen +# define ftello64 ftello +# define fseeko64 fseeko # endif #endif Modified: trunk/lvzip/c_source/unzip.c =================================================================== --- trunk/lvzip/c_source/unzip.c 2019-09-01 16:39:24 UTC (rev 1595) +++ trunk/lvzip/c_source/unzip.c 2019-09-02 20:05:56 UTC (rev 1596) @@ -1251,8 +1251,7 @@ #endif { int i; - int8_t actual; - uint8_t expected; + uint8_t actual, expected; s->pcrc_32_tab = (const z_crc_t*)get_crc_table(); init_keys(password, s->keys, s->pcrc_32_tab); @@ -1268,7 +1267,7 @@ s->cur_file_info.crc >> 24); actual = (uint8_t)source[11]; - if (expected != actual) { + if ((actual != 0) && (expected != actual)) { return UNZ_BADPASSWORD; } Modified: trunk/lvzip/c_source/zip.c =================================================================== --- trunk/lvzip/c_source/zip.c 2019-09-01 16:39:24 UTC (rev 1595) +++ trunk/lvzip/c_source/zip.c 2019-09-02 20:05:56 UTC (rev 1596) @@ -1520,9 +1520,8 @@ if ((zi->ci.compression_method == Z_DEFLATED) && (!zi->ci.raw)) { + uint32_t total_out_before = (uint32_t)zi->ci.stream.total_out; #ifdef HAVE_APPLE_COMPRESSION - uLong total_out_before = zi->ci.stream.total_out; - zi->ci.astream.src_ptr = zi->ci.stream.next_in; zi->ci.astream.src_size = zi->ci.stream.avail_in; zi->ci.astream.dst_ptr = zi->ci.stream.next_out; @@ -1533,7 +1532,7 @@ status = compression_stream_process(&zi->ci.astream, flags); - uLong total_out_after = len - zi->ci.astream.src_size; + uint32_t total_out_after = len - zi->ci.astream.src_size; zi->ci.stream.next_in = zi->ci.astream.src_ptr; zi->ci.stream.avail_in = zi->ci.astream.src_size; @@ -1546,7 +1545,6 @@ if (status == COMPRESSION_STATUS_ERROR) err = ZIP_INTERNALERROR; #else - uint32_t total_out_before = (uint32_t)zi->ci.stream.total_out; err = deflate(&zi->ci.stream, Z_NO_FLUSH); zi->ci.pos_in_buffered_data += (uint32_t)(zi->ci.stream.total_out - total_out_before); #endif @@ -1908,7 +1906,7 @@ pos = centraldir_pos_inzip - zi->add_position_when_writting_offset; /* Write the ZIP64 central directory header */ - if (pos >= UINT32_MAX || zi->number_entry > UINT32_MAX) + if (pos >= UINT32_MAX || zi->number_entry > UINT16_MAX) { uint64_t zip64_eocd_pos_inzip = ZTELL64(zi->z_filefunc, zi->filestream); uint32_t zip64_datasize = 44; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2019-09-14 14:19:14
|
Revision: 1601 http://sourceforge.net/p/opengtoolkit/svn/1601 Author: labviewer Date: 2019-09-14 14:19:12 +0000 (Sat, 14 Sep 2019) Log Message: ----------- Cleanup various makefiles somewhat Modified Paths: -------------- trunk/lvzip/c_source/Makefile trunk/lvzip/c_source/Makefile.vxworks trunk/lvzip/c_source/zlibvc.vcproj Removed Paths: ------------- trunk/lvzip/c_source/Makefile.x64 Modified: trunk/lvzip/c_source/Makefile =================================================================== --- trunk/lvzip/c_source/Makefile 2019-09-13 16:17:41 UTC (rev 1600) +++ trunk/lvzip/c_source/Makefile 2019-09-14 14:19:12 UTC (rev 1601) @@ -33,6 +33,8 @@ STATICLIB=lvzlib.a SHAREDLIB=liblvzlib.so +SHAREDLIB32=lvzlib.so +SHAREDLIB64=lvzlib64.so SHAREDLIBV=liblvzlib.so.4 SHAREDLIBM=lvzlib.so LIBS=$(STATICLIB) $(SHAREDLIBV) @@ -81,10 +83,10 @@ all: static all64 linux32: clean - $(MAKE) $(SHAREDLIBV) ODIR=./Linux_x86 CC_ARCH_SPEC="-m32" + $(MAKE) $(SHAREDLIB32) ODIR=./Linux_x86 CC_ARCH_SPEC="-m32" linux64: clean - $(MAKE) $(SHAREDLIBV) ODIR=./Linux_x64 CC_ARCH_SPEC="-m64" + $(MAKE) $(SHAREDLIB64) ODIR=./Linux_x64 CC_ARCH_SPEC="-m64" static: example$(EXE) minigzip$(EXE) @@ -171,9 +173,9 @@ -@mkdir $(ODIR)/bzip2 2>/dev/null || test -d $(ODIR)/bzip2 $(CC) $(SFLAGS) -DPIC -c -o $(ODIR)/$*.lo $< -placebo $(SHAREDLIBV): $(PIC_OBJS) +placebo $(SHAREDLIBV) $(SHAREDLIB32) $(SHAREDLIB64): $(PIC_OBJS) $(LDSHARED) $(SFLAGS) -shared -o $(ODIR)/$@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS) - rm -f $(ODIR)/$(SHAREDLIB) $(ODIR)/$(SHAREDLIBM) + rm -f $(ODIR)/$(SHAREDLIB) $(ODIR)/$(SHAREDLIBM) $(ODIR)/$(SHAREDLIBV) # ln -s $(ODIR)/$@ $(ODIR)/$(SHAREDLIB) # ln -s $(ODIR)/$@ $(ODIR)/$(SHAREDLIBM) Modified: trunk/lvzip/c_source/Makefile.vxworks =================================================================== --- trunk/lvzip/c_source/Makefile.vxworks 2019-09-13 16:17:41 UTC (rev 1600) +++ trunk/lvzip/c_source/Makefile.vxworks 2019-09-14 14:19:12 UTC (rev 1601) @@ -5,10 +5,10 @@ ADDED_CFLAGS = -DHAVE_AES -DHAVE_BZIP2 -DNO_BZ_STDIO ifeq ($(DEBUG_MODE),1) -OBJ_DIR := PPC603gnu_DEBUG +OBJ_DIR := $(OBJ_BASE)/Debug CFLAGS = -g -mlongcall else -OBJ_DIR := PPC603gnu +OBJ_DIR := $(OBJ_BASE)/Release CFLAGS = -Os -fstrength-reduce -fno-builtin -fno-strict-aliasing -mlongcall endif Deleted: trunk/lvzip/c_source/Makefile.x64 =================================================================== --- trunk/lvzip/c_source/Makefile.x64 2019-09-13 16:17:41 UTC (rev 1600) +++ trunk/lvzip/c_source/Makefile.x64 2019-09-14 14:19:12 UTC (rev 1601) @@ -1,87 +0,0 @@ -# Nmake macros for building makefile -!include <win32.mak> - -PROJ = LVZLIB - -all: $(OUTDIR) $(OUTDIR)\lvzlib.dll - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -#--------------------------------------------------------------------# - -SOURCES=adler32.c \ - compress.c \ - crc32.c \ - deflate.c \ - gzclose.c \ - gzlib.c \ - gzread.c \ - gzwrite.c \ - infback.c \ - inffast.c \ - inflate.c \ - inftrees.c \ - ioapi.c \ - iowin.c \ - iomem.c \ - lvapi.c \ - lvutil.c \ - mztools.c \ - trees.c \ - uncompr.c \ - unzip.c \ - zip.c \ - zutil.c - -OBJS=$(OUTDIR)\adler32.obj \ - $(OUTDIR)\compress.obj \ - $(OUTDIR)\crc32.obj \ - $(OUTDIR)\deflate.obj \ - $(OUTDIR)\gzclose.obj \ - $(OUTDIR)\gzlib.obj \ - $(OUTDIR)\gzread.obj \ - $(OUTDIR)\gzwrite.obj \ - $(OUTDIR)\infback.obj \ - $(OUTDIR)\inffast.obj \ - $(OUTDIR)\inflate.obj \ - $(OUTDIR)\inftrees.obj \ - $(OUTDIR)\ioapi.obj \ - $(OUTDIR)\iowin.obj \ - $(OUTDIR)\iomem.obj \ - $(OUTDIR)\lvapi.obj \ - $(OUTDIR)\lvutil.obj \ - $(OUTDIR)\mztools.obj \ - $(OUTDIR)\trees.obj \ - $(OUTDIR)\uncompr.obj \ - $(OUTDIR)\unzip.obj \ - $(OUTDIR)\zip.obj \ - $(OUTDIR)\zutil.obj - -ELIBS=user32.lib kernel32.lib labview.lib - -# Build rules for resource files - -# Update the resources - -$(OUTDIR)\lvzlib.res: zlib.rc - $(rc) $(rcflags) $(rcvars) /fo $(OUTDIR)\lvzlib.res zlib.rc - -# Compile the sources - -.c{$(OUTDIR)}.obj: - $(cc) $(cdebug) $(cflags) $(cvarsdll) /Fp"$(OUTDIR)\\" /Fo"$(OUTDIR)\\" /Fd"$(OUTDIR)\\" $** - -# Update the import library - -$(OUTDIR)\lvzlib.exp: $(OBJS) lvzlib.def - $(implib) -machine:$(CPU) -def:lvzlib.def -out:$(OUTDIR)\lvzlib.lib $(OBJS) - -# Update the dynamic link library - -$(OUTDIR)\lvzlib.dll: $(OBJS) $(OUTDIR)\lvzlib.res $(OUTDIR)\lvzlib.exp lvzlib.def - $(link) $(ldebug) $(dlllflags) $(conlibsdll) /MACHINE:$(CPU) -out:$(OUTDIR)\lvzlib.dll \ - $(OBJS) $(ELIBS) $(OUTDIR)\lvzlib.exp $(OUTDIR)\lvzlib.res - -clean: - $(CLEANUP) \ No newline at end of file Modified: trunk/lvzip/c_source/zlibvc.vcproj =================================================================== --- trunk/lvzip/c_source/zlibvc.vcproj 2019-09-13 16:17:41 UTC (rev 1600) +++ trunk/lvzip/c_source/zlibvc.vcproj 2019-09-14 14:19:12 UTC (rev 1601) @@ -519,7 +519,7 @@ Name="VCLinkerTool" IgnoreImportLibrary="true" AdditionalDependencies="labview64.lib" - OutputFile="$(OutDir)\lvzlib.dll" + OutputFile="$(OutDir)\lvzlib64.dll" LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="../../cintools" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2019-09-14 14:19:55
|
Revision: 1602 http://sourceforge.net/p/opengtoolkit/svn/1602 Author: labviewer Date: 2019-09-14 14:19:53 +0000 (Sat, 14 Sep 2019) Log Message: ----------- Extend the returned file info structure Modified Paths: -------------- trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/lvutil.h Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2019-09-14 14:19:12 UTC (rev 1601) +++ trunk/lvzip/c_source/lvutil.c 2019-09-14 14:19:53 UTC (rev 1602) @@ -95,6 +95,7 @@ #include <dirent.h> #include <fcntl.h> #include <unistd.h> + #include <sys/stat.h> #define ftruncate64 ftruncate #ifdef HAVE_ICONV #include <iconv.h> @@ -102,10 +103,9 @@ #include <wchar.h> #if VxWorks #include <sys/types.h> - #include <sys/stat.h> #include <string.h> #include <utime.h> - #include <ioLib.h> +// #include <ioLib.h> #ifdef __GNUC__ #define ___unused __attribute__((unused)) #else @@ -120,7 +120,7 @@ inline int link(const char* path1 ___unused, const char* path2 ___unused) { // VxWorks < 6.2 has no link() support - errno = EACCES; + errno = ENOTSUP; return -1; } @@ -127,7 +127,7 @@ inline int chmod(const char* _path ___unused, mode_t _mode ___unused) { // VxWorks < 6.2 has no chmod() support - errno = EACCES; + errno = ENOTSUP; return -1; } #endif @@ -136,7 +136,7 @@ inline int symlink(const char* path1 ___unused, const char* path2 ___unused) { // vxWorks has no symlinks -> always return an error! - errno = EACCES; + errno = ENOTSUP; return -1; } @@ -217,19 +217,6 @@ return err; } -/* Convert a Macintosh UTDDateTime to a LabVIEW timestamp and vice versa */ -static void MacConvertFromLVTime(uInt32 time, UTCDateTime *mTime) -{ - mTime->fraction = 0; - mTime->lowSeconds = time; - mTime->highSeconds = 0; -} - -static void MacConvertToLVTime(UTCDateTime *mTime, uInt32 *time) -{ - *time = mTime->lowSeconds; -} - static MgErr OSErrToLVErr(OSErr err) { switch(err) @@ -300,20 +287,6 @@ pt->u.f.fract = ((li.QuadPart - pt->u.f.val) * 0x100000000 / SECS_TO_FT_MULT) << 32; } -LibAPI(void) SystemTimeToATime(SYSTEMTIME *pst, ATime128 *pt) -{ - FILETIME ft; - SystemTimeToFileTime(pst, &ft); - FileTimeToATime(&ft, pt); -} - -LibAPI(void) ATimeToSystemTime(ATime128 *pt, SYSTEMTIME *pst) -{ - FILETIME ft; - ATimeToFileTime(pt, &ft); - FileTimeToSystemTime(&ft, pst); -} - static MgErr Win32ToLVFileErr(DWORD winErr) { switch (winErr) @@ -453,6 +426,8 @@ #if Unix || MacOSX || defined(EMBEDDED) #define LWStrPtr LStrPtr +#define SStrBuf(s) (char*)LStrBuf(s) + /* wstr is filled with an 8 bit local encoded string from the path, which could be UTF8 on Linux and MacOSX systems */ static int32 MakePathDSString(Path path, LWStrPtr *lstr, size_t reserve) { @@ -1205,12 +1180,8 @@ LibAPI(MgErr) LVPath_HasResourceFork(Path path, LVBoolean *hasResFork, uInt32 *sizeLow, uInt32 *sizeHigh) { MgErr err = mgNoErr; -#if Mac -#if usesHFSPath - FSRef ref; -#else +#if MacOSX LStrHandle lstr = NULL; -#endif #else Unused(path); #endif @@ -1221,32 +1192,10 @@ if (sizeHigh) *sizeHigh = 0; -#if Mac -#if usesHFSPath // 32-Bit MacOSX - err = FSMakePathRef(path, &ref); +#if MacOSX + err = MakePathDSString(path, &lstr, 0); if (!err) { - FSCatalogInfoBitmap whichInfo = kFSCatInfoNodeFlags | kFSCatInfoRsrcSizes; - FSCatalogInfo catalogInfo; - - /* get nodeFlags and catalog info */ - err = OSErrToLVErr(FSGetCatalogInfo(&ref, whichInfo, &catalogInfo, NULL, NULL,NULL)); - if (!err && catalogInfo.nodeFlags & kFSNodeIsDirectoryMask) - err = fIOErr; - if (!err && catalogInfo.rsrcLogicalSize > 0) - { - if (hasResFork) - *hasResFork = LV_TRUE; - if (sizeLow) - *sizeLow = Lo32(catalogInfo.rsrcLogicalSize); - if (sizeHigh) - *sizeHigh = Hi32(catalogInfo.rsrcLogicalSize); - } - } -#else // 64-Bit MacOSX - err = LVPath_ToText(path, &lstr); - if (!err) - { ssize_t len = getxattr((const char)LStrBuf(*lstr), XATTR_RESOURCEFORK_NAME, NULL, 0, 0, O_NOFOLLOW); if (len != -1) { @@ -1261,7 +1210,6 @@ DSDisposeHandle((UHandle)lstr); } #endif -#endif return err; } @@ -1399,6 +1347,8 @@ { fileInfo->type = kUnknownFileType; fileInfo->creator = kUnknownCreator; + fileInfo->uid = 0xFFFFFFFF; + fileInfo->gid = 0xFFFFFFFF; FileTimeToATime(&fi.ftCreationTime, &fileInfo->cDate); FileTimeToATime(&fi.ftLastWriteTime, &fileInfo->mDate); FileTimeToATime(&fi.ftLastAccessTime, &fileInfo->aDate); @@ -1405,6 +1355,7 @@ fileInfo->rfSize = 0; fileInfo->winFlags = Lo16(fi.dwFileAttributes); fileInfo->unixFlags = FlagsFromWindows(fileInfo->winFlags); + fileInfo->xtraFlags = 0; if (fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (!FDepth(path)) @@ -1484,12 +1435,31 @@ UnixConvertFromATime(&fileInfo->cDate, &statbuf.st_ctim); UnixConvertFromATime(&fileInfo->aDate, ×[0]); UnixConvertFromATime(&fileInfo->mDate, ×[1]); - if (utimensat(0, LStrBuf(lstr), times, AT_SYMLINK_NOFOLLOW)) + if (utimensat(0, SStrBuf(lstr), times, AT_SYMLINK_NOFOLLOW)) #endif err = UnixToLVFileErr(); - else if (chmod(LStrBuf(lstr), (statbuf.st_mode & 0170000) | (fileInfo->unixFlags & 07777))) + +#if !VxWorks + /* + * Changing the ownership probably won't succeed, unless we're root + * or POSIX_CHOWN_RESTRICTED is not set. Set uid/gid before setting + * the mode; current BSD behavior is to remove all setuid bits on + * chown. If chown fails, lose setuid/setgid bits. + */ + else if (chown(SStrBuf(lstr), fileInfo->uid, fileInfo->gid)) + { + if (errno != EPERM && errno != ENOTSUP) + err = UnixToLVFileErr(); + fileInfo->unixFlags &= ~(S_ISUID | S_ISGID); + } +#endif + if (!err && chmod(SStrBuf(lstr), (statbuf.st_mode & 0170000) | (fileInfo->unixFlags & 07777)) && errno != ENOTSUP) err = UnixToLVFileErr(); +#if MacOSX + else if (chflags(SStrBuf(lstr), fileInfo->xtraFlags) + err = UnixToLVFileErr(); +#endif } else { @@ -1505,6 +1475,8 @@ fileInfo->type = kUnknownFileType; fileInfo->creator = kUnknownCreator; } + fileInfo->uid = statbuf.st_uid; + fileInfo->gid = statbuf.st_gid; #if VxWorks VxWorksConvertToATime(statbuf.st_ctime, &fileInfo->cDate); VxWorksConvertToATime(statbuf.st_atime, &fileInfo->aDate); @@ -1514,10 +1486,6 @@ UnixConvertToATime(&statbuf.st_mtim, &fileInfo->mDate); UnixConvertToATime(&statbuf.st_atim, &fileInfo->aDate); #endif - fileInfo->rfSize = 0; - fileInfo->size = statbuf.st_size; - fileInfo->unixFlags = Lo16(statbuf.st_mode); - fileInfo->winFlags = FlagsFromUnix(fileInfo->unixFlags); if (S_ISDIR(statbuf.st_mode)) { DIR *dirp; @@ -1530,15 +1498,27 @@ count++; closedir(dirp); fileInfo->size = count - 2; + fileInfo->rfSize = 0; } else { + fileInfo->size = statbuf.st_size; #if MacOSX ssize_t size = getxattr(LStrBuf(*lstr), XATTR_RESOURCEFORK_NAME, NULL, 0, 0, O_NOFOLLOW); if (size > 0) fileInfo->rfSize = (uInt64)size; + else +#else + fileInfo->rfSize = 0; #endif } + fileInfo->unixFlags = Lo16(statbuf.st_mode); + fileInfo->winFlags = FlagsFromUnix(fileInfo->unixFlags); +#if MacOSX + fileInfo->xtraFlags = statbuf.st_flags; +#else + fileInfo->xtraFlags = 0; +#endif } } #endif Modified: trunk/lvzip/c_source/lvutil.h =================================================================== --- trunk/lvzip/c_source/lvutil.h 2019-09-14 14:19:12 UTC (rev 1601) +++ trunk/lvzip/c_source/lvutil.h 2019-09-14 14:19:53 UTC (rev 1602) @@ -678,17 +678,20 @@ #define kWinFileInfoEncrypted 0x00004000 #define kWinFileInfoVirtual 0x00010000 -typedef struct { - uInt32 type; /* handled by LabVIEW Type & Creator */ - uInt32 creator; /* handled by LabVIEW Type & Creator */ - uInt64 size; /* file size or file count for directories */ - uInt64 rfSize; /* resource fork size, 0 on non MacOS platforms */ - ATime128 cDate; /* Creation date */ - ATime128 mDate; /* Modification date */ - ATime128 aDate; /* ast access date */ - uInt16 winFlags; /* Windows compatible flags */ - uInt32 unixFlags; /* Unix compatible flags */ -} LVFileInfo; +typedef struct { /* off */ + uInt32 type; /* 0: handled by LabVIEW Type & Creator */ + uInt32 creator; /* 4: handled by LabVIEW Type & Creator */ + uInt32 uid; /* 8: Unix user id */ + uInt32 gid; /* 12: Unix group id */ + uInt64 size; /* 16: file size or file count for directories */ + uInt64 rfSize; /* 24: resource fork size, 0 on non MacOS platforms */ + ATime128 cDate; /* 32: Creation date */ + ATime128 mDate; /* 48: Modification date */ + ATime128 aDate; /* 64: ast access date */ + uInt16 winFlags; /* 80: Windows compatible flags */ + uInt16 unixFlags; /* 82: Unix compatible flags */ + uInt32 xtraFlags; /* 84: MacOSX extra file flags */ +} LVFileInfo; /* 88: Total length */ /* Retrieve file information from the path */ LibAPI(MgErr) LVPath_FileInfo(Path path, uInt8 write, LVFileInfo *fileInfo); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2019-09-15 00:38:58
|
Revision: 1607 http://sourceforge.net/p/opengtoolkit/svn/1607 Author: labviewer Date: 2019-09-15 00:38:56 +0000 (Sun, 15 Sep 2019) Log Message: ----------- Add an endianess indication routine Modified Paths: -------------- trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvapi.h trunk/lvzip/c_source/lvutil.c Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2019-09-14 18:25:52 UTC (rev 1606) +++ trunk/lvzip/c_source/lvapi.c 2019-09-15 00:38:56 UTC (rev 1607) @@ -194,6 +194,17 @@ return version; } + +LibAPI(uInt32) lvzlib_isLittleEndian(void) +{ +#if BigEndian + return FALSE; +#else + return TRUE; +#endif +} + + /* exported zlib deflate and inflate functions */ LibAPI(int) lvzlib_compress(Bytef *dest, uInt32 *destLen, const Bytef *source, uInt32 sourceLen, int level) Modified: trunk/lvzip/c_source/lvapi.h =================================================================== --- trunk/lvzip/c_source/lvapi.h 2019-09-14 18:25:52 UTC (rev 1606) +++ trunk/lvzip/c_source/lvapi.h 2019-09-15 00:38:56 UTC (rev 1607) @@ -31,6 +31,7 @@ #ifndef lvzip_lvapi_h #define lvzip_lvapi_h LibAPI(const char *) lvzlib_zlibVersion(void); +LibAPI(uInt32) lvzlib_isLittleEndian(void); /* exported zlib deflate and inflate functions */ LibAPI(int) lvzlib_compress(Bytef *dest, uInt32 *destLen, const Bytef *source, uInt32 sourceLen, int level); LibAPI(int) lvzlib_uncompress(Bytef *dest, uInt32 *destLen, const Bytef *source, uInt32 sourceLen); Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2019-09-14 18:25:52 UTC (rev 1606) +++ trunk/lvzip/c_source/lvutil.c 2019-09-15 00:38:56 UTC (rev 1607) @@ -1233,7 +1233,7 @@ } else { - flags |= 0100000; + flags |= 010000; } return flags; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lab...@us...> - 2019-09-23 08:09:54
|
Revision: 1610 http://sourceforge.net/p/opengtoolkit/svn/1610 Author: labviewer Date: 2019-09-23 08:09:52 +0000 (Mon, 23 Sep 2019) Log Message: ----------- More file util improvements Modified Paths: -------------- trunk/lvzip/c_source/lvapi.c trunk/lvzip/c_source/lvutil.c trunk/lvzip/c_source/lvutil.h Modified: trunk/lvzip/c_source/lvapi.c =================================================================== --- trunk/lvzip/c_source/lvapi.c 2019-09-17 07:25:17 UTC (rev 1609) +++ trunk/lvzip/c_source/lvapi.c 2019-09-23 08:09:52 UTC (rev 1610) @@ -198,9 +198,9 @@ LibAPI(uInt32) lvzlib_isLittleEndian(void) { #if BigEndian - return FALSE; + return LV_FALSE; #else - return TRUE; + return LV_TRUE; #endif } @@ -257,7 +257,7 @@ MgErr err = lvzlibCreateRefnum(node, refnum, ZipMagic, LV_FALSE); if (!err && comment) { - int32 len = (int32)strlen(comment); + int32 len = (int32)StrLen((ConstCStr)comment); if (len > 0) { err = NumericArrayResize(uB, 1, (UHandle*)globalcomment, len); @@ -560,31 +560,16 @@ * 2 - case insensitive * ****************************************************************************************************/ -#if Win32 -#define strcasecmp _stricmp -#endif - static int caseInsensitiveNameComparer(unzFile file, const char *filename1, const char *filename2) { Unused(file); -#if VxWorks - int32 c1, c2; - - while (((c1 = *filename1++) == (c2 = *filename2++)) || (tolower(c1) == tolower(c2))) - if(c1 == '\0') - return 0; - c1 = tolower(c1); - c2 = tolower(c2); - return c1 - c2; -#else - return strcasecmp(filename1, filename2); -#endif + return StrNCaseCmp((ConstCStr)filename1, (ConstCStr)filename2, StrLen((ConstCStr)filename1)); } static int caseSensitiveNameComparer(unzFile file, const char *filename1, const char *filename2) { Unused(file); - return strcmp(filename1, filename2); + return StrCmp((ConstCStr)filename1, (ConstCStr)filename2); } LibAPI(MgErr) lvzlib_unzLocateFile(LVRefNum *refnum, LStrHandle fileName, int iCaseSensitivity) Modified: trunk/lvzip/c_source/lvutil.c =================================================================== --- trunk/lvzip/c_source/lvutil.c 2019-09-17 07:25:17 UTC (rev 1609) +++ trunk/lvzip/c_source/lvutil.c 2019-09-23 08:09:52 UTC (rev 1610) @@ -150,12 +150,17 @@ #define FCNTL_PARAM3_CAST(param) (int32)(param) #else #define FCNTL_PARAM3_CAST(param) (param) + #define st_ctimespec st_ctim + #define st_atimespec st_atim + #define st_mtimespec st_mtim #endif #elif MacOSX #include <CoreFoundation/CoreFoundation.h> #include <CoreServices/CoreServices.h> + #include <sys/types.h> #include <sys/stat.h> #include <sys/xattr.h> + #include <dirent.h> #define ftruncate64 ftruncate #if ProcessorType!=kX64 #define MacSpec FSRef @@ -166,8 +171,6 @@ #define MacIsAlias(cpb) ((cpb).hFileInfo.ioFlFndrInfo.fdFlags & kIsAlias) #define kFileChanged (1L<<7) static MgErr OSErrToLVErr(OSErr err); - #else - #include <dirent.h> #endif #endif @@ -191,27 +194,29 @@ #endif #if usesWinPath && !defined(EMBEDDED) -#define LWStrPtr WStrPtr -#define LWStrLen WStrLen -#define LWStrBuf WStrBuf +#define LWStrPtr WStrPtr +#define LWStrLen(p) WStrLen(p) +#define LWStrBuf(p) WStrBuf(p) +#define LWStrLenSet(p, s) WStrLenSet(p, s) -#define LWStrNCat WStrNCat -#define lwslen wcslen -#define lwsrchr wcsrchr +#define LWStrNCat WStrNCat +#define lwslen wcslen +#define lwsrchr wcsrchr static const wchar_t strWildcardPattern[] = L"*.*"; #else -#define LWStrPtr LStrPtr -#define LWStrLen LStrLen -#define LWStrBuf LStrBuf +#define LWStrPtr LStrPtr +#define LWStrLen(p) LStrLen(p) +#define LWStrBuf(p) LStrBuf(p) +#define LWStrLenSet(p, s) LStrLen(p) = s -#define LWStrNCat LStrNCat -#define lwslen strlen -#define lwsrchr strrchr +#define LWStrNCat LStrNCat +#define lwslen strlen +#define lwsrchr strrchr static char strWildcardPattern[] = "*.*"; -#define SStrBuf(s) (char*)LStrBuf(s) +#define SStrBuf(s) (char*)LStrBuf(s) #endif #ifdef HAVE_BZIP2 @@ -374,8 +379,10 @@ a = s = t; e = s + len; if (!*s || !len) + { + *s = '\0'; return noErr; - + } /* \\?\UNC\server\share \\?\C:\ @@ -397,7 +404,7 @@ { n += 2; s += 2; - if ((s[0] == 'U' || s[0] == 'u') && (s[1] == 'N' || s[1] == 'n') && (s[2] == 'C' || s[2] == 'C') && s[2] == kPathSeperator) + if ((s[0] == 'U' || s[0] == 'u') && (s[1] == 'N' || s[1] == 'n') && (s[2] == 'C' || s[2] == 'C') && s[3] == kPathSeperator) { unc = TRUE; n += 4; @@ -530,7 +537,7 @@ static void UnixConvertToATime(struct timespec *sTime, ATime128 *time) { - time->u.f.val = (int64_t)(sTime->tv_sec + dt1970re1904); + time->u.f.val = (int64_t)sTime->tv_sec + dt1970re1904; time->u.p.fractHi = (uint32_t)sTime->tv_nsec * 4.294967296; time->u.p.fractLo = 0; } @@ -569,10 +576,10 @@ static MgErr NormalizePath(LWStrPtr lwstr) { - char *a, s, e, t = LWStrBuf(lwstr); + char *a, *s, *e, *t; int32 len = LWStrLen(lwstr); - a = s = t; + a = s = t = LWStrBuf(lwstr); e = s + len; if (!*s || !len) return noErr; @@ -580,48 +587,36 @@ /* Canonicalize the path */ while (s < e) { - if (s[0] == kPosixPathSeperator) + if (s[0] == kPosixPathSeperator && s[1] == kPosixPathSeperator) { - if (s[1] == kPosixPathSeperator) s++; /* Reduce // to / */ } else if (s[0] == '.') { - if (s[1] == kPosixPathSeperator && (s == a || s[-1] == kPosixPathSeperator)) + if (s[1] == kPosixPathSeperator && (s == a && s[-1] == kPosixPathSeperator)) { s += 2; /* Skip ./ */ } - else if (s[1] == '.' && (t == a || t[-1] == kPosixPathSeperator)) + else if (s[1] == '.') { - /* .. backs up a directory + /* .. backs up a directory but only if it is not at the root of the path */ - if (t != a) + if (t == a || t > a + 2 && t[-1] == kPosixPathSeperator && t[-2] == '.') { - if (t > a + 1 && t[-1] == kPosixPathSeperator && - (t[-2] != kPosixPathSeperator || t > a + 2)) - { - if (t[-2] == ':' && (t > a + 3 || t[-3] == ':')) - { - t -= 2; - while (t > a && *t != kPosixPathSeperator) - t--; - if (*t == kPosixPathSeperator) - t++; /* Reset to last '\' */ - else - t = a; /* Start path again from new root */ - } - else if (t[-2] != ':' && !unc) - t -= 2; - } + *t++ = *s++; + *t++ = *s++; + } + else if (t > a + 2 && t[-1] == kPosixPathSeperator && (t[-2] != kPosixPathSeperator)) + { + t -= 2; while (t > a && *t != kPosixPathSeperator) t--; - if (t == a) - { - *t = kPosixPathSeperator; - s++; - } + if (*t == kPosixPathSeperator) + t++; /* Reset to last '\' */ + s += 3; /* Skip ../ in src path */ } - s += 2; /* Skip .. in src path */ + else + return mgArgErr; } else *t++ = *s++; @@ -629,13 +624,15 @@ else *t++ = *s++; } - *t++ = '\0'; + if (*t == kPosixPathSeperator && t > a + 1) + t--; + *t = '\0'; return noErr; } #endif #if Unix || MacOSX || defined(EMBEDDED) -static MgErr makeFileDSString(LStrHandle string, uInt32 codePage, LWStrPtr *lwstr, size_t *reserve) +static MgErr makeFileDSString(LStrHandle string, uInt32 codePage, LWStrPtr *lwstr, int32 *reserve) { MgErr err = noErr; LStrHandle dest = NULL; @@ -678,7 +675,7 @@ #if Unix || MacOSX else { - LStrBuf(*lwstr)[0] = kPathSeparator; + LStrBuf(*lwstr)[0] = kPathSeperator; LStrLen(*lwstr) = 1; } #endif @@ -698,7 +695,8 @@ off = LStrLen(lstr); if (off + strLen < bufLen) { - strncpy(LStrBuf(lstr) + off, str, strLen + 1); + strncpy(LStrBuf(lstr) + off, str, strLen); + LStrBuf(lstr)[off + strLen] = 0; LStrLen(lstr) = off + strLen; return noErr; } @@ -717,12 +715,12 @@ if (bufLen <= 0) return Win32GetLVFileErr(); - if (isalpha(buf[0]) && buf[1] == ':') + if (iswalpha(buf[0]) && buf[1] == ':') { /* Absolute path with drive letter */ len = 4; } - else if (buf[0] == kPathSeperator && buf[1] == kPathSeperator && isalpha(buf[2])) + else if (buf[0] == kPathSeperator && buf[1] == kPathSeperator && iswalpha(buf[2])) { /* Absolute UNC path */ len = 7; @@ -770,7 +768,8 @@ off = WStrLen(wstr); if (off + strLen < bufLength) { - wcsncpy(WStrBuf(wstr) + off, str, strLen + 1); + wcsncpy(WStrBuf(wstr) + off, str, strLen); + WStrBuf(wstr)[off + strLen] = 0; WStrLenSet(wstr, off + strLen); return noErr; } @@ -777,23 +776,27 @@ return mgArgErr; } -#define Win32HasDOSDevicePrefix(str) (str[0] == kPathSeperator && str[1] == kPathSeperator && (str[2] == '?' || str[2] == '.') && str[3] == kPathSeperator) +#define Win32HasDOSDevicePrefix(str, len) (len >= 4 && str[0] == kPathSeperator && str[1] == kPathSeperator && (str[2] == '?' || str[2] == '.') && str[3] == kPathSeperator) -LibAPI(MgErr) Win32ResolveShortCut(WStrPtr wStr, WStrPtr *wTgt, int32 *bufLen, Bool32 recursive, DWORD *dwAttrs) +static WCHAR *extStr = L".LNK"; + +static int Win32CanBeShortcutLink(WCHAR *str, int32 len) { + int32 extLen = (int32)wcslen(extStr); + return (len >= extLen && !_wcsicmp(str + len - extLen, extStr)); +} + +LibAPI(MgErr) Win32ResolveShortCut(WStrPtr wStr, WStrPtr *wTgt, int32 *bufLen, uInt32 flags, DWORD *dwAttrs) +{ HRESULT err = noErr; IShellLinkW* psl; IPersistFile* ppf; WIN32_FIND_DATAW fileData; - WCHAR *extStr = L".LNK"; - WCHAR tempPath[MAX_PATH], *srcPath = WStrBuf(wStr); - int32 len = WStrLen(wStr), extLen = (int32)wcslen(extStr); + WCHAR tempPath[MAX_PATH * 4], *srcPath = WStrBuf(wStr); // Don't bother trying to resolve shortcut if it doesn't have a ".lnk" extension. - if (len < extLen) + if (!Win32CanBeShortcutLink(srcPath, WStrLen(wStr))) return cancelError; - if (_wcsicmp(srcPath + len - extLen, extStr)) - return cancelError; // Get a pointer to the IShellLink interface. err = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLinkW, (void**)&psl); @@ -812,14 +815,14 @@ if (SUCCEEDED(err)) { fileData.dwFileAttributes = INVALID_FILE_ATTRIBUTES; - err = IShellLinkW_GetPath(psl, tempPath, MAX_PATH, &fileData, SLGP_SHORTPATH); + err = IShellLinkW_GetPath(psl, tempPath, MAX_PATH * 4, &fileData, SLGP_RAWPATH); if (SUCCEEDED(err)) { *dwAttrs = fileData.dwFileAttributes; if (err == S_OK) { - len = (int32)wcslen(tempPath); - if (recursive && len >= extLen && !_wcsicmp(tempPath + len - extLen, extStr)) + int32 len = (int32)wcslen(tempPath); + if (flags & kRecursive && Win32CanBeShortcutLink(tempPath, len)) { srcPath = tempPath; continue; @@ -888,48 +891,49 @@ return success; } -LibAPI(MgErr) Win32ResolveLink(WStrPtr wSrc, WStrPtr *wTgt, int32 *bufLen, Bool32 recursive, DWORD *dwAttrs) +LibAPI(MgErr) Win32ResolveLink(WStrPtr wSrc, WStrPtr *wTgt, int32 *bufLen, int32 flags, DWORD *dwAttrs) { HANDLE handle; MgErr err = noErr; - int32 length, parentLen = 0, offset; DWORD bytes = MAXIMUM_REPARSE_DATA_BUFFER_SIZE; PREPARSE_DATA_BUFFER buffer = NULL; - WStrPtr tempPath = NULL, wIntermediate = wSrc; + WStrPtr wIntermediate = wSrc; *dwAttrs = GetFileAttributes(wSrc); if (*dwAttrs == INVALID_FILE_ATTRIBUTES) - { return Win32GetLVFileErr(); - } + if (!(*dwAttrs & FILE_ATTRIBUTE_REPARSE_POINT)) + return mgNoErr; + // Need to acquire backup privileges in order to be able to retrieve a handle to a directory below or call symlink kernel entry points Win32ModifyBackupPrivilege(TRUE); - while (!err && *dwAttrs & FILE_ATTRIBUTE_REPARSE_POINT) + do { // Open the link file or directory handle = CreateFile(wIntermediate, GENERIC_READ, 0 /*FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE */, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, NULL); if (handle == INVALID_HANDLE_VALUE) - { - err = Win32GetLVFileErr(); - } + return Win32GetLVFileErr(); - if (!err) + if (!buffer) + buffer = (PREPARSE_DATA_BUFFER)DSNewPtr(bytes); + if (buffer) { - if (!buffer) - buffer = (PREPARSE_DATA_BUFFER)DSNewPtr(bytes); if (!DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, NULL, 0, buffer, bytes, &bytes, NULL)) err = Win32GetLVFileErr(); else if (bytes < 9) err = fEOF; - - // Close the handle to our file so we're not locking it anymore. - CloseHandle(handle); } + else + err = mFullErr; + // Close the handle to our file so we're not locking it anymore. + CloseHandle(handle); + if (!err) { + int32 length; BOOL relative = FALSE; LPWSTR start = NULL; @@ -951,53 +955,90 @@ } if (length) { - parentLen = 0; - if (length > 4 && Win32HasDOSDevicePrefix(start)) + WStrPtr tempPath = NULL; + int32 offset = 0, parentLen = 0, intLen = length; + if (Win32HasDOSDevicePrefix(start, length)) { - relative = FALSE; - start += 4; + offset = 4; + if (length >= 7 && towlower(start[4]) == 'u' && towlower(start[5]) == 'n' && towlower(start[6]) == 'c' && start[7] == kPathSeperator) + { + relative = FALSE; + } } - else if (!relative) + else { - length += 4; + if (length >= 2 && start[0] == kPathSeperator && start[1] == kPathSeperator) + { + relative = FALSE; + offset = 1; + intLen += 6; + } } + if (length - offset >= 3 && isalpha(start[offset]) && start[offset + 1] == ':' && start[offset + 2] == kPathSeperator) + { + relative = FALSE; + intLen += (4 - offset); + } + intLen++; if (relative) { - /* Shorten the path to the parent directory */ wchar_t *ptr = WStrBuf(wIntermediate); parentLen = WStrLen(wIntermediate); - while (parentLen && ptr[--parentLen] != kPathSeperator); + while (ptr[--parentLen] != kPathSeperator); parentLen++; - length += parentLen; + intLen = parentLen + length + 1; } - - tempPath = (WStrPtr)DSNewPtr(sizeof(int32) + sizeof(WCHAR) * ++length); + + tempPath = (WStrPtr)DSNewPtr(sizeof(int32) + sizeof(WCHAR) * intLen); if (tempPath) { if (relative) { - WStrNCat(tempPath, 0, parentLen, WStrBuf(wIntermediate), WStrLen(wIntermediate)); + if (start[0] == kPathSeperator) + { + parentLen--; + } + err = WStrNCat(tempPath, 0, intLen, WStrBuf(wIntermediate), parentLen); offset = parentLen; } + else if (offset == 1) + { + err = WStrNCat(tempPath, 0, intLen, L"\\\\?\\UNC", 7); + } else { - WStrNCat(tempPath, 0, length, L"\\\\?\\", 4); - offset = 4; + err = WStrNCat(tempPath, 0, intLen, L"\\\\?\\", 4); } if (wIntermediate != wSrc) DSDisposePtr((UPtr)wIntermediate); + wIntermediate = tempPath; - WStrNCat(tempPath, offset, length - offset, start, length - offset); + if (!err) + err = WStrNCat(wIntermediate, -1, intLen, start + offset, length - offset); + + if (!err) + { + *dwAttrs = GetFileAttributes(wIntermediate); + if (*dwAttrs == INVALID_FILE_ATTRIBUTES) + { + err = Win32GetLVFileErr(); + } + else if (!(flags & kRecursive) || !(*dwAttrs & FILE_ATTRIBUTE_REPARSE_POINT)) + { + if (relative && !(flags & kResolveRel)) + err = WStrNCat(wIntermediate, 0, intLen, start, length); - *dwAttrs = GetFileAttributes(tempPath); - if (!recursive) - break; - - if (*dwAttrs == INVALID_FILE_ATTRIBUTES) - err = Win32GetLVFileErr(); - - wIntermediate = tempPath; + if (!err && wTgt) + { + DSDisposePtr((UPtr)*wTgt); + *wTgt = wIntermediate; + if (bufLen) + *bufLen = intLen; + return noErr; + } + } + } } else { @@ -1004,20 +1045,14 @@ err = mFullErr; } } + else + err = fIOErr; } - } + } while (!err); Win32ModifyBackupPrivilege(FALSE); DSDisposePtr((UPtr)buffer); - if (!err && wTgt) - { - DSDisposePtr((UPtr)*wTgt); - *wTgt = tempPath; - return noErr; - } - else - { - DSDisposePtr((UPtr)tempPath); - } + if (wIntermediate != wSrc) + DSDisposePtr((UPtr)wIntermediate); return err; } #endif @@ -1037,12 +1072,12 @@ len = strlen(ptr); #endif /* look backwards */ - for ( ; k < len && k < kMaxFileExtLength; --ptr, k++) + for (ptr += len; k < len && k < kMaxFileExtLength; --ptr, k++) { if (*ptr == '.') { uChar str[16]; - PStrLen(str) = (uChar)k; + PStrLen(str) = (uChar)k - 1; for (len = 1; k; k--) str[len++] = (uChar)*ptr++; return PStrHasRezExt(str); @@ -1060,7 +1095,8 @@ return mgArgErr; } LWStrBuf(pathName)[LWStrLen(pathName)] = kPathSeperator; - LWStrBuf(pathName)[LWStrLen(pathName) + 1] = 0; + LWStrLenSet(pathName, LWStrLen(pathName) + 1); + LWStrBuf(pathName)[LWStrLen(pathName)] = 0; } return noErr; } @@ -1106,7 +1142,7 @@ On Windows the pathName is a wide char Long String pointer and the function returns UTF8 encoded filenames in the name array On other platforms it uses whatever is the default encoding for both pathName and the filenames, which could be UTF8 (Linux and Mac) */ -static MgErr lvFile_ListDirectory(LWStrPtr pathName, int32 bufLen, LStrArrHdl *nameArr, FileInfoArrHdl *typeArr, int32 flags) +static MgErr lvFile_ListDirectory(LWStrPtr pathName, int32 bufLen, LStrArrHdl *nameArr, FileInfoArrHdl *typeArr, uInt32 cp, int32 flags) { MgErr err; int32 rootLength, type, index = 0, size = 8; @@ -1132,7 +1168,6 @@ #endif #endif -#if Win32 err = NumericArrayResize(uPtr, 1, (UHandle*)nameArr, size); if (err) return err; @@ -1141,6 +1176,7 @@ if (err) return err; +#if Win32 if (!pathName || !LWStrLen(pathName)) { DWORD drives = GetLogicalDrives(); @@ -1249,10 +1285,9 @@ { (**typeArr)->elm[index].flags |= kIsLink; } - else + else if (!Win32ResolveShortCut(pathName, NULL, NULL, 0, &dwAttrs)) { - if (!Win32ResolveShortCut(pathName, NULL, NULL, FALSE, &dwAttrs)) - (**typeArr)->elm[index].flags |= (kIsLink | kIsFile); + (**typeArr)->elm[index].flags |= (kIsLink | kIsFile); } #endif if (!(dwAttrs & FILE_ATTRIBUTE_DIRECTORY)) @@ -1280,9 +1315,9 @@ (**typeArr)->elm[index].flags |= kErrGettingType | kIsFile; } #if EMBEDDED - err = ConvertCString(fileName, -1, CP_ACP, (**nameArr)->elm + index, CP_ACP, 0, NULL); + err = ConvertCString(fileName, -1, CP_ACP, (**nameArr)->elm + index, cp, 0, NULL); #else - err = WideCStrToMultiByte(fileName, -1, (**nameArr)->elm + index, CP_UTF8, 0, NULL); + err = WideCStrToMultiByte(fileName, -1, (**nameArr)->elm + index, cp, 0, NULL); #endif index++; (**nameArr)->numItems = index; @@ -1302,18 +1337,11 @@ #endif if (dirp != INVALID_HANDLE_VALUE) FindClose(dirp); - if (index < size) - { - if (*nameArr || index > 0) - NumericArrayResize(uPtr, 1, (UHandle*)nameArr, index); - if (*typeArr || index > 0) - NumericArrayResize(uQ, 1, (UHandle*)typeArr, index); - } #else if (!pathName || !LWStrLen(pathName)) path = "/"; else - path = SStrBuf(pathName): + path = SStrBuf(pathName); /* Check that we have actually a folder */ if (lstat(path, &statbuf)) @@ -1330,13 +1358,9 @@ if (err) return err; - if (!(dirp = opendir(path)))) + if (!(dirp = opendir(path))) return UnixToLVFileErr(); - /* Skip . and .. directory entries, they're always the first two. */ - (void)readdir(dirp); - (void)readdir(dirp); - err = LWAppendPathSeparator(pathName, bufLen); if (err) goto FListDirOut; @@ -1343,9 +1367,10 @@ rootLength = LWStrLen(pathName); - for (dp = readdir(dirp), index = 1; dp; dp = readdir(dirp), index++) + for (dp = readdir(dirp); dp; dp = readdir(dirp)) { - /* Skip the current dir, and parent dir entries */ + /* Skip the current dir, and parent dir entries. They are not guaranteed to be always the first + two entries enumerated! */ if (dp->d_name[0] != '.' || (dp->d_name[1] != 0 && (dp->d_name[1] != '.' || dp->d_name[2] != 0))) { if (index >= size) @@ -1360,11 +1385,11 @@ goto FListDirOut; } - err = ConvertCString(dp->d_name, -1, CP_ACP, (**nameArr)->elm + index, CP_ACP, 0, NULL); + err = ConvertCString(dp->d_name, -1, CP_ACP, (**nameArr)->elm + index, cp, 0, NULL); if (err) goto FListDirOut; - err = LStrNCat(pathName, rootLength, bufLen, dp->d_name); + err = LWStrNCat(pathName, rootLength, bufLen, dp->d_name, -1); if (err) goto FListDirOut; @@ -1378,7 +1403,7 @@ if (S_ISLNK(statbuf.st_mode)) { (**typeArr)->elm[index].flags |= kIsLink; - if (stat(thePath, &tmpstatbuf) == 0) /* If link points to something */ + if (stat(SStrBuf(pathName), &tmpstatbuf) == 0) /* If link points to something */ statbuf = tmpstatbuf; /* return info about it not link. */ } #endif @@ -1385,7 +1410,7 @@ if (!S_ISDIR(statbuf.st_mode)) { (**typeArr)->elm[index].flags |= kIsFile; - if (type = PtrHasRezExt(SStrBuf(pathName, LStrLen(pathName)))) + if (type = PtrHasRezExt(SStrBuf(pathName), LStrLen(pathName))) { (**typeArr)->elm[index].flags |= kRecognizedType; (**typeArr)->elm[index].type = type; @@ -1400,10 +1425,18 @@ FListDirOut: closedir(dirp); #endif + if (index < size) + { + if (*nameArr || index > 0) + NumericArrayResize(uPtr, 1, (UHandle*)nameArr, index); + if (*typeArr || index > 0) + NumericArrayResize(uQ, 1, (UHandle*)typeArr, index); + } return err; } -/* On Windows, folderPath is a UTF8 encoded string, on other platforms it is locally encoded */ +/* On Windows and Mac, folderPath is a UTF8 encoded string, on other platforms it is locally encoded but + this could be UTF8 (Linux, depending on its configuration) */ LibAPI(MgErr) LVFile_ListDirectory(LStrHandle folderPath, LStrArrHdl *nameArr, FileInfoArrHdl *typeArr, int32 flags) { MgErr err = mgArgErr; @@ -1413,16 +1446,18 @@ if (LStrLenH(folderPath)) #endif { - bufLen = 260; + bufLen = 280; err = MakeFileDSString(folderPath, &pathName, &bufLen); if (err) return err; } - err = lvFile_ListDirectory(pathName, bufLen, nameArr, typeArr, flags); + err = lvFile_ListDirectory(pathName, bufLen, nameArr, typeArr, CP_UTF8, flags); DSDisposePtr((UPtr)pathName); return err; } +/* This is the LabVIEW Path version of above function. It's strings are always locally encoded so there + can be a problem with paths on Windows and other systems that don't use UTF8 as local encoding */ LibAPI(MgErr) LVPath_ListDirectory(Path folderPath, LStrArrHdl *nameArr, FileInfoArrHdl *typeArr, int32 flags) { MgErr err = mgArgErr; @@ -1435,12 +1470,12 @@ if (FDepth(folderPath) > 0) #endif { - bufLen = 260; + bufLen = 280; err = MakePathDSString(folderPath, &pathName, &bufLen); if (err) return err; } - err = lvFile_ListDirectory(pathName, bufLen, nameArr, typeArr, flags); + err = lvFile_ListDirectory(pathName, bufLen, nameArr, typeArr, CP_ACP, flags); DSDisposePtr((UPtr)pathName); } return err; @@ -1637,7 +1672,9 @@ { count = 1; - err = LWStrNCat(pathName, 0, bufLen, strWildcardPattern, 3); + err = LWAppendPathSeparator(pathName, bufLen); + if (!err) + err = LWStrNCat(pathName, 0, bufLen, strWildcardPattern, 3); if (!err) { handle = FindFirstFile(pathName, &fi); @@ -1734,9 +1771,9 @@ VxWorksConvertToATime(statbuf.st_atime, &fileInfo->aDate); VxWorksConvertToATime(statbuf.st_mtime, &fileInfo->mDate); #else - UnixConvertToATime(&statbuf.st_ctim, &fileInfo->cDate); - UnixConvertToATime(&statbuf.st_mtim, &fileInfo->mDate); - UnixConvertToATime(&statbuf.st_atim, &fileInfo->aDate); + UnixConvertToATime(&statbuf.st_ctimespec, &fileInfo->cDate); + UnixConvertToATime(&statbuf.st_mtimespec, &fileInfo->mDate); + UnixConvertToATime(&statbuf.st_atimespec, &fileInfo->aDate); #endif if (S_ISDIR(statbuf.st_mode)) { @@ -1779,13 +1816,20 @@ static Bool32 LStrIsAbsPath(LStrHandle filePath) { int32 len = LStrLenH(filePath); + UPtr ptr = LStrBufH(filePath); #if usesWinPath - UPtr ptr = LStrBufH(filePath); - if (!len || (len >= 3 && isalpha(ptr[0]) && ptr[1] == ':' && ptr[2] == kPathSeperator) + int32 offset = 0; #if !EMBEDDED - || (len >= 3 && ptr[0] == kPathSeperator && ptr[1] == kPathSeperator && isalpha(ptr[2])) - || (len > 4 && Win32HasDOSDevicePrefix(ptr)) + if (Win32HasDOSDevicePrefix(ptr, len)) + { + offset = 4; + } #endif + if (!len || ((len - offset) >= 3 && isalpha(ptr[offset]) && ptr[offset + 1] == ':' && ptr[offset + 2] == kPathSeperator) + || (!offset && len >= 3 && ptr[0] == kPathSeperator && ptr[1] == kPathSeperator && isalpha(ptr[2])) +#if !EMBEDDED + || (offset && len - offset >= 4 && StrNCaseCmp(ptr + offset, (ConstCStr)"UNC\\", 4)) +#endif ) return LV_TRUE; #else @@ -1989,7 +2033,7 @@ if (buffer) { wcscpy(namebuf, L"\\\\?\\"); - if (length > 4 && length < MAX_PATH + 4 && Win32HasDOSDevicePrefix(lpTargetFileName)) + if (length < MAX_PATH + 4 && Win32HasDOSDevicePrefix(lpTargetFileName, length)) { offset = 4; } @@ -2142,11 +2186,60 @@ #endif } -LibAPI(MgErr) LVPath_ReadLink(Path path, Path *target, Bool32 recursive, uInt32 *fileType) +LibAPI(MgErr) LVFile_ReadLink(LStrHandle path, LStrHandle *target, uInt32 flags, uInt32 *fileType) { MgErr err = mgNoErr; LWStrPtr src = NULL; +#if Win32 && EMBEDDED + return mgNotSupported; +#else + err = MakeFileDSString(path, &src, NULL); + if (!err) + { +#if MacOSX || Unix +#else + WStrPtr wTgt = NULL; + DWORD dwAttr; + + err = Win32ResolveLink(src, &wTgt, NULL, flags, &dwAttr); + *fileType = 0; + if (!err && wTgt) + { + int32 offset = 0; + if (Win32HasDOSDevicePrefix(WStrBuf(wTgt), WStrLen(wTgt))) + offset += 4; + + err = WideCStrToMultiByte(WStrBuf(wTgt) + offset, WStrLen(wTgt) - offset, target, CP_UTF8, 0, NULL); + } + if (!err) + { + if (dwAttr & FILE_ATTRIBUTE_REPARSE_POINT) + { + *fileType |= kIsLink; + } + if (!(dwAttr & FILE_ATTRIBUTE_DIRECTORY)) + { + *fileType |= kIsFile; + } + if (dwAttr & FILE_ATTRIBUTE_HIDDEN) + { + *fileType |= kFIsInvisible; + } + } + DSDisposePtr((UPtr)wTgt); +#endif + DSDisposePtr((UPtr)src); + } + return err; +#endif +} + +LibAPI(MgErr) LVPath_ReadLink(Path path, Path *target, uInt32 flags, uInt32 *fileType) +{ + MgErr err = mgNoErr; + LWStrPtr src = NULL; + if (!FIsAbsPath(path)) return mgArgErr; @@ -2153,6 +2246,9 @@ #if Win32 && EMBEDDED return mgNotSupported; #else + if (fileType) + *fileType = 0; + err = MakePathDSString(path, &src, NULL); if (!err) { @@ -2161,7 +2257,7 @@ char *buf = NULL, *ptr = NULL; int len = 0; - if (lstat((const char*)LStrBuf(src), &st)) + if (lstat(SStrBuf(src), &st)) { err = UnixToLVFileErr(); } @@ -2181,7 +2277,7 @@ while (!err) { - ssize_t retval = readlink((const char*)LStrBuf(src), buf, len); + ssize_t retval = readlink(SStrBuf(src), buf, len); if (retval < 0) { err = UnixToLVFileErr(); @@ -2195,10 +2291,11 @@ if (ptr) { buf = ptr; - memmove(buf + LStrLen(src) + 1, buf, retval); - memmove(buf, LStrBuf(src), LStrLen(src)); - buf[LStrLen(src)] = '/'; - retval += LStrLen(src) + 1; + for (ptr = SStrBuf(src) + LStrLen(src); *ptr != kPathSeperator; ptr--); + LStrLen(src) = ptr - SStrBuf(src) + 1; + memmove(buf + LStrLen(src), buf, retval); + memmove(buf, SStrBuf(src), LStrLen(src)); + retval += LStrLen(src); } else { @@ -2212,17 +2309,19 @@ { if (lstat(buf, &st)) { + *fileType = err = UnixToLVFileErr(); } else if (S_ISLNK(st.st_mode)) { + *fileType = kIsLink; if (stat(buf, &st)) { err = UnixToLVFileErr(); } - else + else if (!S_ISDIR(st.st_mode)) { - *fileType = S_ISDIR(st.st_mode) ? kIsLink : kIsLink | kIsFile; + *fileType |= kIsFile; } } else @@ -2256,17 +2355,18 @@ } #else WStrPtr wTgt = NULL; - int32 tgtLen = 0; + int32 bufLen = 0; DWORD dwAttr; - err = Win32ResolveLink(src, &wTgt, &tgtLen, recursive, &dwAttr); - *fileType = 0; + err = Win32ResolveShortCut(src, &wTgt, &bufLen, flags, &dwAttr); + if (err) + err = Win32ResolveLink(src, &wTgt, &bufLen, flags, &dwAttr); if (!err && wTgt) { int32 offset = 0; LStrHandle handle = NULL; - if (WStrLen(wTgt) > 4 && Win32HasDOSDevicePrefix(WStrBuf(wTgt))) - offset += 4; + if (Win32HasDOSDevicePrefix(WStrBuf(wTgt), WStrLen(wTgt))) + offset += 4; err = WideCStrToMultiByte(WStrBuf(wTgt) + offset, WStrLen(wTgt) - offset, &handle, CP_ACP, 0, NULL); if (!err) @@ -2278,12 +2378,16 @@ { if (dwAttr & FILE_ATTRIBUTE_REPARSE_POINT) { - *fileType = kIsLink; + *fileType |= kIsLink; } - else if (!(dwAttr & FILE_ATTRIBUTE_DIRECTORY)) + if (!(dwAttr & FILE_ATTRIBUTE_DIRECTORY)) { - *fileType = kIsFile; + *fileType |= kIsFile; } + if (dwAttr & FILE_ATTRIBUTE_HIDDEN) + { + *fileType |= kFIsInvisible; + } } DSDisposePtr((UPtr)wTgt); #endif Modified: trunk/lvzip/c_source/lvutil.h =================================================================== --- trunk/lvzip/c_source/lvutil.h 2019-09-17 07:25:17 UTC (rev 1609) +++ trunk/lvzip/c_source/lvutil.h 2019-09-23 08:09:52 UTC (rev 1610) @@ -345,6 +345,8 @@ int32 StrNCpy(CStr t, const CStr s, int32 l); int32 StrLen(ConstCStr str); int32 StrCmp(ConstCStr str1, ConstCStr str2); +int32 StrNCmp(ConstCStr, ConstCStr, size_t); +int32 StrNCaseCmp(ConstCStr, ConstCStr, size_t); /** @brief Concatenated Pascal string types. */ typedef struct { @@ -642,10 +644,6 @@ FMListDetails elm[1]; } FileInfoArrRec, *FileInfoArrPtr, **FileInfoArrHdl; -#define kLinkNone 0x00 -#define kLinkHard 0x01 -#define kLinkDir 0x02 - /* Our exported functions */ /**************************/ @@ -696,11 +694,24 @@ /* Retrieve file information from the path */ LibAPI(MgErr) LVPath_FileInfo(Path path, uInt8 write, LVFileInfo *fileInfo); +LibAPI(MgErr) LVFile_FileInfo(LStrHandle path, uInt8 write, LVFileInfo *fileInfo); +/* Creation flags */ +#define kLinkSoft 0x00 +#define kLinkHard 0x01 +#define kLinkDir 0x02 + +/* Resolution flags */ +#define kRecursive 0x01 +#define kResolveRel 0x02 + /* Create and read a link */ LibAPI(MgErr) LVPath_CreateLink(Path path, Path target, uInt32 flags); -LibAPI(MgErr) LVPath_ReadLink(Path path, Path *target, Bool32 recursive, uInt32 *fileType); +LibAPI(MgErr) LVFile_CreateLink(LStrHandle path, Path target, uInt32 flags); +LibAPI(MgErr) LVPath_ReadLink(Path path, Path *target, uInt32 flags, uInt32 *fileType); +LibAPI(MgErr) LVFile_ReadLink(LStrHandle path, LStrHandle *target, uInt32 flags, uInt32 *fileType); + typedef union { int64 q; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |