removed useless variable from CCtx
CStream's pledgedSrcSize is no longer necessary srcSize control is realized within bufferless interface.
This commit is contained in:
@@ -140,7 +140,6 @@ struct ZSTD_CCtx_s {
|
|||||||
size_t outBuffFlushedSize;
|
size_t outBuffFlushedSize;
|
||||||
ZSTD_cStreamStage streamStage;
|
ZSTD_cStreamStage streamStage;
|
||||||
U32 frameEnded;
|
U32 frameEnded;
|
||||||
U64 pledgedSrcSize;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ZSTD_CCtx* ZSTD_createCCtx(void)
|
ZSTD_CCtx* ZSTD_createCCtx(void)
|
||||||
@@ -3320,7 +3319,6 @@ static size_t ZSTD_resetCStream_internal(ZSTD_CStream* zcs, ZSTD_parameters para
|
|||||||
zcs->outBuffContentSize = zcs->outBuffFlushedSize = 0;
|
zcs->outBuffContentSize = zcs->outBuffFlushedSize = 0;
|
||||||
zcs->streamStage = zcss_load;
|
zcs->streamStage = zcss_load;
|
||||||
zcs->frameEnded = 0;
|
zcs->frameEnded = 0;
|
||||||
zcs->pledgedSrcSize = pledgedSrcSize;
|
|
||||||
return 0; /* ready to go */
|
return 0; /* ready to go */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -647,7 +647,7 @@ typedef enum {
|
|||||||
/* dictionary parameters */
|
/* dictionary parameters */
|
||||||
ZSTD_p_refDictContent=300, /* Content of dictionary content will be referenced, instead of copied (default:0).
|
ZSTD_p_refDictContent=300, /* Content of dictionary content will be referenced, instead of copied (default:0).
|
||||||
* This avoids duplicating dictionary content.
|
* This avoids duplicating dictionary content.
|
||||||
* But it also requires that dictionary buffer outlives its user (CCtx or CDict) */
|
* But it also requires that dictionary buffer outlives its user (CDict) */
|
||||||
/* Not ready yet ! */
|
/* Not ready yet ! */
|
||||||
ZSTD_p_rawContentDict, /* load dictionary in "content-only" mode (no header analysis) (default:0) */
|
ZSTD_p_rawContentDict, /* load dictionary in "content-only" mode (no header analysis) (default:0) */
|
||||||
/* question : should there be an option to load dictionary only in zstd format, rejecting others with an error code ? */
|
/* question : should there be an option to load dictionary only in zstd format, rejecting others with an error code ? */
|
||||||
@@ -717,7 +717,7 @@ ZSTDLIB_API size_t ZSTD_CDict_setParameter(ZSTD_CDict* cdict, ZSTD_cParameter pa
|
|||||||
ZSTDLIB_API size_t ZSTD_CDict_loadDictionary(ZSTD_CDict* cdict, const void* dict, size_t dictSize); /* Not ready yet ! */
|
ZSTDLIB_API size_t ZSTD_CDict_loadDictionary(ZSTD_CDict* cdict, const void* dict, size_t dictSize); /* Not ready yet ! */
|
||||||
|
|
||||||
/*! ZSTD_CCtx_refCDict() :
|
/*! ZSTD_CCtx_refCDict() :
|
||||||
* Add a prepared dictionary to cctx, it will used for next compression jobs.
|
* Add a prepared dictionary to cctx, to be used for next compression jobs.
|
||||||
* Note that compression parameters will be enforced from within CDict.
|
* Note that compression parameters will be enforced from within CDict.
|
||||||
* Currently, they supercede any compression parameter previously set within CCtx.
|
* Currently, they supercede any compression parameter previously set within CCtx.
|
||||||
* The dictionary will remain valid for future compression jobs using same cctx.
|
* The dictionary will remain valid for future compression jobs using same cctx.
|
||||||
|
|||||||
+18
-12
@@ -102,7 +102,7 @@ void FIO_setNotificationLevel(unsigned level) { g_displayLevel=level; }
|
|||||||
static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100;
|
static const clock_t refreshRate = CLOCKS_PER_SEC * 15 / 100;
|
||||||
static clock_t g_time = 0;
|
static clock_t g_time = 0;
|
||||||
|
|
||||||
#undef MIN
|
#undef MIN /* in case it would be already defined */
|
||||||
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
#define MIN(a,b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
||||||
|
|
||||||
@@ -226,11 +226,13 @@ static FILE* FIO_openSrcFile(const char* srcFileName)
|
|||||||
SET_BINARY_MODE(stdin);
|
SET_BINARY_MODE(stdin);
|
||||||
} else {
|
} else {
|
||||||
if (!UTIL_isRegFile(srcFileName)) {
|
if (!UTIL_isRegFile(srcFileName)) {
|
||||||
DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n", srcFileName);
|
DISPLAYLEVEL(1, "zstd: %s is not a regular file -- ignored \n",
|
||||||
|
srcFileName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
f = fopen(srcFileName, "rb");
|
f = fopen(srcFileName, "rb");
|
||||||
if ( f==NULL ) DISPLAYLEVEL(1, "zstd: %s: %s \n", srcFileName, strerror(errno));
|
if ( f==NULL )
|
||||||
|
DISPLAYLEVEL(1, "zstd: %s: %s \n", srcFileName, strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
@@ -255,26 +257,28 @@ static FILE* FIO_openDstFile(const char* dstFileName)
|
|||||||
if (g_sparseFileSupport == 1) {
|
if (g_sparseFileSupport == 1) {
|
||||||
g_sparseFileSupport = ZSTD_SPARSE_DEFAULT;
|
g_sparseFileSupport = ZSTD_SPARSE_DEFAULT;
|
||||||
}
|
}
|
||||||
if (strcmp (dstFileName, nulmark)) { /* Check if destination file already exists */
|
if (strcmp (dstFileName, nulmark)) {
|
||||||
|
/* Check if destination file already exists */
|
||||||
f = fopen( dstFileName, "rb" );
|
f = fopen( dstFileName, "rb" );
|
||||||
if (f != 0) { /* dest file exists, prompt for overwrite authorization */
|
if (f != 0) { /* dst file exists, prompt for overwrite authorization */
|
||||||
fclose(f);
|
fclose(f);
|
||||||
if (!g_overwrite) {
|
if (!g_overwrite) {
|
||||||
if (g_displayLevel <= 1) {
|
if (g_displayLevel <= 1) {
|
||||||
/* No interaction possible */
|
/* No interaction possible */
|
||||||
DISPLAY("zstd: %s already exists; not overwritten \n", dstFileName);
|
DISPLAY("zstd: %s already exists; not overwritten \n",
|
||||||
|
dstFileName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
DISPLAY("zstd: %s already exists; do you wish to overwrite (y/N) ? ", dstFileName);
|
DISPLAY("zstd: %s already exists; do you wish to overwrite (y/N) ? ",
|
||||||
|
dstFileName);
|
||||||
{ int ch = getchar();
|
{ int ch = getchar();
|
||||||
if ((ch!='Y') && (ch!='y')) {
|
if ((ch!='Y') && (ch!='y')) {
|
||||||
DISPLAY(" not overwritten \n");
|
DISPLAY(" not overwritten \n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
while ((ch!=EOF) && (ch!='\n')) ch = getchar(); /* flush rest of input line */
|
/* flush rest of input line */
|
||||||
}
|
while ((ch!=EOF) && (ch!='\n')) ch = getchar();
|
||||||
}
|
} }
|
||||||
|
|
||||||
/* need to unlink */
|
/* need to unlink */
|
||||||
FIO_remove(dstFileName);
|
FIO_remove(dstFileName);
|
||||||
} }
|
} }
|
||||||
@@ -304,7 +308,9 @@ static size_t FIO_createDictBuffer(void** bufferPtr, const char* fileName)
|
|||||||
fileHandle = fopen(fileName, "rb");
|
fileHandle = fopen(fileName, "rb");
|
||||||
if (fileHandle==0) EXM_THROW(31, "zstd: %s: %s", fileName, strerror(errno));
|
if (fileHandle==0) EXM_THROW(31, "zstd: %s: %s", fileName, strerror(errno));
|
||||||
fileSize = UTIL_getFileSize(fileName);
|
fileSize = UTIL_getFileSize(fileName);
|
||||||
if (fileSize > DICTSIZE_MAX) EXM_THROW(32, "Dictionary file %s is too large (> %u MB)", fileName, DICTSIZE_MAX >> 20); /* avoid extreme cases */
|
if (fileSize > DICTSIZE_MAX)
|
||||||
|
EXM_THROW(32, "Dictionary file %s is too large (> %u MB)",
|
||||||
|
fileName, DICTSIZE_MAX >> 20); /* avoid extreme cases */
|
||||||
*bufferPtr = malloc((size_t)fileSize);
|
*bufferPtr = malloc((size_t)fileSize);
|
||||||
if (*bufferPtr==NULL) EXM_THROW(34, "zstd: %s", strerror(errno));
|
if (*bufferPtr==NULL) EXM_THROW(34, "zstd: %s", strerror(errno));
|
||||||
{ size_t const readSize = fread(*bufferPtr, 1, (size_t)fileSize, fileHandle);
|
{ size_t const readSize = fread(*bufferPtr, 1, (size_t)fileSize, fileHandle);
|
||||||
|
|||||||
Reference in New Issue
Block a user