From e32e85c964cf8f465be6bcc273b89d4379c776fe Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 5 Sep 2015 16:15:33 +0200 Subject: [PATCH] Cleanups --- decompress/7zip_support.c | 6 +++--- decompress/zip_support.c | 34 +++------------------------------- 2 files changed, 6 insertions(+), 34 deletions(-) diff --git a/decompress/7zip_support.c b/decompress/7zip_support.c index 43dd987f12..f0c92247d9 100644 --- a/decompress/7zip_support.c +++ b/decompress/7zip_support.c @@ -400,12 +400,12 @@ struct string_list *compressed_7zip_file_list_new(const char *path, (void)offset; (void)outSizeProcessed; + /* we skip over everything, which is a directory. */ if (f->IsDir) - { - /* we skip over everything, which is a directory. */ continue; - } + len = SzArEx_GetFileNameUtf16(&db, i, NULL); + if (len > tempSize) { free(temp); diff --git a/decompress/zip_support.c b/decompress/zip_support.c index 44402dcf81..247a212806 100644 --- a/decompress/zip_support.c +++ b/decompress/zip_support.c @@ -54,19 +54,11 @@ int read_zip_file(const char *archive_path, unzFile *zipfile = (unzFile*)unzOpen(archive_path); if (!zipfile) - { - RARCH_ERR("Could not open ZIP file %s.\n",archive_path); return -1; - } /* Get info about the zip file */ if (unzGetGlobalInfo(zipfile, &global_info) != UNZ_OK) - { - RARCH_ERR("Could not get global ZIP file info of %s." - "Could be only a GZIP file without the ZIP part.\n", - archive_path); goto error; - } for ( i = 0; i < global_info.number_entry; ++i ) { @@ -81,29 +73,19 @@ int read_zip_file(const char *archive_path, filename, PATH_MAX_LENGTH, NULL, 0, NULL, 0 ) != UNZ_OK ) - { - RARCH_ERR("Could not read file info in ZIP %s.\n", - archive_path); goto error; - } /* Check if this entry is a directory or file. */ last_char = filename[strlen(filename)-1]; - if ( last_char == '/' || last_char == '\\' ) - { - /* We skip directories */ - } + /* We skip directories */ + if ( last_char == '/' || last_char == '\\' ) { } else if (!strcmp(filename, relative_path)) { /* We found the correct file in the zip, * now extract it to *buf. */ if (unzOpenCurrentFile(zipfile) != UNZ_OK ) - { - RARCH_ERR("The file %s in %s could not be read.\n", - relative_path, archive_path); goto error; - } if (optional_outfile == 0) { @@ -128,10 +110,7 @@ int read_zip_file(const char *archive_path, FILE* outsink = fopen(optional_outfile,"wb"); if (outsink == NULL) - { - RARCH_ERR("Could not open outfilepath %s.\n", optional_outfile); goto close; - } bytes_read = 0; @@ -141,7 +120,7 @@ int read_zip_file(const char *archive_path, bytes_read = unzReadCurrentFile(zipfile, read_buffer, RARCH_ZIP_SUPPORT_BUFFER_SIZE_MAX ); - fwrite_bytes = fwrite(read_buffer,1,bytes_read,outsink); + fwrite_bytes = fwrite(read_buffer, 1, bytes_read,outsink); if (fwrite_bytes == bytes_read) continue; @@ -167,9 +146,6 @@ int read_zip_file(const char *archive_path, if (unzGoToNextFile(zipfile) == UNZ_OK) continue; - RARCH_ERR( - "Could not iterate to next file in %s. ZIP file might be corrupt.\n", - archive_path ); goto error; } } @@ -177,11 +153,7 @@ int read_zip_file(const char *archive_path, unzClose(zipfile); if(!finished_reading) - { - RARCH_ERR("File %s not found in %s\n", - relative_path, archive_path); return -1; - } return bytes_read;