@@ -347,16 +347,43 @@ struct ase_t
347
347
#define CUTE_ASEPRITE_ASSERT assert
348
348
#endif
349
349
350
- #if !defined(CUTE_ASEPRITE_STDIO )
351
- #include <stdio.h> // fopen
352
- #define CUTE_ASEPRITE_STDIO
350
+ #if !defined(CUTE_ASEPRITE_SEEK_SET )
351
+ #include <stdio.h> // SEEK_SET
353
352
#define CUTE_ASEPRITE_SEEK_SET SEEK_SET
353
+ #endif
354
+
355
+ #if !defined(CUTE_ASEPRITE_SEEK_END )
356
+ #include <stdio.h> // SEEK_END
354
357
#define CUTE_ASEPRITE_SEEK_END SEEK_END
358
+ #endif
359
+
360
+ #if !defined(CUTE_ASEPRITE_FILE )
361
+ #include <stdio.h> // FILE
355
362
#define CUTE_ASEPRITE_FILE FILE
363
+ #endif
364
+
365
+ #if !defined(CUTE_ASEPRITE_FOPEN )
366
+ #include <stdio.h> // fopen
356
367
#define CUTE_ASEPRITE_FOPEN fopen
368
+ #endif
369
+
370
+ #if !defined(CUTE_ASEPRITE_FSEEK )
371
+ #include <stdio.h> // fseek
357
372
#define CUTE_ASEPRITE_FSEEK fseek
373
+ #endif
374
+
375
+ #if !defined(CUTE_ASEPRITE_FREAD )
376
+ #include <stdio.h> // fread
358
377
#define CUTE_ASEPRITE_FREAD fread
378
+ #endif
379
+
380
+ #if !defined(CUTE_ASEPRITE_FTELL )
381
+ #include <stdio.h> // ftell
359
382
#define CUTE_ASEPRITE_FTELL ftell
383
+ #endif
384
+
385
+ #if !defined(CUTE_ASEPRITE_FCLOSE )
386
+ #include <stdio.h> // fclose
360
387
#define CUTE_ASEPRITE_FCLOSE fclose
361
388
#endif
362
389
@@ -501,7 +528,7 @@ static uint32_t s_build(deflate_t* s, uint32_t* tree, uint8_t* lens, int sym_cou
501
528
first [n ] = first [n - 1 ] + counts [n - 1 ];
502
529
}
503
530
504
- for (int i = 0 ; i < sym_count ; ++ i )
531
+ for (uint32_t i = 0 ; i < ( uint32_t ) sym_count ; ++ i )
505
532
{
506
533
uint8_t len = lens [i ];
507
534
@@ -529,7 +556,8 @@ static int s_stored(deflate_t* s)
529
556
// read LEN and NLEN, should complement each other
530
557
uint16_t LEN = (uint16_t )s_read_bits (s , 16 );
531
558
uint16_t NLEN = (uint16_t )s_read_bits (s , 16 );
532
- CUTE_ASEPRITE_CHECK (LEN == (uint16_t )(~NLEN ), "Failed to find LEN and NLEN as complements within stored (uncompressed) stream." );
559
+ uint16_t TILDE_NLEN = ~NLEN ;
560
+ CUTE_ASEPRITE_CHECK (LEN == TILDE_NLEN , "Failed to find LEN and NLEN as complements within stored (uncompressed) stream." );
533
561
CUTE_ASEPRITE_CHECK (s -> bits_left / 8 <= (int )LEN , "Stored block extends beyond end of input stream." );
534
562
p = s_ptr (s );
535
563
CUTE_ASEPRITE_MEMCPY (s -> out , p , LEN );
@@ -656,7 +684,7 @@ static int s_inflate(const void* in, int in_bytes, void* out, int out_bytes, voi
656
684
s -> bits_left = in_bytes * 8 ;
657
685
658
686
// s->words is the in-pointer rounded up to a multiple of 4
659
- int first_bytes = (int )((((size_t )in + 3 ) & ~ 3 ) - (size_t )in );
687
+ int first_bytes = (int )((((size_t )in + 3 ) & ( size_t )(~ 3 ) ) - (size_t )in );
660
688
s -> words = (uint32_t * )((char * )in + first_bytes );
661
689
s -> word_count = (in_bytes - first_bytes ) / 4 ;
662
690
int last_bytes = ((in_bytes - first_bytes ) & 3 );
@@ -770,8 +798,8 @@ static uint64_t s_read_uint64(ase_state_t* s)
770
798
}
771
799
#endif
772
800
773
- static int16_t s_read_int16 (ase_state_t * s ) { return (int16_t )s_read_uint16 (s ); }
774
- static int16_t s_read_int32 (ase_state_t * s ) { return (int32_t )s_read_uint32 (s ); }
801
+ #define s_read_int16 (s ) (int16_t)s_read_uint16(s)
802
+ #define s_read_int32 (s ) (int32_t)s_read_uint32(s)
775
803
776
804
#ifdef CUTE_ASPRITE_S_READ_BYTES
777
805
// s_read_bytes() is not currently used.
0 commit comments