mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 08:37:41 +00:00
(RARCH_ZLIB) Stick to 'ret' naming convention for return error values
This commit is contained in:
parent
9d16bca7c8
commit
3d47ee9ea4
@ -32,14 +32,14 @@ static int rarch_extract_currentfile_in_zip(unzFile uf, const char *current_dir,
|
|||||||
FILE *file_out = NULL;
|
FILE *file_out = NULL;
|
||||||
|
|
||||||
unz_file_info file_info;
|
unz_file_info file_info;
|
||||||
int err = unzGetCurrentFileInfo(uf,
|
int ret = unzGetCurrentFileInfo(uf,
|
||||||
&file_info, filename_inzip, sizeof(filename_inzip),
|
&file_info, filename_inzip, sizeof(filename_inzip),
|
||||||
NULL, 0, NULL, 0);
|
NULL, 0, NULL, 0);
|
||||||
|
|
||||||
if (err != UNZ_OK)
|
if (ret != UNZ_OK)
|
||||||
{
|
{
|
||||||
RARCH_ERR("Error %d while trying to get ZIP file information.\n", err);
|
RARCH_ERR("Error %d while trying to get ZIP file information.\n", ret);
|
||||||
return err;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size_buf = WRITEBUFFERSIZE;
|
size_t size_buf = WRITEBUFFERSIZE;
|
||||||
@ -63,9 +63,9 @@ static int rarch_extract_currentfile_in_zip(unzFile uf, const char *current_dir,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
err = unzOpenCurrentFile(uf);
|
ret = unzOpenCurrentFile(uf);
|
||||||
if (err != UNZ_OK)
|
if (ret != UNZ_OK)
|
||||||
RARCH_ERR("Error %d while trying to open ZIP file.\n", err);
|
RARCH_ERR("Error %d while trying to open ZIP file.\n", ret);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* success */
|
/* success */
|
||||||
@ -81,39 +81,39 @@ static int rarch_extract_currentfile_in_zip(unzFile uf, const char *current_dir,
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
err = unzReadCurrentFile(uf, buf, size_buf);
|
ret = unzReadCurrentFile(uf, buf, size_buf);
|
||||||
if (err < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
RARCH_ERR("Error %d while reading from ZIP file.\n", err);
|
RARCH_ERR("Error %d while reading from ZIP file.\n", ret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err > 0)
|
if (ret > 0)
|
||||||
{
|
{
|
||||||
if (fwrite(buf, err, 1, file_out) != 1)
|
if (fwrite(buf, ret, 1, file_out) != 1)
|
||||||
{
|
{
|
||||||
RARCH_ERR("Error while extracting file(s) from ZIP.\n");
|
RARCH_ERR("Error while extracting file(s) from ZIP.\n");
|
||||||
err = UNZ_ERRNO;
|
ret = UNZ_ERRNO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}while (err > 0);
|
}while (ret > 0);
|
||||||
|
|
||||||
if (file_out)
|
if (file_out)
|
||||||
fclose(file_out);
|
fclose(file_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == UNZ_OK)
|
if (ret == UNZ_OK)
|
||||||
{
|
{
|
||||||
err = unzCloseCurrentFile (uf);
|
ret = unzCloseCurrentFile (uf);
|
||||||
if (err != UNZ_OK)
|
if (ret != UNZ_OK)
|
||||||
RARCH_ERR("Error %d while trying to close ZIP file.\n", err);
|
RARCH_ERR("Error %d while trying to close ZIP file.\n", ret);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
unzCloseCurrentFile(uf);
|
unzCloseCurrentFile(uf);
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
return err;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *first_file, size_t first_file_size, unsigned extract_zip_mode)
|
int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *first_file, size_t first_file_size, unsigned extract_zip_mode)
|
||||||
@ -123,9 +123,9 @@ int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *f
|
|||||||
unzFile uf = unzOpen(zip_path);
|
unzFile uf = unzOpen(zip_path);
|
||||||
|
|
||||||
unz_global_info gi;
|
unz_global_info gi;
|
||||||
int err = unzGetGlobalInfo(uf, &gi);
|
int ret = unzGetGlobalInfo(uf, &gi);
|
||||||
if (err != UNZ_OK)
|
if(ret != UNZ_OK)
|
||||||
RARCH_ERR("Error %d while trying to get ZIP file global info.\n",err);
|
RARCH_ERR("Error %d while trying to get ZIP file global info.\n", ret);
|
||||||
|
|
||||||
for (unsigned i = 0; i < gi.number_entry; i++)
|
for (unsigned i = 0; i < gi.number_entry; i++)
|
||||||
{
|
{
|
||||||
@ -156,10 +156,10 @@ int rarch_extract_zipfile(const char *zip_path, const char *current_dir, char *f
|
|||||||
|
|
||||||
if ((i + 1) < gi.number_entry)
|
if ((i + 1) < gi.number_entry)
|
||||||
{
|
{
|
||||||
err = unzGoToNextFile(uf);
|
ret = unzGoToNextFile(uf);
|
||||||
if (err != UNZ_OK)
|
if (ret != UNZ_OK)
|
||||||
{
|
{
|
||||||
RARCH_ERR("Error %d while trying to go to the next file in the ZIP archive.\n",err);
|
RARCH_ERR("Error %d while trying to go to the next file in the ZIP archive.\n", ret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user