]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed gcc conversion warnings
authorYann Collet <cyan@fb.com>
Wed, 3 Mar 2021 23:17:12 +0000 (15:17 -0800)
committerYann Collet <cyan@fb.com>
Wed, 3 Mar 2021 23:17:12 +0000 (15:17 -0800)
contrib/seekable_format/tests/seekable_tests.c
contrib/seekable_format/zstdseek_compress.c

index af851dd63612392a9d46116c4bc39783ce66fe26..7a276bc4cdc9f1018790d3d5b73cf54e843faad5 100644 (file)
@@ -60,34 +60,34 @@ int main(int argc, const char** argv)
     {   /* Github issue #FIXME */
         const size_t compressed_size = 27;
         const uint8_t compressed_data[27] = {
-           '\x28',
-           '\xb5',
-           '\x2f',
-           '\xfd',
-           '\x00',
-           '\x32',
-           '\x91',
-           '\x00',
-           '\x00',
-           '\x00',
-           '\x5e',
-           '\x2a',
-           '\x4d',
-           '\x18',
-           '\x09',
-           '\x00',
-           '\x00',
-           '\x00',
-           '\x00',
-           '\x00',
-           '\x00',
-           '\x00',
-           '\x00',
-           '\xb1',
-           '\xea',
-           '\x92',
-           '\x8f',
-       };
+            (uint8_t)'\x28',
+            (uint8_t)'\xb5',
+            (uint8_t)'\x2f',
+            (uint8_t)'\xfd',
+            (uint8_t)'\x00',
+            (uint8_t)'\x32',
+            (uint8_t)'\x91',
+            (uint8_t)'\x00',
+            (uint8_t)'\x00',
+            (uint8_t)'\x00',
+            (uint8_t)'\x5e',
+            (uint8_t)'\x2a',
+            (uint8_t)'\x4d',
+            (uint8_t)'\x18',
+            (uint8_t)'\x09',
+            (uint8_t)'\x00',
+            (uint8_t)'\x00',
+            (uint8_t)'\x00',
+            (uint8_t)'\x00',
+            (uint8_t)'\x00',
+            (uint8_t)'\x00',
+            (uint8_t)'\x00',
+            (uint8_t)'\x00',
+            (uint8_t)'\xb1',
+            (uint8_t)'\xea',
+            (uint8_t)'\x92',
+            (uint8_t)'\x8f',
+        };
         const size_t uncompressed_size = 400;
         uint8_t uncompressed_data[400];
 
index f153aee73e085c8b8975fd8abc465c3305c075b0..442f9bee9ad89dc7198d7a256758d38b77919425 100644 (file)
@@ -202,7 +202,7 @@ size_t ZSTD_seekable_endFrame(ZSTD_seekable_CStream* zcs, ZSTD_outBuffer* output
     /* end the frame */
     size_t ret = ZSTD_endStream(zcs->cstream, output);
 
-    zcs->frameCSize += output->pos - prevOutPos;
+    zcs->frameCSize += (U32)(output->pos - prevOutPos);
 
     /* need to flush before doing the rest */
     if (ret) return ret;
@@ -245,8 +245,8 @@ size_t ZSTD_seekable_compressStream(ZSTD_seekable_CStream* zcs, ZSTD_outBuffer*
             XXH64_update(&zcs->xxhState, inBase, inTmp.pos);
         }
 
-        zcs->frameCSize += output->pos - prevOutPos;
-        zcs->frameDSize += inTmp.pos;
+        zcs->frameCSize += (U32)(output->pos - prevOutPos);
+        zcs->frameDSize += (U32)inTmp.pos;
 
         input->pos += inTmp.pos;
 
@@ -287,7 +287,7 @@ static inline size_t ZSTD_stwrite32(ZSTD_frameLog* fl,
         memcpy((BYTE*)output->dst + output->pos,
                tmp + (fl->seekTablePos - offset), lenWrite);
         output->pos += lenWrite;
-        fl->seekTablePos += lenWrite;
+        fl->seekTablePos += (U32)lenWrite;
 
         if (lenWrite < 4) return ZSTD_seekable_seekTableSize(fl) - fl->seekTablePos;
     }
@@ -336,8 +336,7 @@ size_t ZSTD_seekable_writeSeekTable(ZSTD_frameLog* fl, ZSTD_outBuffer* output)
 
     if (output->size - output->pos < 1) return seekTableLen - fl->seekTablePos;
     if (fl->seekTablePos < seekTableLen - 4) {
-        BYTE sfd = 0;
-        sfd |= (fl->checksumFlag) << 7;
+        BYTE const sfd = (BYTE)((fl->checksumFlag) << 7);
 
         ((BYTE*)output->dst)[output->pos] = sfd;
         output->pos++;