Skip to content

Commit 448a09f

Browse files
vasiCyan4973
authored andcommitted
seekable_format: Fix conversion warnings in parallel_compression
1 parent 13cb7a1 commit 448a09f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

contrib/seekable_format/examples/parallel_compression.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static void flushFrame(struct state* state, struct job* job)
110110
fwrite_orDie(job->dst, job->dstSize, state->fout);
111111
free(job->dst);
112112

113-
size_t ret = ZSTD_seekable_logFrame(state->frameLog, job->dstSize, job->srcSize, job->checksum);
113+
size_t ret = ZSTD_seekable_logFrame(state->frameLog, (unsigned)job->dstSize, (unsigned)job->srcSize, job->checksum);
114114
if (ZSTD_isError(ret)) {
115115
fprintf(stderr, "ZSTD_seekable_logFrame() error : %s \n", ZSTD_getErrorName(ret));
116116
exit(12);
@@ -141,7 +141,7 @@ static void compressFrame(void* opaque)
141141
{
142142
struct job* job = opaque;
143143

144-
job->checksum = XXH64(job->src, job->srcSize, 0);
144+
job->checksum = (unsigned)XXH64(job->src, job->srcSize, 0);
145145

146146
size_t ret = ZSTD_compress(job->dst, job->dstSize, job->src, job->srcSize, job->state->compressionLevel);
147147
if (ZSTD_isError(ret)) {
@@ -179,7 +179,7 @@ static void openInOut_orDie(const char* fname, FILE** fin, FILE** fout) {
179179
}
180180
}
181181

182-
static void compressFile_orDie(const char* fname, int cLevel, unsigned frameSize, int nbThreads)
182+
static void compressFile_orDie(const char* fname, int cLevel, unsigned frameSize, size_t nbThreads)
183183
{
184184
struct state state = {
185185
.nextID = 0,
@@ -197,7 +197,7 @@ static void compressFile_orDie(const char* fname, int cLevel, unsigned frameSize
197197
openInOut_orDie(fname, &fin, &state.fout);
198198

199199
if (ZSTD_compressBound(frameSize) > 0xFFFFFFFFU) { fprintf(stderr, "Frame size too large \n"); exit(10); }
200-
unsigned dstSize = ZSTD_compressBound(frameSize);
200+
size_t dstSize = ZSTD_compressBound(frameSize);
201201

202202
for (size_t id = 0; 1; id++) {
203203
struct job* job = malloc_orDie(sizeof(struct job));
@@ -245,7 +245,7 @@ int main(int argc, const char** argv) {
245245

246246
{ const char* const inFileName = argv[1];
247247
unsigned const frameSize = (unsigned)atoi(argv[2]);
248-
int const nbThreads = atoi(argv[3]);
248+
size_t const nbThreads = (size_t)atoi(argv[3]);
249249

250250
compressFile_orDie(inFileName, 5, frameSize, nbThreads);
251251
}

0 commit comments

Comments
 (0)