From da1070a234c2793125e606e4e3ba355fbc25aa87 Mon Sep 17 00:00:00 2001 From: Jules Maselbas Date: Sat, 25 Dec 2021 16:37:28 +0100 Subject: [PATCH] Fix missing prototypes warning Functions qoi_write_32 and qoi_read_32 should either have a prototype or be declared static. Do the latter, as theses functions are defined in a header and should only exists in the same compilation unit as the file including qoi.h and defining QOI_IMPLEMENTATION, ie not exported. By adding the static keyword in the function declaration the following command doesn't raise a missing-prototypes warning, anymore: cc -Wmissing-prototypes -DQOI_IMPLEMENTATION -c -o qoi.o -xc qoi.h --- qoi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qoi.h b/qoi.h index b733bb2..fdb3276 100644 --- a/qoi.h +++ b/qoi.h @@ -358,14 +358,14 @@ typedef union { static const unsigned char qoi_padding[8] = {0,0,0,0,0,0,0,1}; -void qoi_write_32(unsigned char *bytes, int *p, unsigned int v) { +static void qoi_write_32(unsigned char *bytes, int *p, unsigned int v) { bytes[(*p)++] = (0xff000000 & v) >> 24; bytes[(*p)++] = (0x00ff0000 & v) >> 16; bytes[(*p)++] = (0x0000ff00 & v) >> 8; bytes[(*p)++] = (0x000000ff & v); } -unsigned int qoi_read_32(const unsigned char *bytes, int *p) { +static unsigned int qoi_read_32(const unsigned char *bytes, int *p) { unsigned int a = bytes[(*p)++]; unsigned int b = bytes[(*p)++]; unsigned int c = bytes[(*p)++];