(file_ops) Rename archive_path to path

This commit is contained in:
twinaphex 2016-01-24 03:11:14 +01:00
parent a6b616e6d1
commit 6da1be9bc9
1 changed files with 10 additions and 10 deletions

View File

@ -85,11 +85,11 @@ static bool utf16_to_char_string(const uint16_t *in, char *s, size_t len)
} }
/* Extract the relative path (needle) from a 7z archive /* Extract the relative path (needle) from a 7z archive
* archive_path and allocate a buf for it to write it in. * (path) and allocate a buf for it to write it in.
* If optional_outfile is set, extract to that instead and don't alloc buffer. * If optional_outfile is set, extract to that instead and don't alloc buffer.
*/ */
static int read_7zip_file( static int read_7zip_file(
const char *archive_path, const char *path,
const char *needle, void **buf, const char *needle, void **buf,
const char *optional_outfile) const char *optional_outfile)
{ {
@ -110,14 +110,14 @@ static int read_7zip_file(
allocTempImp.Alloc = SzAllocTemp; allocTempImp.Alloc = SzAllocTemp;
allocTempImp.Free = SzFreeTemp; allocTempImp.Free = SzFreeTemp;
if (InFile_Open(&archiveStream.file, archive_path)) if (InFile_Open(&archiveStream.file, path))
{ {
RARCH_ERR("Could not open %s as 7z archive\n.",archive_path); RARCH_ERR("Could not open %s as 7z archive\n.", path);
return -1; return -1;
} }
RARCH_LOG_OUTPUT("Opened archive %s. Now trying to extract %s\n", RARCH_LOG_OUTPUT("Opened archive %s. Now trying to extract %s\n",
archive_path, needle); path, needle);
FileInStream_CreateVTable(&archiveStream); FileInStream_CreateVTable(&archiveStream);
LookToRead_CreateVTable(&lookStream, False); LookToRead_CreateVTable(&lookStream, False);
@ -212,7 +212,7 @@ static int read_7zip_file(
{ {
/* Error handling */ /* Error handling */
if (!file_found) if (!file_found)
RARCH_ERR("File %s not found in %s\n", needle, archive_path); RARCH_ERR("File %s not found in %s\n", needle, path);
RARCH_ERR("Failed to open compressed file inside 7zip archive.\n"); RARCH_ERR("Failed to open compressed file inside 7zip archive.\n");
@ -356,7 +356,7 @@ end:
#define RARCH_ZIP_SUPPORT_BUFFER_SIZE_MAX 16384 #define RARCH_ZIP_SUPPORT_BUFFER_SIZE_MAX 16384
/* Extract the relative path (needle) from a /* Extract the relative path (needle) from a
* zip archive archive_path and allocate a buf for it to write it in. */ * ZIP archive (path) and allocate a buf for it to write it in. */
/* This code is inspired by: /* This code is inspired by:
* stackoverflow.com/questions/10440113/simple-way-to-unzip-a-zip-file-using-zlib * stackoverflow.com/questions/10440113/simple-way-to-unzip-a-zip-file-using-zlib
* *
@ -364,7 +364,7 @@ end:
* then. * then.
*/ */
static int read_zip_file(const char *archive_path, static int read_zip_file(const char *path,
const char *needle, void **buf, const char *needle, void **buf,
const char* optional_outfile) const char* optional_outfile)
{ {
@ -372,7 +372,7 @@ static int read_zip_file(const char *archive_path,
unz_global_info global_info; unz_global_info global_info;
ssize_t bytes_read = -1; ssize_t bytes_read = -1;
bool finished_reading = false; bool finished_reading = false;
unzFile *zipfile = (unzFile*)unzOpen(archive_path); unzFile *zipfile = (unzFile*)unzOpen(path);
if (!zipfile) if (!zipfile)
return -1; return -1;
@ -421,7 +421,7 @@ static int read_zip_file(const char *archive_path,
RARCH_ERR( RARCH_ERR(
"Tried to read %d bytes, but only got %d of file %s in ZIP %s.\n", "Tried to read %d bytes, but only got %d of file %s in ZIP %s.\n",
(unsigned int) file_info.uncompressed_size, (int)bytes_read, (unsigned int) file_info.uncompressed_size, (int)bytes_read,
needle, archive_path); needle, path);
free(*buf); free(*buf);
goto close; goto close;
} }