diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-05-22 21:08:39 +1000 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-05-22 21:08:51 +1000 |
| commit | 8656027282931d8d279ce66a52775eacf9dd59a9 (patch) | |
| tree | 38796f59c2f607468be13caf1e907423b43d1ed1 | |
| parent | ee425b55c48c25c7a91b6cba315e6c2cd42d0fb7 (diff) | |
git(attributes): Force LF for all text files except windows specific
files
| -rw-r--r-- | .gitattributes | 5 | ||||
| -rw-r--r-- | src/dbg.c | 4 | ||||
| -rw-r--r-- | src/format/image/png.c | 25 | ||||
| -rw-r--r-- | tests/format/image/png/png_open.c | 2 |
4 files changed, 21 insertions, 15 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..60ceb6c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Force LF for all text files +* text=auto eol=lf +# Keep CRLF for Windows-specific files +*.bat text eol=crlf +*.cmd text eol=crlf @@ -53,9 +53,9 @@ static inline void ff_debug_flush(ff_ctx* ctx, char* buffer, size_t* idx) if (*idx == 0) return; ctx->ff_debug_stream.write( - &ctx->ff_debug_stream, + buffer, *idx, - (uint8_t*)buffer + ctx->ff_debug_stream.user ); *idx = 0; diff --git a/src/format/image/png.c b/src/format/image/png.c index d5959bc..48c073c 100644 --- a/src/format/image/png.c +++ b/src/format/image/png.c @@ -186,7 +186,7 @@ static inline uint16_t ff_png_bpp(ff_png_ctx *png_ctx) ff_result ff_png_header_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx *png_ctx) { - ff_dprintf(ctx, "png: IHDR chunk received (len=%zu)\n"); + ff_dprintf(ctx, "png: IHDR chunk received (len=%u)\n", (unsigned int)len); if (len != 13) { ff_dprintf(ctx, "png: invalid IHDR length\n"); @@ -198,14 +198,13 @@ ff_result ff_png_header_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ct uint32_t w = ff_be32(buf); uint32_t h = ff_be32(buf + 4); - // TODO: Do formatting. - //ff_dprintf("Width: %u\n", w); - //ff_dprintf("Height: %u\n", h); - //ff_dprintf("Bit depth: %u\n", buf[8]); - //ff_dprintf("Color type: %u\n", buf[9]); - //ff_dprintf("Compression method: %u\n", buf[10]); - //ff_dprintf("Filter method: %u\n", buf[11]); - //ff_dprintf("Interlace method: %u\n", buf[12]); + ff_dprintf(ctx, "Width: %u\n", w); + ff_dprintf(ctx, "Height: %u\n", h); + ff_dprintf(ctx, "Bit depth: %u\n", buf[8]); + ff_dprintf(ctx, "Color type: %u\n", buf[9]); + ff_dprintf(ctx, "Compression method: %u\n", buf[10]); + ff_dprintf(ctx, "Filter method: %u\n", buf[11]); + ff_dprintf(ctx, "Interlace method: %u\n", buf[12]); png_ctx->width = w; png_ctx->height = h; @@ -221,7 +220,7 @@ ff_result ff_png_header_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ct ff_result ff_png_palette_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx *png_ctx) { - ff_dprintf(ctx, "png: PLTE chunk received\n"); + ff_dprintf(ctx, "png: PLTE chunk received (len = %u)\n", (unsigned int)len); if (len % 3 != 0) { ff_dprintf(ctx, "png: invalid PLTE length\n"); @@ -231,7 +230,7 @@ ff_result ff_png_palette_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_c } uint16_t num_entries = len / 3; - ff_dprintf(ctx, "png: PLTE contains [number of entries] palette entries\n"); // TODO: Format this with the actual number of entries + ff_dprintf(ctx, "png: PLTE contains %u palette entries\n", num_entries); png_ctx->palette_size = num_entries; png_ctx->palette = ctx->allocator.ff_alloc(len); @@ -254,7 +253,7 @@ ff_result ff_png_palette_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_c ff_result ff_png_data_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx *png_ctx) { - ff_dprintf(ctx, "png: IDAT chunk received\n"); + ff_dprintf(ctx, "png: IDAT chunk received (len = %u)\n", (unsigned int)len); uint8_t *uncompressed_data = NULL; @@ -349,7 +348,7 @@ ff_result ff_png_data_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx } break; default: // Unknown - ff_dprintf(ctx, "png: unsupported scanline filter method"); // TODO: Format + ff_dprintf(ctx, "png: unsupported scanline filter method %u\n", (unsigned int)filter_type); ctx->allocator.ff_free(reconstructed_buf); ctx->allocator.ff_free(previous_row); ctx->allocator.ff_free(uncompressed_data); diff --git a/tests/format/image/png/png_open.c b/tests/format/image/png/png_open.c index 3542ffa..4e16111 100644 --- a/tests/format/image/png/png_open.c +++ b/tests/format/image/png/png_open.c @@ -36,7 +36,9 @@ ff_result fftest_lenna256(ff_ctx* ctx) { fclose(file);
ff_close_png(ctx, png_ctx);
+ #ifdef USE_BENCH
ff_bench_print(ctx, &(ctx)->bench);
+ #endif
return res;
}
|
