summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/quazip/unzip.c
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2020-06-08 20:25:36 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2020-08-07 22:18:41 +0200
commitb0f22620a2dbfb991b10a8e1e8b0c8db5e3ee117 (patch)
tree2695997733229be38ec71c36753b19ba2e98aa61 /rbutil/rbutilqt/quazip/unzip.c
parentb3a0187416e48d80275af6be0178cef155aa03dc (diff)
downloadrockbox-b0f22620a2.tar.gz
rockbox-b0f22620a2.tar.bz2
rockbox-b0f22620a2.zip
rbutil: Update quazip to release 0.9.1.
Update to latest quazip release. Change-Id: I03189ceeadbe3110a9420153d84bd5d33d5b663f
Diffstat (limited to 'rbutil/rbutilqt/quazip/unzip.c')
-rw-r--r--rbutil/rbutilqt/quazip/unzip.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/rbutil/rbutilqt/quazip/unzip.c b/rbutil/rbutilqt/quazip/unzip.c
index bca03f8323..6aaeba6930 100644
--- a/rbutil/rbutilqt/quazip/unzip.c
+++ b/rbutil/rbutilqt/quazip/unzip.c
@@ -15,6 +15,8 @@
For more info read MiniZip_info.txt
+ Modifications for static code analysis report
+ Copyright (C) 2016 Intel Deutschland GmbH
------------------------------------------------------------------------------------
Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of
@@ -28,7 +30,7 @@
If, for some reason, all these files are missing, the Info-ZIP license
also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
- crypt.c (full version) by Info-ZIP. Last revised: [see crypt.h]
+ crypt.c (full version) by Info-ZIP. Last revised: [see minizip_crypt.h]
The encryption/decryption parts of this source code (as opposed to the
non-echoing password parts) were originally written in Europe. The
@@ -71,7 +73,7 @@
#include <stdlib.h>
#include <string.h>
-#include "zlib.h"
+#include <zlib.h>
#if (ZLIB_VERNUM < 0x1270)
typedef uLongf z_crc_t;
#endif
@@ -197,7 +199,7 @@ typedef struct
#ifndef NOUNCRYPT
-#include "crypt.h"
+#include "minizip_crypt.h"
#endif
/* ===========================================================================
@@ -856,6 +858,17 @@ extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info
pglobal_info32->size_comment = s->gi.size_comment;
return UNZ_OK;
}
+
+extern int ZEXPORT unzGetFileFlags (unzFile file, unsigned* pflags)
+{
+ unz64_s* s;
+ if (file==NULL)
+ return UNZ_PARAMERROR;
+ s=(unz64_s*)file;
+ *pflags = s->flags;
+ return UNZ_OK;
+}
+
/*
Translate date/time from Dos format to tm_unz (readable more easilty)
*/
@@ -1198,6 +1211,8 @@ extern int ZEXPORT unzGoToFirstFile (unzFile file)
&s->cur_file_info_internal,
NULL,0,NULL,0,NULL,0);
s->current_file_ok = (err == UNZ_OK);
+ if (s->cur_file_info.flag & UNZ_ENCODING_UTF8)
+ unzSetFlags(file, UNZ_ENCODING_UTF8);
return err;
}
@@ -1594,6 +1609,7 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
pfile_in_zip_read_info->stream_initialised=Z_DEFLATED;
else
{
+ TRYFREE(pfile_in_zip_read_info->read_buffer);
TRYFREE(pfile_in_zip_read_info);
return err;
}
@@ -1845,38 +1861,30 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
} /* end Z_BZIP2ED */
else
{
- ZPOS64_T uTotalOutBefore,uTotalOutAfter;
+ uInt uAvailOutBefore,uAvailOutAfter;
const Bytef *bufBefore;
- ZPOS64_T uOutThis;
+ uInt uOutThis;
int flush=Z_SYNC_FLUSH;
- uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
+ uAvailOutBefore = pfile_in_zip_read_info->stream.avail_out;
bufBefore = pfile_in_zip_read_info->stream.next_out;
- /*
- if ((pfile_in_zip_read_info->rest_read_uncompressed ==
- pfile_in_zip_read_info->stream.avail_out) &&
- (pfile_in_zip_read_info->rest_read_compressed == 0))
- flush = Z_FINISH;
- */
err=inflate(&pfile_in_zip_read_info->stream,flush);
if ((err>=0) && (pfile_in_zip_read_info->stream.msg!=NULL))
err = Z_DATA_ERROR;
- uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
- uOutThis = uTotalOutAfter-uTotalOutBefore;
+ uAvailOutAfter = pfile_in_zip_read_info->stream.avail_out;
+ uOutThis = uAvailOutBefore - uAvailOutAfter;
pfile_in_zip_read_info->total_out_64 = pfile_in_zip_read_info->total_out_64 + uOutThis;
- pfile_in_zip_read_info->crc32 =
- crc32(pfile_in_zip_read_info->crc32,bufBefore,
- (uInt)(uOutThis));
+ pfile_in_zip_read_info->crc32
+ = crc32(pfile_in_zip_read_info->crc32,bufBefore, uOutThis);
- pfile_in_zip_read_info->rest_read_uncompressed -=
- uOutThis;
+ pfile_in_zip_read_info->rest_read_uncompressed -= uOutThis;
- iRead += (uInt)(uTotalOutAfter - uTotalOutBefore);
+ iRead += uAvailOutBefore - uAvailOutAfter;
if (err==Z_STREAM_END)
return (iRead==0) ? UNZ_EOF : iRead;