fix 7z lockup, better 7z error message

This commit is contained in:
dborth 2009-07-09 21:49:26 +00:00
parent 631392688f
commit 87493335bb
3 changed files with 11 additions and 5 deletions

View File

@ -485,8 +485,12 @@ int BrowserLoadFile(int method)
filesize = LoadSzFile(szpath, nesrom); filesize = LoadSzFile(szpath, nesrom);
break; break;
} }
if(filesize <= 0)
{
browser.selIndex = 0;
BrowserChangeFolder(method);
}
} }
inSz = false;
if (filesize <= 0) if (filesize <= 0)
{ {

View File

@ -266,7 +266,7 @@ typedef struct _SzFileInStream
} SzFileInStream; } SzFileInStream;
// 7zip error list // 7zip error list
static char szerrormsg[][50] = { static char szerrormsg[][100] = {
"File is corrupt.", // 7z: Data error "File is corrupt.", // 7z: Data error
"Archive contains too many files.", // 7z: Out of memory "Archive contains too many files.", // 7z: Out of memory
"File is corrupt (CRC mismatch).", // 7z: CRC Error "File is corrupt (CRC mismatch).", // 7z: CRC Error
@ -274,7 +274,7 @@ static char szerrormsg[][50] = {
"File is corrupt.", // 7z: Fail "File is corrupt.", // 7z: Fail
"Failed to read file data.", // 7z: Data read failure "Failed to read file data.", // 7z: Data read failure
"File is corrupt.", // 7z: Archive error "File is corrupt.", // 7z: Archive error
"File uses too high of compression settings.", // 7z: Dictionary too large "File uses too high of compression settings (dictionary size is too large).", // 7z: Dictionary too large
}; };
static SZ_RESULT SzRes; static SZ_RESULT SzRes;
@ -452,7 +452,7 @@ int SzParse(char * filepath, int method)
ResetBrowser(); ResetBrowser();
// add '..' folder in case the user wants exit the 7z // add '..' folder in case the user wants exit the 7z
strncpy(browserList[0].displayname, "..", 2); sprintf(browserList[0].displayname, "Up One Level");
browserList[0].isdir = 1; browserList[0].isdir = 1;
browserList[0].offset = fileoff; browserList[0].offset = fileoff;
browserList[0].length = filelen; browserList[0].length = filelen;
@ -500,6 +500,8 @@ int SzParse(char * filepath, int method)
} }
} }
CancelAction();
// close file // close file
switch (method) switch (method)
{ {

View File

@ -236,7 +236,7 @@ SZ_RESULT SzDecode2(const CFileSize *packSizes, const CFolder *folder,
if (state.Dictionary == 0) if (state.Dictionary == 0)
{ {
allocMain->Free(state.Probs); allocMain->Free(state.Probs);
return SZE_OUTOFMEMORY; return SZE_OUTOFMEMORYDIC;
} }
} }
LzmaDecoderInit(&state); LzmaDecoderInit(&state);