51
51
52
52
#include "deflate.h"
53
53
54
+ /*
55
+ Perl-specific change to allow building with C++
56
+ The 'register' keyword not allowed from C++17
57
+ see https://github.com/pmqs/Compress-Raw-Zlib/issues/23
58
+ */
59
+ #define register
60
+
54
61
const char deflate_copyright [] =
55
62
" deflate 1.2.13 Copyright 1995-2022 Jean-loup Gailly and Mark Adler " ;
56
63
/*
@@ -1279,9 +1286,9 @@ local uInt longest_match(
1279
1286
IPos cur_match )
1280
1287
{
1281
1288
unsigned chain_length = s -> max_chain_length ;/* max hash chain length */
1282
- Bytef * scan = s -> window + s -> strstart ; /* current string */
1283
- Bytef * match ; /* matched string */
1284
- int len ; /* length of current match */
1289
+ register Bytef * scan = s -> window + s -> strstart ; /* current string */
1290
+ register Bytef * match ; /* matched string */
1291
+ register int len ; /* length of current match */
1285
1292
int best_len = (int )s -> prev_length ; /* best match length so far */
1286
1293
int nice_match = s -> nice_match ; /* stop if match long enough */
1287
1294
IPos limit = s -> strstart > (IPos )MAX_DIST (s ) ?
@@ -1296,13 +1303,13 @@ local uInt longest_match(
1296
1303
/* Compare two bytes at a time. Note: this is not always beneficial.
1297
1304
* Try with and without -DUNALIGNED_OK to check.
1298
1305
*/
1299
- Bytef * strend = s -> window + s -> strstart + MAX_MATCH - 1 ;
1300
- ush scan_start = * (ushf * )scan ;
1301
- ush scan_end = * (ushf * )(scan + best_len - 1 );
1306
+ register Bytef * strend = s -> window + s -> strstart + MAX_MATCH - 1 ;
1307
+ register ush scan_start = * (ushf * )scan ;
1308
+ register ush scan_end = * (ushf * )(scan + best_len - 1 );
1302
1309
#else
1303
- Bytef * strend = s -> window + s -> strstart + MAX_MATCH ;
1304
- Byte scan_end1 = scan [best_len - 1 ];
1305
- Byte scan_end = scan [best_len ];
1310
+ register Bytef * strend = s -> window + s -> strstart + MAX_MATCH ;
1311
+ register Byte scan_end1 = scan [best_len - 1 ];
1312
+ register Byte scan_end = scan [best_len ];
1306
1313
#endif
1307
1314
1308
1315
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
@@ -1429,10 +1436,10 @@ local uInt longest_match(
1429
1436
deflate_state * s ,
1430
1437
IPos cur_match )
1431
1438
{
1432
- Bytef * scan = s -> window + s -> strstart ; /* current string */
1433
- Bytef * match ; /* matched string */
1434
- int len ; /* length of current match */
1435
- Bytef * strend = s -> window + s -> strstart + MAX_MATCH ;
1439
+ register Bytef * scan = s -> window + s -> strstart ; /* current string */
1440
+ register Bytef * match ; /* matched string */
1441
+ register int len ; /* length of current match */
1442
+ register Bytef * strend = s -> window + s -> strstart + MAX_MATCH ;
1436
1443
1437
1444
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
1438
1445
* It is easy to get rid of this optimization if necessary.
0 commit comments