mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Restore archive_file_7z.c
This commit is contained in:
parent
69e8be6dc1
commit
a98ab483cb
1 changed files with 9 additions and 6 deletions
|
@ -414,7 +414,6 @@ error:
|
|||
static int sevenzip_parse_file_iterate_step_internal(
|
||||
struct sevenzip_context_t *sevenzip_context,
|
||||
char *s,
|
||||
size_t len,
|
||||
const uint8_t **cdata,
|
||||
unsigned *cmode,
|
||||
uint32_t *size,
|
||||
|
@ -425,7 +424,7 @@ static int sevenzip_parse_file_iterate_step_internal(
|
|||
{
|
||||
if (sevenzip_context->parse_index < sevenzip_context->db.NumFiles)
|
||||
{
|
||||
size_t len = SzArEx_GetFileNameUtf16(&sevenzip_context->db,
|
||||
size_t _len = SzArEx_GetFileNameUtf16(&sevenzip_context->db,
|
||||
sevenzip_context->parse_index, NULL);
|
||||
uint64_t compressed_size = 0;
|
||||
|
||||
|
@ -437,21 +436,24 @@ static int sevenzip_parse_file_iterate_step_internal(
|
|||
sevenzip_context->packIndex++;
|
||||
}
|
||||
|
||||
if ( (len < PATH_MAX_LENGTH)
|
||||
if ( (_len < PATH_MAX_LENGTH)
|
||||
&& !SzArEx_IsDir(&sevenzip_context->db, sevenzip_context->parse_index))
|
||||
{
|
||||
char infile[PATH_MAX_LENGTH];
|
||||
SRes res = SZ_ERROR_FAIL;
|
||||
uint16_t *temp = (uint16_t*)malloc(len * sizeof(uint16_t));
|
||||
uint16_t *temp = (uint16_t*)malloc(_len * sizeof(uint16_t));
|
||||
|
||||
if (!temp)
|
||||
return -1;
|
||||
|
||||
infile[0] = '\0';
|
||||
|
||||
SzArEx_GetFileNameUtf16(&sevenzip_context->db, sevenzip_context->parse_index,
|
||||
temp);
|
||||
|
||||
if (temp)
|
||||
{
|
||||
res = utf16_to_char_string(temp, s, len)
|
||||
res = utf16_to_char_string(temp, infile, sizeof(infile))
|
||||
? SZ_OK : SZ_ERROR_FAIL;
|
||||
free(temp);
|
||||
}
|
||||
|
@ -459,6 +461,8 @@ static int sevenzip_parse_file_iterate_step_internal(
|
|||
if (res != SZ_OK)
|
||||
return -1;
|
||||
|
||||
strlcpy(s, infile, PATH_MAX_LENGTH);
|
||||
|
||||
*cmode = 0; /* unused for 7zip */
|
||||
*checksum = sevenzip_context->db.CRCs.Vals[sevenzip_context->parse_index];
|
||||
*size = (uint32_t)SzArEx_GetFileSize(&sevenzip_context->db, sevenzip_context->parse_index);
|
||||
|
@ -492,7 +496,6 @@ static int sevenzip_parse_file_iterate_step(void *context,
|
|||
|
||||
ret = sevenzip_parse_file_iterate_step_internal(sevenzip_context,
|
||||
userdata->current_file_path,
|
||||
sizeof(userdata->current_file_path),
|
||||
&cdata, &cmode, &size, &csize,
|
||||
&checksum, &payload, userdata);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue