diff --git a/MiniZip/ioapi.c b/MiniZip/ioapi.c index 8e8c33e..7b5c876 100755 --- a/MiniZip/ioapi.c +++ b/MiniZip/ioapi.c @@ -121,7 +121,7 @@ static voidpf file_build_ioposix(FILE *file, const char *filename) 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)); strncpy(ioposix->filename, filename, ioposix->filenameLength); return (voidpf)ioposix; diff --git a/MiniZip/unzip.c b/MiniZip/unzip.c index b1d83a9..df4e534 100755 --- a/MiniZip/unzip.c +++ b/MiniZip/unzip.c @@ -646,14 +646,14 @@ local int unzGoToNextDisk(unzFile file) if (s == NULL) return UNZ_PARAMERROR; pfile_in_zip_read_info = s->pfile_in_zip_read; - number_disk_next = s->number_disk; + number_disk_next = (int) s->number_disk; if ((pfile_in_zip_read_info != NULL) && (pfile_in_zip_read_info->rest_read_uncompressed > 0)) /* We are currently reading a file and we need the next sequential disk */ number_disk_next += 1; else /* Goto the disk for the current file */ - number_disk_next = s->cur_file_info.disk_num_start; + number_disk_next = (int) s->cur_file_info.disk_num_start; if (number_disk_next != s->number_disk) { @@ -1390,8 +1390,8 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) uInt total_bytes_read = 0; if (pfile_in_zip_read_info->stream.next_in != NULL) - bytes_not_read = pfile_in_zip_read_info->read_buffer + UNZ_BUFSIZE - - pfile_in_zip_read_info->stream.next_in; + bytes_not_read = (uInt) (pfile_in_zip_read_info->read_buffer + UNZ_BUFSIZE - + pfile_in_zip_read_info->stream.next_in); bytes_to_read -= bytes_not_read; if (bytes_not_read > 0) memcpy(pfile_in_zip_read_info->read_buffer, pfile_in_zip_read_info->stream.next_in, bytes_not_read); @@ -1407,7 +1407,7 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) ZLIB_FILEFUNC_SEEK_SET) != 0) return UNZ_ERRNO; - bytes_read = ZREAD64(pfile_in_zip_read_info->z_filefunc, pfile_in_zip_read_info->filestream, + bytes_read = (int) ZREAD64(pfile_in_zip_read_info->z_filefunc, pfile_in_zip_read_info->filestream, pfile_in_zip_read_info->read_buffer + bytes_not_read + total_bytes_read, bytes_to_read - total_bytes_read); diff --git a/MiniZip/zip.c b/MiniZip/zip.c index a430c92..0ffb133 100755 --- a/MiniZip/zip.c +++ b/MiniZip/zip.c @@ -510,7 +510,7 @@ local int zipGoToFirstDisk(zipFile file) return err; number_disk_next = 0; if (zi->number_disk_with_CD > 0) - number_disk_next = zi->number_disk_with_CD - 1; + number_disk_next = (int) (zi->number_disk_with_CD - 1); err = zipGoToSpecificDisk(file, number_disk_next, (zi->append == APPEND_STATUS_ADDINZIP)); if ((err == ZIP_ERRNO) && (zi->append == APPEND_STATUS_ADDINZIP)) err = zipGoToSpecificDisk(file, number_disk_next, 0); @@ -535,7 +535,7 @@ local int zipGoToNextDisk(zipFile file) if (zi->disk_size == 0) return err; - number_disk_next = zi->number_disk + 1; + number_disk_next = (int) (zi->number_disk + 1); do { @@ -661,14 +661,14 @@ extern zipFile ZEXPORT zipOpen4(const void *pathname, int append, ZPOS64_T disk_ zip64_internal ziinit; zip64_internal* zi; ZPOS64_T byte_before_the_zipfile; /* byte before the zipfile, (>0 for sfx)*/ - ZPOS64_T size_central_dir; /* size of the central directory */ - ZPOS64_T offset_central_dir; /* offset of start of central directory */ - ZPOS64_T number_entry_CD; /* total number of entries in the central dir */ + ZPOS64_T size_central_dir = 0; /* size of the central directory */ + ZPOS64_T offset_central_dir = 0; /* offset of start of central directory */ + ZPOS64_T number_entry_CD = 0; /* total number of entries in the central dir */ ZPOS64_T number_entry; ZPOS64_T central_pos; ZPOS64_T size_central_dir_to_read; uLong uL; - uLong size_comment; + uLong size_comment = 0; size_t buf_size = SIZEDATA_INDATABLOCK; void* buf_read; int err = ZIP_OK; @@ -1428,7 +1428,7 @@ local int zip64FlushWriteBuffer(zip64_internal* zi) max_write = (uInt)size_available; } - written = ZWRITE64(zi->z_filefunc, zi->filestream, zi->ci.buffered_data + total_written, max_write); + written = (int) ZWRITE64(zi->z_filefunc, zi->filestream, zi->ci.buffered_data + total_written, max_write); if (ZERROR64(zi->z_filefunc,zi->filestream)) { @@ -1784,7 +1784,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si /* Local file header is stored on previous disk, switch to make edits */ if (zi->ci.number_disk != cur_number_disk) - zipGoToSpecificDisk(file, zi->ci.number_disk, 1); + zipGoToSpecificDisk(file, (int) (zi->ci.number_disk), 1); if (ZSEEK64(zi->z_filefunc,zi->filestream, zi->ci.pos_local_header + 14,ZLIB_FILEFUNC_SEEK_SET) != 0) err = ZIP_ERRNO; @@ -1818,7 +1818,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si /* Now switch back again to the disk we were on before */ if (zi->ci.number_disk != cur_number_disk) - zipGoToSpecificDisk(file, cur_number_disk, 1); + zipGoToSpecificDisk(file, (int) cur_number_disk, 1); if (ZSEEK64(zi->z_filefunc,zi->filestream, cur_pos_inzip, ZLIB_FILEFUNC_SEEK_SET) != 0) err = ZIP_ERRNO; @@ -1877,7 +1877,7 @@ extern int ZEXPORT zipClose(zipFile file, const char* global_comment) { if ((err == ZIP_OK) && (ldi->filled_in_this_block > 0)) { - write = ZWRITE64(zi->z_filefunc, zi->filestream, ldi->data, ldi->filled_in_this_block); + write = (int) ZWRITE64(zi->z_filefunc, zi->filestream, ldi->data, ldi->filled_in_this_block); if (write != ldi->filled_in_this_block) err = ZIP_ERRNO; } diff --git a/Objective-Zip Tests/ObjectiveZip_Tests.m b/Objective-Zip Tests/ObjectiveZip_Tests.m index 1901c9e..13320ae 100644 --- a/Objective-Zip Tests/ObjectiveZip_Tests.m +++ b/Objective-Zip Tests/ObjectiveZip_Tests.m @@ -210,7 +210,7 @@ - (void) test02ZipAndUnzip5GB { -#warning Remove to enable this test, but be careful: takes 5 minutes and consumes 5 GB of disk space +// TODO Remove to enable this test, but be careful: takes 5 minutes and consumes 5 GB of disk space return; NSString *documentsDir= [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; diff --git a/ZLib/gzlib.c b/ZLib/gzlib.c index fae202e..16716bc 100644 --- a/ZLib/gzlib.c +++ b/ZLib/gzlib.c @@ -253,7 +253,7 @@ local gzFile gz_open(path, fd, mode) /* save the current position for rewinding (only if reading) */ if (state->mode == GZ_READ) { - state->start = LSEEK(state->fd, 0, SEEK_CUR); + state->start = (z_off64_t) LSEEK(state->fd, 0, SEEK_CUR); if (state->start == -1) state->start = 0; } @@ -393,7 +393,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence) /* if within raw area while reading, just go there */ if (state->mode == GZ_READ && state->how == COPY && state->x.pos + offset >= 0) { - ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); + ret = (z_off64_t) LSEEK(state->fd, offset - state->x.have, SEEK_CUR); if (ret == -1) return -1; state->x.have = 0; @@ -489,7 +489,7 @@ z_off64_t ZEXPORT gzoffset64(file) return -1; /* compute and return effective offset in file */ - offset = LSEEK(state->fd, 0, SEEK_CUR); + offset = (z_off64_t) LSEEK(state->fd, 0, SEEK_CUR); if (offset == -1) return -1; if (state->mode == GZ_READ) /* reading */ diff --git a/ZLib/gzread.c b/ZLib/gzread.c index bf4538e..68ad01d 100644 --- a/ZLib/gzread.c +++ b/ZLib/gzread.c @@ -27,7 +27,7 @@ local int gz_load(state, buf, len, have) *have = 0; do { - ret = read(state->fd, buf + *have, len - *have); + ret = (int) read(state->fd, buf + *have, len - *have); if (ret <= 0) break; *have += ret; diff --git a/ZLib/gzwrite.c b/ZLib/gzwrite.c index aa767fb..e952541 100644 --- a/ZLib/gzwrite.c +++ b/ZLib/gzwrite.c @@ -81,7 +81,7 @@ local int gz_comp(state, flush) /* write directly if requested */ if (state->direct) { - got = write(state->fd, strm->next_in, strm->avail_in); + got = (int) write(state->fd, strm->next_in, strm->avail_in); if (got < 0 || (unsigned)got != strm->avail_in) { gz_error(state, Z_ERRNO, zstrerror()); return -1; @@ -98,7 +98,7 @@ local int gz_comp(state, flush) if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && (flush != Z_FINISH || ret == Z_STREAM_END))) { have = (unsigned)(strm->next_out - state->x.next); - if (have && ((got = write(state->fd, state->x.next, have)) < 0 || + if (have && ((got = (int) write(state->fd, state->x.next, have)) < 0 || (unsigned)got != have)) { gz_error(state, Z_ERRNO, zstrerror()); return -1;