@@ -437,8 +437,8 @@ int ndlz8_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, i
437
437
uint8_t * ip_limit = ip + input_len ;
438
438
uint8_t * op = (uint8_t * )output ;
439
439
uint8_t ndim ;
440
- uint32_t blockshape [2 ];
441
- uint32_t eshape [2 ];
440
+ int32_t blockshape [2 ];
441
+ int32_t eshape [2 ];
442
442
uint8_t * buffercpy ;
443
443
uint8_t token ;
444
444
if (NDLZ_UNEXPECT_CONDITIONAL (input_len < 8 )) {
@@ -464,16 +464,16 @@ int ndlz8_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, i
464
464
}
465
465
memset (op , 0 , blockshape [0 ] * blockshape [1 ]);
466
466
467
- uint32_t i_stop [2 ];
467
+ int32_t i_stop [2 ];
468
468
for (int i = 0 ; i < 2 ; ++ i ) {
469
469
i_stop [i ] = eshape [i ] / cell_shape ;
470
470
}
471
471
472
472
473
473
/* main loop */
474
- uint32_t ii [2 ];
475
- uint32_t padding [2 ];
476
- uint32_t ind = 0 ;
474
+ int32_t ii [2 ];
475
+ int32_t padding [2 ];
476
+ int32_t ind = 0 ;
477
477
uint8_t * local_buffer = malloc (cell_size );
478
478
uint8_t * cell_aux = malloc (cell_size );
479
479
for (ii [0 ] = 0 ; ii [0 ] < i_stop [0 ]; ++ ii [0 ]) {
@@ -545,14 +545,14 @@ int ndlz8_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, i
545
545
}
546
546
547
547
uint32_t orig = ii [0 ] * cell_shape * blockshape [1 ] + ii [1 ] * cell_shape ;
548
- for (uint32_t i = 0 ; i < (uint32_t ) cell_shape ; i ++ ) {
548
+ for (int32_t i = 0 ; i < (int32_t ) cell_shape ; i ++ ) {
549
549
if (i < padding [0 ]) {
550
550
ind = orig + i * blockshape [1 ];
551
551
memcpy (& op [ind ], buffercpy , padding [1 ]);
552
552
}
553
553
buffercpy += padding [1 ];
554
554
}
555
- if (ind > ( uint32_t ) output_len ) {
555
+ if (ind > output_len ) {
556
556
printf ("Output size is bigger than max \n" );
557
557
free (local_buffer );
558
558
free (cell_aux );
@@ -569,7 +569,7 @@ int ndlz8_decompress(const uint8_t *input, int32_t input_len, uint8_t *output, i
569
569
printf ("Output size is not compatible with embedded blockshape \n" );
570
570
return 0 ;
571
571
}
572
- if (ind > ( uint32_t ) output_len ) {
572
+ if (ind > output_len ) {
573
573
printf ("Output size is bigger than max \n" );
574
574
return 0 ;
575
575
}
0 commit comments