gluon-web: compile with -std=c99 -Wall -Wextra

Also fix all warnings.
This commit is contained in:
Matthias Schiffer 2018-02-22 14:33:47 +01:00
parent 56a10e03b3
commit 624d969c52
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
4 changed files with 6 additions and 5 deletions

View File

@ -1,7 +1,7 @@
all: compile
%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS) -D_GNU_SOURCE -fPIC -c -o $@ $<
$(CC) $(CPPFLAGS) $(CFLAGS) -D_GNU_SOURCE -std=c99 -Wall -Wextra -fPIC -c -o $@ $<
clean:
rm -f parser.so *.o

View File

@ -27,8 +27,9 @@ static inline uint16_t get_le16(const uint8_t *d) {
return (((uint16_t)d[1]) << 8) | d[0];
}
static uint32_t sfh_hash(const uint8_t *data, int len)
static uint32_t sfh_hash(const void *input, int len)
{
const uint8_t *data = input;
uint32_t hash = len, tmp;
/* Main loop */

View File

@ -291,7 +291,7 @@ template_format_chunk(struct template_parser *parser, size_t *sz)
return s;
}
const char *template_reader(lua_State *L, void *ud, size_t *sz)
const char *template_reader(lua_State *L __attribute__((unused)), void *ud, size_t *sz)
{
struct template_parser *parser = ud;
int rem = parser->size - (parser->off - parser->data);

View File

@ -200,7 +200,7 @@ static inline int mb_is_illegal(unsigned char *s, int n)
/* scan given source string, validate UTF-8 sequence and store result
* in given buffer object */
static int validate_utf8(unsigned char **s, int l, struct template_buffer *buf)
static int validate_utf8(unsigned char **s, unsigned int l, struct template_buffer *buf)
{
unsigned char *ptr = *s;
unsigned int o = 0, v, n;
@ -289,7 +289,7 @@ char * pcdata(const char *s, unsigned int l)
for (o = 0; o < l; o++)
{
/* Invalid XML bytes */
if (((*ptr >= 0x00) && (*ptr <= 0x08)) ||
if ((*ptr <= 0x08) ||
((*ptr >= 0x0B) && (*ptr <= 0x0C)) ||
((*ptr >= 0x0E) && (*ptr <= 0x1F)) ||
(*ptr == 0x7F))