int CSVPRarLib::ListRar(CString fnRarPath , CStringArray* szaFiles) { szaFiles->RemoveAll(); struct RAROpenArchiveDataEx ArchiveDataEx; memset(&ArchiveDataEx, 0, sizeof(ArchiveDataEx)); ArchiveDataEx.ArcNameW = (LPTSTR)(LPCTSTR)fnRarPath; char fnA[MAX_PATH]; if(wcstombs(fnA, fnRarPath, fnRarPath.GetLength()+1) == -1) fnA[0] = 0; ArchiveDataEx.ArcName = fnA; ArchiveDataEx.OpenMode = RAR_OM_EXTRACT; ArchiveDataEx.CmtBuf = 0; try{ HANDLE hrar = RAROpenArchiveEx(&ArchiveDataEx); if(hrar) { struct RARHeaderDataEx HeaderDataEx; HeaderDataEx.CmtBuf = NULL; while(RARReadHeaderEx(hrar, &HeaderDataEx) == 0) { if (HeaderDataEx.Method == 0x30) { CString subfn(HeaderDataEx.FileNameW); BOOL bAlreadyHaveTheSame = false; for(int i = 0; i < szaFiles->GetCount(); i++){ if(szaFiles->GetAt(i) == subfn){ bAlreadyHaveTheSame = true; break; } } if(!bAlreadyHaveTheSame) szaFiles->Add(subfn); } RARProcessFile(hrar, RAR_SKIP, NULL, NULL); } RARCloseArchive(hrar); } }catch (...) { return 0; } return szaFiles->GetCount(); }
int free_local() { volatile int x = 12; subfn((int*) &x); // <- error here, free a local variable return 1; }