@@ -833,6 +833,7 @@ static void huff_codec_free(void *codec)
833
833
834
834
static chd_error huff_codec_decompress (void * codec , const uint8_t * src , uint32_t complen , uint8_t * dest , uint32_t destlen )
835
835
{
836
+ uint32_t cur ;
836
837
huff_codec_data * huff_codec = (huff_codec_data * ) codec ;
837
838
struct bitstream * bitbuf = create_bitstream (src , complen );
838
839
@@ -845,7 +846,6 @@ static chd_error huff_codec_decompress(void *codec, const uint8_t *src, uint32_t
845
846
}
846
847
847
848
// then decode the data
848
- uint32_t cur ;
849
849
for (cur = 0 ; cur < destlen ; cur ++ )
850
850
dest [cur ] = huffman_decode_one (huff_codec -> decoder , bitbuf );
851
851
bitstream_flush (bitbuf );
@@ -1059,6 +1059,9 @@ static void zstd_codec_free(void* codec)
1059
1059
*/
1060
1060
static chd_error zstd_codec_decompress (void * codec , const uint8_t * src , uint32_t complen , uint8_t * dest , uint32_t destlen )
1061
1061
{
1062
+ ZSTD_inBuffer input = {src , complen , 0 };
1063
+ ZSTD_outBuffer output = {dest , destlen , 0 };
1064
+
1062
1065
/* initialize */
1063
1066
zstd_codec_data * zstd_codec = (zstd_codec_data * ) codec ;
1064
1067
//reset decompressor
@@ -1069,9 +1072,6 @@ static chd_error zstd_codec_decompress(void* codec, const uint8_t *src, uint32_t
1069
1072
return CHDERR_DECOMPRESSION_ERROR ;
1070
1073
}
1071
1074
1072
- ZSTD_inBuffer input = {src , complen , 0 };
1073
- ZSTD_outBuffer output = {dest , destlen , 0 };
1074
-
1075
1075
while ((input .pos < input .size ) && (output .pos < output .size ))
1076
1076
{
1077
1077
zstd_res = ZSTD_decompressStream (zstd_codec -> dstream , & output , & input );
@@ -1320,7 +1320,7 @@ static const codec_interface codec_interfaces[] =
1320
1320
the data stream in bigendian order
1321
1321
-------------------------------------------------*/
1322
1322
1323
- static inline uint64_t get_bigendian_uint64_t (const uint8_t * base )
1323
+ static INLINE uint64_t get_bigendian_uint64_t (const uint8_t * base )
1324
1324
{
1325
1325
return ((uint64_t )base [0 ] << 56 ) | ((uint64_t )base [1 ] << 48 ) | ((uint64_t )base [2 ] << 40 ) | ((uint64_t )base [3 ] << 32 ) |
1326
1326
((uint64_t )base [4 ] << 24 ) | ((uint64_t )base [5 ] << 16 ) | ((uint64_t )base [6 ] << 8 ) | (uint64_t )base [7 ];
@@ -1331,7 +1331,7 @@ static inline uint64_t get_bigendian_uint64_t(const uint8_t *base)
1331
1331
the data stream in bigendian order
1332
1332
-------------------------------------------------*/
1333
1333
1334
- static inline void put_bigendian_uint64_t (uint8_t * base , uint64_t value )
1334
+ static INLINE void put_bigendian_uint64_t (uint8_t * base , uint64_t value )
1335
1335
{
1336
1336
base [0 ] = value >> 56 ;
1337
1337
base [1 ] = value >> 48 ;
@@ -1348,7 +1348,7 @@ static inline void put_bigendian_uint64_t(uint8_t *base, uint64_t value)
1348
1348
the data stream in bigendian order
1349
1349
-------------------------------------------------*/
1350
1350
1351
- static inline uint64_t get_bigendian_uint48 (const uint8_t * base )
1351
+ static INLINE uint64_t get_bigendian_uint48 (const uint8_t * base )
1352
1352
{
1353
1353
return ((uint64_t )base [0 ] << 40 ) | ((uint64_t )base [1 ] << 32 ) |
1354
1354
((uint64_t )base [2 ] << 24 ) | ((uint64_t )base [3 ] << 16 ) | ((uint64_t )base [4 ] << 8 ) | (uint64_t )base [5 ];
@@ -1359,7 +1359,7 @@ static inline uint64_t get_bigendian_uint48(const uint8_t *base)
1359
1359
the data stream in bigendian order
1360
1360
-------------------------------------------------*/
1361
1361
1362
- static inline void put_bigendian_uint48 (uint8_t * base , uint64_t value )
1362
+ static INLINE void put_bigendian_uint48 (uint8_t * base , uint64_t value )
1363
1363
{
1364
1364
value &= 0xffffffffffff ;
1365
1365
base [0 ] = value >> 40 ;
@@ -1374,7 +1374,7 @@ static inline void put_bigendian_uint48(uint8_t *base, uint64_t value)
1374
1374
the data stream in bigendian order
1375
1375
-------------------------------------------------*/
1376
1376
1377
- static inline uint32_t get_bigendian_uint32_t (const uint8_t * base )
1377
+ static INLINE uint32_t get_bigendian_uint32_t (const uint8_t * base )
1378
1378
{
1379
1379
return (base [0 ] << 24 ) | (base [1 ] << 16 ) | (base [2 ] << 8 ) | base [3 ];
1380
1380
}
@@ -1384,7 +1384,7 @@ static inline uint32_t get_bigendian_uint32_t(const uint8_t *base)
1384
1384
the data stream in bigendian order
1385
1385
-------------------------------------------------*/
1386
1386
1387
- static inline void put_bigendian_uint32_t (uint8_t * base , uint32_t value )
1387
+ static INLINE void put_bigendian_uint32_t (uint8_t * base , uint32_t value )
1388
1388
{
1389
1389
base [0 ] = value >> 24 ;
1390
1390
base [1 ] = value >> 16 ;
@@ -1397,7 +1397,7 @@ static inline void put_bigendian_uint32_t(uint8_t *base, uint32_t value)
1397
1397
the data stream in bigendian order
1398
1398
-------------------------------------------------*/
1399
1399
1400
- static inline void put_bigendian_uint24 (uint8_t * base , uint32_t value )
1400
+ static INLINE void put_bigendian_uint24 (uint8_t * base , uint32_t value )
1401
1401
{
1402
1402
value &= 0xffffff ;
1403
1403
base [0 ] = value >> 16 ;
@@ -1410,7 +1410,7 @@ static inline void put_bigendian_uint24(uint8_t *base, uint32_t value)
1410
1410
the data stream in bigendian order
1411
1411
-------------------------------------------------*/
1412
1412
1413
- static inline uint32_t get_bigendian_uint24 (const uint8_t * base )
1413
+ static INLINE uint32_t get_bigendian_uint24 (const uint8_t * base )
1414
1414
{
1415
1415
return (base [0 ] << 16 ) | (base [1 ] << 8 ) | base [2 ];
1416
1416
}
@@ -1420,7 +1420,7 @@ static inline uint32_t get_bigendian_uint24(const uint8_t *base)
1420
1420
the data stream in bigendian order
1421
1421
-------------------------------------------------*/
1422
1422
1423
- static inline uint16_t get_bigendian_uint16 (const uint8_t * base )
1423
+ static INLINE uint16_t get_bigendian_uint16 (const uint8_t * base )
1424
1424
{
1425
1425
return (base [0 ] << 8 ) | base [1 ];
1426
1426
}
@@ -1430,7 +1430,7 @@ static inline uint16_t get_bigendian_uint16(const uint8_t *base)
1430
1430
the data stream in bigendian order
1431
1431
-------------------------------------------------*/
1432
1432
1433
- static inline void put_bigendian_uint16 (uint8_t * base , uint16_t value )
1433
+ static INLINE void put_bigendian_uint16 (uint8_t * base , uint16_t value )
1434
1434
{
1435
1435
base [0 ] = value >> 8 ;
1436
1436
base [1 ] = value ;
@@ -1441,7 +1441,7 @@ static inline void put_bigendian_uint16(uint8_t *base, uint16_t value)
1441
1441
entry from the datastream
1442
1442
-------------------------------------------------*/
1443
1443
1444
- static inline void map_extract (const uint8_t * base , map_entry * entry )
1444
+ static INLINE void map_extract (const uint8_t * base , map_entry * entry )
1445
1445
{
1446
1446
entry -> offset = get_bigendian_uint64_t (& base [0 ]);
1447
1447
entry -> crc = get_bigendian_uint32_t (& base [8 ]);
@@ -1454,7 +1454,7 @@ static inline void map_extract(const uint8_t *base, map_entry *entry)
1454
1454
entry to the datastream
1455
1455
-------------------------------------------------*/
1456
1456
1457
- static inline void map_assemble (uint8_t * base , map_entry * entry )
1457
+ static INLINE void map_assemble (uint8_t * base , map_entry * entry )
1458
1458
{
1459
1459
put_bigendian_uint64_t (& base [0 ], entry -> offset );
1460
1460
put_bigendian_uint32_t (& base [8 ], entry -> crc );
@@ -1466,7 +1466,7 @@ static inline void map_assemble(uint8_t *base, map_entry *entry)
1466
1466
/*-------------------------------------------------
1467
1467
map_size_v5 - calculate CHDv5 map size
1468
1468
-------------------------------------------------*/
1469
- static inline int map_size_v5 (chd_header * header )
1469
+ static INLINE int map_size_v5 (chd_header * header )
1470
1470
{
1471
1471
return header -> hunkcount * header -> mapentrybytes ;
1472
1472
}
@@ -1525,7 +1525,7 @@ uint16_t crc16(const void *data, uint32_t length)
1525
1525
/*-------------------------------------------------
1526
1526
compressed - test if CHD file is compressed
1527
1527
+-------------------------------------------------*/
1528
- static inline int chd_compressed (chd_header * header ) {
1528
+ static INLINE int chd_compressed (chd_header * header ) {
1529
1529
return header -> compression [0 ] != CHD_CODEC_NONE ;
1530
1530
}
1531
1531
@@ -1705,7 +1705,7 @@ static chd_error decompress_v5_map(chd_file* chd, chd_header* header)
1705
1705
entry in old format from the datastream
1706
1706
-------------------------------------------------*/
1707
1707
1708
- static inline void map_extract_old (const uint8_t * base , map_entry * entry , uint32_t hunkbytes )
1708
+ static INLINE void map_extract_old (const uint8_t * base , map_entry * entry , uint32_t hunkbytes )
1709
1709
{
1710
1710
entry -> offset = get_bigendian_uint64_t (& base [0 ]);
1711
1711
entry -> crc = 0 ;
0 commit comments