X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=unzip.c;h=4448d85b27ca5bfb357bcc8ef7017dc98ec17ab7;hb=4de1b0aee9ef3dcbec05bf9042c14bbd74ac2319;hp=9ad4766d8db3e70080cc34ebe04f7c54449709a0;hpb=3ddd6d5ea2811b783bf349c8947cf1bbaaf3c8b9;p=drnoksnes diff --git a/unzip.c b/unzip.c index 9ad4766..4448d85 100644 --- a/unzip.c +++ b/unzip.c @@ -204,8 +204,8 @@ local int unzlocal_getShort (pzlib_filefunc_def,filestream,pX) uLong *pX; { uLong x ; - int i; - int err; + int i = 0; + int err = UNZ_OK; err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); x = (uLong)i; @@ -232,8 +232,8 @@ local int unzlocal_getLong (pzlib_filefunc_def,filestream,pX) uLong *pX; { uLong x ; - int i; - int err; + int i = 0; + int err = UNZ_OK; err = unzlocal_getByte(pzlib_filefunc_def,filestream,&i); x = (uLong)i; @@ -607,11 +607,12 @@ local int unzlocal_GetCurrentFileInfoInternal (file, /* we check the magic */ - if (err==UNZ_OK) + 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; @@ -687,11 +688,13 @@ local int unzlocal_GetCurrentFileInfoInternal (file, else uSizeRead = extraFieldBufferSize; - if (lSeek!=0) + 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; @@ -712,11 +715,13 @@ local int unzlocal_GetCurrentFileInfoInternal (file, else uSizeRead = commentBufferSize; - if (lSeek!=0) + 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; @@ -976,11 +981,12 @@ local int unzlocal_CheckCurrentFileCoherencyHeader (s,piSizeVar, return UNZ_ERRNO; - if (err==UNZ_OK) + 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; @@ -1534,7 +1540,6 @@ extern int ZEXPORT unzGetGlobalComment (file, szComment, uSizeBuf) char *szComment; uLong uSizeBuf; { - int err=UNZ_OK; unz_s* s; uLong uReadThis ; if (file==NULL)