summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTazyFoundSoup <gardendistrict0x0@outlook.com>2026-06-08 10:24:03 +1000
committerTazyFoundSoup <gardendistrict0x0@outlook.com>2026-06-08 10:24:03 +1000
commitc9f5da1d19e6ace5d6a7c650fe996f359e11d1a5 (patch)
treec5d61055549f1819d902e567f7227e0c3778300c
parent62cbefa6a8fca583c6f600f1d7e24f0c61c91b1e (diff)
docs(headers): Clean up comments across public headers
-rw-r--r--include/bridges/stdio/stream_bridge.h2
-rw-r--r--include/tinyff/common.h11
-rw-r--r--include/tinyff/dbg.h7
-rw-r--r--include/tinyff/image/bmp.h7
-rw-r--r--include/tinyff/image/generic.h9
-rw-r--r--include/tinyff/image/png.h3
-rw-r--r--include/tinyff/math/core.h4
-rw-r--r--include/tinyff/result.h2
8 files changed, 11 insertions, 34 deletions
diff --git a/include/bridges/stdio/stream_bridge.h b/include/bridges/stdio/stream_bridge.h
index 561fa8a..2cb01cd 100644
--- a/include/bridges/stdio/stream_bridge.h
+++ b/include/bridges/stdio/stream_bridge.h
@@ -2,7 +2,7 @@
#include <stdio.h>
#include <tinyff/stream.h>
-// Default reads for common types (just FILE for now, memory later)
+// File-backed stream I/O (memory stream coming soon)
size_t ff_file_read(void *ptr, size_t size, void *user);
size_t ff_file_write(const void *ptr, size_t size, void *user);
diff --git a/include/tinyff/common.h b/include/tinyff/common.h
index d4215ed..2b17911 100644
--- a/include/tinyff/common.h
+++ b/include/tinyff/common.h
@@ -38,13 +38,12 @@
#endif
-// Flags
typedef bool ff_flag;
#define FF_ENABLE true
#define FF_DISABLE false
-// Functions
+// Byte-order conversion
static inline uint32_t ff_be32(const uint8_t *b) {
return ((uint32_t)b[0] << 24) |
@@ -76,7 +75,7 @@ static inline void ff_write_le32(uint8_t *out, uint32_t v)
out[3] = (v >> 24) & 0xFF;
}
-// Small stdlib helper functions
+// Freestanding stdlib replacements
static inline size_t ff_strlen(const char *str)
{
size_t len = 0;
@@ -113,8 +112,7 @@ static inline void *ff_memset(void *dest, int ch, size_t count) {
return dest;
}
-// Context bases
-// Default
+// Context and allocator
typedef struct {
void* (*ff_alloc)(size_t size);
@@ -123,11 +121,8 @@ typedef struct {
} ff_allocator;
typedef struct ff_ctx {
- // Debug settings
ff_stream ff_debug_stream;
ff_flag ff_debug_enabled;
-
- // Allocation
ff_allocator allocator;
#ifdef USE_BENCH
diff --git a/include/tinyff/dbg.h b/include/tinyff/dbg.h
index 379e6ce..74a5fbb 100644
--- a/include/tinyff/dbg.h
+++ b/include/tinyff/dbg.h
@@ -1,11 +1,8 @@
#ifndef DBG_H
#define DBG_H
-// Debug writes extra messages to a stream of the user's choice
-// To enable debug, the user needs to include this header
-// Then they can use the ff_set_debug_stream function to set the stream
-// And then use ff_dprintf to print debug messages
-// By default, debug is disabled
+// Debug logging writes to a user-supplied stream.
+// By default debug is disabled. Enable via ff_set_debug_stream.
#define FF_DEBUG_ENABLED 1
diff --git a/include/tinyff/image/bmp.h b/include/tinyff/image/bmp.h
index 973706d..f56fdd5 100644
--- a/include/tinyff/image/bmp.h
+++ b/include/tinyff/image/bmp.h
@@ -28,7 +28,7 @@ typedef struct {
ff_stream *raw;
- uint32_t file_size; // tbh, i actually have no idea why this is needed
+ uint32_t file_size;
uint32_t data_offset;
uint32_t width;
@@ -50,11 +50,6 @@ typedef struct {
typedef ff_result (*ff_bmp_section_handler_ptr)(ff_ctx* ctx, uint8_t *buf, size_t len, ff_bmp_ctx* bmp_ctx);
typedef struct {
- // Even though the types in bitmaps are invisible (they don't have labels)
- // I'll just keep them in for the sake of being in
- // And I might just handle the section looping a bit differently
- // And their names will be what I saw in the spec
-
const char* type;
ff_bmp_section_handler_ptr handler;
} ff_bmp_section_handler;
diff --git a/include/tinyff/image/generic.h b/include/tinyff/image/generic.h
index a0bba62..60a05b8 100644
--- a/include/tinyff/image/generic.h
+++ b/include/tinyff/image/generic.h
@@ -1,6 +1,3 @@
-// This is the generics image header file for tinyff
-// It contains generic image structures and definitions
-
#include <tinyff/common.h>
#include <tinyff/result.h>
@@ -8,16 +5,14 @@
#define GENERIC_IMAGE_H
-// The image origin is **not** the origin point of the image
-// But rather from what the image was loaded
+// Tracks which format the image was decoded from
typedef enum {
FF_IMAGE_ORIGIN_PNG,
FF_IMAGE_ORIGIN_BMP
} ff_image_origin;
-// Only the basic information about an image
-// Warning: Data is RGBA8888 using scanlines going from top to bottom
+// Warning: Data is RGBA8888, scanlines top to bottom
typedef struct {
uint32_t width;
uint32_t height;
diff --git a/include/tinyff/image/png.h b/include/tinyff/image/png.h
index fb064db..5d55b40 100644
--- a/include/tinyff/image/png.h
+++ b/include/tinyff/image/png.h
@@ -63,8 +63,7 @@ typedef struct {
ff_png_chunk_handler_ptr handler;
} ff_png_chunk_handler;
-// Handler declarations
-// Massive W.I.P
+// Chunk handler declarations
// Required by definition
ff_result ff_png_header_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx* png_ctx); // IHDR
diff --git a/include/tinyff/math/core.h b/include/tinyff/math/core.h
index 1db7a40..946cbe7 100644
--- a/include/tinyff/math/core.h
+++ b/include/tinyff/math/core.h
@@ -1,9 +1,7 @@
#ifndef FF_MATH_H
#define FF_MATH_H
-// NOTE: I'm not going to use macros until I feel like my trash code
-// might actually be used in prod. For now im using my beloved
-// static inline functions. Oh god dennis richie, i love you so bad <3
+// Static inline functions for type safety over macros
diff --git a/include/tinyff/result.h b/include/tinyff/result.h
index f167277..8f09a52 100644
--- a/include/tinyff/result.h
+++ b/include/tinyff/result.h
@@ -40,8 +40,6 @@ typedef enum {
// Memory
FF_RESULT_ERROR_MEMORY_ALLOCATION,
-
- // More will be created when more errors occur
} ff_result;
#endif \ No newline at end of file