Removed unneeded whitespace.

This commit is contained in:
n-a-c-h
2005-06-02 01:05:50 +00:00
parent b13fbb8f41
commit 57eed11457
70 changed files with 1570 additions and 1570 deletions

View File

@@ -1,4 +1,4 @@
/* unzip.c -- IO on .zip files using zlib
/* unzip.c -- IO on .zip files using zlib
Version 0.15 beta, Mar 19th, 1998,
Read unzip.h for more info
@@ -150,7 +150,7 @@ local int unzlocal_getByte(fin,pi)
}
else
{
if (ferror(fin))
if (ferror(fin))
return UNZ_ERRNO;
else
return UNZ_EOF;
@@ -159,7 +159,7 @@ local int unzlocal_getByte(fin,pi)
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets
Reads a long in LSB order from the given gz_stream. Sets
*/
local int unzlocal_getShort (fin,pX)
FILE* fin;
@@ -171,11 +171,11 @@ local int unzlocal_getShort (fin,pX)
err = unzlocal_getByte(fin,&i);
x = (uLong)i;
if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<8;
if (err==UNZ_OK)
*pX = x;
else
@@ -193,7 +193,7 @@ local int unzlocal_getLong (fin,pX)
err = unzlocal_getByte(fin,&i);
x = (uLong)i;
if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<8;
@@ -205,7 +205,7 @@ local int unzlocal_getLong (fin,pX)
if (err==UNZ_OK)
err = unzlocal_getByte(fin,&i);
x += ((uLong)i)<<24;
if (err==UNZ_OK)
*pX = x;
else
@@ -249,7 +249,7 @@ local int strcmpcasenosensitive_internal (fileName1,fileName2)
#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
#endif
/*
/*
Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
@@ -270,7 +270,7 @@ extern int ZEXPORT unzStringFileNameCompare (fileName1,fileName2,iCaseSensitivit
return strcmp(fileName1,fileName2);
return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
}
}
#define BUFREADCOMMENT (0x400)
@@ -286,13 +286,13 @@ local uLong unzlocal_SearchCentralDir(fin)
uLong uBackRead;
uLong uMaxBack=0xffff; /* maximum size of global comment */
uLong uPosFound=0;
if (fseek(fin,0,SEEK_END) != 0)
return 0;
uSizeFile = ftell( fin );
if (uMaxBack>uSizeFile)
uMaxBack = uSizeFile;
@@ -305,13 +305,13 @@ local uLong unzlocal_SearchCentralDir(fin)
{
uLong uReadSize,uReadPos ;
int i;
if (uBackRead+BUFREADCOMMENT>uMaxBack)
if (uBackRead+BUFREADCOMMENT>uMaxBack)
uBackRead = uMaxBack;
else
uBackRead+=BUFREADCOMMENT;
uReadPos = uSizeFile-uBackRead ;
uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ?
(BUFREADCOMMENT+4) : (uSizeFile-uReadPos);
if (fseek(fin,uReadPos,SEEK_SET)!=0)
break;
@@ -320,7 +320,7 @@ local uLong unzlocal_SearchCentralDir(fin)
break;
for (i=(int)uReadSize-3; (i--)>0;)
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) &&
((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06))
{
uPosFound = uReadPos+i;
@@ -351,12 +351,12 @@ extern unzFile ZEXPORT unzOpen (path)
uLong central_pos,uL;
FILE * fin ;
uLong number_disk; /* number of the current dist, used for
uLong number_disk; /* number of the current dist, used for
spaning ZIP, unsupported, always 0*/
uLong number_disk_with_CD; /* number the the disk with central dir, used
for spaning ZIP, unsupported, always 0*/
uLong number_entry_CD; /* total number of entries in
the central dir
the central dir
(same than number_entry on nospan) */
int err=UNZ_OK;
@@ -404,7 +404,7 @@ extern unzFile ZEXPORT unzOpen (path)
if (unzlocal_getLong(fin,&us.size_central_dir)!=UNZ_OK)
err=UNZ_ERRNO;
/* offset of start of central directory with respect to the
/* offset of start of central directory with respect to the
starting disk number */
if (unzlocal_getLong(fin,&us.offset_central_dir)!=UNZ_OK)
err=UNZ_ERRNO;
@@ -413,7 +413,7 @@ extern unzFile ZEXPORT unzOpen (path)
if (unzlocal_getShort(fin,&us.gi.size_comment)!=UNZ_OK)
err=UNZ_ERRNO;
if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
if ((central_pos<us.offset_central_dir+us.size_central_dir) &&
(err==UNZ_OK))
err=UNZ_BADZIPFILE;
@@ -428,12 +428,12 @@ extern unzFile ZEXPORT unzOpen (path)
(us.offset_central_dir+us.size_central_dir);
us.central_pos = central_pos;
us.pfile_in_zip_read = NULL;
s=(unz_s*)ALLOC(sizeof(unz_s));
*s=us;
unzGoToFirstFile((unzFile)s);
return (unzFile)s;
unzGoToFirstFile((unzFile)s);
return (unzFile)s;
}
@@ -499,7 +499,7 @@ local void unzlocal_DosDateToTmuDate (ulDosDate, ptm)
*/
local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
unz_file_info *pfile_info,
unz_file_info_internal
unz_file_info_internal
*pfile_info_internal,
char *szFileName,
uLong fileNameBufferSize,
@@ -612,7 +612,7 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
lSeek -= uSizeRead;
}
if ((err==UNZ_OK) && (extraField!=NULL))
{
uLong uSizeRead ;
@@ -634,9 +634,9 @@ local int unzlocal_GetCurrentFileInfoInternal (file,
lSeek += file_info.size_file_extra - uSizeRead;
}
else
lSeek+=file_info.size_file_extra;
lSeek+=file_info.size_file_extra;
if ((err==UNZ_OK) && (szComment!=NULL))
{
uLong uSizeRead ;
@@ -729,7 +729,7 @@ extern int ZEXPORT unzGoToFirstFile (file)
extern int ZEXPORT unzGoToNextFile (file)
unzFile file;
{
unz_s* s;
unz_s* s;
int err;
if (file==NULL)
@@ -764,10 +764,10 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
const char *szFileName;
int iCaseSensitivity;
{
unz_s* s;
unz_s* s;
int err;
uLong num_fileSaved;
uLong pos_in_central_dirSaved;
@@ -877,7 +877,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
if (unzlocal_getLong(s->file,&uData) != UNZ_OK) /* size uncompr */
err=UNZ_ERRNO;
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.uncompressed_size) &&
((uFlags & 8)==0))
err=UNZ_BADZIPFILE;
@@ -899,7 +899,7 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar,
return err;
}
/*
Open for reading data the current file in the zipfile.
If there is no error and the file is opened, the return value is UNZ_OK.
@@ -945,7 +945,7 @@ extern int ZEXPORT unzOpenCurrentFile (file)
}
pfile_in_zip_read_info->stream_initialised=0;
if ((s->cur_file_info.compression_method!=0) &&
(s->cur_file_info.compression_method!=Z_DEFLATED))
err=UNZ_BADZIPFILE;
@@ -964,29 +964,29 @@ extern int ZEXPORT unzOpenCurrentFile (file)
{
pfile_in_zip_read_info->stream.zalloc = (alloc_func)0;
pfile_in_zip_read_info->stream.zfree = (free_func)0;
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
pfile_in_zip_read_info->stream.opaque = (voidpf)0;
err=inflateInit2(&pfile_in_zip_read_info->stream, -MAX_WBITS);
if (err == Z_OK)
pfile_in_zip_read_info->stream_initialised=1;
/* windowBits is passed < 0 to tell that there is no zlib header.
* Note that in this case inflate *requires* an extra "dummy" byte
* after the compressed stream in order to complete decompression and
* return Z_STREAM_END.
* In unzip, i don't wait absolutely Z_STREAM_END because I known the
* return Z_STREAM_END.
* In unzip, i don't wait absolutely Z_STREAM_END because I known the
* size of both compressed and uncompressed data
*/
}
pfile_in_zip_read_info->rest_read_compressed =
pfile_in_zip_read_info->rest_read_compressed =
s->cur_file_info.compressed_size ;
pfile_in_zip_read_info->rest_read_uncompressed =
pfile_in_zip_read_info->rest_read_uncompressed =
s->cur_file_info.uncompressed_size ;
pfile_in_zip_read_info->pos_in_zipfile =
s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
pfile_in_zip_read_info->pos_in_zipfile =
s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
iSizeVar;
pfile_in_zip_read_info->stream.avail_in = (uInt)0;
@@ -1031,9 +1031,9 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
pfile_in_zip_read_info->stream.next_out = (Bytef*)buf;
pfile_in_zip_read_info->stream.avail_out = (uInt)len;
if (len>pfile_in_zip_read_info->rest_read_uncompressed)
pfile_in_zip_read_info->stream.avail_out =
pfile_in_zip_read_info->stream.avail_out =
(uInt)pfile_in_zip_read_info->rest_read_uncompressed;
while (pfile_in_zip_read_info->stream.avail_out>0)
@@ -1047,7 +1047,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
if (uReadThis == 0)
return UNZ_EOF;
if (fseek(pfile_in_zip_read_info->file,
pfile_in_zip_read_info->pos_in_zipfile +
pfile_in_zip_read_info->pos_in_zipfile +
pfile_in_zip_read_info->byte_before_the_zipfile,SEEK_SET)!=0)
return UNZ_ERRNO;
if (fread(pfile_in_zip_read_info->read_buffer,uReadThis,1,
@@ -1056,8 +1056,8 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
pfile_in_zip_read_info->rest_read_compressed-=uReadThis;
pfile_in_zip_read_info->stream.next_in =
pfile_in_zip_read_info->stream.next_in =
(Bytef*)pfile_in_zip_read_info->read_buffer;
pfile_in_zip_read_info->stream.avail_in = (uInt)uReadThis;
}
@@ -1065,16 +1065,16 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
if (pfile_in_zip_read_info->compression_method==0)
{
uInt uDoCopy,i ;
if (pfile_in_zip_read_info->stream.avail_out <
if (pfile_in_zip_read_info->stream.avail_out <
pfile_in_zip_read_info->stream.avail_in)
uDoCopy = pfile_in_zip_read_info->stream.avail_out ;
else
uDoCopy = pfile_in_zip_read_info->stream.avail_in ;
for (i=0;i<uDoCopy;i++)
*(pfile_in_zip_read_info->stream.next_out+i) =
*(pfile_in_zip_read_info->stream.next_in+i);
pfile_in_zip_read_info->crc32 = crc32(pfile_in_zip_read_info->crc32,
pfile_in_zip_read_info->stream.next_out,
uDoCopy);
@@ -1106,8 +1106,8 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
uOutThis = uTotalOutAfter-uTotalOutBefore;
pfile_in_zip_read_info->crc32 =
pfile_in_zip_read_info->crc32 =
crc32(pfile_in_zip_read_info->crc32,bufBefore,
(uInt)(uOutThis));
@@ -1115,10 +1115,10 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
uOutThis;
iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
if (err==Z_STREAM_END)
return (iRead==0) ? UNZ_EOF : iRead;
if (err!=Z_OK)
if (err!=Z_OK)
break;
}
}
@@ -1150,7 +1150,7 @@ extern z_off_t ZEXPORT unztell (file)
/*
return 1 if the end of file was reached, 0 elsewhere
return 1 if the end of file was reached, 0 elsewhere
*/
extern int ZEXPORT unzeof (file)
unzFile file;
@@ -1164,7 +1164,7 @@ extern int ZEXPORT unzeof (file)
if (pfile_in_zip_read_info==NULL)
return UNZ_PARAMERROR;
if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
return 1;
else
@@ -1182,7 +1182,7 @@ extern int ZEXPORT unzeof (file)
if buf!=NULL, len is the size of the buffer, the extra header is copied in
buf.
the return value is the number of bytes copied in buf, or (if <0)
the return value is the number of bytes copied in buf, or (if <0)
the error code
*/
extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
@@ -1203,12 +1203,12 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
if (pfile_in_zip_read_info==NULL)
return UNZ_PARAMERROR;
size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
pfile_in_zip_read_info->pos_local_extrafield);
if (buf==NULL)
return (int)size_to_read;
if (len>size_to_read)
read_now = (uInt)size_to_read;
else
@@ -1216,9 +1216,9 @@ extern int ZEXPORT unzGetLocalExtrafield (file,buf,len)
if (read_now==0)
return 0;
if (fseek(pfile_in_zip_read_info->file,
pfile_in_zip_read_info->offset_local_extrafield +
pfile_in_zip_read_info->offset_local_extrafield +
pfile_in_zip_read_info->pos_local_extrafield,SEEK_SET)!=0)
return UNZ_ERRNO;

View File

@@ -5,7 +5,7 @@
#ifdef __WIN32__
#include <windows.h>
#include <sys/stat.h>
#ifdef __WIN32DBG__
#include <crtdbg.h>
#endif
@@ -42,7 +42,7 @@ int Png_Dump(const char * filename, unsigned short width, unsigned short height,
{
return (-1);
}
fake_pal.red = 0;
fake_pal.green = 0;
fake_pal.blue = 0;
@@ -52,14 +52,14 @@ int Png_Dump(const char * filename, unsigned short width, unsigned short height,
user_error_fn*/NULL, NULL/*user_warning_fn*/);
if (!png_ptr)
return (-1);
/*set png I/O source.*/
png_init_io(png_ptr, fp);
/* set the zlib compression level */
png_set_compression_level(png_ptr,
Z_BEST_COMPRESSION);
/* set other zlib parameters */
png_set_compression_mem_level(png_ptr, 8);
png_set_compression_strategy(png_ptr,
@@ -77,12 +77,12 @@ int Png_Dump(const char * filename, unsigned short width, unsigned short height,
return (-1);
}
/*set a lot of image info (code adapted from libpng documentation!)*/
png_set_IHDR(png_ptr, info_ptr, width, height,
8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
info_ptr->color_type=PNG_COLOR_TYPE_RGB_ALPHA;
/*Allocate an array of scanline pointers*/
@@ -107,10 +107,10 @@ int Png_Dump(const char * filename, unsigned short width, unsigned short height,
/*close file*/
fclose(fp);
/*Destroy PNG structs*/
png_destroy_write_struct(&png_ptr, &info_ptr);
/*clean up dynamically allocated RAM.*/
free(row_pointers);

View File

@@ -1,4 +1,4 @@
/* unzip.h -- IO for uncompress .zip files using zlib
/* unzip.h -- IO for uncompress .zip files using zlib
Version 0.15 beta, Mar 19th, 1998,
Copyright (C) 1998 Gilles Vollant
@@ -33,7 +33,7 @@
*/
/* for more info about .ZIP format, see
/* for more info about .ZIP format, see
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
PkWare has also a specification at :
ftp://ftp.pkware.com/probdesc.zip */
@@ -50,7 +50,7 @@ extern "C" {
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
/* like the STRICT of WIN32, we define a pointer that cannot be converted
from (void*) without cast */
typedef struct TagunzFile__ { int unused; } unzFile__;
typedef struct TagunzFile__ { int unused; } unzFile__;
typedef unzFile__ *unzFile;
#else
typedef voidp unzFile;
@@ -67,7 +67,7 @@ typedef voidp unzFile;
#define UNZ_CRCERROR (-105)
/* tm_unz contain date/time info */
typedef struct tm_unz_s
typedef struct tm_unz_s
{
uInt tm_sec; /* seconds after the minute - [0,59] */
uInt tm_min; /* minutes after the hour - [0,59] */
@@ -96,8 +96,8 @@ typedef struct unz_file_info_s
uLong compression_method; /* compression method 2 bytes */
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
uLong crc; /* crc-32 4 bytes */
uLong compressed_size; /* compressed size 4 bytes */
uLong uncompressed_size; /* uncompressed size 4 bytes */
uLong compressed_size; /* compressed size 4 bytes */
uLong uncompressed_size; /* uncompressed size 4 bytes */
uLong size_filename; /* filename length 2 bytes */
uLong size_file_extra; /* extra field length 2 bytes */
uLong size_file_comment; /* file comment length 2 bytes */
@@ -174,7 +174,7 @@ extern int ZEXPORT unzGoToNextFile OF((unzFile file));
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
*/
extern int ZEXPORT unzLocateFile OF((unzFile file,
extern int ZEXPORT unzLocateFile OF((unzFile file,
const char *szFileName,
int iCaseSensitivity));
/*
@@ -225,8 +225,8 @@ extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
voidp buf,
unsigned len));
/*
@@ -247,7 +247,7 @@ extern z_off_t ZEXPORT unztell OF((unzFile file));
extern int ZEXPORT unzeof OF((unzFile file));
/*
return 1 if the end of file was reached, 0 elsewhere
return 1 if the end of file was reached, 0 elsewhere
*/
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
@@ -262,7 +262,7 @@ extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
if buf!=NULL, len is the size of the buffer, the extra header is copied in
buf.
the return value is the number of bytes copied in buf, or (if <0)
the return value is the number of bytes copied in buf, or (if <0)
the error code
*/