RandyGaul / cute_headers

Collection of cross-platform one-file C/C++ libraries with no dependencies, primarily used for games
4.24k stars 264 forks source link

aseprite: Fix compiler warnings #320

Closed RobLoach closed 1 year ago

RobLoach commented 1 year ago

This fixes up a few compiler warnings...

cute_aseprite.h: In function ‘s_build’:
cute_aseprite.h:540:69: warning: conversion to ‘uint32_t’ {aka ‘unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
  540 |                         tree[slot] = (code << (32 - (uint32_t)len)) | (i << 4) | len;
      |                                                                     ^
cute_aseprite.h: In function ‘s_stored’:
cute_aseprite.h:559:33: warning: comparison of promoted bitwise complement of an unsigned value with unsigned [-Wsign-compare]
  559 |         CUTE_ASEPRITE_CHECK(LEN == (uint16_t)(~NLEN), "Failed to find LEN and NLEN as complements within stored (uncompressed) stream.");
      |                                 ^~
cute_aseprite.h:406:46: note: in definition of macro ‘CUTE_ASEPRITE_CHECK’
  406 | #define CUTE_ASEPRITE_CHECK(X, Y) do { if (!(X)) { s_error_reason = Y; CUTE_ASEPRITE_FAIL(); } } while (0)
      |                                              ^
cute_aseprite.h: In function ‘s_inflate’:
cute_aseprite.h:686:51: warning: unsigned conversion from ‘int’ to ‘long unsigned int’ changes value from ‘-4’ to ‘18446744073709551612’ [-Wsign-conversion]
  686 |         int first_bytes = (int)((((size_t)in + 3) & ~3) - (size_t)in);
      |                                                   ^
cute_aseprite.h: In function ‘s_read_int32’:
cute_aseprite.h:801:54: warning: conversion from ‘int’ to ‘int16_t’ {aka ‘short int’} may change value [-Wconversion]
  801 | static int16_t s_read_int32(ase_state_t* s) { return (int32_t)s_read_uint32(s); }
      |                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~