diff options
| author | Clement Sibille <clements+git@lisible.xyz> | 2024-05-20 23:25:55 +0900 | 
|---|---|---|
| committer | Clement Sibille <clements+git@lisible.xyz> | 2024-05-20 23:25:55 +0900 | 
| commit | 3315de2269a01d296628a2773de6f085d75e3840 (patch) | |
| tree | 128deff22575ecb6a56e99de8180e32a2b6e12b0 | |
| parent | c0d9501d787d9a61884233ecb63182a02e413f5f (diff) | |
Use lisiblestd-0.2.0
| -rw-r--r-- | lisiblepng/src/lisiblepng.c | 28 | ||||
| -rw-r--r-- | lisiblepng/src/lisiblepng/deflate.c | 26 | ||||
| -rw-r--r-- | subprojects/lisiblestd.wrap | 2 | 
3 files changed, 28 insertions, 28 deletions
diff --git a/lisiblepng/src/lisiblepng.c b/lisiblepng/src/lisiblepng.c index fdcf053..de6f06e 100644 --- a/lisiblepng/src/lisiblepng.c +++ b/lisiblepng/src/lisiblepng.c @@ -115,7 +115,7 @@ uint8_t LisPngColourType_sample_count(const LisPngColourType colour_type) {    case LisPngColourType_TruecolourWithAlpha:      return 4;    default: -    LOG0_ERROR("Unknown colour type"); +    LOG_ERROR("Unknown colour type");      abort();    }  } @@ -169,7 +169,7 @@ bool ParsingContext_parse_bytes(DeflateDecompressor *ctx, size_t byte_count,    LSTD_ASSERT(ctx != NULL);    LSTD_ASSERT(output_buffer != NULL);    if (fread(output_buffer, 1, byte_count, ctx->stream) < byte_count) { -    LOG0_ERROR("Couldn't parse bytes, EOF reached"); +    LOG_ERROR("Couldn't parse bytes, EOF reached");      return false;    } @@ -252,7 +252,7 @@ bool ParsingContext_validate_crc_if_required(DeflateDecompressor *ctx) {    uint32_t crc;    PARSE_FIELD(uint32_t, crc);    if (computed_crc != crc) { -    LOG0_ERROR("Invalid CRC checksum"); +    LOG_ERROR("Invalid CRC checksum");      return false;    }  #else @@ -279,7 +279,7 @@ bool parse_IHDR_chunk(DeflateDecompressor *ctx, ImageHeader *image_header) {    uint32_t type;    PARSE_FIELD(uint32_t, type);    if (type != IHDR_CHUNK_TYPE) { -    LOG0_ERROR("Expected IHDR chunk"); +    LOG_ERROR("Expected IHDR chunk");      return false;    } @@ -485,12 +485,12 @@ LisPng *LisPng_decode(FILE *stream) {    uint8_t parsed_png_signature[PNG_SIGNATURE_LENGTH];    if (!ParsingContext_parse_bytes(&ctx, PNG_SIGNATURE_LENGTH,                                    parsed_png_signature)) { -    LOG0_ERROR("Couldn't parse signature"); +    LOG_ERROR("Couldn't parse signature");      goto err;    }    if (!matches_png_signature(parsed_png_signature)) { -    LOG0_ERROR("Invalid signature"); +    LOG_ERROR("Invalid signature");      goto err;    } @@ -508,14 +508,14 @@ LisPng *LisPng_decode(FILE *stream) {    while (!end_reached) {      uint32_t length;      if (!ParsingContext_parse_uint32_t(&ctx, &length)) { -      LOG0_ERROR("Couldn't parse chunk length"); +      LOG_ERROR("Couldn't parse chunk length");        goto cleanup_data;      }      ParsingContext_crc_reset(&ctx);      uint32_t type;      if (!ParsingContext_parse_uint32_t(&ctx, &type)) { -      LOG0_ERROR("Couldn't parse chunk type"); +      LOG_ERROR("Couldn't parse chunk type");        goto cleanup_data;      } @@ -528,7 +528,7 @@ LisPng *LisPng_decode(FILE *stream) {      switch (type) {      case IDAT_CHUNK_TYPE:        if (!parse_IDAT_chunk(&ctx, length, &image_data)) { -        LOG0_ERROR("Couldn't parse IDAT chunk"); +        LOG_ERROR("Couldn't parse IDAT chunk");          goto cleanup_data;        }        parsed_data_chunk_count++; @@ -540,19 +540,19 @@ LisPng *LisPng_decode(FILE *stream) {      case PLTE_CHUNK_TYPE:        palette = parse_PLTE_chunk(&ctx, length);        if (!palette) { -        LOG0_ERROR("Couldn't parse PLTE chunk"); +        LOG_ERROR("Couldn't parse PLTE chunk");          goto cleanup_data;        }        break;      default: -      LOG0_DEBUG("Unknown chunk type, skipping chunk..."); +      LOG_DEBUG("Unknown chunk type, skipping chunk...");        ParsingContext_skip_bytes(&ctx, length + sizeof(uint32_t));        break;      }    }    if (parsed_data_chunk_count == 0) { -    LOG0_ERROR("No IDAT chunk found, at least one is required"); +    LOG_ERROR("No IDAT chunk found, at least one is required");      goto cleanup_data;    } @@ -652,7 +652,7 @@ void LisPng_write_RGBA8_data(const LisPng *png, uint8_t *output_data) {          output_data[target_pixel_base + 3] = 0xFF;        }      } else { -      LOG0_ERROR("Unsupported colour type"); +      LOG_ERROR("Unsupported colour type");        exit(1);      }    } @@ -723,7 +723,7 @@ void LisPng_dump_ppm(const LisPng *png) {          printf("%u %u %u\n", r, g, b);        }      } else { -      LOG0_ERROR("Unsupported colour type"); +      LOG_ERROR("Unsupported colour type");        exit(1);      }    } diff --git a/lisiblepng/src/lisiblepng/deflate.c b/lisiblepng/src/lisiblepng/deflate.c index 41933c1..4050da1 100644 --- a/lisiblepng/src/lisiblepng/deflate.c +++ b/lisiblepng/src/lisiblepng/deflate.c @@ -52,7 +52,7 @@ void OutputBuffer_init(OutputBuffer *output_buffer) {    LSTD_ASSERT(output_buffer != NULL);    output_buffer->buffer = calloc(DEFLATE_OUTPUT_BUFFER_INITIAL_CAPACITY, 1);    if (!output_buffer->buffer) { -    LOG0_ERROR("Couldn't allocate deflate output buffer (out of memory?)"); +    LOG_ERROR("Couldn't allocate deflate output buffer (out of memory?)");      abort();    }    output_buffer->cap = DEFLATE_OUTPUT_BUFFER_INITIAL_CAPACITY; @@ -64,7 +64,7 @@ void OutputBuffer_expand(OutputBuffer *output_buffer) {    size_t new_cap = output_buffer->cap * 2;    output_buffer->buffer = realloc(output_buffer->buffer, new_cap);    if (!output_buffer->buffer) { -    LOG0_ERROR("Couldn't reallocate deflate output buffer (out of memory?)"); +    LOG_ERROR("Couldn't reallocate deflate output buffer (out of memory?)");      abort();    } @@ -192,7 +192,7 @@ bool deflate_decompress_(Bitstream *bitstream,      symbol = huffman_table_decode(length_literal_table->symbols,                                    length_literal_table->counts, bitstream);      if (symbol < 0) { -      LOG0_ERROR("Unknown symbol decoded"); +      LOG_ERROR("Unknown symbol decoded");        return false;      }      if (symbol < 256) { @@ -231,16 +231,16 @@ bool deflate_decompress(Bitstream *bitstream, OutputBuffer *output) {    uint8_t b_final = 0;    while (!b_final) { -    LOG0_DEBUG("Parse deflate block"); +    LOG_DEBUG("Parse deflate block");      b_final = Bitstream_next_bits(bitstream, BFINAL_LENGTH_BITS);      LOG_DEBUG("Final block: %d", b_final);      const uint8_t b_type = Bitstream_next_bits(bitstream, BTYPE_LENGTH_BITS);      if (b_type == DeflateBlockType_NoCompression) { -      LOG0_ERROR("Uncompressed deflate blocks aren't supported"); +      LOG_ERROR("Uncompressed deflate blocks aren't supported");        abort();      } else {        if (b_type == DeflateBlockType_FixedHuffman) { -        LOG0_DEBUG("Static huffman table"); +        LOG_DEBUG("Static huffman table");          static bool are_tables_blank = true;          static LengthLiteralTable length_literal_table = {0};          static DistanceTable distance_table = {0}; @@ -248,7 +248,7 @@ bool deflate_decompress(Bitstream *bitstream, OutputBuffer *output) {          uint16_t lenlit_codelengths[FIXED_LENGTH_LITERAL_CODE_COUNT];          if (are_tables_blank) { -          LOG0_DEBUG("Computing static huffman table"); +          LOG_DEBUG("Computing static huffman table");            for (int symbol = 0; symbol < 144; symbol++) {              lenlit_codelengths[symbol] = 8;            } @@ -303,7 +303,7 @@ bool deflate_decompress(Bitstream *bitstream, OutputBuffer *output) {            int symbol = huffman_table_decode(codelength_table.symbols,                                              codelength_table.counts, bitstream);            if (symbol < 0) { -            LOG0_ERROR("Unknown symbol decoded using huffman table"); +            LOG_ERROR("Unknown symbol decoded using huffman table");              return false;            } else if (symbol < 16) {              lenlit_dist_codelengths[index++] = symbol; @@ -374,24 +374,24 @@ uint8_t *zlib_decompress(const uint8_t *compressed_data_buffer,    uint16_t cmf = bitstream.data[0];    uint16_t flg = bitstream.data[1];    if ((cmf * 256 + flg) % 31 != 0) { -    LOG0_ERROR("fcheck validation failed"); +    LOG_ERROR("fcheck validation failed");      return false;    }    if (flevel > 9) { -    LOG0_ERROR("Invalid compression level"); +    LOG_ERROR("Invalid compression level");      return NULL;    }    if (fdict != 0) { -    LOG0_ERROR("preset dictionnaries are unsupported"); +    LOG_ERROR("preset dictionnaries are unsupported");      return NULL;    }    OutputBuffer output;    OutputBuffer_init(&output);    if (!deflate_decompress(&bitstream, &output)) { -    LOG0_ERROR("deflate decompression failed"); +    LOG_ERROR("deflate decompression failed");      return NULL;    } @@ -414,7 +414,7 @@ uint8_t *zlib_decompress(const uint8_t *compressed_data_buffer,    uint32_t computed_adler32 = (b << 16) | a;    LOG_DEBUG("Computed Adler32 checksum: %u", computed_adler32);    if (adler32 != computed_adler32) { -    LOG0_ERROR("Invalid checksum"); +    LOG_ERROR("Invalid checksum");      exit(1);    } diff --git a/subprojects/lisiblestd.wrap b/subprojects/lisiblestd.wrap index 2b50e74..52d3f56 100644 --- a/subprojects/lisiblestd.wrap +++ b/subprojects/lisiblestd.wrap @@ -1,6 +1,6 @@  [wrap-git]  url = https://github.com/Lisible/lisiblestd.git -revision = v0.1.0 +revision = v0.2.0  depth = 1  [provide]  | 
