mirror of
https://github.com/facebook/zstd.git
synced 2025-07-29 11:21:22 +03:00
fixes for tests and segfault
This commit is contained in:
@ -1453,7 +1453,9 @@ int FIO_compressMultipleFilenames(FIO_prefs_t* const prefs, const char** inFileN
|
||||
} }
|
||||
|
||||
FIO_freeCResources(ress);
|
||||
if (outDirName)
|
||||
UTIL_freeDestinationFilenameTable(dstFileNamesTable, nbFiles);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -2274,24 +2276,12 @@ FIO_decompressMultipleFilenames(FIO_prefs_t* const prefs,
|
||||
}
|
||||
|
||||
FIO_freeDResources(ress);
|
||||
if (outDirName)
|
||||
UTIL_freeDestinationFilenameTable(dstFileNamesTable, nbFiles);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void FIO_processMultipleFilenameDestinationDir(char** dstFilenameTable,
|
||||
const char** filenameTable, unsigned filenameIdx,
|
||||
const char* outFileName, const char* outDirName) {
|
||||
int dirResult;
|
||||
dirResult = UTIL_createDir(outDirName);
|
||||
if (dirResult)
|
||||
DISPLAY("Directory creation unsuccessful \n");
|
||||
|
||||
UTIL_createDestinationDirTable(filenameTable, filenameIdx, outDirName, dstFilenameTable);
|
||||
if (outFileName) {
|
||||
outFileName = dstFilenameTable[0]; /* in case -O is called with single file */
|
||||
}
|
||||
}
|
||||
|
||||
/* **************************************************************************
|
||||
* .zst file info (--list command)
|
||||
***************************************************************************/
|
||||
|
@ -118,10 +118,6 @@ int FIO_decompressMultipleFilenames(FIO_prefs_t* const prefs,
|
||||
const char* outFileName,
|
||||
const char* dictFileName);
|
||||
|
||||
void FIO_processMultipleFilenameDestinationDir(char** dstFilenameTable,
|
||||
const char** filenameTable, unsigned filenameIdx,
|
||||
const char* outFileName, const char* outDirName);
|
||||
|
||||
|
||||
/*-*************************************
|
||||
* Advanced stuff (should actually be hosted elsewhere)
|
||||
|
@ -123,6 +123,20 @@ void UTIL_createDestinationDirTable(const char** filenameTable, unsigned nbFiles
|
||||
}
|
||||
}
|
||||
|
||||
void UTIL_processMultipleFilenameDestinationDir(char** dstFilenameTable,
|
||||
const char** filenameTable, unsigned filenameIdx,
|
||||
const char* outFileName, const char* outDirName) {
|
||||
int dirResult;
|
||||
dirResult = UTIL_createDir(outDirName);
|
||||
if (dirResult)
|
||||
UTIL_DISPLAYLEVEL(1, "Directory creation unsuccessful\n");
|
||||
|
||||
UTIL_createDestinationDirTable(filenameTable, filenameIdx, outDirName, dstFilenameTable);
|
||||
if (outFileName) {
|
||||
outFileName = dstFilenameTable[0]; /* in case -O is called with single file */
|
||||
}
|
||||
}
|
||||
|
||||
void UTIL_freeDestinationFilenameTable(char** dstDirTable, unsigned nbFiles) {
|
||||
unsigned u;
|
||||
for (u = 0; u < nbFiles; ++u) {
|
||||
|
@ -133,6 +133,9 @@ int UTIL_isSameFile(const char* file1, const char* file2);
|
||||
void UTIL_createDestinationDirTable(const char** filenameTable, unsigned filenameIdx,
|
||||
const char* outDirName, char** dstFilenameTable);
|
||||
void UTIL_freeDestinationFilenameTable(char** dstDirTable, unsigned nbFiles);
|
||||
void UTIL_processMultipleFilenameDestinationDir(char** dstFilenameTable,
|
||||
const char** filenameTable, unsigned filenameIdx,
|
||||
const char* outFileName, const char* outDirName);
|
||||
|
||||
U32 UTIL_isLink(const char* infilename);
|
||||
#define UTIL_FILESIZE_UNKNOWN ((U64)(-1))
|
||||
|
@ -1178,8 +1178,9 @@ int main(int argCount, const char* argv[])
|
||||
if (adaptMax < cLevel) cLevel = adaptMax;
|
||||
|
||||
if (outDirName) {
|
||||
printf("ok\n");
|
||||
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
|
||||
FIO_processMultipleFilenameDestinationDir(dstFilenameTable, filenameTable, filenameIdx, outFileName, outDirName);
|
||||
UTIL_processMultipleFilenameDestinationDir(dstFilenameTable, filenameTable, filenameIdx, outFileName, outDirName);
|
||||
}
|
||||
|
||||
if ((filenameIdx==1) && outFileName)
|
||||
@ -1203,7 +1204,7 @@ int main(int argCount, const char* argv[])
|
||||
|
||||
if (outDirName) {
|
||||
dstFilenameTable = (char**)malloc(filenameIdx * sizeof(char*));
|
||||
FIO_processMultipleFilenameDestinationDir(dstFilenameTable, filenameTable, filenameIdx, outFileName, outDirName);
|
||||
UTIL_processMultipleFilenameDestinationDir(dstFilenameTable, filenameTable, filenameIdx, outFileName, outDirName);
|
||||
}
|
||||
if (filenameIdx==1 && outFileName)
|
||||
operationResult = FIO_decompressFilename(prefs, outFileName, filenameTable[0], dictFileName);
|
||||
|
Reference in New Issue
Block a user