|
From: <lab...@us...> - 2009-02-06 19:29:58
|
Revision: 951
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=951&view=rev
Author: labviewer
Date: 2009-02-06 19:29:47 +0000 (Fri, 06 Feb 2009)
Log Message:
-----------
Fixed compiling of assembly targets to also use the new lvzip prefix.
Modified Paths:
--------------
trunk/lvzip/c_source/inffas32.asm
trunk/lvzip/c_source/zalias.h
Modified: trunk/lvzip/c_source/inffas32.asm
===================================================================
--- trunk/lvzip/c_source/inffas32.asm 2009-02-06 19:28:43 UTC (rev 950)
+++ trunk/lvzip/c_source/inffas32.asm 2009-02-06 19:29:47 UTC (rev 951)
@@ -55,7 +55,7 @@
; 75 "inffast.S"
;FILE "inffast.S"
-;;;GLOBAL _inflate_fast
+;;;GLOBAL _lvzip_inflate_fast
;;;SECTION .text
@@ -73,10 +73,10 @@
_TEXT segment
-PUBLIC _inflate_fast
+PUBLIC _lvzip_inflate_fast
ALIGN 4
-_inflate_fast:
+_lvzip_inflate_fast:
jmp inflate_fast_entry
Modified: trunk/lvzip/c_source/zalias.h
===================================================================
--- trunk/lvzip/c_source/zalias.h 2009-02-06 19:28:43 UTC (rev 950)
+++ trunk/lvzip/c_source/zalias.h 2009-02-06 19:29:47 UTC (rev 951)
@@ -28,11 +28,11 @@
#define get_crc_table lvzip_get_crc_table
#define inflate lvzip_inflate
#define inflate_copyright lvzip_inflate_copyright
-#define inflate_fast lvzip_inflate_fast
#define inflate_table lvzip_inflate_table
#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 inflatePrime lvzip_inflatePrime
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2009-12-22 21:59:11
|
Revision: 1016
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1016&view=rev
Author: labviewer
Date: 2009-12-22 21:59:04 +0000 (Tue, 22 Dec 2009)
Log Message:
-----------
Incorporate changes from 1.01f
Modified Paths:
--------------
trunk/lvzip/c_source/unzip.c
trunk/lvzip/c_source/unzip.h
trunk/lvzip/c_source/zip.c
Modified: trunk/lvzip/c_source/unzip.c
===================================================================
--- trunk/lvzip/c_source/unzip.c 2009-11-24 08:07:26 UTC (rev 1015)
+++ trunk/lvzip/c_source/unzip.c 2009-12-22 21:59:04 UTC (rev 1016)
@@ -1,5 +1,5 @@
/* unzip.c -- IO for uncompress .zip files using zlib
- Version 1.01e, February 12th, 2005
+ Version 1.01f, December 22th, 2009
Copyright (C) 1998-2005 Gilles Vollant
@@ -175,10 +175,7 @@
int *pi;
{
unsigned char c;
- int err;
-
- *pi = 0;
- err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
+ int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
if (err==1)
{
*pi = (int)c;
@@ -186,6 +183,7 @@
}
else
{
+ *pi = 0;
if (ZERROR(*pzlib_filefunc_def,filestream))
return UNZ_ERRNO;
else
@@ -208,7 +206,7 @@
uLong *pX;
{
uLong x ;
- int i;
+ int i = 0;
int err;
err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
@@ -236,7 +234,7 @@
uLong *pX;
{
uLong x ;
- int i;
+ int i = 0;
int err;
err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i);
@@ -263,9 +261,6 @@
/* My own strcmpi / strcasecmp */
-local int strcmpcasenosensitive_internal OF((
- const char* fileName1,
- const char* fileName2));
local int strcmpcasenosensitive_internal (fileName1,fileName2)
const char* fileName1;
const char* fileName2;
@@ -495,8 +490,11 @@
s=(unz_s*)ALLOC(sizeof(unz_s));
- *s=us;
- unzGoToFirstFile((unzFile)s);
+ if (s!=NULL)
+ {
+ *s=us;
+ unzGoToFirstFile((unzFile)s);
+ }
return (unzFile)s;
}
@@ -549,9 +547,6 @@
/*
Translate date/time from Dos format to tm_unz (readable more easilty)
*/
-local void unzlocal_DosDateToTmuDate OF((
- uLong ulDosDate,
- tm_unz* ptm));
local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
uLong ulDosDate;
tm_unz* ptm;
@@ -615,10 +610,12 @@
/* we check the magic */
if (err==UNZ_OK)
+ {
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO;
else if (uMagic!=0x02014b50)
err=UNZ_BADZIPFILE;
+ }
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&file_info.version) != UNZ_OK)
err=UNZ_ERRNO;
@@ -695,10 +692,13 @@
uSizeRead = extraFieldBufferSize;
if (lSeek!=0)
+ {
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
+ }
+
if ((file_info.size_file_extra>0) && (extraFieldBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,extraField,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO;
@@ -720,10 +720,13 @@
uSizeRead = commentBufferSize;
if (lSeek!=0)
+ {
if (ZSEEK(s->z_filefunc, s->filestream,lSeek,ZLIB_FILEFUNC_SEEK_CUR)==0)
lSeek=0;
else
err=UNZ_ERRNO;
+ }
+
if ((file_info.size_file_comment>0) && (commentBufferSize>0))
if (ZREAD(s->z_filefunc, s->filestream,szComment,uSizeRead)!=uSizeRead)
err=UNZ_ERRNO;
@@ -961,12 +964,6 @@
store in *piSizeVar the size of extra info in local header
(filename and size of extra field data)
*/
-local int unzlocal_CheckCurrentFileCoherencyHeader OF((
- unz_s* s,
- uInt* piSizeVar,
- uLong *poffset_local_extrafield,
- uInt *psize_local_extrafield));
-
local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
poffset_local_extrafield,
psize_local_extrafield)
@@ -990,10 +987,12 @@
if (err==UNZ_OK)
+ {
if (unzlocal_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK)
err=UNZ_ERRNO;
else if (uMagic!=0x04034b50)
err=UNZ_BADZIPFILE;
+ }
if (unzlocal_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
err=UNZ_ERRNO;
@@ -1176,6 +1175,8 @@
s->pfile_in_zip_read = pfile_in_zip_read_info;
+ s->encrypted = 0;
+
# ifndef NOUNCRYPT
if (password != NULL)
{
@@ -1579,7 +1580,7 @@
unz_s* s;
if (file==NULL)
- return UNZ_PARAMERROR;
+ return (uLong)UNZ_PARAMERROR;
s=(unz_s*)file;
if (!s->current_file_ok)
return 0;
Modified: trunk/lvzip/c_source/unzip.h
===================================================================
--- trunk/lvzip/c_source/unzip.h 2009-11-24 08:07:26 UTC (rev 1015)
+++ trunk/lvzip/c_source/unzip.h 2009-12-22 21:59:04 UTC (rev 1016)
@@ -1,5 +1,5 @@
/* unzip.h -- IO for uncompress .zip files using zlib
- Version 1.01e, February 12th, 2005
+ Version 1.01f, December 22th, 2009
Copyright (C) 1998-2005 Gilles Vollant
@@ -57,6 +57,12 @@
#include "ioapi.h"
#endif
+#ifdef HAVE_BZIP2
+#include "bzlib.h"
+#endif
+
+#define Z_BZIP2ED 12
+
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
/* like the STRICT of WIN32, we define a pointer that cannot be converted
from (void*) without cast */
Modified: trunk/lvzip/c_source/zip.c
===================================================================
--- trunk/lvzip/c_source/zip.c 2009-11-24 08:07:26 UTC (rev 1015)
+++ trunk/lvzip/c_source/zip.c 2009-12-22 21:59:04 UTC (rev 1016)
@@ -1,5 +1,5 @@
/* zip.c -- IO on .zip files using zlib
- Version 1.01e, February 12th, 2005
+ Version 1.01f, December 22th, 2009
27 Dec 2004 Rolf Kalbermatter
Modification to zipOpen2 to support globalComment retrieval.
@@ -173,7 +173,6 @@
return ldi;
}
-local void free_datablock OF((linkedlist_datablock_internal* ldi));
local void free_datablock(ldi)
linkedlist_datablock_internal* ldi;
{
@@ -185,14 +184,12 @@
}
}
-local void init_linkedlist OF((linkedlist_data* ll));
local void init_linkedlist(ll)
linkedlist_data* ll;
{
ll->first_block = ll->last_block = NULL;
}
-local void free_linkedlist OF((linkedlist_data* ll));
local void free_linkedlist(ll)
linkedlist_data* ll;
{
@@ -201,7 +198,6 @@
}
-local int add_data_in_datablock OF((linkedlist_data* ll, const void* buf, uLong len));
local int add_data_in_datablock(ll,buf,len)
linkedlist_data* ll;
const void* buf;
@@ -320,15 +316,14 @@
/****************************************************************************/
-local uLong ziplocal_TmzDateToDosDate OF((const tm_zip* ptm,uLong dosDate));
local uLong ziplocal_TmzDateToDosDate(ptm,dosDate)
const tm_zip* ptm;
uLong dosDate;
{
uLong year = (uLong)ptm->tm_year;
- if (year>1980)
+ if (year>=1980)
year-=1980;
- else if (year>80)
+ else if (year>=80)
year-=80;
return
(uLong) (((ptm->tm_mday) + (32 * (ptm->tm_mon+1)) + (512 * year)) << 16) |
@@ -349,10 +344,7 @@
int *pi;
{
unsigned char c;
- int err;
-
- *pi = 0;
- err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
+ int err = (int)ZREAD(*pzlib_filefunc_def,filestream,&c,1);
if (err==1)
{
*pi = (int)c;
@@ -360,6 +352,7 @@
}
else
{
+ *pi = 0;
if (ZERROR(*pzlib_filefunc_def,filestream))
return ZIP_ERRNO;
else
@@ -382,7 +375,7 @@
uLong *pX;
{
uLong x ;
- int i;
+ int i = 0;
int err;
err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
@@ -410,7 +403,7 @@
uLong *pX;
{
uLong x ;
- int i;
+ int i = 0;
int err;
err = ziplocal_getByte(pzlib_filefunc_def,filestream,&i);
@@ -530,6 +523,8 @@
if (ziinit.filestream == NULL)
return NULL;
+ if (append == APPEND_STATUS_CREATEAFTER)
+ ZSEEK(ziinit.z_filefunc,ziinit.filestream,0,SEEK_END);
ziinit.begin_pos = ZTELL(ziinit.z_filefunc,ziinit.filestream);
ziinit.in_opened_file_inzip = 0;
ziinit.ci.stream_initialised = 0;
@@ -554,7 +549,7 @@
uLong size_central_dir; /* size of the central directory */
uLong offset_central_dir; /* offset of start of central directory */
- uLong central_pos;
+ uLong central_pos,uL;
uLong number_disk; /* number of the current dist, used for
spaning ZIP, unsupported, always 0*/
@@ -565,55 +560,64 @@
the central dir
(same than number_entry on nospan) */
uLong size_comment;
- char sig[4];
central_pos = ziplocal_SearchCentralDir(&ziinit.z_filefunc,ziinit.filestream);
+// if (central_pos==0) disable to allow appending to empty ZIP archive
+// err=ZIP_ERRNO;
- err = ZSEEK(ziinit.z_filefunc, ziinit.filestream, central_pos,ZLIB_FILEFUNC_SEEK_SET);
-
if (err==ZIP_OK)
- err = ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream, (uLong*)sig);
-
+ if (ZSEEK(ziinit.z_filefunc, ziinit.filestream, central_pos,ZLIB_FILEFUNC_SEEK_SET)!=0)
+ err=ZIP_ERRNO;
+ /* the signature, already checked */
if (err==ZIP_OK)
- if (((*(sig))!=0x50) || ((*(sig+1))!=0x4b) || ((*(sig+2))!=0x05) || ((*(sig+3))!=0x06))
- err = ZIP_ERRNO;
-
+ if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&uL)!=ZIP_OK)
+ err=ZIP_ERRNO;
+
/* number of this disk */
if (err==ZIP_OK)
- err = ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk);
+ if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk)!=ZIP_OK)
+ err=ZIP_ERRNO;
/* number of the disk with the start of the central directory */
if (err==ZIP_OK)
- err = ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk_with_CD);
+ if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_disk_with_CD)!=ZIP_OK)
+ err=ZIP_ERRNO;
/* total number of entries in the central dir on this disk */
if (err==ZIP_OK)
- err = ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry);
+ if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry)!=ZIP_OK)
+ err=ZIP_ERRNO;
/* total number of entries in the central dir */
if (err==ZIP_OK)
- err = ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry_CD);
+ if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&number_entry_CD)!=ZIP_OK)
+ err=ZIP_ERRNO;
- if ((number_entry_CD!=number_entry) ||
- (number_disk_with_CD!=0) ||
- (number_disk!=0))
- err = ZIP_BADZIPFILE;
+ if (err==ZIP_OK)
+ if ((number_entry_CD!=number_entry) ||
+ (number_disk_with_CD!=0) ||
+ (number_disk!=0))
+ err=ZIP_BADZIPFILE;
/* size of the central directory */
if (err==ZIP_OK)
- err = ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&size_central_dir);
+ if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&size_central_dir)!=ZIP_OK)
+ err=ZIP_ERRNO;
/* offset of start of central directory with respect to the
starting disk number */
if (err==ZIP_OK)
- err = ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&offset_central_dir);
+ if (ziplocal_getLong(&ziinit.z_filefunc, ziinit.filestream,&offset_central_dir)!=ZIP_OK)
+ err=ZIP_ERRNO;
/* zipfile global comment length */
if (err==ZIP_OK)
- err = ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&size_comment);
+ if (ziplocal_getShort(&ziinit.z_filefunc, ziinit.filestream,&size_comment)!=ZIP_OK)
+ err=ZIP_ERRNO;
- if ((err==ZIP_OK) && (central_pos<offset_central_dir+size_central_dir))
- err = ZIP_BADZIPFILE;
+ if ((central_pos<offset_central_dir+size_central_dir) &&
+ (err==ZIP_OK))
+ err=ZIP_BADZIPFILE;
if (err!=ZIP_OK)
{
@@ -623,7 +627,7 @@
if (size_comment>0)
{
- ziinit.globalcomment = ALLOC(size_comment+1);
+ ziinit.globalcomment = (char*)ALLOC(size_comment+1);
if (ziinit.globalcomment)
{
size_comment = ZREAD(ziinit.z_filefunc, ziinit.filestream,ziinit.globalcomment,size_comment);
@@ -865,6 +869,7 @@
zi->ci.stream.next_out = zi->ci.buffered_data;
zi->ci.stream.total_in = 0;
zi->ci.stream.total_out = 0;
+ zi->ci.stream.data_type = Z_BINARY;
if ((err==ZIP_OK) && (zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
{
@@ -949,7 +954,6 @@
comment, method, level, 0);
}
-local int zipFlushWriteBuffer OF((zip_internal* zi));
local int zipFlushWriteBuffer(zi)
zip_internal* zi;
{
@@ -987,9 +991,9 @@
if (zi->in_opened_file_inzip == 0)
return ZIP_PARAMERROR;
- zi->ci.stream.next_in = (void*)buf;
+ zi->ci.stream.next_in = (Bytef*)buf;
zi->ci.stream.avail_in = len;
- zi->ci.crc32 = crc32(zi->ci.crc32,buf,len);
+ zi->ci.crc32 = crc32(zi->ci.crc32,buf,(uInt)len);
while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))
{
@@ -1055,7 +1059,7 @@
zi->ci.stream.avail_in = 0;
if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
- while (err == ZIP_OK)
+ while (err==ZIP_OK)
{
uLong uTotalOutBefore;
if (zi->ci.stream.avail_out == 0)
@@ -1073,8 +1077,8 @@
zi->ci.pos_in_buffered_data += (uInt)(zi->ci.stream.total_out - uTotalOutBefore) ;
}
- if (err == Z_STREAM_END)
- err = ZIP_OK; /* this is normal */
+ if (err==Z_STREAM_END)
+ err=ZIP_OK; /* this is normal */
if ((zi->ci.pos_in_buffered_data>0) && (err==ZIP_OK))
if (zipFlushWriteBuffer(zi)==ZIP_ERRNO)
@@ -1082,7 +1086,7 @@
if ((zi->ci.method == Z_DEFLATED) && (!zi->ci.raw))
{
- err = deflateEnd(&zi->ci.stream);
+ err=deflateEnd(&zi->ci.stream);
zi->ci.stream_initialised = 0;
}
@@ -1186,7 +1190,7 @@
ldi = ldi->next_datablock;
}
}
- free_datablock(zi->central_dir.first_block);
+ free_linkedlist(&(zi->central_dir));
if (err==ZIP_OK) /* Magic End */
err = ziplocal_putValue(&zi->z_filefunc,zi->filestream,(uLong)ENDHEADERMAGIC,4);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2010-06-16 08:46:15
|
Revision: 1042
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1042&view=rev
Author: labviewer
Date: 2010-06-16 08:46:07 +0000 (Wed, 16 Jun 2010)
Log Message:
-----------
Incorporated zlib 1.2.5 and minizip 1.1
Added Paths:
-----------
trunk/lvzip/c_source/MiniZip64_Changes.txt
trunk/lvzip/c_source/gvmat64.asm
trunk/lvzip/c_source/inffas8664.c
trunk/lvzip/c_source/inffasx64.asm
Added: trunk/lvzip/c_source/MiniZip64_Changes.txt
===================================================================
--- trunk/lvzip/c_source/MiniZip64_Changes.txt (rev 0)
+++ trunk/lvzip/c_source/MiniZip64_Changes.txt 2010-06-16 08:46:07 UTC (rev 1042)
@@ -0,0 +1,6 @@
+
+MiniZip 1.1 was derrived from MiniZip at version 1.01f
+
+Change in 1.0 (Okt 2009)
+ - **TODO - Add history**
+
Added: trunk/lvzip/c_source/gvmat64.asm
===================================================================
--- trunk/lvzip/c_source/gvmat64.asm (rev 0)
+++ trunk/lvzip/c_source/gvmat64.asm 2010-06-16 08:46:07 UTC (rev 1042)
@@ -0,0 +1,553 @@
+;uInt longest_match_x64(
+; deflate_state *s,
+; IPos cur_match); /* current match */
+
+; gvmat64.asm -- Asm portion of the optimized longest_match for 32 bits x86_64
+; (AMD64 on Athlon 64, Opteron, Phenom
+; and Intel EM64T on Pentium 4 with EM64T, Pentium D, Core 2 Duo, Core I5/I7)
+; Copyright (C) 1995-2010 Jean-loup Gailly, Brian Raiter and Gilles Vollant.
+;
+; File written by Gilles Vollant, by converting to assembly the longest_match
+; from Jean-loup Gailly in deflate.c of zLib and infoZip zip.
+;
+; and by taking inspiration on asm686 with masm, optimised assembly code
+; from Brian Raiter, written 1998
+;
+; This software is provided 'as-is', without any express or implied
+; warranty. In no event will the authors be held liable for any damages
+; arising from the use of this software.
+;
+; Permission is granted to anyone to use this software for any purpose,
+; including commercial applications, and to alter it and redistribute it
+; freely, subject to the following restrictions:
+;
+; 1. The origin of this software must not be misrepresented; you must not
+; claim that you wrote the original software. If you use this software
+; in a product, an acknowledgment in the product documentation would be
+; appreciated but is not required.
+; 2. Altered source versions must be plainly marked as such, and must not be
+; misrepresented as being the original software
+; 3. This notice may not be removed or altered from any source distribution.
+;
+;
+;
+; http://www.zlib.net
+; http://www.winimage.com/zLibDll
+; http://www.muppetlabs.com/~breadbox/software/assembly.html
+;
+; to compile this file for infozip Zip, I use option:
+; ml64.exe /Flgvmat64 /c /Zi /DINFOZIP gvmat64.asm
+;
+; to compile this file for zLib, I use option:
+; ml64.exe /Flgvmat64 /c /Zi gvmat64.asm
+; Be carrefull to adapt zlib1222add below to your version of zLib
+; (if you use a version of zLib before 1.0.4 or after 1.2.2.2, change
+; value of zlib1222add later)
+;
+; This file compile with Microsoft Macro Assembler (x64) for AMD64
+;
+; ml64.exe is given with Visual Studio 2005/2008/2010 and Windows WDK
+;
+; (you can get Windows WDK with ml64 for AMD64 from
+; http://www.microsoft.com/whdc/Devtools/wdk/default.mspx for low price)
+;
+
+
+;uInt longest_match(s, cur_match)
+; deflate_state *s;
+; IPos cur_match; /* current match */
+.code
+longest_match PROC
+
+
+;LocalVarsSize equ 88
+ LocalVarsSize equ 72
+
+; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12
+; free register : r14,r15
+; register can be saved : rsp
+
+ chainlenwmask equ rsp + 8 - LocalVarsSize ; high word: current chain len
+ ; low word: s->wmask
+;window equ rsp + xx - LocalVarsSize ; local copy of s->window ; stored in r10
+;windowbestlen equ rsp + xx - LocalVarsSize ; s->window + bestlen , use r10+r11
+;scanstart equ rsp + xx - LocalVarsSize ; first two bytes of string ; stored in r12w
+;scanend equ rsp + xx - LocalVarsSize ; last two bytes of string use ebx
+;scanalign equ rsp + xx - LocalVarsSize ; dword-misalignment of string r13
+;bestlen equ rsp + xx - LocalVarsSize ; size of best match so far -> r11d
+;scan equ rsp + xx - LocalVarsSize ; ptr to string wanting match -> r9
+IFDEF INFOZIP
+ELSE
+ nicematch equ (rsp + 16 - LocalVarsSize) ; a good enough match size
+ENDIF
+
+save_rdi equ rsp + 24 - LocalVarsSize
+save_rsi equ rsp + 32 - LocalVarsSize
+save_rbx equ rsp + 40 - LocalVarsSize
+save_rbp equ rsp + 48 - LocalVarsSize
+save_r12 equ rsp + 56 - LocalVarsSize
+save_r13 equ rsp + 64 - LocalVarsSize
+;save_r14 equ rsp + 72 - LocalVarsSize
+;save_r15 equ rsp + 80 - LocalVarsSize
+
+
+; summary of register usage
+; scanend ebx
+; scanendw bx
+; chainlenwmask edx
+; curmatch rsi
+; curmatchd esi
+; windowbestlen r8
+; scanalign r9
+; scanalignd r9d
+; window r10
+; bestlen r11
+; bestlend r11d
+; scanstart r12d
+; scanstartw r12w
+; scan r13
+; nicematch r14d
+; limit r15
+; limitd r15d
+; prev rcx
+
+; all the +4 offsets are due to the addition of pending_buf_size (in zlib
+; in the deflate_state structure since the asm code was first written
+; (if you compile with zlib 1.0.4 or older, remove the +4).
+; Note : these value are good with a 8 bytes boundary pack structure
+
+
+ MAX_MATCH equ 258
+ MIN_MATCH equ 3
+ MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1)
+
+
+;;; Offsets for fields in the deflate_state structure. These numbers
+;;; are calculated from the definition of deflate_state, with the
+;;; assumption that the compiler will dword-align the fields. (Thus,
+;;; changing the definition of deflate_state could easily cause this
+;;; program to crash horribly, without so much as a warning at
+;;; compile time. Sigh.)
+
+; all the +zlib1222add offsets are due to the addition of fields
+; in zlib in the deflate_state structure since the asm code was first written
+; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)").
+; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0").
+; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8").
+
+
+IFDEF INFOZIP
+
+_DATA SEGMENT
+COMM window_size:DWORD
+; WMask ; 7fff
+COMM window:BYTE:010040H
+COMM prev:WORD:08000H
+; MatchLen : unused
+; PrevMatch : unused
+COMM strstart:DWORD
+COMM match_start:DWORD
+; Lookahead : ignore
+COMM prev_length:DWORD ; PrevLen
+COMM max_chain_length:DWORD
+COMM good_match:DWORD
+COMM nice_match:DWORD
+prev_ad equ OFFSET prev
+window_ad equ OFFSET window
+nicematch equ nice_match
+_DATA ENDS
+WMask equ 07fffh
+
+ELSE
+
+ IFNDEF zlib1222add
+ zlib1222add equ 8
+ ENDIF
+dsWSize equ 56+zlib1222add+(zlib1222add/2)
+dsWMask equ 64+zlib1222add+(zlib1222add/2)
+dsWindow equ 72+zlib1222add
+dsPrev equ 88+zlib1222add
+dsMatchLen equ 128+zlib1222add
+dsPrevMatch equ 132+zlib1222add
+dsStrStart equ 140+zlib1222add
+dsMatchStart equ 144+zlib1222add
+dsLookahead equ 148+zlib1222add
+dsPrevLen equ 152+zlib1222add
+dsMaxChainLen equ 156+zlib1222add
+dsGoodMatch equ 172+zlib1222add
+dsNiceMatch equ 176+zlib1222add
+
+window_size equ [ rcx + dsWSize]
+WMask equ [ rcx + dsWMask]
+window_ad equ [ rcx + dsWindow]
+prev_ad equ [ rcx + dsPrev]
+strstart equ [ rcx + dsStrStart]
+match_start equ [ rcx + dsMatchStart]
+Lookahead equ [ rcx + dsLookahead] ; 0ffffffffh on infozip
+prev_length equ [ rcx + dsPrevLen]
+max_chain_length equ [ rcx + dsMaxChainLen]
+good_match equ [ rcx + dsGoodMatch]
+nice_match equ [ rcx + dsNiceMatch]
+ENDIF
+
+; parameter 1 in r8(deflate state s), param 2 in rdx (cur match)
+
+; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and
+; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
+;
+; All registers must be preserved across the call, except for
+; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch.
+
+
+
+;;; Save registers that the compiler may be using, and adjust esp to
+;;; make room for our stack frame.
+
+
+;;; Retrieve the function arguments. r8d will hold cur_match
+;;; throughout the entire function. edx will hold the pointer to the
+;;; deflate_state structure during the function's setup (before
+;;; entering the main loop.
+
+; parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match)
+
+; this clear high 32 bits of r8, which can be garbage in both r8 and rdx
+
+ mov [save_rdi],rdi
+ mov [save_rsi],rsi
+ mov [save_rbx],rbx
+ mov [save_rbp],rbp
+IFDEF INFOZIP
+ mov r8d,ecx
+ELSE
+ mov r8d,edx
+ENDIF
+ mov [save_r12],r12
+ mov [save_r13],r13
+; mov [save_r14],r14
+; mov [save_r15],r15
+
+
+;;; uInt wmask = s->w_mask;
+;;; unsigned chain_length = s->max_chain_length;
+;;; if (s->prev_length >= s->good_match) {
+;;; chain_length >>= 2;
+;;; }
+
+ mov edi, prev_length
+ mov esi, good_match
+ mov eax, WMask
+ mov ebx, max_chain_length
+ cmp edi, esi
+ jl LastMatchGood
+ shr ebx, 2
+LastMatchGood:
+
+;;; chainlen is decremented once beforehand so that the function can
+;;; use the sign flag instead of the zero flag for the exit test.
+;;; It is then shifted into the high word, to make room for the wmask
+;;; value, which it will always accompany.
+
+ dec ebx
+ shl ebx, 16
+ or ebx, eax
+
+;;; on zlib only
+;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
+
+IFDEF INFOZIP
+ mov [chainlenwmask], ebx
+; on infozip nice_match = [nice_match]
+ELSE
+ mov eax, nice_match
+ mov [chainlenwmask], ebx
+ mov r10d, Lookahead
+ cmp r10d, eax
+ cmovnl r10d, eax
+ mov [nicematch],r10d
+ENDIF
+
+;;; register Bytef *scan = s->window + s->strstart;
+ mov r10, window_ad
+ mov ebp, strstart
+ lea r13, [r10 + rbp]
+
+;;; Determine how many bytes the scan ptr is off from being
+;;; dword-aligned.
+
+ mov r9,r13
+ neg r13
+ and r13,3
+
+;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
+;;; s->strstart - (IPos)MAX_DIST(s) : NIL;
+IFDEF INFOZIP
+ mov eax,07efah ; MAX_DIST = (WSIZE-MIN_LOOKAHEAD) (0x8000-(3+8+1))
+ELSE
+ mov eax, window_size
+ sub eax, MIN_LOOKAHEAD
+ENDIF
+ xor edi,edi
+ sub ebp, eax
+
+ mov r11d, prev_length
+
+ cmovng ebp,edi
+
+;;; int best_len = s->prev_length;
+
+
+;;; Store the sum of s->window + best_len in esi locally, and in esi.
+
+ lea rsi,[r10+r11]
+
+;;; register ush scan_start = *(ushf*)scan;
+;;; register ush scan_end = *(ushf*)(scan+best_len-1);
+;;; Posf *prev = s->prev;
+
+ movzx r12d,word ptr [r9]
+ movzx ebx, word ptr [r9 + r11 - 1]
+
+ mov rdi, prev_ad
+
+;;; Jump into the main loop.
+
+ mov edx, [chainlenwmask]
+
+ cmp bx,word ptr [rsi + r8 - 1]
+ jz LookupLoopIsZero
+
+LookupLoop1:
+ and r8d, edx
+
+ movzx r8d, word ptr [rdi + r8*2]
+ cmp r8d, ebp
+ jbe LeaveNow
+ sub edx, 00010000h
+ js LeaveNow
+
+LoopEntry1:
+ cmp bx,word ptr [rsi + r8 - 1]
+ jz LookupLoopIsZero
+
+LookupLoop2:
+ and r8d, edx
+
+ movzx r8d, word ptr [rdi + r8*2]
+ cmp r8d, ebp
+ jbe LeaveNow
+ sub edx, 00010000h
+ js LeaveNow
+
+LoopEntry2:
+ cmp bx,word ptr [rsi + r8 - 1]
+ jz LookupLoopIsZero
+
+LookupLoop4:
+ and r8d, edx
+
+ movzx r8d, word ptr [rdi + r8*2]
+ cmp r8d, ebp
+ jbe LeaveNow
+ sub edx, 00010000h
+ js LeaveNow
+
+LoopEntry4:
+
+ cmp bx,word ptr [rsi + r8 - 1]
+ jnz LookupLoop1
+ jmp LookupLoopIsZero
+
+
+;;; do {
+;;; match = s->window + cur_match;
+;;; if (*(ushf*)(match+best_len-1) != scan_end ||
+;;; *(ushf*)match != scan_start) continue;
+;;; [...]
+;;; } while ((cur_match = prev[cur_match & wmask]) > limit
+;;; && --chain_length != 0);
+;;;
+;;; Here is the inner loop of the function. The function will spend the
+;;; majority of its time in this loop, and majority of that time will
+;;; be spent in the first ten instructions.
+;;;
+;;; Within this loop:
+;;; ebx = scanend
+;;; r8d = curmatch
+;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask)
+;;; esi = windowbestlen - i.e., (window + bestlen)
+;;; edi = prev
+;;; ebp = limit
+
+LookupLoop:
+ and r8d, edx
+
+ movzx r8d, word ptr [rdi + r8*2]
+ cmp r8d, ebp
+ jbe LeaveNow
+ sub edx, 00010000h
+ js LeaveNow
+
+LoopEntry:
+
+ cmp bx,word ptr [rsi + r8 - 1]
+ jnz LookupLoop1
+LookupLoopIsZero:
+ cmp r12w, word ptr [r10 + r8]
+ jnz LookupLoop1
+
+
+;;; Store the current value of chainlen.
+ mov [chainlenwmask], edx
+
+;;; Point edi to the string under scrutiny, and esi to the string we
+;;; are hoping to match it up with. In actuality, esi and edi are
+;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is
+;;; initialized to -(MAX_MATCH_8 - scanalign).
+
+ lea rsi,[r8+r10]
+ mov rdx, 0fffffffffffffef8h; -(MAX_MATCH_8)
+ lea rsi, [rsi + r13 + 0108h] ;MAX_MATCH_8]
+ lea rdi, [r9 + r13 + 0108h] ;MAX_MATCH_8]
+
+ prefetcht1 [rsi+rdx]
+ prefetcht1 [rdi+rdx]
+
+
+;;; Test the strings for equality, 8 bytes at a time. At the end,
+;;; adjust rdx so that it is offset to the exact byte that mismatched.
+;;;
+;;; We already know at this point that the first three bytes of the
+;;; strings match each other, and they can be safely passed over before
+;;; starting the compare loop. So what this code does is skip over 0-3
+;;; bytes, as much as necessary in order to dword-align the edi
+;;; pointer. (rsi will still be misaligned three times out of four.)
+;;;
+;;; It should be confessed that this loop usually does not represent
+;;; much of the total running time. Replacing it with a more
+;;; straightforward "rep cmpsb" would not drastically degrade
+;;; performance.
+
+
+LoopCmps:
+ mov rax, [rsi + rdx]
+ xor rax, [rdi + rdx]
+ jnz LeaveLoopCmps
+
+ mov rax, [rsi + rdx + 8]
+ xor rax, [rdi + rdx + 8]
+ jnz LeaveLoopCmps8
+
+
+ mov rax, [rsi + rdx + 8+8]
+ xor rax, [rdi + rdx + 8+8]
+ jnz LeaveLoopCmps16
+
+ add rdx,8+8+8
+
+ jnz short LoopCmps
+ jmp short LenMaximum
+LeaveLoopCmps16: add rdx,8
+LeaveLoopCmps8: add rdx,8
+LeaveLoopCmps:
+
+ test eax, 0000FFFFh
+ jnz LenLower
+
+ test eax,0ffffffffh
+
+ jnz LenLower32
+
+ add rdx,4
+ shr rax,32
+ or ax,ax
+ jnz LenLower
+
+LenLower32:
+ shr eax,16
+ add rdx,2
+LenLower: sub al, 1
+ adc rdx, 0
+;;; Calculate the length of the match. If it is longer than MAX_MATCH,
+;;; then automatically accept it as the best possible match and leave.
+
+ lea rax, [rdi + rdx]
+ sub rax, r9
+ cmp eax, MAX_MATCH
+ jge LenMaximum
+
+;;; If the length of the match is not longer than the best match we
+;;; have so far, then forget it and return to the lookup loop.
+;///////////////////////////////////
+
+ cmp eax, r11d
+ jg LongerMatch
+
+ lea rsi,[r10+r11]
+
+ mov rdi, prev_ad
+ mov edx, [chainlenwmask]
+ jmp LookupLoop
+
+;;; s->match_start = cur_match;
+;;; best_len = len;
+;;; if (len >= nice_match) break;
+;;; scan_end = *(ushf*)(scan+best_len-1);
+
+LongerMatch:
+ mov r11d, eax
+ mov match_start, r8d
+ cmp eax, [nicematch]
+ jge LeaveNow
+
+ lea rsi,[r10+rax]
+
+ movzx ebx, word ptr [r9 + rax - 1]
+ mov rdi, prev_ad
+ mov edx, [chainlenwmask]
+ jmp LookupLoop
+
+;;; Accept the current string, with the maximum possible length.
+
+LenMaximum:
+ mov r11d,MAX_MATCH
+ mov match_start, r8d
+
+;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
+;;; return s->lookahead;
+
+LeaveNow:
+IFDEF INFOZIP
+ mov eax,r11d
+ELSE
+ mov eax, Lookahead
+ cmp r11d, eax
+ cmovng eax, r11d
+ENDIF
+
+;;; Restore the stack and return from whence we came.
+
+
+ mov rsi,[save_rsi]
+ mov rdi,[save_rdi]
+ mov rbx,[save_rbx]
+ mov rbp,[save_rbp]
+ mov r12,[save_r12]
+ mov r13,[save_r13]
+; mov r14,[save_r14]
+; mov r15,[save_r15]
+
+
+ ret 0
+; please don't remove this string !
+; Your can freely use gvmat64 in any free or commercial app
+; but it is far better don't remove the string in the binary!
+ db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0
+longest_match ENDP
+
+match_init PROC
+ ret 0
+match_init ENDP
+
+
+END
Added: trunk/lvzip/c_source/inffas8664.c
===================================================================
--- trunk/lvzip/c_source/inffas8664.c (rev 0)
+++ trunk/lvzip/c_source/inffas8664.c 2010-06-16 08:46:07 UTC (rev 1042)
@@ -0,0 +1,186 @@
+/* inffas8664.c is a hand tuned assembler version of inffast.c - fast decoding
+ * version for AMD64 on Windows using Microsoft C compiler
+ *
+ * Copyright (C) 1995-2003 Mark Adler
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ *
+ * Copyright (C) 2003 Chris Anderson <chr...@ch...>
+ * Please use the copyright conditions above.
+ *
+ * 2005 - Adaptation to Microsoft C Compiler for AMD64 by Gilles Vollant
+ *
+ * inffas8664.c call function inffas8664fnc in inffasx64.asm
+ * inffasx64.asm is automatically convert from AMD64 portion of inffas86.c
+ *
+ * Dec-29-2003 -- I added AMD64 inflate asm support. This version is also
+ * slightly quicker on x86 systems because, instead of using rep movsb to copy
+ * data, it uses rep movsw, which moves data in 2-byte chunks instead of single
+ * bytes. I've tested the AMD64 code on a Fedora Core 1 + the x86_64 updates
+ * from http://fedora.linux.duke.edu/fc1_x86_64
+ * which is running on an Athlon 64 3000+ / Gigabyte GA-K8VT800M system with
+ * 1GB ram. The 64-bit version is about 4% faster than the 32-bit version,
+ * when decompressing mozilla-source-1.3.tar.gz.
+ *
+ * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from
+ * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at
+ * the moment. I have successfully compiled and tested this code with gcc2.96,
+ * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S
+ * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX
+ * enabled. I will attempt to merge the MMX code into this version. Newer
+ * versions of this and inffast.S can be found at
+ * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/
+ *
+ */
+
+#include <stdio.h>
+#include "zutil.h"
+#include "inftrees.h"
+#include "inflate.h"
+#include "inffast.h"
+
+/* Mark Adler's comments from inffast.c: */
+
+/*
+ Decode literal, length, and distance codes and write out the resulting
+ literal and match bytes until either not enough input or output is
+ available, an end-of-block is encountered, or a data error is encountered.
+ When large enough input and output buffers are supplied to inflate(), for
+ example, a 16K input buffer and a 64K output buffer, more than 95% of the
+ inflate execution time is spent in this routine.
+
+ Entry assumptions:
+
+ state->mode == LEN
+ strm->avail_in >= 6
+ strm->avail_out >= 258
+ start >= strm->avail_out
+ state->bits < 8
+
+ On return, state->mode is one of:
+
+ LEN -- ran out of enough output space or enough available input
+ TYPE -- reached end of block code, inflate() to interpret next block
+ BAD -- error in block data
+
+ Notes:
+
+ - The maximum input bits used by a length/distance pair is 15 bits for the
+ length code, 5 bits for the length extra, 15 bits for the distance code,
+ and 13 bits for the distance extra. This totals 48 bits, or six bytes.
+ Therefore if strm->avail_in >= 6, then there is enough input to avoid
+ checking for available input while decoding.
+
+ - The maximum bytes that a single length/distance pair can output is 258
+ bytes, which is the maximum length that can be coded. inflate_fast()
+ requires strm->avail_out >= 258 for each loop to avoid checking for
+ output space.
+ */
+
+
+
+ typedef struct inffast_ar {
+/* 64 32 x86 x86_64 */
+/* ar offset register */
+/* 0 0 */ void *esp; /* esp save */
+/* 8 4 */ void *ebp; /* ebp save */
+/* 16 8 */ unsigned char FAR *in; /* esi rsi local strm->next_in */
+/* 24 12 */ unsigned char FAR *last; /* r9 while in < last */
+/* 32 16 */ unsigned char FAR *out; /* edi rdi local strm->next_out */
+/* 40 20 */ unsigned char FAR *beg; /* inflate()'s init next_out */
+/* 48 24 */ unsigned char FAR *end; /* r10 while out < end */
+/* 56 28 */ unsigned char FAR *window;/* size of window, wsize!=0 */
+/* 64 32 */ code const FAR *lcode; /* ebp rbp local strm->lencode */
+/* 72 36 */ code const FAR *dcode; /* r11 local strm->distcode */
+/* 80 40 */ size_t /*unsigned long */hold; /* edx rdx local strm->hold */
+/* 88 44 */ unsigned bits; /* ebx rbx local strm->bits */
+/* 92 48 */ unsigned wsize; /* window size */
+/* 96 52 */ unsigned write; /* window write index */
+/*100 56 */ unsigned lmask; /* r12 mask for lcode */
+/*104 60 */ unsigned dmask; /* r13 mask for dcode */
+/*108 64 */ unsigned len; /* r14 match length */
+/*112 68 */ unsigned dist; /* r15 match distance */
+/*116 72 */ unsigned status; /* set when state chng*/
+ } type_ar;
+#ifdef ASMINF
+
+void inflate_fast(strm, start)
+z_streamp strm;
+unsigned start; /* inflate()'s starting value for strm->avail_out */
+{
+ struct inflate_state FAR *state;
+ type_ar ar;
+ void inffas8664fnc(struct inffast_ar * par);
+
+
+
+#if (defined( __GNUC__ ) && defined( __amd64__ ) && ! defined( __i386 )) || (defined(_MSC_VER) && defined(_M_AMD64))
+#define PAD_AVAIL_IN 6
+#define PAD_AVAIL_OUT 258
+#else
+#define PAD_AVAIL_IN 5
+#define PAD_AVAIL_OUT 257
+#endif
+
+ /* copy state to local variables */
+ state = (struct inflate_state FAR *)strm->state;
+
+ ar.in = strm->next_in;
+ ar.last = ar.in + (strm->avail_in - PAD_AVAIL_IN);
+ ar.out = strm->next_out;
+ ar.beg = ar.out - (start - strm->avail_out);
+ ar.end = ar.out + (strm->avail_out - PAD_AVAIL_OUT);
+ ar.wsize = state->wsize;
+ ar.write = state->wnext;
+ ar.window = state->window;
+ ar.hold = state->hold;
+ ar.bits = state->bits;
+ ar.lcode = state->lencode;
+ ar.dcode = state->distcode;
+ ar.lmask = (1U << state->lenbits) - 1;
+ ar.dmask = (1U << state->distbits) - 1;
+
+ /* decode literals and length/distances until end-of-block or not enough
+ input data or output space */
+
+ /* align in on 1/2 hold size boundary */
+ while (((size_t)(void *)ar.in & (sizeof(ar.hold) / 2 - 1)) != 0) {
+ ar.hold += (unsigned long)*ar.in++ << ar.bits;
+ ar.bits += 8;
+ }
+
+ inffas8664fnc(&ar);
+
+ if (ar.status > 1) {
+ if (ar.status == 2)
+ strm->msg = "invalid literal/length code";
+ else if (ar.status == 3)
+ strm->msg = "invalid distance code";
+ else
+ strm->msg = "invalid distance too far back";
+ state->mode = BAD;
+ }
+ else if ( ar.status == 1 ) {
+ state->mode = TYPE;
+ }
+
+ /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
+ ar.len = ar.bits >> 3;
+ ar.in -= ar.len;
+ ar.bits -= ar.len << 3;
+ ar.hold &= (1U << ar.bits) - 1;
+
+ /* update state and return */
+ strm->next_in = ar.in;
+ strm->next_out = ar.out;
+ strm->avail_in = (unsigned)(ar.in < ar.last ?
+ PAD_AVAIL_IN + (ar.last - ar.in) :
+ PAD_AVAIL_IN - (ar.in - ar.last));
+ strm->avail_out = (unsigned)(ar.out < ar.end ?
+ PAD_AVAIL_OUT + (ar.end - ar.out) :
+ PAD_AVAIL_OUT - (ar.out - ar.end));
+ state->hold = (unsigned long)ar.hold;
+ state->bits = ar.bits;
+ return;
+}
+
+#endif
Added: trunk/lvzip/c_source/inffasx64.asm
===================================================================
--- trunk/lvzip/c_source/inffasx64.asm (rev 0)
+++ trunk/lvzip/c_source/inffasx64.asm 2010-06-16 08:46:07 UTC (rev 1042)
@@ -0,0 +1,396 @@
+; inffasx64.asm is a hand tuned assembler version of inffast.c - fast decoding
+; version for AMD64 on Windows using Microsoft C compiler
+;
+; inffasx64.asm is automatically convert from AMD64 portion of inffas86.c
+; inffasx64.asm is called by inffas8664.c, which contain more info.
+
+
+; to compile this file, I use option
+; ml64.exe /Flinffasx64 /c /Zi inffasx64.asm
+; with Microsoft Macro Assembler (x64) for AMD64
+;
+
+; This file compile with Microsoft Macro Assembler (x64) for AMD64
+;
+; ml64.exe is given with Visual Studio 2005/2008/2010 and Windows WDK
+;
+; (you can get Windows WDK with ml64 for AMD64 from
+; http://www.microsoft.com/whdc/Devtools/wdk/default.mspx for low price)
+;
+
+
+.code
+inffas8664fnc PROC
+
+; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and
+; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp
+;
+; All registers must be preserved across the call, except for
+; rax, rcx, rdx, r8, r-9, r10, and r11, which are scratch.
+
+
+ mov [rsp-8],rsi
+ mov [rsp-16],rdi
+ mov [rsp-24],r12
+ mov [rsp-32],r13
+ mov [rsp-40],r14
+ mov [rsp-48],r15
+ mov [rsp-56],rbx
+
+ mov rax,rcx
+
+ mov [rax+8], rbp ; /* save regs rbp and rsp */
+ mov [rax], rsp
+
+ mov rsp, rax ; /* make rsp point to &ar */
+
+ mov rsi, [rsp+16] ; /* rsi = in */
+ mov rdi, [rsp+32] ; /* rdi = out */
+ mov r9, [rsp+24] ; /* r9 = last */
+ mov r10, [rsp+48] ; /* r10 = end */
+ mov rbp, [rsp+64] ; /* rbp = lcode */
+ mov r11, [rsp+72] ; /* r11 = dcode */
+ mov rdx, [rsp+80] ; /* rdx = hold */
+ mov ebx, [rsp+88] ; /* ebx = bits */
+ mov r12d, [rsp+100] ; /* r12d = lmask */
+ mov r13d, [rsp+104] ; /* r13d = dmask */
+ ; /* r14d = len */
+ ; /* r15d = dist */
+
+
+ cld
+ cmp r10, rdi
+ je L_one_time ; /* if only one decode left */
+ cmp r9, rsi
+
+ jne L_do_loop
+
+
+L_one_time:
+ mov r8, r12 ; /* r8 = lmask */
+ cmp bl, 32
+ ja L_get_length_code_one_time
+
+ lodsd ; /* eax = *(uint *)in++ */
+ mov cl, bl ; /* cl = bits, needs it for shifting */
+ add bl, 32 ; /* bits += 32 */
+ shl rax, cl
+ or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
+ jmp L_get_length_code_one_time
+
+ALIGN 4
+L_while_test:
+ cmp r10, rdi
+ jbe L_break_loop
+ cmp r9, rsi
+ jbe L_break_loop
+
+L_do_loop:
+ mov r8, r12 ; /* r8 = lmask */
+ cmp bl, 32
+ ja L_get_length_code ; /* if (32 < bits) */
+
+ lodsd ; /* eax = *(uint *)in++ */
+ mov cl, bl ; /* cl = bits, needs it for shifting */
+ add bl, 32 ; /* bits += 32 */
+ shl rax, cl
+ or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
+
+L_get_length_code:
+ and r8, rdx ; /* r8 &= hold */
+ mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */
+
+ mov cl, ah ; /* cl = this.bits */
+ sub bl, ah ; /* bits -= this.bits */
+ shr rdx, cl ; /* hold >>= this.bits */
+
+ test al, al
+ jnz L_test_for_length_base ; /* if (op != 0) 45.7% */
+
+ mov r8, r12 ; /* r8 = lmask */
+ shr eax, 16 ; /* output this.val char */
+ stosb
+
+L_get_length_code_one_time:
+ and r8, rdx ; /* r8 &= hold */
+ mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */
+
+L_dolen:
+ mov cl, ah ; /* cl = this.bits */
+ sub bl, ah ; /* bits -= this.bits */
+ shr rdx, cl ; /* hold >>= this.bits */
+
+ test al, al
+ jnz L_test_for_length_base ; /* if (op != 0) 45.7% */
+
+ shr eax, 16 ; /* output this.val char */
+ stosb
+ jmp L_while_test
+
+ALIGN 4
+L_test_for_length_base:
+ mov r14d, eax ; /* len = this */
+ shr r14d, 16 ; /* len = this.val */
+ mov cl, al
+
+ test al, 16
+ jz L_test_for_second_level_length ; /* if ((op & 16) == 0) 8% */
+ and cl, 15 ; /* op &= 15 */
+ jz L_decode_distance ; /* if (!op) */
+
+L_add_bits_to_len:
+ sub bl, cl
+ xor eax, eax
+ inc eax
+ shl eax, cl
+ dec eax
+ and eax, edx ; /* eax &= hold */
+ shr rdx, cl
+ add r14d, eax ; /* len += hold & mask[op] */
+
+L_decode_distance:
+ mov r8, r13 ; /* r8 = dmask */
+ cmp bl, 32
+ ja L_get_distance_code ; /* if (32 < bits) */
+
+ lodsd ; /* eax = *(uint *)in++ */
+ mov cl, bl ; /* cl = bits, needs it for shifting */
+ add bl, 32 ; /* bits += 32 */
+ shl rax, cl
+ or rdx, rax ; /* hold |= *((uint *)in)++ << bits */
+
+L_get_distance_cod...
[truncated message content] |
|
From: <lab...@us...> - 2010-06-16 08:51:13
|
Revision: 1043
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1043&view=rev
Author: labviewer
Date: 2010-06-16 08:51:07 +0000 (Wed, 16 Jun 2010)
Log Message:
-----------
Incorporated zlib 1.2.5 and minizip 1.1
Modified Paths:
--------------
trunk/lvzip/c_source/unzip.c
trunk/lvzip/c_source/zip.c
Modified: trunk/lvzip/c_source/unzip.c
===================================================================
--- trunk/lvzip/c_source/unzip.c 2010-06-16 08:46:07 UTC (rev 1042)
+++ trunk/lvzip/c_source/unzip.c 2010-06-16 08:51:07 UTC (rev 1043)
@@ -72,6 +72,7 @@
#define NOUNCRYPT
#endif
+#define ZLIB_INTERNAL
#include "zlib.h"
#include "unzip.h"
Modified: trunk/lvzip/c_source/zip.c
===================================================================
--- trunk/lvzip/c_source/zip.c 2010-06-16 08:46:07 UTC (rev 1042)
+++ trunk/lvzip/c_source/zip.c 2010-06-16 08:51:07 UTC (rev 1043)
@@ -22,6 +22,7 @@
*/
+#define ZLIB_INTERNAL
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2010-06-16 08:55:42
|
Revision: 1044
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1044&view=rev
Author: labviewer
Date: 2010-06-16 08:55:35 +0000 (Wed, 16 Jun 2010)
Log Message:
-----------
Incorporated zlib 1.2.5 and minizip 1.1
Modified Paths:
--------------
trunk/lvzip/c_source/zlib.rc
trunk/lvzip/c_source/zlibvc.dsp
Modified: trunk/lvzip/c_source/zlib.rc
===================================================================
--- trunk/lvzip/c_source/zlib.rc 2010-06-16 08:51:07 UTC (rev 1043)
+++ trunk/lvzip/c_source/zlib.rc 2010-06-16 08:55:35 UTC (rev 1044)
@@ -2,8 +2,8 @@
#define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
- FILEVERSION 2,5,2
- PRODUCTVERSION 2,5,2
+ FILEVERSION 2,6,1
+ PRODUCTVERSION 2,6,1
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32
@@ -17,7 +17,7 @@
BEGIN
VALUE "FileDescription", "LabVIEW zlib data compression library\0"
- VALUE "FileVersion", "2.5.2.LV6\0"
+ VALUE "FileVersion", "2.6.1.LV6\0"
VALUE "InternalName", "lvzlib\0"
VALUE "OriginalFilename", "lvzlib.dll\0"
VALUE "ProductName", "LVZLib.DLL\0"
Modified: trunk/lvzip/c_source/zlibvc.dsp
===================================================================
--- trunk/lvzip/c_source/zlibvc.dsp 2010-06-16 08:51:07 UTC (rev 1043)
+++ trunk/lvzip/c_source/zlibvc.dsp 2010-06-16 08:55:35 UTC (rev 1044)
@@ -352,29 +352,6 @@
# End Source File
# Begin Source File
-SOURCE=.\zlibvc.def
-
-!IF "$(CFG)" == "zlibvc - Win32 DLL Release"
-
-# PROP Exclude_From_Build 1
-
-!ELSEIF "$(CFG)" == "zlibvc - Win32 DLL Debug"
-
-!ELSEIF "$(CFG)" == "zlibvc - Win32 DLL ASM Release"
-
-!ELSEIF "$(CFG)" == "zlibvc - Win32 DLL ASM Debug"
-
-!ELSEIF "$(CFG)" == "zlibvc - Win32 DLL ASM Obj Release"
-
-!ELSEIF "$(CFG)" == "zlibvc - Win32 static ASM Release"
-
-!ELSEIF "$(CFG)" == "zlibvc - Win32 static Release"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
SOURCE=.\zutil.c
# End Source File
# End Group
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2010-06-16 15:05:08
|
Revision: 1048
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1048&view=rev
Author: labviewer
Date: 2010-06-16 15:04:59 +0000 (Wed, 16 Jun 2010)
Log Message:
-----------
Incorporated zlib 1.2.5 and minizip 1.1
Modified Paths:
--------------
trunk/lvzip/c_source/compress.c
trunk/lvzip/c_source/iomem.c
trunk/lvzip/c_source/lvutil.h
trunk/lvzip/c_source/zutil.c
Modified: trunk/lvzip/c_source/compress.c
===================================================================
--- trunk/lvzip/c_source/compress.c 2010-06-16 15:04:19 UTC (rev 1047)
+++ trunk/lvzip/c_source/compress.c 2010-06-16 15:04:59 UTC (rev 1048)
@@ -5,8 +5,7 @@
/* @(#) $Id$ */
-#define ZLIB_INTERNAL
-#include "zlib.h"
+#include "zutil.h"
/* ===========================================================================
Compresses the source buffer into the destination buffer. The level
Modified: trunk/lvzip/c_source/iomem.c
===================================================================
--- trunk/lvzip/c_source/iomem.c 2010-06-16 15:04:19 UTC (rev 1047)
+++ trunk/lvzip/c_source/iomem.c 2010-06-16 15:04:59 UTC (rev 1048)
@@ -11,7 +11,7 @@
voidpf ZCALLBACK mem_open_file_func OF((
voidpf opaque,
- const char* filename,
+ const void* filename,
int mode));
uLong ZCALLBACK mem_read_file_func OF((
@@ -54,7 +54,7 @@
voidpf ZCALLBACK mem_open_file_func (opaque, filename, mode)
voidpf opaque;
- const char* filename;
+ const void* filename;
int mode;
{
MEMORY_IO *memio = malloc(sizeof(MEMORY_IO));
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2010-06-16 15:04:19 UTC (rev 1047)
+++ trunk/lvzip/c_source/lvutil.h 2010-06-16 15:04:59 UTC (rev 1048)
@@ -7,7 +7,6 @@
#ifndef _lvUtil_H
#define _lvUtil_H
-#define ZLIB_INTERNAL
#include "zlib.h"
#ifdef __cplusplus
Modified: trunk/lvzip/c_source/zutil.c
===================================================================
--- trunk/lvzip/c_source/zutil.c 2010-06-16 15:04:19 UTC (rev 1047)
+++ trunk/lvzip/c_source/zutil.c 2010-06-16 15:04:59 UTC (rev 1048)
@@ -5,7 +5,6 @@
/* @(#) $Id$ */
-#define ZLIB_INTERNAL
#include "zutil.h"
#ifndef NO_DUMMY_DECL
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2010-06-16 20:56:51
|
Revision: 1051
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1051&view=rev
Author: labviewer
Date: 2010-06-16 20:56:45 +0000 (Wed, 16 Jun 2010)
Log Message:
-----------
Added Paths:
-----------
trunk/lvzip/c_source/iowin.c
trunk/lvzip/c_source/iowin.h
Added: trunk/lvzip/c_source/iowin.c
===================================================================
--- trunk/lvzip/c_source/iowin.c (rev 0)
+++ trunk/lvzip/c_source/iowin.c 2010-06-16 20:56:45 UTC (rev 1051)
@@ -0,0 +1,389 @@
+/* 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 )
+
+ Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+ Modifications for Zip64 support
+ Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+ For more info read MiniZip_info.txt
+
+*/
+
+#include <stdlib.h>
+
+#include "zlib.h"
+#include "ioapi.h"
+#include "iowin.h"
+
+#ifndef INVALID_HANDLE_VALUE
+#define INVALID_HANDLE_VALUE (0xFFFFFFFF)
+#endif
+
+#ifndef INVALID_SET_FILE_POINTER
+#define INVALID_SET_FILE_POINTER ((DWORD)-1)
+#endif
+
+voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode));
+uLong ZCALLBACK win32_read_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size));
+uLong ZCALLBACK win32_write_file_func OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
+ZPOS64_T ZCALLBACK win32_tell64_file_func OF((voidpf opaque, voidpf stream));
+long ZCALLBACK win32_seek64_file_func OF((voidpf opaque, voidpf stream, ZPOS64_T offset, int origin));
+int ZCALLBACK win32_close_file_func OF((voidpf opaque, voidpf stream,voidpf output));
+int ZCALLBACK win32_error_file_func OF((voidpf opaque, voidpf stream));
+
+typedef struct
+{
+ HANDLE hf;
+ int error;
+} WIN32FILE_IOWIN;
+
+
+static void win32_translate_open_mode(int mode,
+ DWORD* lpdwDesiredAccess,
+ DWORD* lpdwCreationDisposition,
+ DWORD* lpdwShareMode,
+ DWORD* lpdwFlagsAndAttributes)
+{
+ *lpdwDesiredAccess = *lpdwShareMode = *lpdwFlagsAndAttributes = *lpdwCreationDisposition = 0;
+
+ if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
+ {
+ *lpdwDesiredAccess = GENERIC_READ;
+ *lpdwCreationDisposition = OPEN_EXISTING;
+ *lpdwShareMode = FILE_SHARE_READ;
+ }
+ else if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
+ {
+ *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
+ *lpdwCreationDisposition = OPEN_EXISTING;
+ }
+ else if (mode & ZLIB_FILEFUNC_MODE_CREATE)
+ {
+ *lpdwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
+ *lpdwCreationDisposition = CREATE_ALWAYS;
+ }
+}
+
+static voidpf win32_build_iowin(HANDLE hFile)
+{
+ voidpf ret=NULL;
+
+ if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
+ {
+ WIN32FILE_IOWIN w32fiow;
+ w32fiow.hf = hFile;
+ w32fiow.error = 0;
+ ret = malloc(sizeof(WIN32FILE_IOWIN));
+
+ if (ret==NULL)
+ CloseHandle(hFile);
+ else
+ *((WIN32FILE_IOWIN*)ret) = w32fiow;
+ }
+ return ret;
+}
+
+voidpf ZCALLBACK win32_open64_file_func (voidpf opaque,const void* filename,int mode)
+{
+ const char* mode_fopen = NULL;
+ DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
+ HANDLE hFile = NULL;
+
+ win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
+
+ if ((filename!=NULL) && (dwDesiredAccess != 0))
+ hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
+
+ return win32_build_iowin(hFile);
+}
+
+
+voidpf ZCALLBACK win32_open64_file_funcA (voidpf opaque,const void* filename,int mode)
+{
+ const char* mode_fopen = NULL;
+ DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
+ HANDLE hFile = NULL;
+
+ win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
+
+ if ((filename!=NULL) && (dwDesiredAccess != 0))
+ hFile = CreateFileA((LPCSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
+
+ return win32_build_iowin(hFile);
+}
+
+
+voidpf ZCALLBACK win32_open64_file_funcW (voidpf opaque,const void* filename,int mode)
+{
+ const char* mode_fopen = NULL;
+ DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
+ HANDLE hFile = NULL;
+
+ win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
+
+ if ((filename!=NULL) && (dwDesiredAccess != 0))
+ hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
+
+ return win32_build_iowin(hFile);
+}
+
+
+voidpf ZCALLBACK win32_open_file_func (voidpf opaque,const char* filename,int mode)
+{
+ const char* mode_fopen = NULL;
+ DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
+ HANDLE hFile = NULL;
+
+ win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
+
+ if ((filename!=NULL) && (dwDesiredAccess != 0))
+ hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
+
+ return win32_build_iowin(hFile);
+}
+
+
+uLong ZCALLBACK win32_read_file_func (voidpf opaque, voidpf stream, void* buf,uLong size)
+{
+ uLong ret=0;
+ HANDLE hFile = NULL;
+ if (stream!=NULL)
+ hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
+
+ if (hFile != NULL)
+ {
+ if (!ReadFile(hFile, buf, size, &ret, NULL))
+ {
+ DWORD dwErr = GetLastError();
+ if (dwErr == ERROR_HANDLE_EOF)
+ dwErr = 0;
+ ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+ }
+ }
+
+ return ret;
+}
+
+
+uLong ZCALLBACK win32_write_file_func (voidpf opaque,voidpf stream,const void* buf,uLong size)
+{
+ uLong ret=0;
+ HANDLE hFile = NULL;
+ if (stream!=NULL)
+ hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
+
+ if (hFile != NULL)
+ {
+ if (!WriteFile(hFile, buf, size, &ret, NULL))
+ {
+ DWORD dwErr = GetLastError();
+ if (dwErr == ERROR_HANDLE_EOF)
+ dwErr = 0;
+ ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+ }
+ }
+
+ return ret;
+}
+
+long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream)
+{
+ long ret=-1;
+ HANDLE hFile = NULL;
+ if (stream!=NULL)
+ hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
+ if (hFile != NULL)
+ {
+ DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT);
+ if (dwSet == INVALID_SET_FILE_POINTER)
+ {
+ DWORD dwErr = GetLastError();
+ ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+ ret = -1;
+ }
+ else
+ ret=(long)dwSet;
+ }
+ return ret;
+}
+
+ZPOS64_T ZCALLBACK win32_tell64_file_func (voidpf opaque, voidpf stream)
+{
+ ZPOS64_T ret= (ZPOS64_T)-1;
+ HANDLE hFile = NULL;
+ if (stream!=NULL)
+ hFile = ((WIN32FILE_IOWIN*)stream)->hf;
+
+ if (hFile)
+ {
+ LARGE_INTEGER li;
+ li.QuadPart = 0;
+ li.u.LowPart = SetFilePointer(hFile, li.u.LowPart, &li.u.HighPart, FILE_CURRENT);
+ if ( (li.LowPart == 0xFFFFFFFF) && (GetLastError() != NO_ERROR))
+ {
+ DWORD dwErr = GetLastError();
+ ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+ ret = (ZPOS64_T)-1;
+ }
+ else
+ ret=li.QuadPart;
+ }
+ return ret;
+}
+
+
+long ZCALLBACK win32_seek_file_func (voidpf opaque,voidpf stream,uLong offset,int origin)
+{
+ DWORD dwMoveMethod=0xFFFFFFFF;
+ HANDLE hFile = NULL;
+
+ long ret=-1;
+ if (stream!=NULL)
+ hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
+ switch (origin)
+ {
+ case ZLIB_FILEFUNC_SEEK_CUR :
+ dwMoveMethod = FILE_CURRENT;
+ break;
+ case ZLIB_FILEFUNC_SEEK_END :
+ dwMoveMethod = FILE_END;
+ break;
+ case ZLIB_FILEFUNC_SEEK_SET :
+ dwMoveMethod = FILE_BEGIN;
+ break;
+ default: return -1;
+ }
+
+ if (hFile != NULL)
+ {
+ DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod);
+ if (dwSet == INVALID_SET_FILE_POINTER)
+ {
+ DWORD dwErr = GetLastError();
+ ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+ ret = -1;
+ }
+ else
+ ret=0;
+ }
+ return ret;
+}
+
+long ZCALLBACK win32_seek64_file_func (voidpf opaque, voidpf stream,ZPOS64_T offset,int origin)
+{
+ DWORD dwMoveMethod=0xFFFFFFFF;
+ HANDLE hFile = NULL;
+ long ret=-1;
+
+ if (stream!=NULL)
+ hFile = ((WIN32FILE_IOWIN*)stream)->hf;
+
+ switch (origin)
+ {
+ case ZLIB_FILEFUNC_SEEK_CUR :
+ dwMoveMethod = FILE_CURRENT;
+ break;
+ case ZLIB_FILEFUNC_SEEK_END :
+ dwMoveMethod = FILE_END;
+ break;
+ case ZLIB_FILEFUNC_SEEK_SET :
+ dwMoveMethod = FILE_BEGIN;
+ break;
+ default: return -1;
+ }
+
+ if (hFile)
+ {
+ LARGE_INTEGER* li = (LARGE_INTEGER*)&offset;
+ DWORD dwSet = SetFilePointer(hFile, li->u.LowPart, &li->u.HighPart, dwMoveMethod);
+ if (dwSet == INVALID_SET_FILE_POINTER)
+ {
+ DWORD dwErr = GetLastError();
+ ((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
+ ret = -1;
+ }
+ else
+ ret=0;
+ }
+ return ret;
+}
+
+int ZCALLBACK win32_close_file_func (voidpf opaque, voidpf stream, voidpf output)
+{
+ int ret=-1;
+
+ if (stream!=NULL)
+ {
+ HANDLE hFile;
+ hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
+ if (hFile != NULL)
+ {
+ CloseHandle(hFile);
+ ret=0;
+ }
+ free(stream);
+ }
+ return ret;
+}
+
+int ZCALLBACK win32_error_file_func (voidpf opaque,voidpf stream)
+{
+ int ret=-1;
+ if (stream!=NULL)
+ {
+ ret = ((WIN32FILE_IOWIN*)stream) -> error;
+ }
+ return ret;
+}
+
+void fill_win32_filefunc (zlib_filefunc_def* pzlib_filefunc_def)
+{
+ pzlib_filefunc_def->zopen_file = win32_open_file_func;
+ pzlib_filefunc_def->zread_file = win32_read_file_func;
+ pzlib_filefunc_def->zwrite_file = win32_write_file_func;
+ pzlib_filefunc_def->ztell_file = win32_tell_file_func;
+ pzlib_filefunc_def->zseek_file = win32_seek_file_func;
+ pzlib_filefunc_def->zclose_file = win32_close_file_func;
+ pzlib_filefunc_def->zerror_file = win32_error_file_func;
+ pzlib_filefunc_def->opaque = NULL;
+}
+
+void fill_win32_filefunc64(zlib_filefunc64_def* pzlib_filefunc_def)
+{
+ pzlib_filefunc_def->zopen64_file = win32_open64_file_func;
+ pzlib_filefunc_def->zread_file = win32_read_file_func;
+ pzlib_filefunc_def->zwrite_file = win32_write_file_func;
+ pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
+ pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
+ pzlib_filefunc_def->zclose_file = win32_close_file_func;
+ pzlib_filefunc_def->zerror_file = win32_error_file_func;
+ pzlib_filefunc_def->opaque = NULL;
+}
+
+
+void fill_win32_filefunc64A(zlib_filefunc64_def* pzlib_filefunc_def)
+{
+ pzlib_filefunc_def->zopen64_file = win32_open64_file_funcA;
+ pzlib_filefunc_def->zread_file = win32_read_file_func;
+ pzlib_filefunc_def->zwrite_file = win32_write_file_func;
+ pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
+ pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
+ pzlib_filefunc_def->zclose_file = win32_close_file_func;
+ pzlib_filefunc_def->zerror_file = win32_error_file_func;
+ pzlib_filefunc_def->opaque = NULL;
+}
+
+
+void fill_win32_filefunc64W(zlib_filefunc64_def* pzlib_filefunc_def)
+{
+ pzlib_filefunc_def->zopen64_file = win32_open64_file_funcW;
+ pzlib_filefunc_def->zread_file = win32_read_file_func;
+ pzlib_filefunc_def->zwrite_file = win32_write_file_func;
+ pzlib_filefunc_def->ztell64_file = win32_tell64_file_func;
+ pzlib_filefunc_def->zseek64_file = win32_seek64_file_func;
+ pzlib_filefunc_def->zclose_file = win32_close_file_func;
+ pzlib_filefunc_def->zerror_file = win32_error_file_func;
+ pzlib_filefunc_def->opaque = NULL;
+}
Added: trunk/lvzip/c_source/iowin.h
===================================================================
--- trunk/lvzip/c_source/iowin.h (rev 0)
+++ trunk/lvzip/c_source/iowin.h 2010-06-16 20:56:45 UTC (rev 1051)
@@ -0,0 +1,28 @@
+/* iowin32.h -- 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 )
+
+ Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html )
+
+ Modifications for Zip64 support
+ Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
+
+ For more info read MiniZip_info.txt
+
+*/
+
+#include <windows.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
+void fill_win32_filefunc64 OF((zlib_filefunc64_def* pzlib_filefunc_def));
+void fill_win32_filefunc64A OF((zlib_filefunc64_def* pzlib_filefunc_def));
+void fill_win32_filefunc64W OF((zlib_filefunc64_def* pzlib_filefunc_def));
+
+#ifdef __cplusplus
+}
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2011-04-12 11:41:05
|
Revision: 1356
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1356&view=rev
Author: labviewer
Date: 2011-04-12 11:40:59 +0000 (Tue, 12 Apr 2011)
Log Message:
-----------
Removed some depreciated Carbon function calls for OSX
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 2011-04-11 19:35:44 UTC (rev 1355)
+++ trunk/lvzip/c_source/lvutil.c 2011-04-12 11:40:59 UTC (rev 1356)
@@ -797,7 +797,6 @@
int32 count = 0;
#if MacOS
FSSpec fss;
- DTPBRec dtpb;
CInfoPBRec cpb;
#elif Win32
LStrPtr lstr;
@@ -830,17 +829,27 @@
if (!err)
{
- dtpb.ioCompletion = nil;
- dtpb.ioNamePtr = NULL;
+ #if !MacOSX
+ DTPBRec dtpb;
+
+ memset(&dtpb, 0, sizeof(DTPBRec));
dtpb.ioVRefNum = fss.vRefNum;
-
err = OSErrToLVErr(PBDTGetPath(&dtpb));
if (err)
+ {
+ dtpb.ioNamePtr = nil;
DEBUGPRINTF(("PBGetPath: err = %ld", err));
+ /* Ignore error for getting/setting Desktop comments */
+ err = mgNoErr;
+ }
+ else
+ {
+ dtpb.ioNamePtr = fss.name;
+ dtpb.ioDirID = fss.parID;
+ }
+ #endif
if (!err)
{
- dtpb.ioNamePtr = fss.name;
- dtpb.ioDirID = fss.parID;
*isDirectory = (MacIsDir(cpb) != 0);
if (write)
@@ -872,13 +881,15 @@
err = OSErrToLVErr(PBSetCatInfoSync(&cpb));
if (err)
DEBUGPRINTF(("PBSetCatInfo: err = %ld", err));
- if (!err && comment)
+ #if !MacOSX
+ if (!err && comment && dtpb.ioNamePtr)
{
dtpb.ioDTBuffer = LStrBuf(*comment);
dtpb.ioDTReqCount = LStrLen(*comment);
- /* Ignore error for setting Desktop comments as this is not supported on OSX */
+ /* Ignore error for setting Desktop comments */
PBDTSetCommentSync(&dtpb);
}
+ #endif
}
else
{
@@ -913,7 +924,8 @@
MacConvertToLVTime(cpb.hFileInfo.ioFlMdDat, &fileInfo->mDate);
}
- if (comment)
+ #if !MacOSX
+ if (comment && dtpb.ioNamePtr)
{
err = DSSetHandleSize((UHandle)comment, 255);
if (!err)
@@ -923,10 +935,11 @@
dtpb.ioDTActCount = 0;
err = OSErrToLVErr(PBDTGetCommentSync(&dtpb));
LStrLen(*comment) = err ? 0 : dtpb.ioDTActCount;
- /* Ignore error for getting Desktop comments as this is not supported on OSX */
+ /* Ignore error for getting Desktop comments */
err = mgNoErr;
}
}
+ #endif
}
}
}
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2011-04-11 19:35:44 UTC (rev 1355)
+++ trunk/lvzip/c_source/lvutil.h 2011-04-12 11:40:59 UTC (rev 1356)
@@ -15,7 +15,7 @@
#if defined(macintosh) || defined(__PPCC__) || defined(THINK_C) || defined(__SC__) || defined(__MWERKS__) || defined(__APPLE_CC__)
#define MacOS 1
- #ifdef __MACH__
+ #ifdef TARGET_API_MAC_CARBON
#define MacOSX 1
#endif
#if defined(__i386__)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2011-06-27 13:12:46
|
Revision: 1387
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1387&view=rev
Author: labviewer
Date: 2011-06-27 13:12:35 +0000 (Mon, 27 Jun 2011)
Log Message:
-----------
Fix some 64 bit troubles not yet in zlib 1.2.5
Modified Paths:
--------------
trunk/lvzip/c_source/zconf.h
trunk/lvzip/c_source/zlib.h
Modified: trunk/lvzip/c_source/zconf.h
===================================================================
--- trunk/lvzip/c_source/zconf.h 2011-05-18 12:24:37 UTC (rev 1386)
+++ trunk/lvzip/c_source/zconf.h 2011-06-27 13:12:35 UTC (rev 1387)
@@ -375,7 +375,11 @@
# undef _LARGEFILE64_SOURCE
#endif
-#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+# define Z_LARGE
+#endif
+
+#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* for off_t */
Modified: trunk/lvzip/c_source/zlib.h
===================================================================
--- trunk/lvzip/c_source/zlib.h 2011-05-18 12:24:37 UTC (rev 1386)
+++ trunk/lvzip/c_source/zlib.h 2011-06-27 13:12:35 UTC (rev 1387)
@@ -1573,13 +1573,22 @@
#endif
#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
-# define gzopen gzopen64
-# define gzseek gzseek64
-# define gztell gztell64
-# define gzoffset gzoffset64
-# define adler32_combine adler32_combine64
-# define crc32_combine crc32_combine64
-# ifdef _LARGEFILE64_SOURCE
+# ifdef Z_PREFIX_SET
+# define z_gzopen z_gzopen64
+# define z_gzseek z_gzseek64
+# define z_gztell z_gztell64
+# define z_gzoffset z_gzoffset64
+# define z_adler32_combine z_adler32_combine64
+# define z_crc32_combine z_crc32_combine64
+# else
+# define gzopen gzopen64
+# define gzseek gzseek64
+# define gztell gztell64
+# define gzoffset gzoffset64
+# define adler32_combine adler32_combine64
+# define crc32_combine crc32_combine64
+# endif
+# ifndef _LARGEFILE64_SOURCE
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2011-07-26 21:08:10
|
Revision: 1389
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1389&view=rev
Author: labviewer
Date: 2011-07-26 21:08:04 +0000 (Tue, 26 Jul 2011)
Log Message:
-----------
add mztools.c to the list of compiled modules
Modified Paths:
--------------
trunk/lvzip/c_source/Makefile
trunk/lvzip/c_source/Makefile.vxworks
Modified: trunk/lvzip/c_source/Makefile
===================================================================
--- trunk/lvzip/c_source/Makefile 2011-07-26 21:05:33 UTC (rev 1388)
+++ trunk/lvzip/c_source/Makefile 2011-07-26 21:08:04 UTC (rev 1389)
@@ -47,7 +47,7 @@
OBJS = adler32.o compress.o crc32.o uncompr.o deflate.o trees.o \
zutil.o inflate.o infback.o inftrees.o inffast.o \
- ioapi.o iomem.o lvutil.o zip.o unzip.o
+ ioapi.o iomem.o lvutil.o mztools.o zip.o unzip.o
OBJA =
# to use the asm code: make OBJA=match.o
Modified: trunk/lvzip/c_source/Makefile.vxworks
===================================================================
--- trunk/lvzip/c_source/Makefile.vxworks 2011-07-26 21:05:33 UTC (rev 1388)
+++ trunk/lvzip/c_source/Makefile.vxworks 2011-07-26 21:08:04 UTC (rev 1389)
@@ -20,8 +20,8 @@
# compile it.
OBJECTS := $(OBJ_DIR)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/uncompr.o $(OBJ_DIR)/deflate.o \
$(OBJ_DIR)/trees.o $(OBJ_DIR)/zutil.o $(OBJ_DIR)/inflate.o $(OBJ_DIR)/infback.o $(OBJ_DIR)/inftrees.o \
- $(OBJ_DIR)/inffast.o $(OBJ_DIR)/ioapi.o $(OBJ_DIR)/iomem.o $(OBJ_DIR)/lvutil.o $(OBJ_DIR)/zip.o \
- $(OBJ_DIR)/unzip.o
+ $(OBJ_DIR)/inffast.o $(OBJ_DIR)/ioapi.o $(OBJ_DIR)/iomem.o $(OBJ_DIR)/lvutil.o $(OBJ_DIR)/mztools.o \
+ $(OBJ_DIR)/zip.o $(OBJ_DIR)/unzip.o
# This is the name of the output shared library.
PROJECT_TARGETS := $(OBJ_DIR)/lvzlib.out
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2012-07-23 21:26:23
|
Revision: 1484
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1484&view=rev
Author: labviewer
Date: 2012-07-23 21:26:16 +0000 (Mon, 23 Jul 2012)
Log Message:
-----------
Modify 64 Bit support
Modified Paths:
--------------
trunk/lvzip/c_source/Makefile
trunk/lvzip/c_source/Makefile.in
trunk/lvzip/c_source/Makefile.vxworks
trunk/lvzip/c_source/Makefile.x64
trunk/lvzip/c_source/lvutil.c
trunk/lvzip/c_source/lvutil.h
trunk/lvzip/c_source/zalias.h
trunk/lvzip/c_source/zip.h
trunk/lvzip/c_source/zlibvc.vcproj
Added Paths:
-----------
trunk/lvzip/c_source/lvapi.c
Modified: trunk/lvzip/c_source/Makefile
===================================================================
--- trunk/lvzip/c_source/Makefile 2012-07-23 21:23:01 UTC (rev 1483)
+++ trunk/lvzip/c_source/Makefile 2012-07-23 21:26:16 UTC (rev 1484)
@@ -25,7 +25,7 @@
# -Wstrict-prototypes -Wmissing-prototypes
CINDIR=/usr/local/lv70/cintools
-SFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -L$(CINDIR)
+SFLAGS=-O3 -fPIC -fvisibility=hidden -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -L$(CINDIR)
LDFLAGS=
TEST_LDFLAGS=-L. libz.a
LDSHARED=gcc
@@ -57,12 +57,12 @@
OBJZ = adler32.o crc32.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 = unzip.o zip.o lvutil.o ioapi.o iomem.o mztools.o
+OBJL = lvutil.o ioapi.o iomem.o mztools.o unzip.o zip.o
OBJC = $(OBJZ) $(OBJL) $(OBJG)
PIC_OBJZ = adler32.lo crc32.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 = unzip.lo zip.lo lvutil.lo ioapi.lo iomem.lo mztools.lo
+PIC_OBJL = lvapi.lo lvutil.lo ioapi.lo iomem.lo mztools.lo unzip.lo zip.lo
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJL) $(PIC_OBJG)
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
Modified: trunk/lvzip/c_source/Makefile.in
===================================================================
--- trunk/lvzip/c_source/Makefile.in 2012-07-23 21:23:01 UTC (rev 1483)
+++ trunk/lvzip/c_source/Makefile.in 2012-07-23 21:26:16 UTC (rev 1484)
@@ -58,13 +58,13 @@
OBJZ = adler32.o crc32.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
+OBJL = lvapi.o lvutil.o ioapi.o iomem.o mztools.o
OBJC = $(OBJZ) $(OBJL) $(OBJG)
PIC_OBJZ = adler32.lo crc32.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_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
-PIC_OBJL = lvutil.lo ioapi.lo iomem.lo mztools.lo
+PIC_OBJL = lvapi.lo lvutil.lo ioapi.lo iomem.lo mztools.lo
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJL) $(PIC_OBJG)
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
Modified: trunk/lvzip/c_source/Makefile.vxworks
===================================================================
--- trunk/lvzip/c_source/Makefile.vxworks 2012-07-23 21:23:01 UTC (rev 1483)
+++ trunk/lvzip/c_source/Makefile.vxworks 2012-07-23 21:26:16 UTC (rev 1484)
@@ -18,10 +18,11 @@
# List all the *compiled* object files here, under the OBJ_DIR
# directory. Make will automatically locate the source file and
# compile it.
-OBJECTS := $(OBJ_DIR)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/uncompr.o $(OBJ_DIR)/deflate.o \
- $(OBJ_DIR)/trees.o $(OBJ_DIR)/zutil.o $(OBJ_DIR)/inflate.o $(OBJ_DIR)/infback.o $(OBJ_DIR)/inftrees.o \
- $(OBJ_DIR)/inffast.o $(OBJ_DIR)/ioapi.o $(OBJ_DIR)/iomem.o $(OBJ_DIR)/lvutil.o $(OBJ_DIR)/mztools.o \
- $(OBJ_DIR)/zip.o $(OBJ_DIR)/unzip.o
+OBJECTS := $(OBJ_DIR)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/deflate.o \
+ $(OBJ_DIR)\gzclose.o $(OBJ_DIR)\gzlib.o $(OBJ_DIR)\gzread.o $(OBJ_DIR)\gzwrite.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)/unzip.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/zutil.o
# This is the name of the output shared library.
PROJECT_TARGETS := $(OBJ_DIR)/lvzlib.out
Modified: trunk/lvzip/c_source/Makefile.x64
===================================================================
--- trunk/lvzip/c_source/Makefile.x64 2012-07-23 21:23:01 UTC (rev 1483)
+++ trunk/lvzip/c_source/Makefile.x64 2012-07-23 21:26:16 UTC (rev 1484)
@@ -13,40 +13,50 @@
SOURCES=adler32.c \
compress.c \
crc32.c \
- uncompr.c \
deflate.c \
- trees.c \
- zutil.c \
+ gzclose.c \
+ gzlib.c \
+ gzread.c \
+ gzwrite.c \
+ infback.c \
+ inffast.c \
inflate.c \
- infback.c \
inftrees.c \
- inffast.c \
ioapi.c \
iowin.c \
iomem.c \
+ lvapi.c \
lvutil.c \
mztools.c \
+ trees.c \
+ uncompr.c \
+ unzip.c \
zip.c \
- unzip.c
-
+ zutil.c
+
OBJS=$(OUTDIR)\adler32.obj \
$(OUTDIR)\compress.obj \
$(OUTDIR)\crc32.obj \
- $(OUTDIR)\uncompr.obj \
$(OUTDIR)\deflate.obj \
- $(OUTDIR)\trees.obj \
- $(OUTDIR)\zutil.obj \
+ $(OUTDIR)\gzclose.obj \
+ $(OUTDIR)\gzlib.obj \
+ $(OUTDIR)\gzread.obj \
+ $(OUTDIR)\gzwrite.obj \
+ $(OUTDIR)\infback.obj \
+ $(OUTDIR)\inffast.obj \
$(OUTDIR)\inflate.obj \
- $(OUTDIR)\infback.obj \
$(OUTDIR)\inftrees.obj \
- $(OUTDIR)\inffast.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)\unzip.obj
+ $(OUTDIR)\zutil.obj
ELIBS=user32.lib kernel32.lib labview.lib
Added: trunk/lvzip/c_source/lvapi.c
===================================================================
--- trunk/lvzip/c_source/lvapi.c (rev 0)
+++ trunk/lvzip/c_source/lvapi.c 2012-07-23 21:26:16 UTC (rev 1484)
@@ -0,0 +1,200 @@
+#define ZLIB_INTERNAL
+#include "zlib.h"
+#include "lvutil.h"
+#include "zip.h"
+#include "unzip.h"
+
+#ifndef VERSIONMADEBY
+# define VERSIONMADEBY (0x0) /* platform depedent */
+#endif
+
+LibAPI(const char *) lvzlib_zlibVersion(void)
+{
+ return zlibVersion();
+}
+
+LibAPI(int) lvzlib_compress(Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen, int level)
+{
+ return compress2(dest, destLen, source, sourceLen, level);
+}
+
+LibAPI(int) lvzlib_uncompress(Bytef *dest, uLongf *destLen,
+ const Bytef *source, uLong sourceLen)
+{
+ return uncompress(dest, destLen, source, sourceLen);
+}
+
+LibAPI(uInt32) lvzlib_crc32(uInt32 crc, const Bytef *buf, uInt32 len)
+{
+ return crc32(crc, buf, len);
+}
+
+LibAPI(int) lvzlib__openDummy(LStrHandle *name, UPtr *node)
+{
+ Unused(name);
+ *node = NULL;
+ return mgNotSupported;
+}
+
+LibAPI(int) lvzlib_noProp(UPtr node, uInt32 attr, UPtr data)
+{
+ Unused(node);
+ Unused(attr);
+ Unused(data);
+ return mgNotSupported;
+}
+
+LibAPI(int) lvzlib_zipCleanup(zipFile node)
+{
+ return zipClose2(node, NULL, NULL);
+}
+
+LibAPI(int) lvzlib_unzipCleanup(unzFile node)
+{
+ return unzClose(node);
+}
+
+LibAPI(int) lvzlib_zipOpen(const void *pathname, int append, LStrHandle *globalcomment,
+ zlib_filefunc64_def* pzlib_filefunc_def, zipFile *file)
+{
+ zipcharpc comment;
+ *file = zipOpen2_64(pathname, append, &comment, pzlib_filefunc_def);
+ if (*file)
+ {
+ if (comment)
+ {
+ size_t len = strlen(comment);
+ MgErr err = NumericArrayResize(uB, 1, (UHandle*)globalcomment, len);
+ if (!err)
+ {
+ MoveBlock(comment, LStrBuf(**globalcomment), len);
+ LStrLen(**globalcomment) = (int32)len;
+ }
+ }
+ return Z_OK;
+ }
+ return Z_ERRNO;
+}
+
+LibAPI(int) lvzlib_zipOpenNewFileInZip(zipFile *file, const char* filename,
+ const zip_fileinfo* zipfi, const void* extrafield_local,
+ uInt size_extrafield_local, const void* extrafield_global,
+ uInt size_extrafield_global, const char* comment, int method,
+ int level, int raw, int windowBits, int memLevel, int strategy,
+ const char* password, uLong crcForCrypting, int zip64)
+{
+ return zipOpenNewFileInZip4_64(*file, filename, zipfi, extrafield_local, size_extrafield_local,
+ extrafield_global, size_extrafield_global, comment, method, level,
+ raw, windowBits, memLevel, strategy, password[0] ? password : NULL,
+ crcForCrypting, VERSIONMADEBY, 0, zip64);
+}
+
+LibAPI(int) lvzlib_zipWriteInFileInZip(zipFile *file, const voidp buf, uInt32 len)
+{
+ return zipWriteInFileInZip(*file, buf, len);
+}
+
+LibAPI(int) lvzlib_zipCloseFileInZipRaw(zipFile *file, uInt32 uncompressedSize, uInt32 crc32)
+{
+ return zipCloseFileInZipRaw64(*file, uncompressedSize, crc32);
+}
+
+LibAPI(int) lvzlib_zipCloseFileInZipRaw64(zipFile *file, uInt64 uncompressedSize, uInt32 crc32)
+{
+ return zipCloseFileInZipRaw64(*file, uncompressedSize, crc32);
+}
+
+LibAPI(int) lvzlib_zipClose(zipFile *file, const char *globalComment, LStrHandle *stream)
+{
+ return zipClose2(*file, globalComment, stream);
+}
+
+LibAPI(int) lvzlib_unzOpen(const void *pathname, zlib_filefunc64_def* pzlib_filefunc_def, unzFile *file)
+{
+ *file = unzOpen2_64(pathname, pzlib_filefunc_def);
+ if (*file)
+ return Z_OK;
+ return Z_ERRNO;
+}
+
+LibAPI(int) lvzlib_unzClose(unzFile *file)
+{
+ return unzClose(*file);
+}
+
+LibAPI(int) lvzlib_unzGetGlobalInfo(unzFile *file, unz_global_info* pglobal_info)
+{
+ return unzGetGlobalInfo(*file, pglobal_info);
+}
+
+LibAPI(int) lvzlib_unzGetGlobalInfo64(unzFile *file, unz_global_info64* pglobal_info)
+{
+ return unzGetGlobalInfo64(*file, pglobal_info);
+}
+
+LibAPI(int) lvzlib_unzGetGlobalComment(unzFile *file, char *szComment, uInt32 len)
+{
+ return unzGetGlobalComment(*file, szComment, len);
+}
+
+LibAPI(int) lvzlib_unzLocateFile(unzFile *file, const char *szFileName, int iCaseSensitivity)
+{
+ return unzLocateFile(*file, szFileName, iCaseSensitivity);
+}
+
+LibAPI(int) lvzlib_unzGetCurrentFileInfoLen(unzFile *file, unz_file_info * pfile_info)
+{
+ return unzGetCurrentFileInfo(*file, pfile_info, NULL, 0, NULL, 0, NULL, 0);
+}
+
+LibAPI(int) lvzlib_unzGetCurrentFileInfo(unzFile *file, unz_file_info * pfile_info,
+ char * szFileName, uInt32 fileNameBufferSize,
+ void *extraField, uInt32 extraFieldBufferSize,
+ char* szComment, uInt32 commentBufferSize)
+{
+ return unzGetCurrentFileInfo(*file, pfile_info, szFileName, fileNameBufferSize,
+ extraField, extraFieldBufferSize, szComment, commentBufferSize);
+}
+
+LibAPI(int) lvzlib_unzOpenCurrentFile(unzFile *file, int32* method, int32* level, int16 raw, const char* password)
+{
+ return unzOpenCurrentFile3(*file, method, level, raw, password[0] ? password : NULL);
+}
+
+LibAPI(int) lvzlib_unzGetLocalExtrafield(unzFile *file, LStrHandle *extra)
+{
+ int len = unzGetLocalExtrafield(*file, NULL, 0);
+ if (len > 0)
+ {
+ MgErr err = NumericArrayResize(uB, 1, (UHandle*)extra, len);
+ if (!err)
+ {
+ LStrLen(**extra) = len;
+ return unzGetLocalExtrafield(*file, LStrBuf(**extra), len);
+ }
+ else
+ len = Z_MEM_ERROR;
+ }
+ return len;
+}
+
+LibAPI(int) lvzlib_unzReadCurrentFile(unzFile *file, voidp buffer, uInt32 size)
+{
+ return unzReadCurrentFile(*file, buffer, size);
+}
+
+LibAPI(int) lvzlib_unzCloseCurrentFile(unzFile *file)
+{
+ return unzCloseCurrentFile(*file);
+}
+
+LibAPI(int) lvzlib_unzGoToFirstFile(unzFile *file)
+{
+ return unzGoToFirstFile(*file);
+}
+
+LibAPI(int) lvzlib_unzGoToNextFile(unzFile *file)
+{
+ return unzGoToNextFile(*file);
+}
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2012-07-23 21:23:01 UTC (rev 1483)
+++ trunk/lvzip/c_source/lvutil.c 2012-07-23 21:26:16 UTC (rev 1484)
@@ -525,12 +525,12 @@
#endif
#endif
-extern void ZEXPORT DLLVersion(uChar* version)
+LibAPI(void) DLLVersion(uChar* version)
{
- sprintf((char*)version, "lvzlib date: %s, time: %s",__DATE__,__TIME__);
+ sprintf((char*)version, "lvzlib V 2.1, date: %s, time: %s",__DATE__,__TIME__);
}
-extern MgErr ZEXPORT LVPath_HasResourceFork(Path path, int32 *hasResFork)
+LibAPI(MgErr) LVPath_HasResourceFork(Path path, int32 *hasResFork)
{
MgErr err = noErr;
#if MacOS
@@ -566,7 +566,7 @@
return err;
}
-extern MgErr ZEXPORT LVPath_EncodeMacbinary(Path srcPath, Path dstPath)
+LibAPI(MgErr) LVPath_EncodeMacbinary(Path srcPath, Path dstPath)
{
#if MacOS
FSSpec srcFSSpec;
@@ -586,7 +586,7 @@
#endif
}
-extern MgErr ZEXPORT LVPath_DecodeMacbinary(Path srcPath, Path dstPath)
+LibAPI(MgErr) LVPath_DecodeMacbinary(Path srcPath, Path dstPath)
{
#if MacOS
FSSpec srcFSSpec;
@@ -606,7 +606,7 @@
#endif
}
-extern MgErr ZEXPORT LVPath_OpenFile(LVRefNum *refnum, Path path, uInt8 rsrc, uInt32 openMode, uInt32 denyMode)
+LibAPI(MgErr) LVPath_OpenFile(LVRefNum *refnum, Path path, uInt8 rsrc, uInt32 openMode, uInt32 denyMode)
{
MgErr err;
int32 type;
@@ -852,7 +852,7 @@
return err;
}
-extern MgErr ZEXPORT LVPath_UtilFileInfo(Path path,
+LibAPI(MgErr) LVPath_UtilFileInfo(Path path,
uInt8 write,
uInt8 *isDirectory,
LVFileInfo *fileInfo,
@@ -1157,31 +1157,36 @@
return err;
}
-extern long ZEXPORT InitializeFileFuncs (zlib_filefunc64_def* pzlib_filefunc_def, LStrHandle *memory)
+LibAPI(MgErr) InitializeFileFuncs(LStrHandle filefunc_def)
{
- DoDebugger();
-
- if (pzlib_filefunc_def)
- {
- if (memory)
- {
- fill_mem_filefunc(pzlib_filefunc_def, memory);
- }
- else
- {
+ MgErr err = NumericArrayResize(uB, 1, (UHandle*)&filefunc_def, sizeof(zlib_filefunc64_def));
+ if (!err)
+ {
+ zlib_filefunc64_def* pzlib_filefunc_def = (zlib_filefunc64_def*)LStrBuf(*filefunc_def);
+ LStrLen(*filefunc_def) = sizeof(zlib_filefunc64_def);
#if Win32
fill_win32_filefunc64A(pzlib_filefunc_def);
#else
fill_fopen64_filefunc(pzlib_filefunc_def);
#endif
- }
- return mgNoErr;
+ }
+ return err;
+}
+
+LibAPI(MgErr) InitializeStreamFuncs(LStrHandle filefunc_def, LStrHandle *memory)
+{
+ MgErr err = NumericArrayResize(uB, 1, (UHandle*)&filefunc_def, sizeof(zlib_filefunc64_def));
+ if (!err)
+ {
+ zlib_filefunc64_def* pzlib_filefunc_def = (zlib_filefunc64_def*)LStrBuf(*filefunc_def);
+ LStrLen(*filefunc_def) = sizeof(zlib_filefunc64_def);
+
+ fill_mem_filefunc(pzlib_filefunc_def, memory);
}
- else
- return sizeof(zlib_filefunc64_def);
+ return err;
}
-extern MgErr ZEXPORT LVPath_ToText(Path path, CStr str, int32 *len)
+LibAPI(MgErr) LVPath_ToText(Path path, CStr str, int32 *len)
{
MgErr err;
LStrPtr lstr;
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2012-07-23 21:23:01 UTC (rev 1483)
+++ trunk/lvzip/c_source/lvutil.h 2012-07-23 21:26:16 UTC (rev 1484)
@@ -44,6 +44,12 @@
#error No target defined
#endif
+#if Win32
+ #define LibAPI(retval) extern __declspec(dllexport) retval
+#else
+ #define LibAPI(retval) __attribute__((visibility ("default"))) extern retval
+#endif
+
#if defined(DEBUG)
#if Win32
#if defined(_CVI_DEBUG_)
@@ -70,16 +76,38 @@
*/
#endif
-typedef char int8;
-typedef unsigned char uInt8;
-typedef uInt8 uChar;
-typedef short int16;
-typedef unsigned short uInt16;
-typedef long int32;
-typedef unsigned long uInt32;
-typedef float float32;
-typedef double float64;
+#ifndef Unused
+/* The macro Unused can be used to avoid compiler warnings for
+unused parameters or locals. */
+# ifdef __cplusplus
+/* This implementation of Unused is safe for const parameters. */
+# define Unused(var_or_param) _Unused((const void *)&var_or_param)
+ inline void _Unused(const void *) {}
+# elif MSWin
+/* This implementation of Unused is not safe for const parameters. */
+# define Unused(var_or_param) var_or_param=var_or_param
+# else
+# define Unused(var_or_param)
+# endif
+#endif /* Unused */
+typedef signed char int8;
+typedef unsigned char uInt8;
+typedef uInt8 uChar;
+typedef signed short int16;
+typedef unsigned short uInt16;
+typedef signed int int32;
+typedef unsigned int uInt32;
+#if Win32
+typedef signed __int64 int64;
+typedef unsigned __int64 uInt64;
+#else
+typedef signed long long int64;
+typedef unsigned long long uInt64;
+#endif
+typedef float float32;
+typedef double float64;
+
#define Private(T) typedef struct T##_t { void *p; } *T
#define PrivateH(T) struct T##_t; typedef struct T##_t **T
@@ -199,7 +227,7 @@
} LVPoint;
typedef uChar Str255[256], *PStr, *CStr, *UPtr, **UHandle;
-typedef const uChar *ConstCStr, *ConstPStr, ConstStr255[256];
+typedef const uChar *ConstCStr, *ConstPStr, *ConstUPtr, ConstStr255[256];
#define PStrBuf(b) (&((PStr)(b))[1])
#define PStrLen(b) (((PStr)(b))[0]) /* # of chars in string */
@@ -258,39 +286,42 @@
MgErr FNewRefNum(Path path, File fd, LVRefNum* refnum);
int32 DbgPrintf(CStr fmt, ...);
-UPtr DSNewPClr(int32);
+UPtr DSNewPClr(size_t size);
MgErr DSDisposePtr(UPtr);
-UHandle DSNewHClr(int32 size);
-MgErr DSSetHandleSize(UHandle, int32);
+UHandle DSNewHClr(size_t size);
+MgErr DSSetHandleSize(UHandle, size_t);
int32 DSGetHandleSize(UHandle);
MgErr DSDisposeHandle(UHandle);
-MgErr NumericArrayResize(int32, int32, UHandle*, int32);
+void MoveBlock(ConstUPtr ps, UPtr pd, size_t size);
+MgErr NumericArrayResize(int32, int32, UHandle*, size_t);
+
#define Min(a, b) ((a) < (b)) ? (a) : (b)
#define Max(a, b) ((a) > (b)) ? (a) : (b)
/* Our exported functions */
-ZEXTERN void ZEXPORT DLLVersion OF((uChar* Version));
+LibAPI(void) DLLVersion OF((uChar* Version));
-ZEXTERN MgErr ZEXPORT LVPath_ToText OF((Path path, CStr str, int32 *len));
-ZEXTERN MgErr ZEXPORT LVPath_HasResourceFork OF((Path path, int32 *hasResFork));
-ZEXTERN MgErr ZEXPORT LVPath_EncodeMacbinary OF((Path srcFileName, Path dstFileName));
-ZEXTERN MgErr ZEXPORT LVPath_DecodeMacbinary OF((Path srcFileName, Path dstFileName));
+LibAPI(MgErr) LVPath_ToText OF((Path path, CStr str, int32 *len));
+LibAPI(MgErr) LVPath_HasResourceFork OF((Path path, int32 *hasResFork));
+LibAPI(MgErr) LVPath_EncodeMacbinary OF((Path srcFileName, Path dstFileName));
+LibAPI(MgErr) LVPath_DecodeMacbinary OF((Path srcFileName, Path dstFileName));
-ZEXTERN MgErr ZEXPORT LVPath_UtilFileInfo OF((Path path,
+LibAPI(MgErr) LVPath_UtilFileInfo OF((Path path,
uInt8 write,
uInt8 *isDirectory,
LVFileInfo *finderInfo,
LStrHandle comment));
-ZEXTERN MgErr ZEXPORT LVPath_OpenFile OF((LVRefNum *refnum,
+LibAPI(MgErr) LVPath_OpenFile OF((LVRefNum *refnum,
Path path,
uInt8 rsrc,
uInt32 openMode,
uInt32 denyMode));
-ZEXTERN long ZEXPORT InitializeFileFuncs OF((zlib_filefunc64_def* pzlib_filefunc_def, LStrHandle *memory));
+LibAPI(MgErr) InitializeFileFuncs OF((LStrHandle filefunc_def));
+LibAPI(MgErr) InitializeStreamFuncs OF((LStrHandle filefunc_def, LStrHandle *memory));
#ifdef __cplusplus
}
Modified: trunk/lvzip/c_source/zalias.h
===================================================================
--- trunk/lvzip/c_source/zalias.h 2012-07-23 21:23:01 UTC (rev 1483)
+++ trunk/lvzip/c_source/zalias.h 2012-07-23 21:26:16 UTC (rev 1484)
@@ -1,144 +1,86 @@
-#define _dist_code lvzip__dist_code
-#define _length_code lvzip__length_code
-#define _tr_align lvzip__tr_align
-#define _tr_flush_block lvzip__tr_flush_block
-#define _tr_init lvzip__tr_init
-#define _tr_stored_block lvzip__tr_stored_block
-#define _tr_tally lvzip__tr_tally
-#define adler32 lvzip_adler32
-#define adler32_combine lvzip_adler32_combine
-#define adler32_combine64 lvzip_adler32_combine64
-#define compress lvzip_compress
-#define compress2 lvzip_compress2
-#define compressBound lvzip_compressBound
-#define crc32 lvzip_crc32
-#define crc32_combine lvzip_crc32_combine
-#define crc32_combine64 lvzip_crc32_combine64
-#define deflate lvzip_deflate
-#define deflate_copyright lvzip_deflate_copyright
-#define deflateBound lvzip_deflateBound
-#define deflateCopy lvzip_deflateCopy
-#define deflateEnd lvzip_deflateEnd
-#define deflateInit_ lvzip_deflateInit_
-#define deflateInit2_ lvzip_deflateInit2_
-#define deflateParams lvzip_deflateParams
-#define deflatePending lvzip_deflatePending
-#define deflatePrime lvzip_deflatePrime
-#define deflateReset lvzip_deflateReset
-#define deflateResetKeep lvzip_deflateResetKeep
-#define deflateSetDictionary lvzip_deflateSetDictionary
-#define deflateSetHeader lvzip_deflateSetHeader
-#define deflateTune lvzip_deflateTune
-#define get_crc_table lvzip_get_crc_table
-#define inflate lvzip_inflate
-#define inflate_copyright lvzip_inflate_copyright
-#define inflate_table lvzip_inflate_table
-#define inflateBack lvzip_inflateBack
-#define inflateBackEnd lvzip_inflateBackEnd
-#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 inflateMark lvzip_inflateMark
-#define inflatePrime lvzip_inflatePrime
-#define inflateReset lvzip_inflateReset
-#define inflateReset2 lvzip_inflateReset2
-#define inflateResetKeep lvzip_inflateResetKeep
-#define inflateSetDictionary lvzip_inflateSetDictionary
-#define inflateSync lvzip_inflateSync
-#define inflateSyncPoint lvzip_inflateSyncPoint
-#define inflateUndermine lvzip_inflateUndermine
-#define uncompress lvzip_uncompress
-#define z_errmsg lvzip_z_errmsg
-#define zcalloc lvzip_zcalloc
-#define zcfree lvzip_zcfree
-#define zError lvzip_zError
-#define zlibCompileFlags lvzip_zlibCompileFlags
-#define zlibVersion lvzip_zlibVersion
-#define unzClose lvzip_unzClose
-#define unzCloseCurrentFile lvzip_unzCloseCurrentFile
-#define unzGetCurrentFileInfo lvzip_unzGetCurrentFileInfo
-#define unzGetCurrentFileInfo64 lvzip_unzGetCurrentFileInfo64
-#define unzGetCurrentFileZStreamPos64 lvzip_unzGetCurrentFileZStreamPos64
-#define unzGetFilePos lvzip_unzGetFilePos
-#define unzGetFilePos64 lvzip_unzGetFilePos64
-#define unzGetGlobalComment lvzip_unzGetGlobalComment
-#define unzGetGlobalInfo lvzip_unzGetGlobalInfo
-#define unzGetGlobalInfo64 lvzip_unzGetGlobalInfo64
-#define unzGetLocalExtrafield lvzip_unzGetLocalExtrafield
-#define unzGetOffset lvzip_unzGetOffset
-#define unzGetOffset64 lvzip_unzGetOffset64
-#define unzGoToFilePos lvzip_unzGoToFilePos
-#define unzGoToFilePos64 lvzip_unzGoToFilePos64
-#define unzGoToFirstFile lvzip_unzGoToFirstFile
-#define unzGoToNextFile lvzip_unzGoToNextFile
-#define unzLocateFile lvzip_unzLocateFile
-#define unzOpen lvzip_unzOpen
-#define unzOpen64 lvzip_unzOpen64
-#define unzOpen2 lvzip_unzOpen2
-#define unzOpen2_64 lvzip_unzOpen2_64
-#define unzOpenCurrentFile lvzip_unzOpenCurrentFile
-#define unzOpenCurrentFile2 lvzip_unzOpenCurrentFile2
-#define unzOpenCurrentFile3 lvzip_unzOpenCurrentFile3
-#define unzOpenCurrentFilePassword lvzip_unzOpenCurrentFilePassword
-#define unzReadCurrentFile lvzip_unzReadCurrentFile
-#define unzRepair lvzip_unzRepair
-#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 zipClose lvzip_zipClose
-#define zipClose2 lvzip_zipClose2
-#define zipCloseFileInZip lvzip_zipCloseFileInZip
-#define zipCloseFileInZipRaw lvzip_zipCloseFileInZipRaw
-#define zipCloseFileInZipRaw64 lvzip_zipCloseFileInZipRaw64
-#define zipOpen lvzip_zipOpen
-#define zipOpen64 lvzip_zipOpen64
-#define zipOpen2 lvzip_zipOpen2
-#define zipOpen2_64 lvzip_zipOpen2_64
-#define zipOpen3 lvzip_zipOpen3
-#define zipOpenNewFileInZip lvzip_zipOpenNewFileInZip
-#define zipOpenNewFileInZip64 lvzip_zipOpenNewFileInZip64
-#define zipOpenNewFileInZip2 lvzip_zipOpenNewFileInZip2
-#define zipOpenNewFileInZip2_64 lvzip_zipOpenNewFileInZip2_64
-#define zipOpenNewFileInZip3 lvzip_zipOpenNewFileInZip3
-#define zipOpenNewFileInZip3_64 lvzip_zipOpenNewFileInZip3_64
-#define zipOpenNewFileInZip4 lvzip_zipOpenNewFileInZip4
-#define zipOpenNewFileInZip4_64 lvzip_zipOpenNewFileInZip4_64
-#define zipRemoveExtraInfoBlock lvzip_zipRemoveExtraInfoBlock
-#define zipWriteInFileInZip lvzip_zipWriteInFileInZip
-#define gzopen lvzlib_gzopen
-#define gzopen64 lvzlib_gzopen64
-#define gzdopen lvzlib_gzdopen
-#define gzbuffer lvzlib_gzbuffer
-#define gzseek lvzlib_gzseek
-#define gzseek64 lvzlib_gzseek64
-#define gzsetparams lvzlib_gzsetparams
-#define gzread lvzlib_gzread
-#define gzwrite lvzlib_gzwrite
-#define gzprintf lvzlib_gzprintf
-#define gzputc lvzlib_gzputc
-#define gzputs lvzlib_gzputs
-#define gzgetc lvzlib_gzgetc
-#define gzgets lvzlib_gzgets
-#define gzungetc lvzlib_gzungetc
-#define gzrewind lvzlib_gzrewind
-#define gzeof lvzlib_gzeof
-#define gzclearerr lvzlib_gzclearerr
-#define gzflush lvzlib_gzflush
-#define gzdirect lvzlib_gzdirect
-#define gzerror lvzlib_gzerror
-#define gzclose lvzlib_gzclose
-#define gzclose_r lvzlib_gzclose_r
-#define gzclose_w lvzlib_gzclose_w
-#define gztell lvzlib_gztell
-#define gztell64 lvzlib_gztell64
-#define gzoffset lvzlib_gzoffset
-#define gzoffset64 lvzlib_gzoffset64
-#define gcrc32_combine lvzlib_crc32_combine
-#define gcrc32_combine64 lvzlib_crc32_combine64
+#define z_errmsg z_z_errmsg
+
+#define unzClose z_unzClose
+#define unzCloseCurrentFile z_unzCloseCurrentFile
+#define unzGetCurrentFileInfo z_unzGetCurrentFileInfo
+#define unzGetCurrentFileInfo64 z_unzGetCurrentFileInfo64
+#define unzGetCurrentFileZStreamPos64 z_unzGetCurrentFileZStreamPos64
+#define unzGetFilePos z_unzGetFilePos
+#define unzGetFilePos64 z_unzGetFilePos64
+#define unzGetGlobalComment z_unzGetGlobalComment
+#define unzGetGlobalInfo z_unzGetGlobalInfo
+#define unzGetGlobalInfo64 z_unzGetGlobalInfo64
+#define unzGetLocalExtrafield z_unzGetLocalExtrafield
+#define unzGetOffset z_unzGetOffset
+#define unzGetOffset64 z_unzGetOffset64
+#define unzGoToFilePos z_unzGoToFilePos
+#define unzGoToFilePos64 z_unzGoToFilePos64
+#define unzGoToFirstFile z_unzGoToFirstFile
+#define unzGoToNextFile z_unzGoToNextFile
+#define unzLocateFile z_unzLocateFile
+#define unzOpen z_unzOpen
+#define unzOpen64 z_unzOpen64
+#define unzOpen2 z_unzOpen2
+#define unzOpen2_64 z_unzOpen2_64
+#define unzOpenCurrentFile z_unzOpenCurrentFile
+#define unzOpenCurrentFile2 z_unzOpenCurrentFile2
+#define unzOpenCurrentFile3 z_unzOpenCurrentFile3
+#define unzOpenCurrentFilePassword z_unzOpenCurrentFilePassword
+#define unzReadCurrentFile z_unzReadCurrentFile
+#define unzRepair z_unzRepair
+#define unzSetOffset z_unzSetOffset
+#define unzSetOffset64 z_unzSetOffset64
+#define unzStringFileNameCompare z_unzStringFileNameCompare
+#define unztell z_unztell
+#define unztell64 z_unztell64
+#define unzeof z_unzeof
+#define zipClose z_zipClose
+#define zipClose2 z_zipClose2
+#define zipCloseFileInZip z_zipCloseFileInZip
+#define zipCloseFileInZipRaw z_zipCloseFileInZipRaw
+#define zipCloseFileInZipRaw64 z_zipCloseFileInZipRaw64
+#define zipOpen z_zipOpen
+#define zipOpen64 z_zipOpen64
+#define zipOpen2 z_zipOpen2
+#define zipOpen2_64 ...
[truncated message content] |
|
From: <lab...@us...> - 2013-03-17 15:06:36
|
Revision: 1487
http://opengtoolkit.svn.sourceforge.net/opengtoolkit/?rev=1487&view=rev
Author: labviewer
Date: 2013-03-17 15:06:30 +0000 (Sun, 17 Mar 2013)
Log Message:
-----------
various minor edits
Modified Paths:
--------------
trunk/lvzip/c_source/Makefile.vxworks
trunk/lvzip/c_source/gzread.c
trunk/lvzip/c_source/inflate.c
trunk/lvzip/c_source/ioapi.h
trunk/lvzip/c_source/iomem.h
trunk/lvzip/c_source/mztools.c
trunk/lvzip/c_source/unzip.c
trunk/lvzip/c_source/zip.h
Modified: trunk/lvzip/c_source/Makefile.vxworks
===================================================================
--- trunk/lvzip/c_source/Makefile.vxworks 2013-03-17 15:01:38 UTC (rev 1486)
+++ trunk/lvzip/c_source/Makefile.vxworks 2013-03-17 15:06:30 UTC (rev 1487)
@@ -19,10 +19,10 @@
# directory. Make will automatically locate the source file and
# compile it.
OBJECTS := $(OBJ_DIR)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/deflate.o \
- $(OBJ_DIR)\gzclose.o $(OBJ_DIR)\gzlib.o $(OBJ_DIR)\gzread.o $(OBJ_DIR)\gzwrite.o \
+ $(OBJ_DIR)/gzclose.o $(OBJ_DIR)/gzlib.o $(OBJ_DIR)/gzread.o $(OBJ_DIR)/gzwrite.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)/unzip.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/zutil.o
+ $(OBJ_DIR)/trees.o $(OBJ_DIR)/uncompr.o $(OBJ_DIR)/unzip.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/zutil.o
# This is the name of the output shared library.
PROJECT_TARGETS := $(OBJ_DIR)/lvzlib.out
@@ -50,11 +50,11 @@
# copy this rule and modify its extension and compile flags for the
# required source file type.
$(OBJ_DIR)/%.o : %.c
- ccppc $(CFLAGS) $(CC_ARCH_SPEC) -Wall -MD -MP $(ADDED_CFLAGS) $(IDE_INCLUDES) $(ADDED_INCLUDES) -DCPU=$(CPU) -DTOOL_FAMILY=$(TOOL_FAMILY) -DTOOL=$(TOOL) -D_WRS_KERNEL $(DEFINES) -o "$@" -c "$<"
+ ccppc $(CFLAGS) $(CC_ARCH_SPEC) -Wall -MD -MP $(ADDED_CFLAGS) $(IDE_INCLUDES) $(ADDED_INCLUDES) -DCPU=$(CPU) -DTOOL_FAMILY=$(TOOL_FAMILY) -DTOOL=$(TOOL) -D_WRS_KERNEL $(DEFINES) -o "$@" -c "$<"
# Adapted rule for .cpp files
$(OBJ_DIR)/%.o : %.cpp
- c++ppc $(CFLAGS) $(CC_ARCH_SPEC) -Wall -MD -MP $(ADDED_CFLAGS) $(IDE_INCLUDES) $(ADDED_INCLUDES) -DCPU=$(CPU) -DTOOL_FAMILY=$(TOOL_FAMILY) -DTOOL=$(TOOL) -D_WRS_KERNEL $(DEFINES) -o "$@" -c "$<"
+ c++ppc $(CFLAGS) $(CC_ARCH_SPEC) -Wall -MD -MP $(ADDED_CFLAGS) $(IDE_INCLUDES) $(ADDED_INCLUDES) -DCPU=$(CPU) -DTOOL_FAMILY=$(TOOL_FAMILY) -DTOOL=$(TOOL) -D_WRS_KERNEL $(DEFINES) -o "$@" -c "$<"
all : check_objectdir $(PROJECT_TARGETS)
Modified: trunk/lvzip/c_source/gzread.c
===================================================================
--- trunk/lvzip/c_source/gzread.c 2013-03-17 15:01:38 UTC (rev 1486)
+++ trunk/lvzip/c_source/gzread.c 2013-03-17 15:06:30 UTC (rev 1487)
@@ -378,7 +378,6 @@
}
/* -- see zlib.h -- */
-//#undef gzgetc
int ZEXPORT gzgetc(file)
gzFile file;
{
Modified: trunk/lvzip/c_source/inflate.c
===================================================================
--- trunk/lvzip/c_source/inflate.c 2013-03-17 15:01:38 UTC (rev 1486)
+++ trunk/lvzip/c_source/inflate.c 2013-03-17 15:06:30 UTC (rev 1487)
@@ -429,10 +429,10 @@
/* check function to use adler32() for zlib or crc32() for gzip */
#ifdef GUNZIP
-# define UPDATE(check, buf, len) \
+# define UPDATE_CHECK(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_CHECK(check, buf, len) adler32(check, buf, len)
#endif
/* check macros for header crc */
@@ -1178,7 +1178,7 @@
state->total += out;
if (out)
strm->adler = state->check =
- UPDATE(state->check, put - out, out);
+ UPDATE_CHECK(state->check, put - out, out);
out = left;
if ((
#ifdef GUNZIP
@@ -1241,7 +1241,7 @@
state->total += out;
if (state->wrap && out)
strm->adler = state->check =
- UPDATE(state->check, strm->next_out - out, out);
+ UPDATE_CHECK(state->check, strm->next_out - out, out);
strm->data_type = 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 2013-03-17 15:01:38 UTC (rev 1486)
+++ trunk/lvzip/c_source/ioapi.h 2013-03-17 15:06:30 UTC (rev 1487)
@@ -23,8 +23,8 @@
#if (!defined(_WIN32)) && (!defined(WIN32)) && (!defined(__APPLE__))
- // Linux needs this to support file operation on files larger then 4+GB
- // But might need better if/def to select just the platforms that needs them.
+ /* Linux needs this to support file operation on files larger then 4+GB
+ But might need better if/def to select just the platforms that needs them. */
#ifndef __USE_FILE_OFFSET64
#define __USE_FILE_OFFSET64
@@ -186,8 +186,8 @@
#define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
#define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size))
-//#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))
-//#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))
+/*#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream))*/
+/*#define ZSEEK64(filefunc,filestream,pos,mode) ((*((filefunc).zseek64_file)) ((filefunc).opaque,filestream,pos,mode))*/
#define ZCLOSE64(filefunc,filestream, output) ((*((filefunc).zfile_func64.zclose_file)) ((filefunc).zfile_func64.opaque,filestream,output))
#define ZERROR64(filefunc,filestream) ((*((filefunc).zfile_func64.zerror_file)) ((filefunc).zfile_func64.opaque,filestream))
Modified: trunk/lvzip/c_source/iomem.h
===================================================================
--- trunk/lvzip/c_source/iomem.h 2013-03-17 15:01:38 UTC (rev 1486)
+++ trunk/lvzip/c_source/iomem.h 2013-03-17 15:06:30 UTC (rev 1487)
@@ -9,7 +9,7 @@
extern "C" {
#endif
-void fill_mem_filefunc OF((zlib_filefunc64_def* pzlib_filefunc_def, LStrHandle *memory));
+void fill_mem_filefunc(zlib_filefunc64_def* pzlib_filefunc_def, LStrHandle *memory);
#ifdef __cplusplus
}
Modified: trunk/lvzip/c_source/mztools.c
===================================================================
--- trunk/lvzip/c_source/mztools.c 2013-03-17 15:01:38 UTC (rev 1486)
+++ trunk/lvzip/c_source/mztools.c 2013-03-17 15:06:30 UTC (rev 1487)
@@ -222,7 +222,7 @@
{
int entriesZip = entries;
char header[22];
- char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
+ char* comment = ""; /* "ZIP File recovered by zlib/minizip/mztools" */
int comsize = (int) strlen(comment);
if (entriesZip > 0xffff) {
entriesZip = 0xffff;
Modified: trunk/lvzip/c_source/unzip.c
===================================================================
--- trunk/lvzip/c_source/unzip.c 2013-03-17 15:01:38 UTC (rev 1486)
+++ trunk/lvzip/c_source/unzip.c 2013-03-17 15:06:30 UTC (rev 1487)
@@ -956,7 +956,7 @@
if (unz64local_getLong(&s->z_filefunc, s->filestream,&file_info.external_fa) != UNZ_OK)
err=UNZ_ERRNO;
- // relative offset of local header
+ /* relative offset of local header */
if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
err=UNZ_ERRNO;
file_info_internal.offset_curfile = uL;
@@ -979,7 +979,7 @@
lSeek -= uSizeRead;
}
- // Read extrafield
+ /* Read extrafield */
if ((err==UNZ_OK) && (extraField!=NULL))
{
ZPOS64_T uSizeRead ;
@@ -1010,7 +1010,7 @@
{
uLong acc = 0;
- // since lSeek now points to after the extra field we need to move back
+ /* since lSeek now points to after the extra field we need to move back */
lSeek -= file_info.size_file_extra;
if (lSeek!=0)
@@ -1627,6 +1627,7 @@
zdecode(s->keys,s->pcrc_32_tab,source[i]);
s->pfile_in_zip_read->pos_in_zipfile+=12;
+ pfile_in_zip_read_info->rest_read_compressed -= 12;
s->encrypted=1;
}
# endif
Modified: trunk/lvzip/c_source/zip.h
===================================================================
--- trunk/lvzip/c_source/zip.h 2013-03-17 15:01:38 UTC (rev 1486)
+++ trunk/lvzip/c_source/zip.h 2013-03-17 15:06:30 UTC (rev 1487)
@@ -44,7 +44,7 @@
ZEXTERN "C" {
#endif
-//#define HAVE_BZIP2
+/*#define HAVE_BZIP2*/
#ifndef _ZLIB_H
#include "zlib.h"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-04-14 19:25:49
|
Revision: 1507
http://sourceforge.net/p/opengtoolkit/svn/1507
Author: labviewer
Date: 2015-04-14 19:25:47 +0000 (Tue, 14 Apr 2015)
Log Message:
-----------
Some Mac specific edits
Modified Paths:
--------------
trunk/lvzip/c_source/MacBinaryIII.h
trunk/lvzip/c_source/lvutil.c
trunk/lvzip/c_source/lvutil.h
trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj
trunk/lvzip/c_source/mztools.c
trunk/lvzip/c_source/utf.c
trunk/lvzip/c_source/zip.c
Modified: trunk/lvzip/c_source/MacBinaryIII.h
===================================================================
--- trunk/lvzip/c_source/MacBinaryIII.h 2015-04-10 10:11:59 UTC (rev 1506)
+++ trunk/lvzip/c_source/MacBinaryIII.h 2015-04-14 19:25:47 UTC (rev 1507)
@@ -12,7 +12,7 @@
#include <String.h>
#pragma once
-#pragma options align=mac68k
+//#pragma options align=mac68k
/*
000
Byte
@@ -169,4 +169,4 @@
}
#endif
-#pragma options align=reset
+//#pragma options align=reset
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2015-04-10 10:11:59 UTC (rev 1506)
+++ trunk/lvzip/c_source/lvutil.c 2015-04-14 19:25:47 UTC (rev 1507)
@@ -382,8 +382,10 @@
LStrHandle comment)
{
MgErr err = mgNoErr;
-#if MacOSX
+#if MacOS
+#if !MacOSX
FSRef ref;
+#endif
#elif Win32
LStrPtr lstr;
HANDLE handle = NULL;
@@ -400,6 +402,15 @@
return mgArgErr;
#if MacOSX
+ if (write)
+ {
+ err = FSetInfo(path, fileInfo);
+ }
+ else
+ {
+ err = FGetInfo(path, fileInfo);
+ }
+#elif MacOS
err = FSMakePathRef(path, &ref);
if (!err)
{
@@ -723,7 +734,7 @@
LStrLen(**str) = pathLen;
#if MacOSX
if (!err)
- err = ConvertToPosixPath(*str, str);
+ err = ConvertToPosixPath(*str, str, false);
#endif
}
}
@@ -742,7 +753,7 @@
{
MgErr err = mgNoErr;
#if MacOSX
- err = OSErrToLVErr(FSCloseFork(ioRefNum);
+ err = OSErrToLVErr(FSCloseFork(ioRefNum));
#elif Unix
if (fclose(ioRefNum))
{
@@ -901,7 +912,7 @@
if ((offs->q == 0) && (mode == fCurrent))
return noErr;
#if MacOSX
- ret = FSSetForkPosition(ioRefNum, mode, offs.q);
+ ret = FSSetForkPosition(ioRefNum, mode, offs->q);
if (ret == posErr)
{
ret = FSSetForkPosition(ioRefNum, fsFromStart, 0);
@@ -1043,7 +1054,7 @@
if (0 == ioRefNum)
return mgArgErr;
#if MacOSX
- err = FSRead(ioRefNum, &inCount, buffer);
+ err = FSRead(ioRefNum, (int32*)&inCount, buffer);
if (outCount)
{
if (err && err != eofErr)
@@ -1105,8 +1116,8 @@
if (0 == ioRefNum)
return mgArgErr;
-#if Mac
- err = FSWrite(ioRefNum, &inCount, buffer);
+#if MacOSX
+ err = FSWrite(ioRefNum, (int32*)&inCount, buffer);
if (outCount)
{
if (err && err != dskFulErr)
@@ -1124,7 +1135,7 @@
err = Win32ToLVFileErr();
if (outCount)
*outCount = actCount;
- return err;
+ return err;
#elif Unix
errno = 0;
actCount = fwrite((char *)buffer, 1, inCount, ioRefNum);
@@ -1135,7 +1146,7 @@
}
if (outCount)
*outCount = actCount;
- return err;
+ return err;
#endif
}
@@ -1144,18 +1155,18 @@
MgErr err;
int32 type;
FileRefNum ioRefNum;
+ LStrPtr lstr;
#if MacOSX
FSRef ref;
HFSUniStr255 forkName;
int8 perm;
+ char theMode[4];
OSErr ret;
#elif Win32
- LStrPtr lstr;
DWORD shareAcc, openAcc;
DWORD createMode = OPEN_EXISTING;
int32 attempts;
#elif Unix
- LStrPtr lstr;
uChar theMode[3];
struct stat statbuf;
#endif
@@ -1312,7 +1323,8 @@
#if MacOSX
else
{
- if (err = FSMakePathRef(path, &ref))
+ err = FSMakePathRef(path, &ref);
+ if (err)
{
DEBUGPRINTF(("FSMakePathRef: err = %ld", err));
return err;
@@ -1362,7 +1374,7 @@
ret = FSOpenFork(&ref, forkName.length, forkName.unicode, perm, &ioRefNum);
}
err = OSErrToLVErr(ret);
- if (!err && if (openMode == openWriteOnlyTruncate)
+ if (!err && openMode == openWriteOnlyTruncate)
{
FileOffset size;
size.q = 0;
@@ -1613,13 +1625,13 @@
{
return mFullErr;
}
- hsfRef = CFURLCopyFileSystemPath(urlRef, kCFURLHFSPathStyle);
+ hfsRef = CFURLCopyFileSystemPath(urlRef, kCFURLHFSPathStyle);
CFRelease(urlRef);
- if (hsfRef)
+ if (hfsRef)
{
CFIndex len;
- CFRange range = CFRangeMake(0, CFStringGetLength(posixRef));
- if (CFStringGetBytes(hsfRef, range, encoding, 0, false, NULL, 0, &len) > 0)
+ CFRange range = CFRangeMake(0, CFStringGetLength(hfsRef));
+ if (CFStringGetBytes(hfsRef, range, encoding, 0, false, NULL, 0, &len) > 0)
{
if (len > 0)
{
@@ -1629,7 +1641,7 @@
encoding = ConvertCodepageToEncoding(destcp);
if (encoding != kCFStringEncodingInvalidId)
{
- if (CFStringGetBytes(hsfRef, range, encoding, 0, false, LStrBuf(**dest), len, &len) > 0)
+ if (CFStringGetBytes(hfsRef, range, encoding, 0, false, LStrBuf(**dest), len, &len) > 0)
{
LStrBuf(**dest)[len] = 0;
LStrLen(**dest) = len;
@@ -1643,11 +1655,11 @@
}
}
}
- CFRelease(hsfRef);
+ CFRelease(hfsRef);
}
else
{
- err = mgFullErr;
+ err = mFullErr;
}
}
#endif
@@ -1730,7 +1742,7 @@
{
return mFullErr;
}
- urlRef = CFURLCreateWithFileSystemPath(NULL, fileRef, kCFURLHSFPathStyle, isDir);
+ urlRef = CFURLCreateWithFileSystemPath(NULL, fileRef, kCFURLHFSPathStyle, isDir);
CFRelease(fileRef);
if (!urlRef)
{
@@ -1769,7 +1781,7 @@
}
else
{
- err = mgFullErr;
+ err = mFullErr;
}
}
#endif
@@ -2140,7 +2152,7 @@
{
CFMutableStringRef cfpath2 = CFStringCreateMutableCopy(NULL, 0, cfpath);
CFRelease(cfpath);
- if (cpath2)
+ if (cfpath2)
{
CFStringNormalize(cfpath2, kCFStringNormalizationFormD);
CFStringEncoding encoding = ConvertCodepageToEncoding(codePage);
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2015-04-10 10:11:59 UTC (rev 1506)
+++ trunk/lvzip/c_source/lvutil.h 2015-04-14 19:25:47 UTC (rev 1507)
@@ -325,6 +325,7 @@
#define kUnknownFileType RTToL('?','?','?','?')
#define kUnknownCreator RTToL('?','?','?','?')
+
enum { openReadWrite, openReadOnly, openWriteOnly, openWriteOnlyTruncate }; /* open modes */
enum { denyReadWrite, denyWriteOnly, denyNeither}; /* deny modes */
@@ -364,7 +365,6 @@
MgErr FGetPathType(Path, int32*);
int32 FDepth(Path path);
MgErr FDisposePath(Path p);
-
MgErr FNewRefNum(Path path, File fd, LVRefNum* refnum);
Bool32 FIsARefNum(LVRefNum);
MgErr FDisposeRefNum(LVRefNum);
Modified: trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj
===================================================================
--- trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2015-04-10 10:11:59 UTC (rev 1506)
+++ trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2015-04-14 19:25:47 UTC (rev 1507)
@@ -42,9 +42,10 @@
839542ED0894F2490020C3E2 /* infback.c in Sources */ = {isa = PBXBuildFile; fileRef = 839542B60894F2490020C3E2 /* infback.c */; };
839542EF0894F2490020C3E2 /* gvmat32c.c in Sources */ = {isa = PBXBuildFile; fileRef = 839542B80894F2490020C3E2 /* gvmat32c.c */; };
839542F10894F2490020C3E2 /* adler32.c in Sources */ = {isa = PBXBuildFile; fileRef = 839542BA0894F2490020C3E2 /* adler32.c */; };
- 83D3E21E080D117200DE332C /* MacBinaryIII.c in Sources */ = {isa = PBXBuildFile; fileRef = 83D3E1B3080D116E00DE332C /* MacBinaryIII.c */; };
- 83D3E21F080D117200DE332C /* MacBinaryIII.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D3E1B4080D116E00DE332C /* MacBinaryIII.h */; };
83D3E26D080D117700DE332C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83D3E26C080D117700DE332C /* Carbon.framework */; };
+ 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 */; };
C77CC6BF0C9C7D3200886AB2 /* liblvexports.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C77CC6BE0C9C7D3200886AB2 /* liblvexports.a */; };
C77CC6C20C9C7D6500886AB2 /* liblabviewcin.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C77CC6C10C9C7D6500886AB2 /* liblabviewcin.a */; };
C79368AC0C9ED687006083BF /* iomem.c in Sources */ = {isa = PBXBuildFile; fileRef = C79368AA0C9ED687006083BF /* iomem.c */; };
@@ -88,9 +89,10 @@
839542B80894F2490020C3E2 /* gvmat32c.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gvmat32c.c; sourceTree = "<group>"; };
839542BA0894F2490020C3E2 /* adler32.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = adler32.c; sourceTree = "<group>"; };
83D3E1AF080D116E00DE332C /* lvzlib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = lvzlib.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- 83D3E1B3080D116E00DE332C /* MacBinaryIII.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = MacBinaryIII.c; sourceTree = SOURCE_ROOT; };
- 83D3E1B4080D116E00DE332C /* MacBinaryIII.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MacBinaryIII.h; sourceTree = SOURCE_ROOT; };
83D3E26C080D117700DE332C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+ 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>"; };
C77CC6BE0C9C7D3200886AB2 /* liblvexports.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblvexports.a; path = "/Applications/National Instruments/LabVIEW 8.2/cintools/Mach-O/liblvexports.a"; sourceTree = "<absolute>"; };
C77CC6C10C9C7D6500886AB2 /* liblabviewcin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblabviewcin.a; path = "/Applications/National Instruments/LabVIEW 8.2/cintools/Mach-O/liblabviewcin.a"; sourceTree = "<absolute>"; };
C79368AA0C9ED687006083BF /* iomem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = iomem.c; sourceTree = "<group>"; };
@@ -119,7 +121,6 @@
C79368AB0C9ED687006083BF /* iomem.h */,
C77CC6C10C9C7D6500886AB2 /* liblabviewcin.a */,
C77CC6BE0C9C7D3200886AB2 /* liblvexports.a */,
- 83D3E1B0080D116E00DE332C /* mac Specific */,
83D3E1B5080D116E00DE332C /* zlib Sources */,
83D3E26B080D117700DE332C /* Frameworks */,
83D3E19A080D116E00DE332C /* Products */,
@@ -134,18 +135,12 @@
name = Products;
sourceTree = "<group>";
};
- 83D3E1B0080D116E00DE332C /* mac Specific */ = {
- isa = PBXGroup;
- children = (
- 83D3E1B4080D116E00DE332C /* MacBinaryIII.h */,
- 83D3E1B3080D116E00DE332C /* MacBinaryIII.c */,
- );
- name = "mac Specific";
- sourceTree = "<group>";
- };
83D3E1B5080D116E00DE332C /* zlib Sources */ = {
isa = PBXGroup;
children = (
+ 888E743D1ADD96D700C5AEFE /* lvapi.c */,
+ 888E743B1ADD96C200C5AEFE /* utf.h */,
+ 888E74391ADD96A900C5AEFE /* utf.c */,
839542890894F2480020C3E2 /* lvutil.h */,
8395428A0894F2480020C3E2 /* lvutil.c */,
8395428C0894F2480020C3E2 /* mztools.c */,
@@ -200,13 +195,13 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
- 83D3E21F080D117200DE332C /* MacBinaryIII.h in Headers */,
839542C00894F2490020C3E2 /* lvutil.h in Headers */,
839542C60894F2490020C3E2 /* inffast.h in Headers */,
839542C90894F2490020C3E2 /* crc32.h in Headers */,
839542CB0894F2490020C3E2 /* crypt.h in Headers */,
839542CD0894F2490020C3E2 /* inflate.h in Headers */,
839542CE0894F2490020C3E2 /* deflate.h in Headers */,
+ 888E743C1ADD96C200C5AEFE /* utf.h in Headers */,
839542CF0894F2490020C3E2 /* zutil.h in Headers */,
839542D90894F2490020C3E2 /* ioapi.h in Headers */,
839542DB0894F2490020C3E2 /* inftrees.h in Headers */,
@@ -248,6 +243,8 @@
/* Begin PBXProject section */
83D3E190080D116E00DE332C /* Project object */ = {
isa = PBXProject;
+ attributes = {
+ };
buildConfigurationList = C77CC6B80C9C7C6500886AB2 /* Build configuration list for PBXProject "lvzip" */;
compatibilityVersion = "Xcode 2.4";
developmentRegion = English;
@@ -280,7 +277,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 83D3E21E080D117200DE332C /* MacBinaryIII.c in Sources */,
839542C10894F2490020C3E2 /* lvutil.c in Sources */,
839542C30894F2490020C3E2 /* mztools.c in Sources */,
839542C70894F2490020C3E2 /* inffast.c in Sources */,
@@ -289,10 +285,12 @@
839542CC0894F2490020C3E2 /* inftrees.c in Sources */,
839542D00894F2490020C3E2 /* zutil.c in Sources */,
839542D60894F2490020C3E2 /* compress.c in Sources */,
+ 888E743E1ADD96D700C5AEFE /* lvapi.c in Sources */,
839542DA0894F2490020C3E2 /* ioapi.c in Sources */,
839542E00894F2490020C3E2 /* zip.c in Sources */,
839542E40894F2490020C3E2 /* unzip.c in Sources */,
839542E50894F2490020C3E2 /* uncompr.c in Sources */,
+ 888E743A1ADD96A900C5AEFE /* utf.c in Sources */,
839542E70894F2490020C3E2 /* trees.c in Sources */,
839542EB0894F2490020C3E2 /* inflate.c in Sources */,
839542ED0894F2490020C3E2 /* infback.c in Sources */,
@@ -308,6 +306,7 @@
C77CC6B50C9C7C6500886AB2 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COPY_PHASE_STRIP = NO;
GCC_ALTIVEC_EXTENSIONS = NO;
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
@@ -334,6 +333,7 @@
LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SYSTEM_APPS_DIR)/National Instruments/LabVIEW 2009/cintools/Mach-O\"";
LIBRARY_STYLE = DYNAMIC;
MACH_O_TYPE = mh_dylib;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
OTHER_CFLAGS = "-fno-inline";
OTHER_LDFLAGS = (
"-multiply_defined",
@@ -343,6 +343,7 @@
PRODUCT_NAME = lvzlib;
REZ_SCRIPT_TYPE = Roman;
REZ_SUPPRESS_REDECLARED_RESOURCE_TYPE_WARNINGS = NO;
+ SDKROOT = macosx10.9;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
"-Wmost",
@@ -356,6 +357,7 @@
C77CC6B60C9C7C6500886AB2 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COPY_PHASE_STRIP = YES;
GCC_ALTIVEC_EXTENSIONS = NO;
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
@@ -379,6 +381,7 @@
LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SYSTEM_APPS_DIR)/National Instruments/LabVIEW 2009/cintools/Mach-O\"";
LIBRARY_STYLE = DYNAMIC;
MACH_O_TYPE = mh_dylib;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
OTHER_CFLAGS = "-fno-inline";
OTHER_LDFLAGS = (
"-multiply_defined",
@@ -388,6 +391,7 @@
PRODUCT_NAME = lvzlib;
REZ_SCRIPT_TYPE = Roman;
REZ_SUPPRESS_REDECLARED_RESOURCE_TYPE_WARNINGS = NO;
+ SDKROOT = macosx10.9;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
"-Wmost",
@@ -401,6 +405,7 @@
C77CC6B70C9C7C6500886AB2 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_ALTIVEC_EXTENSIONS = NO;
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
GCC_ENABLE_CPP_EXCEPTIONS = NO;
@@ -422,6 +427,7 @@
LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SYSTEM_APPS_DIR)/National Instruments/LabVIEW 2009/cintools/Mach-O\"";
LIBRARY_STYLE = DYNAMIC;
MACH_O_TYPE = mh_dylib;
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
OTHER_CFLAGS = "-fno-inline";
OTHER_LDFLAGS = (
"-multiply_defined",
@@ -431,6 +437,7 @@
PRODUCT_NAME = lvzlib;
REZ_SCRIPT_TYPE = Roman;
REZ_SUPPRESS_REDECLARED_RESOURCE_TYPE_WARNINGS = NO;
+ SDKROOT = macosx10.9;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
"-Wmost",
Modified: trunk/lvzip/c_source/mztools.c
===================================================================
--- trunk/lvzip/c_source/mztools.c 2015-04-10 10:11:59 UTC (rev 1506)
+++ trunk/lvzip/c_source/mztools.c 2015-04-14 19:25:47 UTC (rev 1507)
@@ -27,7 +27,7 @@
WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
} while(0)
-extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
+ZEXTERN int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
const char* file;
const char* fileOut;
const char* fileOutTmp;
Modified: trunk/lvzip/c_source/utf.c
===================================================================
--- trunk/lvzip/c_source/utf.c 2015-04-10 10:11:59 UTC (rev 1506)
+++ trunk/lvzip/c_source/utf.c 2015-04-14 19:25:47 UTC (rev 1507)
@@ -99,7 +99,7 @@
if (!utf8_is_trail(src[*offset]))
return INCOMPLETE_SEQUENCE;
- return noErr;
+ return mgNoErr;
}
#define UTF8_INCREASE_AND_RETURN_ON_ERROR(src, offset, length) {MgErr ret = utf8_increase_safely(src, offset, length); if (ret) return ret;}
@@ -112,7 +112,7 @@
*code_point = utf8_mask(src[*offset]);
++(*offset);
- return noErr;
+ return mgNoErr;
}
static MgErr utf8_get_sequence_2(const uInt8 *src, int32 *offset, int32 length, uInt32 *code_point)
@@ -126,7 +126,7 @@
*code_point = ((*code_point << 6) & 0x7c0) + (src[*offset] & 0x3f);
++(*offset);
- return noErr;
+ return mgNoErr;
}
static MgErr utf8_get_sequence_3(const uInt8 *src, int32 *offset, int32 length, uInt32 *code_point)
@@ -144,7 +144,7 @@
*code_point += src[*offset] & 0x3f;
++(*offset);
- return noErr;
+ return mgNoErr;
}
static MgErr utf8_get_sequence_4(const uInt8 *src, int32 *offset, int32 length, uInt32 *code_point)
@@ -166,7 +166,7 @@
*code_point += src[*offset++] & 0x3f;
- return noErr;
+ return mgNoErr;
}
static MgErr utf8_append(uInt32 cp, uInt8 *buffer, int32 *offset, int32 length)
@@ -226,7 +226,7 @@
}
*offset += 4;
}
- return noErr;
+ return mgNoErr;
}
static MgErr utf8_next(const uInt8 *buffer, int32 *offset, int32 length, uInt32 *cp)
@@ -256,7 +256,7 @@
break;
}
*offset = (int32)(ptr - buffer);
- return noErr;
+ return mgNoErr;
}
return mgArgErr;
}
@@ -278,7 +278,7 @@
MgErr utf8_advance(const uInt8 *src, int32 *offset, int32 length, int32 distance)
{
- MgErr err = noErr;
+ MgErr err = mgNoErr;
int32 i = 0;
uInt32 cp;
for (; !err && i < distance; ++i)
@@ -290,7 +290,7 @@
MgErr utf8_distance(const uInt8 *src, int32 *offset, int32 length)
{
- MgErr err = noErr;
+ MgErr err = mgNoErr;
int32 i = 0;
uInt32 cp;
for (; !err && src[*offset] && (length < 0 || *offset < length); i++)
@@ -302,7 +302,7 @@
MgErr utf8_validate_next(const uInt8 *src, int32 *offset, int32 length, uInt32 *code_point)
{
- MgErr err = noErr;
+ MgErr err = mgNoErr;
uInt32 cp = 0;
// Save the original value of offset so we can go back in case of failure
@@ -341,7 +341,7 @@
if (code_point)
*code_point = cp;
offset++;
- return noErr;
+ return mgNoErr;
}
else
err = OVERLONG_SEQUENCE;
@@ -357,14 +357,14 @@
MgErr utf8_replace_invalid(const uInt8 *src, int32 *soff, int32 slen, uInt8 *dest, int32 *doff, int32 dlen, uInt32 replacement)
{
- MgErr err = noErr;
+ MgErr err = mgNoErr;
while (src[*soff] && (slen < 0 || *soff < slen))
{
int32 off = *soff;
err = utf8_validate_next(src, soff, slen, NULL);
switch (err)
{
- case noErr:
+ case mgNoErr:
for (; off < *soff && *doff < dlen; off++, (*doff)++)
dest[*doff] = src[off];
break;
@@ -390,7 +390,7 @@
MgErr utf8_is_valid(const uInt8 *src, int32 *offset, int32 length)
{
- MgErr err = noErr;
+ MgErr err = mgNoErr;
while (!err && src[*offset] && (length < 0 || *offset < length))
{
err = utf8_validate_next(src, offset, length, NULL);
@@ -400,7 +400,7 @@
MgErr utf16to8(const uInt16 *src, int32 slen, uInt8 *dest, int32 *offset, int32 length)
{
- MgErr err = noErr;
+ MgErr err = mgNoErr;
int32 soff = 0, doff = offset ? *offset : 0;
uInt32 cp = 0;
while (!err && src[soff] && (slen < 0 || soff < slen))
@@ -421,7 +421,7 @@
MgErr utf8to16(const uInt8 *src, int32 slen, uInt16 *dest, int32 *offset, int32 length)
{
- MgErr err = noErr;
+ MgErr err = mgNoErr;
int32 soff = 0, doff = offset ? *offset : 0;
uInt32 cp = 0;
while (!err && src[soff] && (slen < 0 || soff < slen))
@@ -461,7 +461,7 @@
MgErr utf32to8(const uInt32 *src, int32 slen, uInt8 *dest, int32 *offset, int32 length)
{
- MgErr err = noErr;
+ MgErr err = mgNoErr;
int32 soff = 0, doff = offset ? *offset : 0;
while (!err && src[soff] && (slen < 0 || soff < slen))
{
@@ -474,7 +474,7 @@
MgErr utf8to32(const uInt8 *src, int32 slen, uInt32 *dest, int32 *offset, int32 length)
{
- MgErr err = noErr;
+ MgErr err = mgNoErr;
int32 soff = 0, doff = offset ? *offset : 0;
uInt32 cp = 0;
while (!err && src[soff] && (slen < 0 || soff < slen) && (!dest || doff < length))
Modified: trunk/lvzip/c_source/zip.c
===================================================================
--- trunk/lvzip/c_source/zip.c 2015-04-10 10:11:59 UTC (rev 1506)
+++ trunk/lvzip/c_source/zip.c 2015-04-14 19:25:47 UTC (rev 1507)
@@ -181,7 +181,6 @@
} zip64_internal;
-
#ifndef NOCRYPT
#define INCLUDECRYPTINGCODE_IFCRYPTALLOWED
#include "crypt.h"
@@ -638,7 +637,7 @@
return relativeOffset;
}
-int LoadCentralDirectoryRecord(zip64_internal* pziinit)
+local int LoadCentralDirectoryRecord(zip64_internal* pziinit)
{
int err=ZIP_OK;
ZPOS64_T byte_before_the_zipfile;/* byte before the zipfile, (>0 for sfx)*/
@@ -956,7 +955,7 @@
return zipOpen3(pathname,append,NULL,NULL);
}
-int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
+local int Write_LocalFileHeader(zip64_internal* zi, const char* filename, uInt size_extrafield_local, const void* extrafield_local)
{
/* write the local header */
int err;
@@ -1753,7 +1752,7 @@
return zipCloseFileInZipRaw (file,0,0);
}
-int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
+local int Write_Zip64EndOfCentralDirectoryLocator(zip64_internal* zi, ZPOS64_T zip64eocd_pos_inzip)
{
int err = ZIP_OK;
ZPOS64_T pos = zip64eocd_pos_inzip - zi->add_position_when_writting_offset;
@@ -1775,7 +1774,7 @@
return err;
}
-int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
+local int Write_Zip64EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
int err = ZIP_OK;
@@ -1814,7 +1813,8 @@
}
return err;
}
-int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
+
+local int Write_EndOfCentralDirectoryRecord(zip64_internal* zi, uLong size_centraldir, ZPOS64_T centraldir_pos_inzip)
{
int err = ZIP_OK;
@@ -1862,7 +1862,7 @@
return err;
}
-int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
+local int Write_GlobalComment(zip64_internal* zi, const char* global_comment)
{
int err = ZIP_OK;
uInt size_global_comment = 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-04-14 21:38:08
|
Revision: 1509
http://sourceforge.net/p/opengtoolkit/svn/1509
Author: labviewer
Date: 2015-04-14 21:38:01 +0000 (Tue, 14 Apr 2015)
Log Message:
-----------
More MacOS X changes
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 2015-04-14 20:44:01 UTC (rev 1508)
+++ trunk/lvzip/c_source/lvutil.c 2015-04-14 21:38:01 UTC (rev 1509)
@@ -382,10 +382,10 @@
LStrHandle comment)
{
MgErr err = mgNoErr;
-#if MacOS
-#if !MacOSX
+#if MacOSX
+ FInfoRec64 infoRec;
+#elif MacOS
FSRef ref;
-#endif
#elif Win32
LStrPtr lstr;
HANDLE handle = NULL;
@@ -404,11 +404,37 @@
#if MacOSX
if (write)
{
- err = FSetInfo(path, fileInfo);
+ infoRec.creator = fileInfo->creator;
+ infoRec.type = fileInfo->type;
+ infoRec.permissions = 0;
+ infoRec.size = fileInfo->size;
+ infoRec.rfSize = fileInfo->rfSize;
+ infoRec.cdate = fileInfo->cDate;
+ infoRec.mdate = fileInfo->mDate;
+ infoRec.folder = *isDirectory;
+ infoRec.isInvisible = fileInfo->flags & kFIsInvisible;
+ infoRec.location.v = fileInfo->location.v;
+ infoRec.location.h = fileInfo->location.h;
+ infoRec.owner[0] = 0;
+ infoRec.group[0] = 0;
+ err = FSetInfo64(path, &infoRec);
}
else
{
- err = FGetInfo(path, fileInfo);
+ err = FGetInfo64(path, &infoRec, kFGetInfoAll);
+ if (!err)
+ {
+ fileInfo->creator = infoRec.creator;
+ fileInfo->type = infoRec.type;
+ fileInfo->size = infoRec.size;
+ fileInfo->rfSize = infoRec.rfSize;
+ fileInfo->cDate = infoRec.cdate;
+ fileInfo->mDate = infoRec.mdate;
+ *isDirectory = infoRec.folder;
+ fileInfo->flags = infoRec.isInvisible ? kFIsInvisible : 0;
+ fileInfo->location.v = infoRec.location.v;
+ fileInfo->location.h = infoRec.location.h;
+ }
}
#elif MacOS
err = FSMakePathRef(path, &ref);
@@ -1021,7 +1047,7 @@
if (0 == ioRefNum)
return mgArgErr;
#if MacOSX
- return OSErrToLVErr(FSGetForkPosition(ioRefNum, tell));
+ return OSErrToLVErr(FSGetForkPosition(ioRefNum, &tell->q));
#elif Unix
errno = 0;
tell->q = ftello64(ioRefNum);
@@ -1584,7 +1610,7 @@
}
/* Converts a Unix style path to a LabVIEW platform path */
-LibAPI(MgErr) ConvertCPath(ConstCStr src, int32 srclen, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed)
+LibAPI(MgErr) ConvertCPath(ConstCStr src, int32 srclen, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed, LVBoolean isDir)
{
MgErr err = mgNotSupported;
#if Win32
@@ -1707,7 +1733,7 @@
#endif
/* Converts a LabVIEW platform path to Unix style path */
-LibAPI(MgErr) ConvertLPath(const LStrHandle src, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed)
+LibAPI(MgErr) ConvertLPath(const LStrHandle src, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed, LVBoolean isDir)
{
MgErr err = mgNotSupported;
#if Win32
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2015-04-14 20:44:01 UTC (rev 1508)
+++ trunk/lvzip/c_source/lvutil.h 2015-04-14 21:38:01 UTC (rev 1509)
@@ -441,7 +441,9 @@
enum { fAbsPath, fRelPath, fNotAPath, fUNCPath, nPathTypes}; /* path type codes */
Private(File);
-PrivateH(Path);
+typedef struct PATHREF PathRef;
+typedef PathRef* Path;
+typedef const PathRef* ConstPath;
typedef MagicCookie LVRefNum;
#define kNotARefNum ((LVRefNum)0L) /* canonical invalid magic cookie */
@@ -459,7 +461,7 @@
MgErr FDisposeRefNum(LVRefNum);
MgErr FRefNumToFD(LVRefNum, File*);
MgErr FGetInfo(ConstPath path, FInfoPtr infop);
-MgErr FGetInfo64(ConstPath path, FInfo64Ptr infop, FGetInfoWhich which));
+MgErr FGetInfo64(ConstPath path, FInfo64Ptr infop, FGetInfoWhich which);
MgErr FSetInfo(ConstPath path, FInfoPtr infop);
MgErr FSetInfo64(ConstPath path, FInfo64Ptr infop);
@@ -546,9 +548,9 @@
LibAPI(MgErr) WideStringToMultiByte(const UStrHandle src, LStrHandle *dest, uInt32 codePage, char defaultChar, LVBoolean *defaultCharWasUsed);
LibAPI(MgErr) ConvertCString(ConstCStr src, int32 srclen, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed);
-LibAPI(MgErr) ConvertCPath(ConstCStr src, int32 srclen, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed);
+LibAPI(MgErr) ConvertCPath(ConstCStr src, int32 srclen, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed, LVBoolean isDir);
LibAPI(MgErr) ConvertLString(const LStrHandle src, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed);
-LibAPI(MgErr) ConvertLPath(const LStrHandle src, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed);
+LibAPI(MgErr) ConvertLPath(const LStrHandle src, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed, LVBoolean isDir);
#ifdef __cplusplus
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-04-25 21:49:06
|
Revision: 1510
http://sourceforge.net/p/opengtoolkit/svn/1510
Author: labviewer
Date: 2015-04-25 21:49:03 +0000 (Sat, 25 Apr 2015)
Log Message:
-----------
Fix some more Mac compile errors
Modified Paths:
--------------
trunk/lvzip/c_source/lvutil.c
trunk/lvzip/c_source/lvutil.h
trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj
trunk/lvzip/c_source/utf.c
trunk/lvzip/c_source/utf.h
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2015-04-14 21:38:01 UTC (rev 1509)
+++ trunk/lvzip/c_source/lvutil.c 2015-04-25 21:49:03 UTC (rev 1510)
@@ -49,6 +49,7 @@
#elif MacOSX
#include <CoreFoundation/CoreFoundation.h>
#include "MacBinaryIII.h"
+ #include <sys/stat.h>
#define MacSpec FSRef
#define MacIsInvisible(cpb) ((cpb).hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible)
@@ -192,7 +193,8 @@
}
return fIOErr; /* fIOErr generally signifies some unknown file error */
}
-#elif Unix || Win32
+#endif
+
static int32 MakePathDSString(Path path, LStrPtr *lstr, int32 reserve)
{
int32 pathLen = -1;
@@ -329,7 +331,6 @@
return fIOErr; /* fIOErr generally signifies some unknown file error */
}
-#endif
#endif
LibAPI(void) DLLVersion(uChar* version)
@@ -383,7 +384,7 @@
{
MgErr err = mgNoErr;
#if MacOSX
- FInfoRec64 infoRec;
+ FInfoRec infoRec;
#elif MacOS
FSRef ref;
#elif Win32
@@ -417,11 +418,11 @@
infoRec.location.h = fileInfo->location.h;
infoRec.owner[0] = 0;
infoRec.group[0] = 0;
- err = FSetInfo64(path, &infoRec);
+ err = FSetInfo(path, &infoRec);
}
else
{
- err = FGetInfo64(path, &infoRec, kFGetInfoAll);
+ err = FGetInfo(path, &infoRec /*, kFGetInfoAll*/);
if (!err)
{
fileInfo->creator = infoRec.creator;
@@ -705,7 +706,7 @@
LibAPI(MgErr) LVPath_EncodeMacbinary(Path srcPath, Path dstPath)
{
-#if MacOS
+#if MacOS && !MacOSX
MacSpec srcFSSpec;
MacSpec dstFSSpec;
MgErr err;
@@ -727,7 +728,7 @@
LibAPI(MgErr) LVPath_DecodeMacbinary(Path srcPath, Path dstPath)
{
-#if MacOS
+#if MacOS && !MacOSX
MacSpec srcFSSpec;
MacSpec dstFSSpec;
MgErr err;
@@ -1186,6 +1187,7 @@
FSRef ref;
HFSUniStr255 forkName;
int8 perm;
+ struct stat statbuf;
char theMode[4];
OSErr ret;
#elif Win32
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2015-04-14 21:38:01 UTC (rev 1509)
+++ trunk/lvzip/c_source/lvutil.h 2015-04-25 21:49:03 UTC (rev 1510)
@@ -4,6 +4,7 @@
Copyright (C) 2002-2007 Rolf Kalbermatter
*/
+#define test
#ifndef _lvUtil_H
#define _lvUtil_H
@@ -13,25 +14,86 @@
extern "C" {
#endif
+ /* Possible values for ProcessorType */
+#define kM68000 1 /* OBSOLETE */
+#define kX86 2
+#define kSparc 3
+#define kPPC 4
+#define kPARISC 5
+#define kMIPS 6
+#define kDECAlpha 7 /* OBSOLETE */
+#define kPIC 8
+#define kARM 9
+#define kX64 10
+
#if defined(macintosh) || defined(__PPCC__) || defined(THINK_C) || defined(__SC__) || defined(__MWERKS__) || defined(__APPLE_CC__)
- #define MacOS 1
#ifdef __APPLE_CC__
#define MacOSX 1
#endif
- #if defined(__i386__)
+ #if defined(__powerc) || defined(__ppc__)
+ #define ProcessorType kPPC
+ #define BigEndian 1
+ #elif defined(__i386__)
+ #define ProcessorType kX86
#define BigEndian 0
+ #elif defined(__x86_64)
+ #define ProcessorType kX64
+ #define BigEndian 0
#else
+ #define ProcessorType kM68000
#define BigEndian 1
#endif
+ #define MacOS 1
+ #ifdef __APPLE_CC__
+ #define MacOSX 1
+ #endif
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN32_WCE)
+ #ifdef _M_PPC
+ #define ProcessorType kPPC
+ #elif defined(_M_IX86)
+ #define ProcessorType kX86
+ #elif defined(_M_X64)
+ #define ProcessorType kX64
+ #elif defined(_M_ALPHA)
+ #define ProcessorType kDECAlpha
+ #elif Compiler == kBorlandC
+ #define ProcessorType kX86
+ #elif defined(_ARM_)
+ #define ProcessorType kARM
+ #else
+ #error "We don't know the ProcessorType architecture"
+ #endif
#define Win32 1
#if defined(_DEBUG) || defined(_CVI_DEBUG_)
#define DEBUG 1
#endif
#define BigEndian 0
-#elif defined(linux)
+#elif defined(linux) || defined(__linux) || defined(__linux__)
+ #if defined(i386)
+ #define ProcessorType kX86
+ #define BigEndian 0
+ #elif defined(__alpha)
+ #define ProcessorType kDECAlpha
+ #define BigEndian 0
+ #elif defined(powerpc)
+ #define ProcessorType kPPC
+ #define BigEndian 1
+ #elif defined(sparc)
+ #define ProcessorType kSparc
+ #define BigEndian 1
+ #elif defined(mips)
+ #define ProcessorType kMIPS
+ #define BigEndian 1
+ #elif defined(arm) || defined(__arm__)
+ #define ProcessorType kARM
+ #define BigEndian 0
+ #elif defined(__x86_64__)
+ #define ProcessorType kX64
+ #define BigEndian 0
+ #else
+ #error "Unknown Linux platform"
+ #endif
#define Unix 1
- #define BigEndian 0
#define HAVE_FCNTL
#define HAVE_ICONV
#define HAVE_WCRTOMB
@@ -39,8 +101,10 @@
#define Unix 1
#define VxWorks 1
#if defined (__ppc)
+ #define ProcessorType kPPC
#define BigEndian 1
#else
+ #define ProcessorType kX86
#define BigEndian 0
#endif
#else
@@ -514,11 +578,7 @@
#endif
} FileOffset;
-LibAPI(MgErr) LVFile_OpenFile(LVRefNum *refnum,
- Path path,
- uInt8 rsrc,
- uInt32 openMode,
- uInt32 denyMode);
+LibAPI(MgErr) LVFile_OpenFile(LVRefNum *refnum, Path path, uInt8 rsrc, uInt32 openMode, uInt32 denyMode);
LibAPI(MgErr) LVFile_CloseFile(LVRefNum *refnum);
LibAPI(MgErr) LVFile_GetSize(LVRefNum *refnum, FileOffset *size);
LibAPI(MgErr) LVFile_SetSize(LVRefNum *refnum, FileOffset *size);
Modified: trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj
===================================================================
--- trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2015-04-14 21:38:01 UTC (rev 1509)
+++ trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2015-04-25 21:49:03 UTC (rev 1510)
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 42;
+ objectVersion = 44;
objects = {
/* Begin PBXBuildFile section */
@@ -29,7 +29,6 @@
839542DD0894F2490020C3E2 /* zlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 839542A60894F2490020C3E2 /* zlib.h */; };
839542DF0894F2490020C3E2 /* zip.h in Headers */ = {isa = PBXBuildFile; fileRef = 839542A80894F2490020C3E2 /* zip.h */; };
839542E00894F2490020C3E2 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 839542A90894F2490020C3E2 /* zip.c */; };
- 839542E10894F2490020C3E2 /* zconf.in.h in Headers */ = {isa = PBXBuildFile; fileRef = 839542AA0894F2490020C3E2 /* zconf.in.h */; };
839542E20894F2490020C3E2 /* zconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 839542AB0894F2490020C3E2 /* zconf.h */; };
839542E30894F2490020C3E2 /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = 839542AC0894F2490020C3E2 /* unzip.h */; };
839542E40894F2490020C3E2 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 839542AD0894F2490020C3E2 /* unzip.c */; };
@@ -46,8 +45,6 @@
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 */; };
- C77CC6BF0C9C7D3200886AB2 /* liblvexports.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C77CC6BE0C9C7D3200886AB2 /* liblvexports.a */; };
- C77CC6C20C9C7D6500886AB2 /* liblabviewcin.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C77CC6C10C9C7D6500886AB2 /* liblabviewcin.a */; };
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 */
@@ -75,7 +72,6 @@
839542A60894F2490020C3E2 /* zlib.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = zlib.h; sourceTree = "<group>"; };
839542A80894F2490020C3E2 /* zip.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = zip.h; sourceTree = "<group>"; };
839542A90894F2490020C3E2 /* zip.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = zip.c; sourceTree = "<group>"; };
- 839542AA0894F2490020C3E2 /* zconf.in.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = zconf.in.h; sourceTree = "<group>"; };
839542AB0894F2490020C3E2 /* zconf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = zconf.h; sourceTree = "<group>"; };
839542AC0894F2490020C3E2 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = "<group>"; };
839542AD0894F2490020C3E2 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = unzip.c; sourceTree = "<group>"; };
@@ -93,8 +89,6 @@
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>"; };
- C77CC6BE0C9C7D3200886AB2 /* liblvexports.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblvexports.a; path = "/Applications/National Instruments/LabVIEW 8.2/cintools/Mach-O/liblvexports.a"; sourceTree = "<absolute>"; };
- C77CC6C10C9C7D6500886AB2 /* liblabviewcin.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = liblabviewcin.a; path = "/Applications/National Instruments/LabVIEW 8.2/cintools/Mach-O/liblabviewcin.a"; sourceTree = "<absolute>"; };
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 */
@@ -106,8 +100,6 @@
files = (
83D3E26D080D117700DE332C /* Carbon.framework in Frameworks */,
836583B4088D13980083EC20 /* System.framework in Frameworks */,
- C77CC6BF0C9C7D3200886AB2 /* liblvexports.a in Frameworks */,
- C77CC6C20C9C7D6500886AB2 /* liblabviewcin.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -119,8 +111,6 @@
children = (
C79368AA0C9ED687006083BF /* iomem.c */,
C79368AB0C9ED687006083BF /* iomem.h */,
- C77CC6C10C9C7D6500886AB2 /* liblabviewcin.a */,
- C77CC6BE0C9C7D3200886AB2 /* liblvexports.a */,
83D3E1B5080D116E00DE332C /* zlib Sources */,
83D3E26B080D117700DE332C /* Frameworks */,
83D3E19A080D116E00DE332C /* Products */,
@@ -162,7 +152,6 @@
839542A60894F2490020C3E2 /* zlib.h */,
839542A80894F2490020C3E2 /* zip.h */,
839542A90894F2490020C3E2 /* zip.c */,
- 839542AA0894F2490020C3E2 /* zconf.in.h */,
839542AB0894F2490020C3E2 /* zconf.h */,
839542AC0894F2490020C3E2 /* unzip.h */,
839542AD0894F2490020C3E2 /* unzip.c */,
@@ -207,7 +196,6 @@
839542DB0894F2490020C3E2 /* inftrees.h in Headers */,
839542DD0894F2490020C3E2 /* zlib.h in Headers */,
839542DF0894F2490020C3E2 /* zip.h in Headers */,
- 839542E10894F2490020C3E2 /* zconf.in.h in Headers */,
839542E20894F2490020C3E2 /* zconf.h in Headers */,
839542E30894F2490020C3E2 /* unzip.h in Headers */,
839542E60894F2490020C3E2 /* trees.h in Headers */,
@@ -306,7 +294,7 @@
C77CC6B50C9C7C6500886AB2 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
COPY_PHASE_STRIP = NO;
GCC_ALTIVEC_EXTENSIONS = NO;
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
@@ -325,12 +313,7 @@
GCC_WARN_UNUSED_PARAMETER = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
- LIBRARY_SEARCH_PATHS = (
- "$(LIBRARY_SEARCH_PATHS_QUOTED_1)",
- "$(LIBRARY_SEARCH_PATHS_QUOTED_2)",
- );
- LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SYSTEM_APPS_DIR)/National Instruments/LabVIEW 2009/cintools/Mach-O\"";
- LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SYSTEM_APPS_DIR)/National Instruments/LabVIEW 2009/cintools/Mach-O\"";
+ LIBRARY_SEARCH_PATHS = "$(SYSTEM_APPS_DIR)/National\\ Instruments/LabVIEW\\ 2014/cintools/Mach-O";
LIBRARY_STYLE = DYNAMIC;
MACH_O_TYPE = mh_dylib;
MACOSX_DEPLOYMENT_TARGET = 10.8;
@@ -338,12 +321,13 @@
OTHER_LDFLAGS = (
"-multiply_defined",
warning,
+ "-llvexports",
);
OTHER_REZFLAGS = "";
PRODUCT_NAME = lvzlib;
REZ_SCRIPT_TYPE = Roman;
REZ_SUPPRESS_REDECLARED_RESOURCE_TYPE_WARNINGS = NO;
- SDKROOT = macosx10.9;
+ SDKROOT = macosx10.8;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
"-Wmost",
@@ -357,7 +341,7 @@
C77CC6B60C9C7C6500886AB2 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
COPY_PHASE_STRIP = YES;
GCC_ALTIVEC_EXTENSIONS = NO;
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
@@ -373,12 +357,7 @@
GCC_WARN_UNUSED_PARAMETER = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
- LIBRARY_SEARCH_PATHS = (
- "$(LIBRARY_SEARCH_PATHS_QUOTED_1)",
- "$(LIBRARY_SEARCH_PATHS_QUOTED_2)",
- );
- LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SYSTEM_APPS_DIR)/National Instruments/LabVIEW 2009/cintools/Mach-O\"";
- LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SYSTEM_APPS_DIR)/National Instruments/LabVIEW 2009/cintools/Mach-O\"";
+ LIBRARY_SEARCH_PATHS = "$(SYSTEM_APPS_DIR)/National\\ Instruments/LabVIEW\\ 2014/cintools/Mach-O";
LIBRARY_STYLE = DYNAMIC;
MACH_O_TYPE = mh_dylib;
MACOSX_DEPLOYMENT_TARGET = 10.8;
@@ -386,12 +365,13 @@
OTHER_LDFLAGS = (
"-multiply_defined",
warning,
+ "-llvexports",
);
OTHER_REZFLAGS = "";
PRODUCT_NAME = lvzlib;
REZ_SCRIPT_TYPE = Roman;
REZ_SUPPRESS_REDECLARED_RESOURCE_TYPE_WARNINGS = NO;
- SDKROOT = macosx10.9;
+ SDKROOT = macosx10.8;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
"-Wmost",
@@ -405,7 +385,7 @@
C77CC6B70C9C7C6500886AB2 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
GCC_ALTIVEC_EXTENSIONS = NO;
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
GCC_ENABLE_CPP_EXCEPTIONS = NO;
@@ -419,12 +399,7 @@
GCC_WARN_UNUSED_PARAMETER = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
- LIBRARY_SEARCH_PATHS = (
- "$(LIBRARY_SEARCH_PATHS_QUOTED_1)",
- "$(LIBRARY_SEARCH_PATHS_QUOTED_2)",
- );
- LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SYSTEM_APPS_DIR)/National Instruments/LabVIEW 2009/cintools/Mach-O\"";
- LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SYSTEM_APPS_DIR)/National Instruments/LabVIEW 2009/cintools/Mach-O\"";
+ LIBRARY_SEARCH_PATHS = "$(SYSTEM_APPS_DIR)/National\\ Instruments/LabVIEW\\ 2014/cintools/Mach-O";
LIBRARY_STYLE = DYNAMIC;
MACH_O_TYPE = mh_dylib;
MACOSX_DEPLOYMENT_TARGET = 10.8;
@@ -432,12 +407,13 @@
OTHER_LDFLAGS = (
"-multiply_defined",
warning,
+ "-llvexports",
);
OTHER_REZFLAGS = "";
PRODUCT_NAME = lvzlib;
REZ_SCRIPT_TYPE = Roman;
REZ_SUPPRESS_REDECLARED_RESOURCE_TYPE_WARNINGS = NO;
- SDKROOT = macosx10.9;
+ SDKROOT = macosx10.8;
SECTORDER_FLAGS = "";
WARNING_CFLAGS = (
"-Wmost",
@@ -450,18 +426,59 @@
C77CC6B90C9C7C6500886AB2 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ "ADDITIONAL_SDKS[arch=i386]" = "";
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ GCC_CHAR_IS_UNSIGNED_CHAR = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+ "/Applications/National\\ Instruments/LabVIEW\\ 2014/cintools",
+ );
+ LD_DYLIB_INSTALL_NAME = lvzlib.framework;
+ LIBRARY_SEARCH_PATHS = "/Application/National\\ Instruments/LabVIEW\\ 2014/cintools";
+ MACH_O_TYPE = mh_dylib;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ ONLY_ACTIVE_ARCH = NO;
+ SDKROOT = macosx10.8;
};
name = Development;
};
C77CC6BA0C9C7C6500886AB2 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ GCC_CHAR_IS_UNSIGNED_CHAR = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+ "/Applications/National\\ Instruments/LabVIEW\\ 2014/cintools",
+ );
+ LD_DYLIB_INSTALL_NAME = lvzlib.framework;
+ LIBRARY_SEARCH_PATHS = "/Application/National\\ Instruments/LabVIEW\\ 2014/cintools";
+ MACH_O_TYPE = mh_dylib;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ ONLY_ACTIVE_ARCH = NO;
+ SDKROOT = macosx10.8;
};
name = Deployment;
};
C77CC6BB0C9C7C6500886AB2 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ "ADDITIONAL_SDKS[arch=*]" = "";
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ GCC_CHAR_IS_UNSIGNED_CHAR = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
+ "/Applications/National\\ Instruments/LabVIEW\\ 2014/cintools",
+ );
+ LD_DYLIB_INSTALL_NAME = lvzlib.framework;
+ LIBRARY_SEARCH_PATHS = "/Application/National\\ Instruments/LabVIEW\\ 2014/cintools";
+ MACH_O_TYPE = mh_dylib;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ ONLY_ACTIVE_ARCH = NO;
+ SDKROOT = macosx10.8;
};
name = Default;
};
Modified: trunk/lvzip/c_source/utf.c
===================================================================
--- trunk/lvzip/c_source/utf.c 2015-04-14 21:38:01 UTC (rev 1509)
+++ trunk/lvzip/c_source/utf.c 2015-04-25 21:49:03 UTC (rev 1510)
@@ -16,42 +16,49 @@
// Maximum valid value for a Unicode code point
#define CODE_POINT_MAX 0x0010ffffu
-__inline uInt8 utf8_mask(uInt8 oc)
+static MgErr utf8_is_valid(const uInt8 *src, int32 *offset, int32 length);
+static MgErr utf8_replace_invalid(const uInt8 *src, int32 *soff, int32 slen, uInt8 *dest, int32 *doff, int32 dlen, uInt32 replacement);
+static MgErr utf8_advance(const uInt8 *src, int32 *offset, int32 length, int32 distance);
+static MgErr utf8_distance(const uInt8 *src, int32 *offset, int32 length);
+
+static uInt8 utf8_mask(uInt8 oc)
{
return (uInt8)(0xff & oc);
}
-__inline uInt16 utf16_mask(uInt16 oc)
+static uInt16 utf16_mask(uInt16 oc)
{
return (uInt16)(0xffff & oc);
}
-__inline LVBoolean utf8_is_trail(uInt8 oc)
+static LVBoolean utf8_is_trail(uInt8 oc)
{
return ((utf8_mask(oc) >> 6) == 0x2);
}
-__inline LVBoolean utf16_is_lead_surrogate(uInt16 cp)
+static LVBoolean utf16_is_lead_surrogate(uInt16 cp)
{
return (LVBoolean)(cp >= LEAD_SURROGATE_MIN && cp <= LEAD_SURROGATE_MAX);
}
-__inline LVBoolean utf16_is_trail_surrogate(uInt16 cp)
+/*
+static LVBoolean utf16_is_trail_surrogate(uInt16 cp)
{
return (LVBoolean)(cp >= TRAIL_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
}
+*/
-__inline LVBoolean utf32_is_surrogate(uInt32 cp)
+static LVBoolean utf32_is_surrogate(uInt32 cp)
{
return (LVBoolean)(cp >= LEAD_SURROGATE_MIN && cp <= TRAIL_SURROGATE_MAX);
}
-__inline LVBoolean utf32_is_code_point_valid(uInt32 cp)
+static LVBoolean utf32_is_code_point_valid(uInt32 cp)
{
return (LVBoolean)(cp <= CODE_POINT_MAX && !utf32_is_surrogate(cp));
}
-__inline int32 utf8_sequence_length(uInt8 oc)
+static int32 utf8_sequence_length(uInt8 oc)
{
uInt8 lead = utf8_mask(oc);
if (lead < 0x80)
@@ -65,7 +72,7 @@
return 0;
}
-__inline LVBoolean utf32_is_overlong_sequence(uInt32 cp, int32 length)
+static LVBoolean utf32_is_overlong_sequence(uInt32 cp, int32 length)
{
if (cp < 0x80)
{
@@ -355,7 +362,7 @@
return err;
}
-MgErr utf8_replace_invalid(const uInt8 *src, int32 *soff, int32 slen, uInt8 *dest, int32 *doff, int32 dlen, uInt32 replacement)
+static MgErr utf8_replace_invalid(const uInt8 *src, int32 *soff, int32 slen, uInt8 *dest, int32 *doff, int32 dlen, uInt32 replacement)
{
MgErr err = mgNoErr;
while (src[*soff] && (slen < 0 || *soff < slen))
@@ -388,7 +395,7 @@
return err;
}
-MgErr utf8_is_valid(const uInt8 *src, int32 *offset, int32 length)
+static MgErr utf8_is_valid(const uInt8 *src, int32 *offset, int32 length)
{
MgErr err = mgNoErr;
while (!err && src[*offset] && (length < 0 || *offset < length))
@@ -512,15 +519,16 @@
#endif
}
+static wchar_t testchar = 0x00B0;
+
LibAPI(LVBoolean) utf8_is_current_mbcs()
{
- static wchar_t test = 0x00B0;
LVBoolean is_utf8 = LV_FALSE;
char *result = malloc(MB_CUR_MAX);
if (result)
{
- int len = wctomb(NULL, test);
- len = wctomb(result, test);
+ int len = wctomb(NULL, testchar);
+ len = wctomb(result, testchar);
if ((len == 2) && (result[0] == (char)0xC2) && (result[1] == (char)0xB0))
is_utf8 = LV_TRUE;
free(result);
Modified: trunk/lvzip/c_source/utf.h
===================================================================
--- trunk/lvzip/c_source/utf.h 2015-04-14 21:38:01 UTC (rev 1509)
+++ trunk/lvzip/c_source/utf.h 2015-04-25 21:49:03 UTC (rev 1510)
@@ -9,7 +9,7 @@
extern "C" {
#endif
-LibAPI(LVBoolean) utf8_is_current_mbcs();
+LibAPI(LVBoolean) utf8_is_current_mbcs(void);
MgErr utf8_validate_next(const uInt8 *src, int32 *offset, int32 length, uInt32 *code_point);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-01 20:27:05
|
Revision: 1511
http://sourceforge.net/p/opengtoolkit/svn/1511
Author: labviewer
Date: 2015-05-01 20:27:03 +0000 (Fri, 01 May 2015)
Log Message:
-----------
Fix some errors
Modified Paths:
--------------
trunk/lvzip/c_source/lvapi.c
trunk/lvzip/c_source/lvutil.c
trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj
trunk/lvzip/c_source/zip.h
Added Paths:
-----------
trunk/lvzip/c_source/lvapi.h
Modified: trunk/lvzip/c_source/lvapi.c
===================================================================
--- trunk/lvzip/c_source/lvapi.c 2015-04-25 21:49:03 UTC (rev 1510)
+++ trunk/lvzip/c_source/lvapi.c 2015-05-01 20:27:03 UTC (rev 1511)
@@ -4,6 +4,7 @@
#include "zip.h"
#include "unzip.h"
#include <string.h>
+#include "lvapi.h"
#ifndef VERSIONMADEBY
# define VERSIONMADEBY (0x0) /* platform depedent */
@@ -231,12 +232,11 @@
{
zipFile node;
MgErr err = lvzlibGetRefnum(refnum, &node, ZipMagic);
- if(!err)
+ if (!err)
{
int retval = zipWriteInFileInZip(node, LStrBuf(*buffer), LStrLen(*buffer));
if (retval < 0)
return LibToMgErr(retval);
- LStrLen(*buffer) = retval;
}
return err;
}
@@ -271,7 +271,10 @@
{
int retval;
LStrHandle comment = NULL;
- if (globalComment && LStrLen(*globalComment) > 0)
+
+ *refnum = kNotARefNum;
+
+ if (globalComment && LStrLen(*globalComment) > 0)
{
err = ConvertLString(globalComment, CP_ACP, &comment, CP_OEMCP, 0, NULL);
if (err)
Added: trunk/lvzip/c_source/lvapi.h
===================================================================
--- trunk/lvzip/c_source/lvapi.h (rev 0)
+++ trunk/lvzip/c_source/lvapi.h 2015-05-01 20:27:03 UTC (rev 1511)
@@ -0,0 +1,46 @@
+//
+// lvapi.h
+// lvzip
+//
+// Created by imac on 01-05-15.
+//
+//
+
+#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(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 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);
+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_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_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);
+LibAPI(MgErr) lvzlib_unzGetLocalExtrafield(LVRefNum *refnum, LStrHandle *extra);
+LibAPI(MgErr) lvzlib_unzReadCurrentFile(LVRefNum *refnum, LStrHandle buffer);
+LibAPI(MgErr) lvzlib_unzCloseCurrentFile(LVRefNum *refnum);
+LibAPI(MgErr) lvzlib_unzGoToFirstFile(LVRefNum *refnum);
+LibAPI(MgErr) lvzlib_unzGoToNextFile(LVRefNum *refnum);
+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);
+LibAPI(MgErr) lvzlib_unzGetFilePos64(LVRefNum *refnum, unz64_file_pos *pos);
+
+
+#endif
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2015-04-25 21:49:03 UTC (rev 1510)
+++ trunk/lvzip/c_source/lvutil.c 2015-05-01 20:27:03 UTC (rev 1511)
@@ -72,10 +72,9 @@
if (!posixPath)
return mgArgErr;
- if (*posixPath)
- LStrLen(**posixPath) = 0;
-
fileRef = CFStringCreateWithBytes(kCFAllocatorDefault, LStrBuf(*hfsPath), LStrLen(*hfsPath), encoding, false);
+ if (*posixPath)
+ LStrLen(**posixPath) = 0;
if (!fileRef)
{
return mFullErr;
@@ -759,7 +758,7 @@
{
err = FPathToText(path, **str);
LStrLen(**str) = pathLen;
-#if MacOSX
+#if MacOSX && (ProcessorType == kX86)
if (!err)
err = ConvertToPosixPath(*str, str, false);
#endif
@@ -1081,7 +1080,7 @@
if (0 == ioRefNum)
return mgArgErr;
#if MacOSX
- err = FSRead(ioRefNum, (int32*)&inCount, buffer);
+ err = FMRead(ioRefNum, (int32*)&inCount, buffer);
if (outCount)
{
if (err && err != eofErr)
@@ -1144,7 +1143,7 @@
if (0 == ioRefNum)
return mgArgErr;
#if MacOSX
- err = FSWrite(ioRefNum, (int32*)&inCount, buffer);
+ err = FMWrite(ioRefNum, (int32*)&inCount, buffer);
if (outCount)
{
if (err && err != dskFulErr)
Modified: trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj
===================================================================
--- trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2015-04-25 21:49:03 UTC (rev 1510)
+++ trunk/lvzip/c_source/lvzip.xcodeproj/project.pbxproj 2015-05-01 20:27:03 UTC (rev 1511)
@@ -86,6 +86,7 @@
839542BA0894F2490020C3E2 /* adler32.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = adler32.c; sourceTree = "<group>"; };
83D3E1AF080D116E00DE332C /* lvzlib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = lvzlib.framework; sourceTree = BUILT_PRODUCTS_DIR; };
83D3E26C080D117700DE332C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+ 88521A381AF4145000A9CDF7 /* lvapi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lvapi.h; sourceTree = "<group>"; };
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>"; };
@@ -128,6 +129,7 @@
83D3E1B5080D116E00DE332C /* zlib Sources */ = {
isa = PBXGroup;
children = (
+ 88521A381AF4145000A9CDF7 /* lvapi.h */,
888E743D1ADD96D700C5AEFE /* lvapi.c */,
888E743B1ADD96C200C5AEFE /* utf.h */,
888E74391ADD96A900C5AEFE /* utf.c */,
@@ -294,7 +296,7 @@
C77CC6B50C9C7C6500886AB2 /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COPY_PHASE_STRIP = NO;
GCC_ALTIVEC_EXTENSIONS = NO;
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
@@ -341,7 +343,7 @@
C77CC6B60C9C7C6500886AB2 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COPY_PHASE_STRIP = YES;
GCC_ALTIVEC_EXTENSIONS = NO;
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
@@ -385,7 +387,7 @@
C77CC6B70C9C7C6500886AB2 /* Default */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_ALTIVEC_EXTENSIONS = NO;
GCC_CHAR_IS_UNSIGNED_CHAR = NO;
GCC_ENABLE_CPP_EXCEPTIONS = NO;
@@ -427,7 +429,7 @@
isa = XCBuildConfiguration;
buildSettings = {
"ADDITIONAL_SDKS[arch=i386]" = "";
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
@@ -446,7 +448,7 @@
C77CC6BA0C9C7C6500886AB2 /* Deployment */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
@@ -466,7 +468,7 @@
isa = XCBuildConfiguration;
buildSettings = {
"ADDITIONAL_SDKS[arch=*]" = "";
- ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_CHAR_IS_UNSIGNED_CHAR = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
Modified: trunk/lvzip/c_source/zip.h
===================================================================
--- trunk/lvzip/c_source/zip.h 2015-04-25 21:49:03 UTC (rev 1510)
+++ trunk/lvzip/c_source/zip.h 2015-05-01 20:27:03 UTC (rev 1511)
@@ -143,6 +143,8 @@
int append,
zipcharpc* globalcomment,
zlib_filefunc64_def* pzlib_filefunc_def));
+
+ZEXTERN zipFile ZEXPORT zipOpen3 (const void *pathname, int append, zipcharpc* globalcomment, zlib_filefunc64_32_def* pzlib_filefunc64_32_def);
ZEXTERN int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
const char* filename,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-01 20:41:57
|
Revision: 1512
http://sourceforge.net/p/opengtoolkit/svn/1512
Author: labviewer
Date: 2015-05-01 20:41:54 +0000 (Fri, 01 May 2015)
Log Message:
-----------
Fix call to LabVIEW file manager functions
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 2015-05-01 20:27:03 UTC (rev 1511)
+++ trunk/lvzip/c_source/lvutil.c 2015-05-01 20:41:54 UTC (rev 1512)
@@ -1068,9 +1068,7 @@
static MgErr lvfile_Read(FileRefNum ioRefNum, uInt32 inCount, uInt32 *outCount, UPtr buffer)
{
-#if MacOSX
- OSErr err;
-#elif Unix
+#if Unix
MgErr err = mgNoErr;
int actCount;
#elif Win32
@@ -1080,19 +1078,7 @@
if (0 == ioRefNum)
return mgArgErr;
#if MacOSX
- err = FMRead(ioRefNum, (int32*)&inCount, buffer);
- if (outCount)
- {
- if (err && err != eofErr)
- {
- *outCount = 0L;
- }
- else
- {
- *outCount = inCount;
- }
- }
- return OSErrToLVErr(err);
+ return FMRead(ioRefNum, inCount, (int32*)&outCount, buffer);
#elif Unix
errno = 0;
actCount = fread((char *)buffer, 1, inCount, ioRefNum);
@@ -1133,9 +1119,7 @@
static MgErr lvfile_Write(FileRefNum ioRefNum, uInt32 inCount, uInt32 *outCount, UPtr buffer)
{
-#if MacOSX
- OSErr err;
-#elif Unix || Win32
+#if Unix || Win32
MgErr err = mgNoErr;
int actCount;
#endif
@@ -1143,19 +1127,7 @@
if (0 == ioRefNum)
return mgArgErr;
#if MacOSX
- err = FMWrite(ioRefNum, (int32*)&inCount, buffer);
- if (outCount)
- {
- if (err && err != dskFulErr)
- {
- *outCount = 0L;
- }
- else
- {
- *outCount = inCount;
- }
- }
- return OSErrToLVErr(err);
+ return FMWrite(ioRefNum, inCount, (int32*)outCount, buffer);
#elif Win32
if (!WriteFile(ioRefNum, buffer, inCount, &actCount, NULL))
err = Win32ToLVFileErr();
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2015-05-01 20:27:03 UTC (rev 1511)
+++ trunk/lvzip/c_source/lvutil.h 2015-05-01 20:41:54 UTC (rev 1512)
@@ -528,6 +528,8 @@
MgErr FGetInfo64(ConstPath path, FInfo64Ptr infop, FGetInfoWhich which);
MgErr FSetInfo(ConstPath path, FInfoPtr infop);
MgErr FSetInfo64(ConstPath path, FInfo64Ptr infop);
+MgErr FMRead(File fd, int32 inCount, int32* outCount, UPtr buffer);
+MgErr FMWrite(File fd, int32 inCount, int32* outCount, UPtr buffer);
int32 DbgPrintf(CStr fmt, ...);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-01 22:54:49
|
Revision: 1514
http://sourceforge.net/p/opengtoolkit/svn/1514
Author: labviewer
Date: 2015-05-01 22:54:47 +0000 (Fri, 01 May 2015)
Log Message:
-----------
Updated project file to include the new lvapi.h file
Modified Paths:
--------------
trunk/lvzip/c_source/lvapi.h
trunk/lvzip/c_source/zlibvc.vcproj
Modified: trunk/lvzip/c_source/lvapi.h
===================================================================
--- trunk/lvzip/c_source/lvapi.h 2015-05-01 20:56:12 UTC (rev 1513)
+++ trunk/lvzip/c_source/lvapi.h 2015-05-01 22:54:47 UTC (rev 1514)
@@ -1,46 +1,38 @@
-//
-// lvapi.h
-// lvzip
-//
-// Created by imac on 01-05-15.
-//
-//
-
-#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(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 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);
-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_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_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);
-LibAPI(MgErr) lvzlib_unzGetLocalExtrafield(LVRefNum *refnum, LStrHandle *extra);
-LibAPI(MgErr) lvzlib_unzReadCurrentFile(LVRefNum *refnum, LStrHandle buffer);
-LibAPI(MgErr) lvzlib_unzCloseCurrentFile(LVRefNum *refnum);
-LibAPI(MgErr) lvzlib_unzGoToFirstFile(LVRefNum *refnum);
-LibAPI(MgErr) lvzlib_unzGoToNextFile(LVRefNum *refnum);
-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);
-LibAPI(MgErr) lvzlib_unzGetFilePos64(LVRefNum *refnum, unz64_file_pos *pos);
-
-
-#endif
+#include "lvutil.h"
+#include "zlib.h"
+#include "zip.h"
+#include "unzip.h"
+
+#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(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 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);
+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_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_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);
+LibAPI(MgErr) lvzlib_unzGetLocalExtrafield(LVRefNum *refnum, LStrHandle *extra);
+LibAPI(MgErr) lvzlib_unzReadCurrentFile(LVRefNum *refnum, LStrHandle buffer);
+LibAPI(MgErr) lvzlib_unzCloseCurrentFile(LVRefNum *refnum);
+LibAPI(MgErr) lvzlib_unzGoToFirstFile(LVRefNum *refnum);
+LibAPI(MgErr) lvzlib_unzGoToNextFile(LVRefNum *refnum);
+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);
+LibAPI(MgErr) lvzlib_unzGetFilePos64(LVRefNum *refnum, unz64_file_pos *pos);
+#endif
Modified: trunk/lvzip/c_source/zlibvc.vcproj
===================================================================
--- trunk/lvzip/c_source/zlibvc.vcproj 2015-05-01 20:56:12 UTC (rev 1513)
+++ trunk/lvzip/c_source/zlibvc.vcproj 2015-05-01 22:54:47 UTC (rev 1514)
@@ -1674,6 +1674,10 @@
>
</File>
<File
+ RelativePath=".\lvapi.h"
+ >
+ </File>
+ <File
RelativePath="lvutil.h"
>
</File>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-02 19:48:54
|
Revision: 1515
http://sourceforge.net/p/opengtoolkit/svn/1515
Author: labviewer
Date: 2015-05-02 19:48:51 +0000 (Sat, 02 May 2015)
Log Message:
-----------
More code cleanup
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 2015-05-01 22:54:47 UTC (rev 1514)
+++ trunk/lvzip/c_source/lvutil.c 2015-05-02 19:48:51 UTC (rev 1515)
@@ -50,18 +50,36 @@
#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
+ #define MacIsInvisible(cpb) ((cpb).hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible)
+ #define MacIsInvFolder(cpb) ((cpb).dirInfo.ioDrUsrWds.frFlags & kIsInvisible)
+ #define MacIsDir(cpb) ((cpb).nodeFlags & ioDirMask)
+ #define MacIsStationery(cpb) ((cpb).hFileInfo.ioFlFndrInfo.fdFlags & kIsStationery)
+ #define MacIsAlias(cpb) ((cpb).hFileInfo.ioFlFndrInfo.fdFlags & kIsAlias)
+ #define kFileChanged (1L<<7)
+ static MgErr OSErrToLVErr(OSErr err);
+ #endif
+#endif
- #define MacSpec FSRef
- #define MacIsInvisible(cpb) ((cpb).hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible)
- #define MacIsInvFolder(cpb) ((cpb).dirInfo.ioDrUsrWds.frFlags & kIsInvisible)
- #define MacIsDir(cpb) ((cpb).nodeFlags & ioDirMask)
- #define MacIsStationery(cpb) ((cpb).hFileInfo.ioFlFndrInfo.fdFlags & kIsStationery)
- #define MacIsAlias(cpb) ((cpb).hFileInfo.ioFlFndrInfo.fdFlags & kIsAlias)
- #define kFileChanged (1L<<7)
- static MgErr OSErrToLVErr(OSErr err);
+#define usesHFSPath MacOS && ProcessorType!=kX64
+#define usesPosixPath Unix || (MacOSX && ProcessorType==kX64)
+#define usesWinPath Win32
+
+#if usesHFSPath
+typedef SInt16 FileRefNum;
+#elif usesPosixPath
+typedef FILE* FileRefNum;
+#elif usesWinPath
+typedef HANDLE FileRefNum;
#endif
-#if MacOSX
+#if MacOS
+#if usesHFSPath
static MgErr ConvertToPosixPath(const LStrHandle hfsPath, LStrHandle *posixPath, Boolean isDir)
{
MgErr err = mFullErr;
@@ -123,19 +141,21 @@
{
LStrHandle str = NULL;
MgErr err = LVPath_ToText(path, &str);
- DEBUGPRINTF(("FPathToText1: path = %z", path));
+ DEBUGPRINTF(((CStr)"FPathToText1: path = %z", path));
if (!err)
{
err = OSErrToLVErr(FSPathMakeRef(LStrBuf(*str), ref, NULL));
if (err)
{
- DEBUGPRINTF(("FSPathMakeRef: err = %ld, len = %ld, path = %s", err, LStrLen(*str), LStrBuf(*str)));
+ DEBUGPRINTF(((CStr)"FSPathMakeRef: err = %ld, len = %ld, path = %s", err, LStrLen(*str), LStrBuf(*str)));
}
DSDisposeHandle((UHandle)str);
}
return err;
}
+#endif
+#if MacOS && !MacOSX
/* Convert a Macintosh UTDDateTime to a LabVIEW timestamp and vice versa */
static void MacConvertFromLVTime(uInt32 lTime, UTCDateTime *mTime)
{
@@ -148,7 +168,9 @@
{
*lTime = mTime->lowSeconds;
}
+#endif
+#if usesHFSPath
static MgErr OSErrToLVErr(OSErr err)
{
switch(err)
@@ -193,24 +215,8 @@
return fIOErr; /* fIOErr generally signifies some unknown file error */
}
#endif
+#endif
-static int32 MakePathDSString(Path path, LStrPtr *lstr, int32 reserve)
-{
- int32 pathLen = -1;
-
- MgErr err = FPathToText(path, (LStrPtr)&pathLen);
- if (!err)
- {
- *lstr = (LStrPtr)DSNewPClr(sizeof(int32) + pathLen + reserve + 1);
- if (!*lstr)
- return mFullErr;
- (*lstr)->cnt = pathLen;
- err = FPathToText(path, *lstr);
- if (err)
- DSDisposePtr((UPtr)*lstr);
- }
- return err;
-}
#if Win32
/* int64 100ns intervals from Jan 1 1601 GMT to Jan 1 1904 GMT */
static const FILETIME dt1904FileTime = {
@@ -283,6 +289,7 @@
#include <string.h>
#include <utime.h>
+#if Unix
/* seconds between Jan 1 1904 GMT and Jan 1 1970 GMT */
#define dt1970re1904 2082844800L
@@ -298,7 +305,9 @@
{
*time = sTime + dt1970re1904;
}
+#endif
+#if usesPosixPath
static MgErr UnixToLVFileErr(void)
{
switch (errno)
@@ -330,7 +339,25 @@
return fIOErr; /* fIOErr generally signifies some unknown file error */
}
+static int32 MakePathDSString(Path path, LStrPtr *lstr, int32 reserve)
+{
+ int32 pathLen = -1;
+
+ MgErr err = FPathToText(path, (LStrPtr)&pathLen);
+ if (!err)
+ {
+ *lstr = (LStrPtr)DSNewPClr(sizeof(int32) + pathLen + reserve + 1);
+ if (!*lstr)
+ return mFullErr;
+ (*lstr)->cnt = pathLen;
+ err = FPathToText(path, *lstr);
+ if (err)
+ DSDisposePtr((UPtr)*lstr);
+ }
+ return err;
+}
#endif
+#endif
LibAPI(void) DLLVersion(uChar* version)
{
@@ -341,16 +368,36 @@
{
MgErr err = mgNoErr;
#if MacOSX
+ LStrHandle lstr = NULL;
+#elif MacOS
FSRef ref;
#else
Unused(path);
#endif
- *hasResFork = 0;
+ if (hasResFork)
+ *hasResFork = 0;
if (sizeLow)
*sizeLow = 0;
if (sizeHigh)
*sizeHigh = 0;
#if 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)
+ {
+ if (hasResFork)
+ *hasResFork = LV_TRUE;
+ if (sizeLow)
+ *sizeLow = Lo32(len);
+ if (sizeHigh)
+ *sizeHigh = Hi32(len);
+
+ }
+ DSDisposeHandle((UHandle)lstr);
+ }
+#elif MacOS
err = FSMakePathRef(path, &ref);
if (!err)
{
@@ -361,10 +408,10 @@
err = OSErrToLVErr(FSGetCatalogInfo(&ref, whichInfo, &catalogInfo, NULL, NULL,NULL));
if (!err && catalogInfo.nodeFlags & kFSNodeIsDirectoryMask)
err = fIOErr;
- if (!err)
+ if (!err && catalogInfo.rsrcLogicalSize > 0)
{
if (hasResFork)
- *hasResFork = catalogInfo.rsrcLogicalSize > 0;
+ *hasResFork = LV_TRUE;
if (sizeLow)
*sizeLow = Lo32(catalogInfo.rsrcLogicalSize);
if (sizeHigh)
@@ -664,9 +711,7 @@
buf.actime = statbuf.st_atime;
buf.modtime = statbuf.st_mtime;
- /* No modification of creation time in Unix?
UnixConvertFromLVTime(fileInfo->cDate, &statbuf.st_ctime);
- */
UnixConvertFromLVTime(fileInfo->mDate, &buf.modtime);
if (utime((const char*)lstr->str, &buf))
err = fIOErr;
@@ -758,7 +803,7 @@
{
err = FPathToText(path, **str);
LStrLen(**str) = pathLen;
-#if MacOSX && (ProcessorType == kX86)
+#if usesHFSPath
if (!err)
err = ConvertToPosixPath(*str, str, false);
#endif
@@ -767,25 +812,17 @@
return err;
}
-#if MacOSX
-#define FileRefNum SInt16
-#elif Unix
-#define FileRefNum FILE*
-#elif Win32
-#define FileRefNum HANDLE
-#endif
-
static MgErr lvfile_CloseFile(FileRefNum ioRefNum)
{
MgErr err = mgNoErr;
-#if MacOSX
+#if usesHFSPath
err = OSErrToLVErr(FSCloseFork(ioRefNum));
-#elif Unix
+#elif usesPosixPath
if (fclose(ioRefNum))
{
err = UnixToLVFileErr();
}
-#elif Win32
+#elif usesWinPath
if (!CloseHandle(ioRefNum))
{
err = Win32ToLVFileErr();
@@ -796,18 +833,18 @@
static MgErr lvfile_GetSize(FileRefNum ioRefNum, FileOffset *size)
{
-#if Unix || Win32
+#if usesPosixPath || usesWinPath
FileOffset tell;
-#if Win32
- MgErr err;
+#if usesWinPath
+ MgErr err;
#endif
#endif
if (0 == ioRefNum)
return mgArgErr;
size->q = 0;
-#if MacOSX
+#if usesHFSPath
return OSErrToLVErr(FSGetForkSize(ioRefNum, &(size->q)));
-#elif Unix
+#elif usesPosixPath
errno = 0;
tell.q = ftello64(ioRefNum);
if (tell.q == - 1)
@@ -827,7 +864,7 @@
{
return UnixToLVFileErr();
}
-#elif Win32
+#elif usesWinPath
tell.q = 0;
tell.l.lo = SetFilePointer(ioRefNum, 0, &tell.l.hi, FILE_CURRENT);
if (tell.l.lo == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
@@ -856,9 +893,9 @@
static MgErr lvfile_SetSize(FileRefNum ioRefNum, FileOffset *size)
{
-#if Unix || Win32
+#if usesPosixPath || usesWinPath
FileOffset tell;
-#if Win32
+#if usesWinPath
MgErr err = mgNoErr;
#endif
#endif
@@ -866,9 +903,9 @@
return mgArgErr;
if (size->q < 0)
return mgArgErr;
-#if MacOSX
+#if usesHFSPath
return OSErrToLVErr(FSSetForkSize(ioRefNum, fsFromStart, size->q));
-#elif Unix
+#elif usesPosixPath
errno = 0;
if (fflush(ioRefNum) != 0)
{
@@ -887,8 +924,8 @@
{
return UnixToLVFileErr();
}
-#elif Win32
- tell.q = 0;
+#elif usesWinPath
+ tell.q = 0;
tell.l.lo = SetFilePointer(ioRefNum, 0, &tell.l.hi, FILE_CURRENT);
if (tell.l.lo == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
{
@@ -924,11 +961,11 @@
static MgErr lvfile_SetFilePos(FileRefNum ioRefNum, FileOffset *offs, uInt16 mode)
{
-#if MacOSX
+#if usesHFSPath
OSErr ret;
-#elif Unix || Win32
+#elif usesPosixPath || usesWinPath
FileOffset size, sought, tell;
-#if Win32
+#if usesWinPath
MgErr err = mgNoErr;
#endif
#endif
@@ -937,7 +974,7 @@
if ((offs->q == 0) && (mode == fCurrent))
return noErr;
-#if MacOSX
+#if usesHFSPath
ret = FSSetForkPosition(ioRefNum, mode, offs->q);
if (ret == posErr)
{
@@ -948,7 +985,7 @@
ret = FSSetForkPosition(ioRefNum, fsFromLEOF, 0);
}
return OSErrToLVErr(ret);
-#elif Unix
+#elif usesPosixPath
errno = 0;
if (mode == fCurrent)
{
@@ -991,7 +1028,7 @@
{
return UnixToLVFileErr();
}
-#elif Win32
+#elif usesWinPath
size.l.lo = GetFileSize(ioRefNum, &size.l.hi);
if (size.l.lo == INVALID_FILE_SIZE && GetLastError() != NO_ERROR)
{
@@ -1046,16 +1083,16 @@
{
if (0 == ioRefNum)
return mgArgErr;
-#if MacOSX
+#if usesHFSPath
return OSErrToLVErr(FSGetForkPosition(ioRefNum, &tell->q));
-#elif Unix
+#elif usesPosixPath
errno = 0;
tell->q = ftello64(ioRefNum);
if (tell->q == -1)
{
return UnixToLVFileErr();
}
-#elif Win32
+#elif usesWinPath
tell->l.hi = 0;
tell->l.lo = SetFilePointer(ioRefNum, 0, &tell->l.hi, FILE_CURRENT);
if (tell->l.lo == INVALID_SET_FILE_POINTER /* && GetLastError() != NO_ERROR */)
@@ -1068,84 +1105,85 @@
static MgErr lvfile_Read(FileRefNum ioRefNum, uInt32 inCount, uInt32 *outCount, UPtr buffer)
{
-#if Unix
- MgErr err = mgNoErr;
+ MgErr err = mgNoErr;
+#if usesPosixPath || usesWinPath
int actCount;
-#elif Win32
- Bool32 readSuccess;
- int actCount;
#endif
- if (0 == ioRefNum)
+
+ if (0 == ioRefNum)
return mgArgErr;
-#if MacOSX
- return FMRead(ioRefNum, inCount, (int32*)&outCount, buffer);
-#elif Unix
+ if (outCount)
+ *outCount = 0;
+
+#if usesHFSPath
+ err = OSErrToLVErr(FSRead(ioRefNum, (SInt32*)&inCount, buffer));
+ if (!err && outCount)
+ *outCount = inCount;
+#elif usesPosixPath
errno = 0;
actCount = fread((char *)buffer, 1, inCount, ioRefNum);
if (ferror(ioRefNum))
{
- err = fIOErr;
clearerr(ioRefNum);
+ return fIOErr;
}
- else if (feof(ioRefNum))
+ if (feof(ioRefNum))
{
- err = fEOF;
clearerr(ioRefNum);
+ err = fEOF;
}
- if (outCount)
- *outCount = actCount;
- return err;
-#elif Win32
- readSuccess = ReadFile(ioRefNum, buffer, inCount, &actCount, NULL);
- if (outCount)
+ if (outCount)
+ *outCount = actCount;
+#elif usesWinPath
+ if (!ReadFile(ioRefNum, buffer, inCount, &actCount, NULL))
{
- *outCount = actCount;
- }
- if (!readSuccess)
- {
return Win32ToLVFileErr();
}
-
- if (actCount == inCount)
+ if (outCount)
+ *outCount = actCount;
+ if (actCount != inCount)
{
- return mgNoErr;
+ err = fEOF;
}
- else
- {
- return fEOF;
- }
#endif
+ return err;
}
static MgErr lvfile_Write(FileRefNum ioRefNum, uInt32 inCount, uInt32 *outCount, UPtr buffer)
{
-#if Unix || Win32
- MgErr err = mgNoErr;
+ MgErr err = mgNoErr;
+#if usesPosixPath || usesWinPath
int actCount;
#endif
if (0 == ioRefNum)
return mgArgErr;
-#if MacOSX
- return FMWrite(ioRefNum, inCount, (int32*)outCount, buffer);
-#elif Win32
+ if (outCount)
+ *outCount = 0;
+
+#if usesHFSPath
+ err = OSErrToLVErr(FSWrite(ioRefNum, (SInt32*)outCount, buffer));
+ if (!err && outCount)
+ *outCount = inCount;
+#elif usesPosixPath
+ errno = 0;
+ actCount = fwrite((char *)buffer, 1, inCount, ioRefNum);
+ if (ferror(ioRefNum))
+ {
+ clearerr(ioRefNum);
+ return fIOErr;
+ }
+ if (outCount)
+ *outCount = actCount;
+#elif usesWinPath
if (!WriteFile(ioRefNum, buffer, inCount, &actCount, NULL))
- err = Win32ToLVFileErr();
+ {
+ return Win32ToLVFileErr();
+ }
if (outCount)
*outCount = actCount;
+#endif
return err;
-#elif Unix
- errno = 0;
- actCount = fwrite((char *)buffer, 1, inCount, ioRefNum);
- if (ferror(ioRefNum))
- {
- err = fIOErr;
- clearerr(ioRefNum);
- }
- if (outCount)
- *outCount = actCount;
- return err;
-#endif
}
LibAPI(MgErr) LVFile_OpenFile(LVRefNum *refnum, Path path, uInt8 rsrc, uInt32 openMode, uInt32 denyMode)
@@ -1153,21 +1191,20 @@
MgErr err;
int32 type;
FileRefNum ioRefNum;
- LStrPtr lstr;
-#if MacOSX
+#if usesHFSPath
FSRef ref;
HFSUniStr255 forkName;
int8 perm;
+ OSErr ret;
+#elif usesPosixPath
+ LStrPtr lstr;
struct stat statbuf;
char theMode[4];
- OSErr ret;
-#elif Win32
+#elif usesWinPath
+ LStrPtr lstr;
DWORD shareAcc, openAcc;
DWORD createMode = OPEN_EXISTING;
int32 attempts;
-#elif Unix
- uChar theMode[3];
- struct stat statbuf;
#endif
*refnum = 0;
@@ -1177,7 +1214,7 @@
if ((type != fAbsPath) && (type != fUNCPath))
return mgArgErr;
-#if Win32
+#if usesWinPath
if (FDepth(path) == 1L)
return mgArgErr;
@@ -1240,31 +1277,28 @@
{
err = Win32ToLVFileErr();
}
-#elif Unix || MacOSX
+#elif usesPosixPath
#if Unix
if (rsrc)
{
return mgNotSupported;
}
else
+#endif
{
- #else
- if (rsrc & 0x2)
- {
- #endif
switch (openMode)
{
case openWriteOnly:
/* Treat write-only as read-write, since you can't open a file for write-only
using buffered i/o functions without truncating the file. */
case openReadWrite:
- StrCpy(theMode, (uChar *)"r+");
+ strcpy(theMode, "r+");
break;
case openReadOnly:
- StrCpy(theMode, (uChar *)"r");
+ strcpy(theMode, "r");
break;
case openWriteOnlyTruncate:
- StrCpy(theMode, (uChar *)"w");
+ strcpy(theMode, "w");
break;
default:
return mgArgErr;
@@ -1281,7 +1315,7 @@
}
err = MakePathDSString(path, &lstr, 5);
- if (!err && rsrc & 0x1)
+ if (!err && rsrc)
{
strcpy((char*)(LStrBuf(lstr) + LStrLen(lstr)), "/rsrc");
}
@@ -1318,69 +1352,65 @@
}
}
#endif
+ }
+#elif usesHFSPath
+ err = FSMakePathRef(path, &ref);
+ if (err)
+ {
+ DEBUGPRINTF(((CStr)"FSMakePathRef: err = %ld", err));
+ return err;
}
- #if MacOSX
- else
+
+ switch (openMode)
{
- err = FSMakePathRef(path, &ref);
- if (err)
- {
- DEBUGPRINTF(("FSMakePathRef: err = %ld", err));
- return err;
- }
+ case openReadWrite:
+ perm = fsRdWrPerm;
+ break;
+ case openReadOnly:
+ perm = fsRdPerm;
+ break;
+ case openWriteOnly:
+ case openWriteOnlyTruncate:
+ perm = fsWrPerm;
+ break;
+ default:
+ return mgArgErr;
+ }
- switch (openMode)
- {
- case openReadWrite:
- perm = fsRdWrPerm;
- break;
- case openReadOnly:
- perm = fsRdPerm;
- break;
- case openWriteOnly:
- case openWriteOnlyTruncate:
- perm = fsWrPerm;
- break;
- default:
- return mgArgErr;
- }
+ switch (denyMode)
+ {
+ case denyReadWrite:
+ perm |= fsRdDenyPerm | fsWrDenyPerm;
+ break;
+ case denyWriteOnly:
+ perm |= fsWrDenyPerm;
+ break;
+ case denyNeither:
+ /* leave all deny mode bits clear */
+ break;
+ default:
+ return mgArgErr;
+ }
- switch (denyMode)
- {
- case denyReadWrite:
- perm |= fsRdDenyPerm | fsWrDenyPerm;
- break;
- case denyWriteOnly:
- perm |= fsWrDenyPerm;
- break;
- case denyNeither:
- /* leave all deny mode bits clear */
- break;
- default:
- return mgArgErr;
- }
-
- if (rsrc)
- {
- ret = FSGetResourceForkName(&forkName);
- }
- else
- {
- ret = FSGetDataForkName(&forkName);
- }
- if (ret == noErr)
- {
- ret = FSOpenFork(&ref, forkName.length, forkName.unicode, perm, &ioRefNum);
- }
- err = OSErrToLVErr(ret);
- if (!err && openMode == openWriteOnlyTruncate)
- {
- FileOffset size;
- size.q = 0;
- err = lvfile_SetSize(ioRefNum, &size);
- }
+ if (rsrc)
+ {
+ ret = FSGetResourceForkName(&forkName);
}
- #endif
+ else
+ {
+ ret = FSGetDataForkName(&forkName);
+ }
+ if (ret == noErr)
+ {
+ ret = FSOpenFork(&ref, forkName.length, forkName.unicode, perm, &ioRefNum);
+ }
+ err = OSErrToLVErr(ret);
+ if (!err && openMode == openWriteOnlyTruncate)
+ {
+ FileOffset size;
+ size.q = 0;
+ err = lvfile_SetSize(ioRefNum, &size);
+ }
#else
err = mgNotSupported;
#endif
@@ -1391,7 +1421,7 @@
if (err)
{
lvfile_CloseFile(ioRefNum);
- DEBUGPRINTF(("OpenFile: err = %ld, rsrc = %d", err, (int16)rsrc));
+ DEBUGPRINTF(((CStr)"OpenFile: err = %ld, rsrc = %d", err, (int16)rsrc));
}
return err;
}
@@ -1508,10 +1538,7 @@
CFStringEncoding encoding = CFStringConvertWindowsCodepageToEncoding(codePage);
if (encoding == kCFStringEncodingInvalidId)
{
- if (codePage == CP_ACP)
- encoding = GetApplicationTextEncoding();
- else if (codePage == CP_OEMCP)
- encoding = CFStringGetSystemEncoding();
+ encoding = CFStringGetSystemEncoding();
}
return encoding;
}
@@ -1522,7 +1549,8 @@
#if Win32
return acp ? GetACP() : GetOEMCP();
#elif MacOSX
- CFStringEncoding encoding = acp ? GetApplicationTextEncoding() : CFStringGetSystemEncoding();
+ Unused(acp);
+ CFStringEncoding encoding = CFStringGetSystemEncoding();
return CFStringConvertEncodingToWindowsCodepage(encoding);
#else
if (utf8_is_current_mbcs())
@@ -1586,8 +1614,9 @@
LibAPI(MgErr) ConvertCPath(ConstCStr src, int32 srclen, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed, LVBoolean isDir)
{
MgErr err = mgNotSupported;
-#if Win32
- err = ConvertCString(src, srclen, srccp, dest, destcp, defaultChar, defUsed);
+#if usesWinPath
+ Unused(isDir);
+ err = ConvertCString(src, srclen, srccp, dest, destcp, defaultChar, defUsed);
if (!err)
{
int32 len = LStrLen(**dest);
@@ -1606,9 +1635,12 @@
}
}
}
-#elif Unix
+#elif usesPosixPath
+ Unused(isDir);
err = ConvertCString(src, srclen, srccp, dest, destcp, defaultChar, defUsed);
-#elif MacOSX
+#elif usesHFSPath
+ Unused(defaultChar);
+ Unused(defUsed);
CFStringEncoding encoding = ConvertCodepageToEncoding(srccp);
if (encoding != kCFStringEncodingInvalidId)
{
@@ -1709,7 +1741,8 @@
LibAPI(MgErr) ConvertLPath(const LStrHandle src, uInt32 srccp, LStrHandle *dest, uInt32 destcp, char defaultChar, LVBoolean *defUsed, LVBoolean isDir)
{
MgErr err = mgNotSupported;
-#if Win32
+#if usesWinPath
+ Unused(isDir);
err = ConvertLString(src, srccp, dest, destcp, defaultChar, defUsed);
if (!err)
{
@@ -1729,9 +1762,12 @@
}
}
}
-#elif Unix
+#elif usesPosixPath
+ Unused(isDir);
err = ConvertLString(src, srccp, dest, destcp, defaultChar, defUsed);
-#elif MacOSX
+#elif usesHFSPath
+ Unused(defaultChar);
+ Unused(defUsed);
CFStringEncoding encoding = ConvertCodepageToEncoding(srccp);
if (encoding != kCFStringEncodingInvalidId)
{
@@ -2023,10 +2059,11 @@
}
}
#elif MacOSX
+ Unused(srclen);
CFStringEncoding encoding = ConvertCodepageToEncoding(codePage);
if (encoding != kCFStringEncodingInvalidId)
{
- CFStringRef cfpath = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, src, encoding, kCFAllocatorNull);
+ CFStringRef cfpath = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, (const char)src, encoding, kCFAllocatorNull);
if (cfpath)
{
CFMutableStringRef cfpath2 = CFStringCreateMutableCopy(kCFAllocatorDefault, 0, cfpath);
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2015-05-01 22:54:47 UTC (rev 1514)
+++ trunk/lvzip/c_source/lvutil.h 2015-05-02 19:48:51 UTC (rev 1515)
@@ -27,9 +27,6 @@
#define kX64 10
#if defined(macintosh) || defined(__PPCC__) || defined(THINK_C) || defined(__SC__) || defined(__MWERKS__) || defined(__APPLE_CC__)
- #ifdef __APPLE_CC__
- #define MacOSX 1
- #endif
#if defined(__powerc) || defined(__ppc__)
#define ProcessorType kPPC
#define BigEndian 1
@@ -320,10 +317,18 @@
int32 StrNCpy(CStr t, const CStr s, int32 l);
int32 StrLen(ConstCStr str);
+/** @brief Concatenated Pascal string types. */
typedef struct {
+ int32 cnt; /* number of pascal strings that follow */
+ uChar str[1]; /* cnt bytes of concatenated pascal strings */
+} CPStr, *CPStrPtr, **CPStrHandle;
+
+typedef struct {
int32 cnt;
uChar str[1];
} LStr, *LStrPtr, **LStrHandle;
+typedef LStr const* ConstLStrP;
+typedef LStr const*const* ConstLStrH;
#define LStrLen(p) ((p)->cnt)
#define LStrBuf(p) ((p)->str)
@@ -468,6 +473,9 @@
FMFileType type;
} FMListDetails;
+/** @brief Data types used to describe a list of entries from a directory. */
+typedef CPStr FDirEntRec, *FDirEntPtr, **FDirEntHandle;
+
/** Type Flags used with FMListDetails */
#define kIsFile 0x01
#define kRecognizedType 0x02
@@ -530,6 +538,7 @@
MgErr FSetInfo64(ConstPath path, FInfo64Ptr infop);
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 DbgPrintf(CStr fmt, ...);
@@ -605,6 +614,7 @@
LibAPI(MgErr) ZeroTerminateLString(LStrHandle *dest);
LibAPI(uInt32) GetCurrentCodePage(LVBoolean acp);
+LibAPI(uInt32) determine_codepage(uLong *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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-03 10:47:17
|
Revision: 1516
http://sourceforge.net/p/opengtoolkit/svn/1516
Author: labviewer
Date: 2015-05-03 10:47:14 +0000 (Sun, 03 May 2015)
Log Message:
-----------
Add a function to enumerate directory contents with extra flag info
Modified Paths:
--------------
trunk/lvzip/c_source/lvutil.c
trunk/lvzip/c_source/lvutil.h
trunk/lvzip/c_source/unzip.c
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2015-05-02 19:48:51 UTC (rev 1515)
+++ trunk/lvzip/c_source/lvutil.c 2015-05-03 10:47:14 UTC (rev 1516)
@@ -338,7 +338,10 @@
}
return fIOErr; /* fIOErr generally signifies some unknown file error */
}
+#endif
+#endif
+#if usesPosixPath || usesWinPath
static int32 MakePathDSString(Path path, LStrPtr *lstr, int32 reserve)
{
int32 pathLen = -1;
@@ -357,13 +360,81 @@
return err;
}
#endif
-#endif
LibAPI(void) DLLVersion(uChar* version)
{
sprintf((char*)version, "lvzlib V 2.2, date: %s, time: %s",__DATE__,__TIME__);
}
+LibAPI(MgErr) LVPath_ListDirectory(Path folderPath, LStrArrHdl *nameArr, FileInfoArrHdl *typeArr)
+{
+ MgErr err;
+ FInfoRec foldInfo;
+ FMListDetails **typeList = NULL;
+ FDirEntHandle nameList = NULL;
+
+ if (!FIsAPath(folderPath))
+ return mgArgErr;
+ /* Check that we have actually a folder */
+ err = FGetInfo(folderPath, &foldInfo);
+ if (err)
+ return err;
+ if (!foldInfo.folder)
+ return mgArgErr;
+
+ nameList = (FDirEntHandle)AZNewHClr(4);
+ if (!nameList)
+ return mFullErr;
+ typeList = (FMListDetails **)AZNewHandle(0);
+ if (!typeList)
+ {
+ AZDisposeHandle((UHandle)nameList);
+ return mFullErr;
+ }
+ err = FListDir(folderPath, nameList, typeList);
+ if (!err)
+ {
+ int32 i = 0, n = CPStrLen(*nameList);
+ UPtr fName = CPStrBuf(*nameList);
+ err = NumericArrayResize(uPtr, 1, (UHandle*)nameArr, n);
+ if (!err)
+ {
+ LStrHandle *names = (**nameArr)->elm;
+ err = NumericArrayResize(uL, 1, (UHandle*)typeArr, n * 2);
+ if (!err)
+ {
+ for (i = 0; i < n; i++, names++)
+ {
+ err = NumericArrayResize(uB, 1, (UHandle*)names, PStrLen(fName));
+ if (err)
+ break;
+
+ MoveBlock(PStrBuf(fName), LStrBuf(**names), PStrLen(fName));
+ LStrLen(**names) = PStrLen(fName);
+ fName += PStrSize(fName);
+ }
+ MoveBlock((ConstUPtr)*typeList, (UPtr)((**typeArr)->elm), n * sizeof(FMListDetails));
+ (**typeArr)->numItems = i;
+ }
+ n = (**nameArr)->numItems;
+ (**nameArr)->numItems = i;
+ /* Clear out possibly superfluous handles */
+ if (n > i)
+ {
+ for (; i < n; i++, names++)
+ {
+ if (*names)
+ DSDisposeHandle((UHandle)*names);
+ *names = NULL;
+ }
+ }
+ }
+ }
+ AZDisposeHandle((UHandle)nameList);
+ AZDisposeHandle((UHandle)typeList);
+ return err;
+}
+
LibAPI(MgErr) LVPath_HasResourceFork(Path path, LVBoolean *hasResFork, uInt32 *sizeLow, uInt32 *sizeHigh)
{
MgErr err = mgNoErr;
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2015-05-02 19:48:51 UTC (rev 1515)
+++ trunk/lvzip/c_source/lvutil.h 2015-05-03 10:47:14 UTC (rev 1516)
@@ -186,6 +186,12 @@
typedef int32 Bool32;
+#if ProcessorType==kX64
+#define uPtr uQ
+#else
+#define uPtr uL
+#endif
+
/*** The Support Manager ***/
#define HiNibble(x) (uInt8)(((x)>>4) & 0x0F)
@@ -336,6 +342,10 @@
#define LStrLenH(h) ((h) ? (*(h))->cnt : 0)
#define LStrBufH(h) ((h) ? (*(h))->str : NULL)
+/*** Concatenated Pascal String Support Functions ***/
+#define CPStrLen LStrLen /* concatenated Pascal vs. LabVIEW strings */
+#define CPStrBuf LStrBuf /* concatenated Pascal vs. LabVIEW strings */
+
typedef struct {
int32 cnt;
uChar str[256];
@@ -521,6 +531,7 @@
#define kNotARefNum ((LVRefNum)0L) /* canonical invalid magic cookie */
/* LabVIEW exported functions */
+Bool32 FIsAPath(Path path);
MgErr FPathToText(Path path, LStrPtr lstr);
MgErr FPathToPath(Path *p);
MgErr FAppendName(Path path, PStr name);
@@ -544,12 +555,20 @@
UPtr DSNewPClr(size_t size);
MgErr DSDisposePtr(UPtr);
+UHandle DSNewHandle(size_t size);
UHandle DSNewHClr(size_t size);
MgErr DSSetHandleSize(UHandle, size_t);
int32 DSGetHandleSize(UHandle);
MgErr DSDisposeHandle(UHandle);
MgErr DSCopyHandle(void *ph, const void *hsrc);
+UHandle AZNewHandle(size_t size);
+UHandle AZNewHClr(size_t size);
+MgErr AZSetHandleSize(UHandle, size_t);
+int32 AZGetHandleSize(UHandle);
+MgErr AZDisposeHandle(UHandle);
+MgErr AZCopyHandle(void *ph, const void *hsrc);
+
void MoveBlock(ConstUPtr ps, UPtr pd, size_t size);
MgErr NumericArrayResize(int32, int32, UHandle*, size_t);
@@ -557,6 +576,18 @@
#define Min(a, b) ((a) < (b)) ? (a) : (b)
#define Max(a, b) ((a) > (b)) ? (a) : (b)
+typedef struct
+{
+ int32 numItems;
+ LStrHandle elm[1];
+} LStrArrRec, *LStrArrPtr, **LStrArrHdl;
+
+typedef struct
+{
+ int32 numItems;
+ FMListDetails elm[1];
+} FileInfoArrRec, *FileInfoArrPtr, **FileInfoArrHdl;
+
/* Our exported functions */
LibAPI(void) DLLVersion OF((uChar* Version));
@@ -564,6 +595,7 @@
LibAPI(MgErr) LVPath_HasResourceFork(Path path, LVBoolean *hasResFork, uInt32 *sizeLow, uInt32 *sizeHigh);
LibAPI(MgErr) LVPath_EncodeMacbinary(Path srcFileName, Path dstFileName);
LibAPI(MgErr) LVPath_DecodeMacbinary(Path srcFileName, Path dstFileName);
+LibAPI(MgErr) LVPath_ListDirectory(Path dirname, LStrArrHdl *names, FileInfoArrHdl *fileInfo);
LibAPI(MgErr) LVPath_UtilFileInfo(Path path,
uInt8 write,
Modified: trunk/lvzip/c_source/unzip.c
===================================================================
--- trunk/lvzip/c_source/unzip.c 2015-05-02 19:48:51 UTC (rev 1515)
+++ trunk/lvzip/c_source/unzip.c 2015-05-03 10:47:14 UTC (rev 1516)
@@ -2040,7 +2040,6 @@
return err;
}
-
/*
Get the global comment string of the ZipFile, in the szComment buffer.
uSizeBuf is the size of the szComment buffer.
@@ -2119,5 +2118,5 @@
ZEXTERN int ZEXPORT unzSetOffset (unzFile file, uLong pos)
{
- return unzSetOffset64(file,pos);
+ return unzSetOffset64(file, pos);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-03 18:50:54
|
Revision: 1521
http://sourceforge.net/p/opengtoolkit/svn/1521
Author: labviewer
Date: 2015-05-03 18:50:52 +0000 (Sun, 03 May 2015)
Log Message:
-----------
implemented the Windows side of links
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 2015-05-03 15:20:13 UTC (rev 1520)
+++ trunk/lvzip/c_source/lvutil.c 2015-05-03 18:50:52 UTC (rev 1521)
@@ -168,6 +168,58 @@
return err;
}
+static MgErr ConvertFromPosixPath(ConstCStr posixPath, int32 len, LStrHandle *hfsPath, Boolean isDir)
+{
+ MgErr err = mFullErr;
+ CFURLRef urlRef = NULL;
+ CFStringRef hfsRef;
+ uInt32 encoding = CFStringGetSystemEncoding();
+
+ if (!hfsPath)
+ return mgArgErr;
+
+ if (*hsfPath)
+ LStrLen(**hsfPath) = 0;
+
+ urlRef = CFURLCreateFromFileSystemRepresentation(NULL, posixPath, len, false);
+ if (!urlRef)
+ {
+ return mFullErr;
+ }
+ hsfRef = CFURLCopyFileSystemPath(urlRef, kCFURLHFSPathStyle);
+ CFRelease(urlRef);
+ if (hfsRef)
+ {
+ CFIndex len;
+ CFRange range = CFRangeMake(0, CFStringGetLength(hfsRef));
+ if (CFStringGetBytes(hfsRef, range, encoding, 0, false, NULL, 0, &len) > 0)
+ {
+ if (len > 0)
+ {
+ err = NumericArrayResize(uB, 1, (UHandle*)hfsPath, len + 1);
+ if (!err)
+ {
+ if (CFStringGetBytes(hsfRef, range, encoding, 0, false, LStrBuf(**hfsPath), len, &len) > 0)
+ {
+ LStrBuf(**hfsPath)[len] = 0;
+ LStrLen(**hfsPath) = len;
+ }
+ else
+ {
+ err = bogusError;
+ }
+ }
+ }
+ }
+ else
+ {
+ err = bogusError;
+ }
+ CFRelease(hfsRef);
+ }
+ return err;
+}
+
static MgErr FSMakePathRef(Path path, FSRef *ref)
{
LStrHandle str = NULL;
@@ -914,6 +966,24 @@
return err;
}
+LibAPI(MgErr) LVPath_FromText(CStr str, int32 len, Path *path, LVBoolean isDir)
+{
+ MgErr err = mgNoErr;
+#if usesHFSPath
+ LStrHandle hsfPath = NULL;
+ /* Convert the posix path to an HFS path */
+ err = ConvertFromPosixPath(str, len, &hfsPath, isDir);
+ if (!err)
+ {
+ err = FTextToPath(LStrBuf(*hfsPath), LStrLen(*hsfPath), path);
+ }
+#else
+ Unused(isDir);
+ err = FTextToPath(str, len, path);
+#endif
+ return err;
+}
+
LibAPI(MgErr) LVPath_CreateLink(Path path, uInt32 flags, Path target)
{
MgErr err = mgNoErr;
@@ -954,7 +1024,7 @@
{
if (flags & kLinkDir)
err = mgNotSupported;
- else if (!CreateHardLinkA(LStrBuf(*src), LStrBuf(*tgt), NULL)
+ else if (!CreateHardLinkA(LStrBuf(*src), LStrBuf(*tgt), NULL))
{
err = Win32ToLVFileErr();
}
@@ -974,6 +1044,8 @@
return err;
}
+#define PREPARSE_DATA_BUFFER_SIZE 16*1024
+
LibAPI(MgErr) LVPath_ReadLink(Path path, Path *target)
{
MgErr err = mgNoErr;
@@ -1013,7 +1085,7 @@
}
else if (retval < len)
{
-
+ err = LVPath_FromText(buf, retval, target, LV_FALSE);
free(buf);
break;
}
@@ -1021,28 +1093,64 @@
buf = realloc(buf, len);
}
#elif Win32
- if (GetFileAttributes(fpath) & REPARSE_FOLDER == REPARSE_FOLDER)
+ if ((GetFileAttributesA(LStrBuf(*src)) & REPARSE_FOLDER) == REPARSE_FOLDER)
{
- // Open the file correctly depending on the string type.
- HANDLE handle = CreateFileA(fpath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT, 0);
+ PREPARSE_DATA_BUFFER buffer = NULL;
+ // Open the target file
+ HANDLE handle = CreateFileA(LStrBuf(*src), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT, NULL);
+ if (handle != INVALID_HANDLE_VALUE)
+ {
+ DWORD bytes;
+ // Maximum REPARSE_DATA_BUFFER_SIZE = 16384 = (16*1024)
+ buffer = (PREPARSE_DATA_BUFFER)malloc(PREPARSE_DATA_BUFFER_SIZE);
+ if (DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, NULL, 0, buffer, PREPARSE_DATA_BUFFER_SIZE, &bytes, NULL))
+ err = Win32ToLVFileErr();
+
+ if (bytes < 9)
+ err = fEOF;
+
+ // Close the handle to our file so we're not locking it anymore.
+ CloseHandle(handle);
+ }
+ else
+ {
+ err = Win32ToLVFileErr();
+ }
- // MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16384 = (16*1024)
- buffer = DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, NULL, 16*1024)
- // Above will return an ugly string (byte array), so we'll need to parse it.
- // But first, we'll close the handle to our file so we're not locking it anymore.
- CloseHandle(handle)
-
- // Minimum possible length (assuming that the length of the target is bigger than 0)
- if len(buffer) < 9:
- return None
- // Parse and return our result.
- result = parse_reparse_buffer(buffer)
- offset = result[SYMBOLIC_LINK]['substitute_name_offset']
- ending = offset + result[SYMBOLIC_LINK]['substitute_name_length']
- rpath = result[SYMBOLIC_LINK]['buffer'][offset:ending].replace('\x00','')
- if len(rpath) > 4 and rpath[0:4] == '\\??\\':
- rpath = rpath[4:]
- return rpath;
+ if (!err)
+ {
+ PWCHAR start;
+ USHORT length;
+ int32 numBytes;
+ LStrHandle dest = NULL;
+
+ switch (buffer->ReparseTag)
+ {
+ case IO_REPARSE_TAG_SYMLINK:
+ start = (PWCHAR)((char)buffer->SymbolicLinkReparseBuffer.PathBuffer + buffer->SymbolicLinkReparseBuffer.SubstituteNameOffset);
+ length = buffer->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(WCHAR);
+ break;
+ default:
+ start = (PWCHAR)((char)buffer->MountPointReparseBuffer.PathBuffer + buffer->MountPointReparseBuffer.SubstituteNameOffset);
+ length = buffer->SymbolicLinkReparseBuffer.SubstituteNameLength / sizeof(WCHAR);
+ break;
+ }
+ // Skip possible path prefix
+ if (length > 4 && !CompareStringW(LOCALE_SYSTEM_DEFAULT, 0, start, 4, L"\\\\??\\", 4));
+ start += 4;
+
+ numBytes = WideCharToMultiByte(CP_ACP, 0, start, length, NULL, 0, NULL, NULL);
+ if (numBytes > 0 && numBytes <= PREPARSE_DATA_BUFFER_SIZE)
+ {
+ numBytes = WideCharToMultiByte(CP_ACP, 0, start, length, (LPSTR)buffer, numBytes, NULL, NULL);
+ if (numBytes > 0)
+ {
+ err = LVPath_FromText((CStr)buffer, numBytes, target, LV_FALSE);
+ }
+ }
+ }
+ if (buffer)
+ free(buffer);
}
#else
err = mgNotSupported;
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2015-05-03 15:20:13 UTC (rev 1520)
+++ trunk/lvzip/c_source/lvutil.h 2015-05-03 18:50:52 UTC (rev 1521)
@@ -543,6 +543,7 @@
Path FNotAPath(Path);
Bool32 FIsAPath(Path path);
Bool32 FIsAbsPath(Path path);
+MgErr FTextToPath(UPtr str, int32 len, Path* path);
MgErr FPathToText(Path path, LStrPtr lstr);
MgErr FPathToPath(Path *p);
Bool32 FIsAPathOfType(Path path, int32 ofType);
@@ -556,6 +557,7 @@
MgErr FNewRefNum(Path path, File fd, LVRefNum* refnum);
Bool32 FIsARefNum(LVRefNum);
MgErr FDisposeRefNum(LVRefNum);
+Bool32 FExists(ConstPath path);
MgErr FRefNumToFD(LVRefNum, File*);
MgErr FGetInfo(ConstPath path, FInfoPtr infop);
MgErr FGetInfo64(ConstPath path, FInfo64Ptr infop, FGetInfoWhich which);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-06 16:08:18
|
Revision: 1523
http://sourceforge.net/p/opengtoolkit/svn/1523
Author: labviewer
Date: 2015-05-06 16:08:15 +0000 (Wed, 06 May 2015)
Log Message:
-----------
Make code compile on Mac
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 2015-05-03 19:14:24 UTC (rev 1522)
+++ trunk/lvzip/c_source/lvutil.c 2015-05-06 16:08:15 UTC (rev 1523)
@@ -178,15 +178,15 @@
if (!hfsPath)
return mgArgErr;
- if (*hsfPath)
- LStrLen(**hsfPath) = 0;
+ if (*hfsPath)
+ LStrLen(**hfsPath) = 0;
- urlRef = CFURLCreateFromFileSystemRepresentation(NULL, posixPath, len, false);
+ urlRef = CFURLCreateFromFileSystemRepresentation(NULL, posixPath, len, isDir);
if (!urlRef)
{
return mFullErr;
}
- hsfRef = CFURLCopyFileSystemPath(urlRef, kCFURLHFSPathStyle);
+ hfsRef = CFURLCopyFileSystemPath(urlRef, kCFURLHFSPathStyle);
CFRelease(urlRef);
if (hfsRef)
{
@@ -199,7 +199,7 @@
err = NumericArrayResize(uB, 1, (UHandle*)hfsPath, len + 1);
if (!err)
{
- if (CFStringGetBytes(hsfRef, range, encoding, 0, false, LStrBuf(**hfsPath), len, &len) > 0)
+ if (CFStringGetBytes(hfsRef, range, encoding, 0, false, LStrBuf(**hfsPath), len, &len) > 0)
{
LStrBuf(**hfsPath)[len] = 0;
LStrLen(**hfsPath) = len;
@@ -970,12 +970,12 @@
{
MgErr err = mgNoErr;
#if usesHFSPath
- LStrHandle hsfPath = NULL;
+ LStrHandle hfsPath = NULL;
/* Convert the posix path to an HFS path */
err = ConvertFromPosixPath(str, len, &hfsPath, isDir);
if (!err)
{
- err = FTextToPath(LStrBuf(*hfsPath), LStrLen(*hsfPath), path);
+ err = FTextToPath(LStrBuf(*hfsPath), LStrLen(*hfsPath), path);
}
#else
Unused(isDir);
Modified: trunk/lvzip/c_source/lvutil.h
===================================================================
--- trunk/lvzip/c_source/lvutil.h 2015-05-03 19:14:24 UTC (rev 1522)
+++ trunk/lvzip/c_source/lvutil.h 2015-05-06 16:08:15 UTC (rev 1523)
@@ -616,6 +616,7 @@
/* Convert the path into a string representation for the current platform */
LibAPI(MgErr) LVPath_ToText(Path path, LStrHandle *str);
+LibAPI(MgErr) LVPath_FromText(CStr str, int32 len, Path *path, LVBoolean isDir);
/* Check if the file path points to has a resource fork */
LibAPI(MgErr) LVPath_HasResourceFork(Path path, LVBoolean *hasResFork, uInt32 *sizeLow, uInt32 *sizeHigh);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-27 11:25:43
|
Revision: 1530
http://sourceforge.net/p/opengtoolkit/svn/1530
Author: labviewer
Date: 2015-05-27 11:25:40 +0000 (Wed, 27 May 2015)
Log Message:
-----------
Fix some minor 64 bit implicit conversion warnings
Modified Paths:
--------------
trunk/lvzip/c_source/bzip2/compress.c
trunk/lvzip/c_source/crypt.h
trunk/lvzip/c_source/ioapi.c
trunk/lvzip/c_source/iowin.c
trunk/lvzip/c_source/zip.c
Modified: trunk/lvzip/c_source/bzip2/compress.c
===================================================================
--- trunk/lvzip/c_source/bzip2/compress.c 2015-05-27 11:12:39 UTC (rev 1529)
+++ trunk/lvzip/c_source/bzip2/compress.c 2015-05-27 11:25:40 UTC (rev 1530)
@@ -202,7 +202,7 @@
*ryy_j = rtmp2;
};
yy[0] = rtmp;
- j = ryy_j - &(yy[0]);
+ j = (Int32)(ryy_j - &(yy[0]));
mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++;
}
Modified: trunk/lvzip/c_source/crypt.h
===================================================================
--- trunk/lvzip/c_source/crypt.h 2015-05-27 11:12:39 UTC (rev 1529)
+++ trunk/lvzip/c_source/crypt.h 2015-05-27 11:25:40 UTC (rev 1530)
@@ -34,7 +34,7 @@
/***********************************************************************
* Return the next byte in the pseudo-random sequence
*/
-static int decrypt_byte(unsigned long* pkeys, const z_crc_t* pcrc_32_tab)
+static int decrypt_byte(unsigned long* pkeys /*, const z_crc_t* pcrc_32_tab*/)
{
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
* unpredictable manner on 16-bit systems; not a problem
@@ -75,10 +75,10 @@
}
#define zdecode(pkeys,pcrc_32_tab,c) \
- (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
+ (update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys /*,pcrc_32_tab*/)))
#define zencode(pkeys,pcrc_32_tab,c,t) \
- (t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
+ (t=decrypt_byte(pkeys /*,pcrc_32_tab*/), update_keys(pkeys,pcrc_32_tab,c), t^(c))
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
Modified: trunk/lvzip/c_source/ioapi.c
===================================================================
--- trunk/lvzip/c_source/ioapi.c 2015-05-27 11:12:39 UTC (rev 1529)
+++ trunk/lvzip/c_source/ioapi.c 2015-05-27 11:25:40 UTC (rev 1530)
@@ -114,7 +114,7 @@
return NULL;
ioposix = (FILE_IOPOSIX*)malloc(sizeof(FILE_IOPOSIX));
ioposix->file = file;
- ioposix->filenameLength = strlen(filename) + 1;
+ ioposix->filenameLength = (int)strlen(filename) + 1;
ioposix->filename = (char*)malloc(ioposix->filenameLength * sizeof(char));
memcpy(ioposix->filename, filename, ioposix->filenameLength);
return (voidpf)ioposix;
Modified: trunk/lvzip/c_source/iowin.c
===================================================================
--- trunk/lvzip/c_source/iowin.c 2015-05-27 11:12:39 UTC (rev 1529)
+++ trunk/lvzip/c_source/iowin.c 2015-05-27 11:25:40 UTC (rev 1530)
@@ -83,13 +83,13 @@
if ((hFile != NULL) && (hFile != INVALID_HANDLE_VALUE))
{
- int len = wcslen(filename);
+ size_t len = wcslen(filename);
w32fiow = (WIN32FILE_IOWIN *)malloc(sizeof(WIN32FILE_IOWIN) + len);
if (w32fiow)
{
w32fiow->hf = hFile;
w32fiow->error = 0;
- w32fiow->filenameLength = len;
+ w32fiow->filenameLength = (int)len;
wcsncpy(w32fiow->filename, filename, len + 1);
}
else
Modified: trunk/lvzip/c_source/zip.c
===================================================================
--- trunk/lvzip/c_source/zip.c 2015-05-27 11:12:39 UTC (rev 1529)
+++ trunk/lvzip/c_source/zip.c 2015-05-27 11:25:40 UTC (rev 1530)
@@ -1463,16 +1463,16 @@
zi->ci.pcrc_32_tab = get_crc_table();
/*init_keys(password,zi->ci.keys,zi->ci.pcrc_32_tab);*/
- sizeHead = crypthead(password,bufHead,RAND_HEAD_LEN,zi->ci.keys,zi->ci.pcrc_32_tab,crcForCrypting);
+ sizeHead = crypthead(password, bufHead, RAND_HEAD_LEN, zi->ci.keys, zi->ci.pcrc_32_tab, crcForCrypting);
zi->ci.crypt_header_size = sizeHead;
- if (ZWRITE64(zi->z_filefunc,zi->filestream,bufHead,sizeHead) != sizeHead)
+ if (ZWRITE64(zi->z_filefunc, zi->filestream, bufHead, sizeHead) != sizeHead)
err = ZIP_ERRNO;
}
#endif
}
- if (err==Z_OK)
+ if (err == Z_OK)
zi->in_opened_file_inzip = 1;
return err;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-27 13:31:41
|
Revision: 1531
http://sourceforge.net/p/opengtoolkit/svn/1531
Author: labviewer
Date: 2015-05-27 13:31:38 +0000 (Wed, 27 May 2015)
Log Message:
-----------
Fix some linux compilation issues
Modified Paths:
--------------
trunk/lvzip/c_source/Makefile
trunk/lvzip/c_source/Makefile.vxworks
trunk/lvzip/c_source/aes/entropy.c
trunk/lvzip/c_source/lvutil.c
Modified: trunk/lvzip/c_source/Makefile
===================================================================
--- trunk/lvzip/c_source/Makefile 2015-05-27 11:25:40 UTC (rev 1530)
+++ trunk/lvzip/c_source/Makefile 2015-05-27 13:31:38 UTC (rev 1531)
@@ -18,6 +18,7 @@
CC=gcc
+
CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DDEBUG
@@ -25,7 +26,7 @@
# -Wstrict-prototypes -Wmissing-prototypes
CINDIR=/usr/local/lv70/cintools
-SFLAGS=-O3 -fPIC -m64 -fvisibility=hidden -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -L$(CINDIR)
+SFLAGS=-O3 -fPIC $(CC_ARCH_SPEC) -fvisibility=hidden -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -L$(CINDIR)
LDFLAGS=
TEST_LDFLAGS=-L. libz.a
LDSHARED=gcc
@@ -58,12 +59,17 @@
OBJZ = adler32.o crc32.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
-OBJC = $(OBJZ) $(OBJL) $(OBJG)
+OBJE = aes/aescrypt.o aes/aeskey.o aes/aestab.o aes/entropy.o aes/filenc.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
+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_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_OBJC = $(PIC_OBJZ) $(PIC_OBJL) $(PIC_OBJG)
+PIC_OBJE = aes/aescrypt.lo aes/aeskey.lo aes/aestab.lo aes/entropy.lo aes/filenc.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_OBJC = $(PIC_OBJZ) $(PIC_OBJL) $(PIC_OBJG) $(PIC_OBJ2) $(PIC_OBJE)
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
OBJA =
@@ -73,9 +79,14 @@
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
-#all: static all64
-all: clean $(SHAREDLIBV)
+all: static all64
+linux32: clean
+ $(MAKE) $(SHAREDLIBV) ARCH_DIR=./Linux_x86 CC_ARCH_SPEC="-m32"
+
+linux64: clean
+ $(MAKE) $(SHAREDLIBV) ARCH_DIR=./Linux_x64 CC_ARCH_SPEC="-m64"
+
static: example$(EXE) minigzip$(EXE)
shared: examplesh$(EXE) minigzipsh$(EXE)
@@ -156,16 +167,17 @@
.SUFFIXES: .lo
.c.lo:
- -@mkdir objs 2>/dev/null || test -d objs
- $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
- -@mv objs/$*.o $@
+ -@mkdir $(ARCH_DIR) 2>/dev/null || test -d $(ARCH_DIR)
+ -@mkdir $(ARCH_DIR)/aes 2>/dev/null || test -d $(ARCH_DIR)/aes
+ -@mkdir $(ARCH_DIR)/bzip2 2>/dev/null || test -d $(ARCH_DIR)/bzip2
+ $(CC) $(SFLAGS) -DPIC -c -o $(ARCH_DIR)/$*.o $<
+ -@mv $(ARCH_DIR)/$*.o $(ARCH_DIR)/$@
placebo $(SHAREDLIBV): $(PIC_OBJS)
$(LDSHARED) $(SFLAGS) -shared -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
rm -f $(SHAREDLIB) $(SHAREDLIBM)
# ln -s $@ $(SHAREDLIB)
# ln -s $@ $(SHAREDLIBM)
- -@rmdir objs
example$(EXE): example.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
@@ -248,7 +260,7 @@
infcover \
libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o
- rm -rf objs
+ rm -rf $(ARCH_DIR)/*.lo
rm -f *.gcda *.gcno *.gcov
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
Modified: trunk/lvzip/c_source/Makefile.vxworks
===================================================================
--- trunk/lvzip/c_source/Makefile.vxworks 2015-05-27 11:25:40 UTC (rev 1530)
+++ trunk/lvzip/c_source/Makefile.vxworks 2015-05-27 13:31:38 UTC (rev 1531)
@@ -19,11 +19,16 @@
# 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)/adler32.o $(OBJ_DIR)/compress.o $(OBJ_DIR)/crc32.o $(OBJ_DIR)/deflate.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 \
+ $(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)/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 \
- $(OBJ_DIR)/unzip.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/zutil.o
+ $(OBJ_DIR)/unzip.o $(OBJ_DIR)/zip.o $(OBJ_DIR)/zutil.o
# This is the name of the output shared library.
PROJECT_TARGETS := $(OBJ_DIR)/lvzlib.out
Modified: trunk/lvzip/c_source/aes/entropy.c
===================================================================
--- trunk/lvzip/c_source/aes/entropy.c 2015-05-27 11:25:40 UTC (rev 1530)
+++ trunk/lvzip/c_source/aes/entropy.c 2015-05-27 13:31:38 UTC (rev 1531)
@@ -1,48 +1,49 @@
-#ifdef _WIN32
-#include <windows.h>
-#endif
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <fcntl.h>
+#endif
#if defined(__cplusplus)
extern "C"
{
#endif
-
-#ifdef _WIN32
-int entropy_fun(unsigned char buf[], unsigned int len)
-{
- HCRYPTPROV provider;
- unsigned __int64 pentium_tsc[1];
- unsigned int i;
- int result = 0;
-
-
- 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)
- buf[i] = ((unsigned char*)pentium_tsc)[i];
-
- return i;
-}
-#else
-int entropy_fun(unsigned char buf[], unsigned int len)
-{
+
+#ifdef _WIN32
+int entropy_fun(unsigned char buf[], unsigned int len)
+{
+ HCRYPTPROV provider;
+ unsigned __int64 pentium_tsc[1];
+ unsigned int i;
+ int result = 0;
+
+ 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)
+ buf[i] = ((unsigned char*)pentium_tsc)[i];
+
+ return i;
+}
+#else
+int entropy_fun(unsigned char buf[], unsigned int len)
+{
int frand = open("/dev/random", O_RDONLY);
int rlen = 0;
if (frand != -1)
{
rlen = read(frand, buf, len);
- close(frand);
- }
- return rlen;
-}
+ close(frand);
+ }
+ return rlen;
+}
#endif
#if defined(__cplusplus)
Modified: trunk/lvzip/c_source/lvutil.c
===================================================================
--- trunk/lvzip/c_source/lvutil.c 2015-05-27 11:25:40 UTC (rev 1530)
+++ trunk/lvzip/c_source/lvutil.c 2015-05-27 13:31:38 UTC (rev 1531)
@@ -111,14 +111,14 @@
#endif
#if HAVE_BZIP2
-void bz_internal_error(int errcode)
-{
- // if we have a debug build then print the error in the LabVIEW debug console
-#if DEBUG
- DbgPrintf("BZIP2 internal error %ld occurred!!", errcode);
-#endif
-}
+void bz_internal_error(int errcode)
+{
+ // if we have a debug build then print the error in the LabVIEW debug console
+#if DEBUG
+ DbgPrintf("BZIP2 internal error %ld occurred!!", errcode);
#endif
+}
+#endif
#if MacOS
#if usesHFSPath
@@ -1680,7 +1680,7 @@
return mgNotSupported;
}
else
-#endif
+ #endif
{
switch (openMode)
{
@@ -1710,11 +1710,19 @@
return mgArgErr;
}
- err = MakePathDSString(path, &lstr, strlen(namedResourceFork));
- if (!err && rsrc)
+ #if MacOSX
+ if (rsrc)
{
- strcpy((char*)(LStrBuf(lstr) + LStrLen(lstr)), namedResourceFork);
+ err = MakePathDSString(path, &lstr, strlen(namedResourceFork));
+ if (!err)
+ {
+ strcpy((char*)(LStrBuf(lstr) + LStrLen(lstr)), namedResourceFork);
+ }
}
+ else
+ #else
+ err = MakePathDSString(path, &lstr, 0);
+ #endif
if (err)
return err;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lab...@us...> - 2015-05-27 15:22:27
|
Revision: 1532
http://sourceforge.net/p/opengtoolkit/svn/1532
Author: labviewer
Date: 2015-05-27 15:22:25 +0000 (Wed, 27 May 2015)
Log Message:
-----------
Update project files for Unix systems
Modified Paths:
--------------
trunk/lvzip/c_source/.cproject
trunk/lvzip/c_source/Makefile
trunk/lvzip/c_source/aes/entropy.c
trunk/lvzip/c_source/zip.c
Modified: trunk/lvzip/c_source/.cproject
===================================================================
--- trunk/lvzip/c_source/.cproject 2015-05-27 13:31:38 UTC (rev 1531)
+++ trunk/lvzip/c_source/.cproject 2015-05-27 15:22:25 UTC (rev 1532)
@@ -63,7 +63,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
- <entry excluding="iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry excluding="bzip2/bzip2.c|bzip2/dlltest.c|iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@@ -136,7 +136,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
- <entry excluding="iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry excluding="bzip2/bzip2.c|bzip2/dlltest.c|iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@@ -204,7 +204,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
- <entry excluding="iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry excluding="bzip2/bzip2.c|bzip2/dlltest.c|iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@@ -276,7 +276,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
- <entry excluding="iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry excluding="bzip2/bzip2.c|bzip2/dlltest.c|iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@@ -344,7 +344,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
- <entry excluding="iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry excluding="bzip2/bzip2.c|bzip2/dlltest.c|iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@@ -406,7 +406,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
- <entry excluding="iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ <entry excluding="bzip2/bzip2.c|bzip2/dlltest.c|iowin.h|iowin.c|minizip.c|miniunz.c|minigzip.c|gzwrite.c|gzread.c|gzlib.c|gzguts.h|gzclose.c|gvmat64.asm|gvmat32.asm|inffasx64.asm|inffas32.asm|MacBinaryIII.h|MacBinaryIII.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
Modified: trunk/lvzip/c_source/Makefile
===================================================================
--- trunk/lvzip/c_source/Makefile 2015-05-27 13:31:38 UTC (rev 1531)
+++ trunk/lvzip/c_source/Makefile 2015-05-27 15:22:25 UTC (rev 1532)
@@ -18,7 +18,6 @@
CC=gcc
-
CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DDEBUG
@@ -27,15 +26,15 @@
CINDIR=/usr/local/lv70/cintools
SFLAGS=-O3 -fPIC $(CC_ARCH_SPEC) -fvisibility=hidden -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -L$(CINDIR)
-LDFLAGS=
+LDFLAGS=-Wl,-soname=$(SHAREDLIBM)
TEST_LDFLAGS=-L. libz.a
LDSHARED=gcc
CPP=gcc -E
STATICLIB=lvzlib.a
-SHAREDLIB=lvzlib.so.1
-SHAREDLIBV=lvzlib.so
-SHAREDLIBM=
+SHAREDLIB=liblvzlib.so
+SHAREDLIBV=liblvzlib.so.4
+SHAREDLIBM=lvzlib.so
LIBS=$(STATICLIB) $(SHAREDLIBV)
AR=ar
@@ -59,7 +58,7 @@
OBJZ = adler32.o crc32.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/filenc.o aes/hmac.o aes/prng.o aes/pwd2key.o aes/sha1.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
OBJC = $(OBJZ) $(OBJL) $(OBJG) $(OBJ2) $(OBJE)
@@ -67,7 +66,7 @@
PIC_OBJZ = adler32.lo crc32.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/filenc.lo aes/hmac.lo aes/prng.lo aes/pwd2key.lo aes/sha1.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_OBJC = $(PIC_OBJZ) $(PIC_OBJL) $(PIC_OBJG) $(PIC_OBJ2) $(PIC_OBJE)
@@ -77,15 +76,15 @@
OBJS = $(OBJC) $(OBJA)
-PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
+PIC_OBJS = $(patsubst %,$(ODIR)/%,$(PIC_OBJC)) $(patsubst %,$(ODIR)/%,$(PIC_OBJA))
all: static all64
linux32: clean
- $(MAKE) $(SHAREDLIBV) ARCH_DIR=./Linux_x86 CC_ARCH_SPEC="-m32"
+ $(MAKE) $(SHAREDLIBV) ODIR=./Linux_x86 CC_ARCH_SPEC="-m32"
linux64: clean
- $(MAKE) $(SHAREDLIBV) ARCH_DIR=./Linux_x64 CC_ARCH_SPEC="-m64"
+ $(MAKE) $(SHAREDLIBV) ODIR=./Linux_x64 CC_ARCH_SPEC="-m64"
static: example$(EXE) minigzip$(EXE)
@@ -166,18 +165,17 @@
.SUFFIXES: .lo
-.c.lo:
- -@mkdir $(ARCH_DIR) 2>/dev/null || test -d $(ARCH_DIR)
- -@mkdir $(ARCH_DIR)/aes 2>/dev/null || test -d $(ARCH_DIR)/aes
- -@mkdir $(ARCH_DIR)/bzip2 2>/dev/null || test -d $(ARCH_DIR)/bzip2
- $(CC) $(SFLAGS) -DPIC -c -o $(ARCH_DIR)/$*.o $<
- -@mv $(ARCH_DIR)/$*.o $(ARCH_DIR)/$@
+$(ODIR)/%.lo: %.c
+ -@mkdir $(ODIR) 2>/dev/null || test -d $(ODIR)
+ -@mkdir $(ODIR)/aes 2>/dev/null || test -d $(ODIR)/aes
+ -@mkdir $(ODIR)/bzip2 2>/dev/null || test -d $(ODIR)/bzip2
+ $(CC) $(SFLAGS) -DPIC -c -o $(ODIR)/$*.lo $<
placebo $(SHAREDLIBV): $(PIC_OBJS)
- $(LDSHARED) $(SFLAGS) -shared -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
- rm -f $(SHAREDLIB) $(SHAREDLIBM)
-# ln -s $@ $(SHAREDLIB)
-# ln -s $@ $(SHAREDLIBM)
+ $(LDSHARED) $(SFLAGS) -shared -o $(ODIR)/$@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
+ rm -f $(ODIR)/$(SHAREDLIB) $(ODIR)/$(SHAREDLIBM)
+# ln -s $(ODIR)/$@ $(ODIR)/$(SHAREDLIB)
+# ln -s $(ODIR)/$@ $(ODIR)/$(SHAREDLIBM)
example$(EXE): example.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
@@ -260,7 +258,7 @@
infcover \
libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o
- rm -rf $(ARCH_DIR)/*.lo
+ rm -rf *.lo
rm -f *.gcda *.gcno *.gcov
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
Modified: trunk/lvzip/c_source/aes/entropy.c
===================================================================
--- trunk/lvzip/c_source/aes/entropy.c 2015-05-27 13:31:38 UTC (rev 1531)
+++ trunk/lvzip/c_source/aes/entropy.c 2015-05-27 15:22:25 UTC (rev 1532)
@@ -1,6 +1,7 @@
#ifdef _WIN32
#include <windows.h>
#else
+#include <stdio.h>
#include <fcntl.h>
#endif
@@ -35,12 +36,12 @@
#else
int entropy_fun(unsigned char buf[], unsigned int len)
{
- int frand = open("/dev/random", O_RDONLY);
+ FILE *frand = fopen("/dev/random", "r");
int rlen = 0;
- if (frand != -1)
+ if (frand != NULL)
{
- rlen = read(frand, buf, len);
- close(frand);
+ rlen = fread(buf, sizeof(unsigned char), len, frand);
+ fclose(frand);
}
return rlen;
}
Modified: trunk/lvzip/c_source/zip.c
===================================================================
--- trunk/lvzip/c_source/zip.c 2015-05-27 13:31:38 UTC (rev 1531)
+++ trunk/lvzip/c_source/zip.c 2015-05-27 15:22:25 UTC (rev 1532)
@@ -843,7 +843,7 @@
if (err == ZIP_OK)
{
err = zip64local_SearchCentralDir64(&pziinit->z_filefunc, pziinit->filestream, ¢ral_pos);
- if (err = ZIP_OK)
+ if (err == ZIP_OK)
{
ZPOS64_T sizeEndOfCentralDirectory;
if (ZSEEK64(pziinit->z_filefunc, pziinit->filestream, central_pos, ZLIB_FILEFUNC_SEEK_SET) != 0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|