From 33bc2f29e63dce5819c40854d719ddbf1d6f9604 Mon Sep 17 00:00:00 2001 From: Andrew Haynes Date: Wed, 9 Sep 2026 17:32:22 -0400 Subject: [PATCH] DOCS: added documentation to find_extension and removed redundant asterisks from comments --- include/image/utils.h | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/include/image/utils.h b/include/image/utils.h index e9af703..ba31113 100644 --- a/include/image/utils.h +++ b/include/image/utils.h @@ -47,7 +47,7 @@ extern const char* error_messages[]; * @brief Max value for any channel * @details For alpha channel this is the max opacity setting and 0 is fully * transparent, 255 is white for any color and 0 is black. - * */ + */ #define MAX 255 #define HALF_MAX \ ((int)(MAX / 2) + 1) /**< Half Max Color Value for any channel */ @@ -70,7 +70,7 @@ extern const char* error_messages[]; * @param[in] g The green channel stored as char and packed into int * @param[in] b The blue channel stored as char and packed into int * - * */ + */ #define ENCODE_RGB(r, g, b) \ (((unsigned int)(MAX) << SHIFT_24) | ((unsigned int)(r) << SHIFT_16) | \ ((unsigned int)(g) << SHIFT_8) | (unsigned int)(b)) @@ -85,7 +85,7 @@ extern const char* error_messages[]; * @param[in] g The green channel stored as char and packed into int * @param[in] b The blue channel stored as char and packed into int * - * */ + */ #define ENCODE_ARGB(a, r, g, b) \ (((unsigned int)(a) << SHIFT_24) | ((unsigned int)(r) << SHIFT_16) | \ ((unsigned int)(g) << SHIFT_8) | (unsigned int)(b)) @@ -95,7 +95,7 @@ extern const char* error_messages[]; * @details Takes in a value of X and checks if it is Above the Max of 255. If * so, then set to Max. If not, then simply set back to whatever X was before. * @param[in] x Color channel: char - * */ + */ #define CLAMP_MAX(x) (((x) > MAX) ? MAX : (x)) /** @@ -103,14 +103,14 @@ extern const char* error_messages[]; * @details Takes in a value of X and checks if it is Below 0. If so, then set * to 0. If not, then simply set back to whatever X was before. * @param[in] x Color channel: char - * */ + */ #define CLAMP_MIN(x) (((x) < 0) ? 0 : (x)) /** * @brief Contains values for PPM Image * @details Can be defined with just a name and filled later with ppm_load * as it stores information for header of file not the pixels of the image - * */ + */ typedef struct { int width; /**< Image width in pixels */ @@ -124,7 +124,7 @@ typedef struct * @brief Contains values for JPEG Image * @details Can be defined with just a name and filled later with jpeg_load as * it stores information for header of file not the pixels of the image - * */ + */ typedef struct { int width; /**< Image width in pixels */ @@ -140,7 +140,7 @@ typedef struct * then dividing later. * @param[in] clr Takes a packed color, unsigned int * @return unsigned long Packed color in 4 ints instead of one - * */ + */ unsigned long u32to_u64(const unsigned int clr); @@ -150,7 +150,7 @@ u32to_u64(const unsigned int clr); * @param[in] clr Takes a packed color, unsigned long * @param[in] u64_div Takes a divisor to break down to raw color * @return unsigned int Packed color in 1 int instead of 4 - * */ + */ unsigned int u64to_u32(const unsigned long clr, const unsigned long u64_div); @@ -159,7 +159,7 @@ u64to_u32(const unsigned long clr, const unsigned long u64_div); * @details Prints metadata like Name, Format, Width, Height and Length * important for debugging errors * @param[in] src Pointer to src metadata of a PPM image - * */ + */ void __attribute__((overloadable)) print_attr(const PPM* src); @@ -168,10 +168,16 @@ print_attr(const PPM* src); * @details Prints metadata like Name, Width, Height and Length * important for debugging errors * @param[in] src Pointer to src metadata of a JPEG image - * */ + */ void __attribute__((overloadable)) print_attr(const JPEG* src); +/** + * @brief Finds start of extension in image name + * @details Loops through the character array starting from the end to find the + * start of the extension. + * @param[in] n Char array (str) + */ size_t find_extension(const char* n);