Fix some clang complaints

This commit is contained in:
Kim Woelders 2023-08-24 19:07:43 +02:00
parent 5300f19575
commit 74dae151cd
6 changed files with 20 additions and 15 deletions

View File

@ -91,14 +91,14 @@ image_load_mem(const char *file, int *perr)
else else
ext = file; ext = file;
err = stat(file, &st);
if (err)
goto bail;
im = NULL; im = NULL;
fd = -1; fd = -1;
fdata = MAP_FAILED; fdata = MAP_FAILED;
err = stat(file, &st);
if (err)
goto bail;
fd = open(file, O_RDONLY); fd = open(file, O_RDONLY);
if (fd < 0) if (fd < 0)
goto bail; goto bail;

View File

@ -9,7 +9,7 @@
#include "span.h" #include "span.h"
ImlibPoly * ImlibPoly *
__imlib_polygon_new() __imlib_polygon_new(void)
{ {
ImlibPoly *poly; ImlibPoly *poly;

View File

@ -75,7 +75,7 @@ __imlib_LoadFilter(char *file)
} }
void void
__imlib_dynamic_filters_init() __imlib_dynamic_filters_init(void)
{ {
char **list; char **list;
int num_filters, i = 0; int num_filters, i = 0;
@ -116,7 +116,7 @@ __imlib_dynamic_filters_init()
} }
void void
__imlib_dynamic_filters_deinit() __imlib_dynamic_filters_deinit(void)
{ {
} }

View File

@ -264,7 +264,7 @@ init(ImlibFilterInfo * info)
} }
void void
deinit() deinit(void)
{ {
return; return;
} }

View File

@ -245,7 +245,7 @@ init(ImlibFilterInfo * info)
} }
void void
deinit() deinit(void)
{ {
return; return;
} }

View File

@ -86,7 +86,7 @@ typedef struct __PACKED__ {
png_fctl_t fctl; png_fctl_t fctl;
png_fdat_t fdat; png_fdat_t fdat;
}; };
uint32_t crc; // Misplaced - just indication // uint32_t crc; // Misplaced - just indication
} png_chunk_t; } png_chunk_t;
typedef struct { typedef struct {
@ -284,7 +284,6 @@ _load(ImlibImage * im, int load_data)
png_structp png_ptr = NULL; png_structp png_ptr = NULL;
png_infop info_ptr = NULL; png_infop info_ptr = NULL;
ctx_t ctx = { 0 }; ctx_t ctx = { 0 };
int ic;
unsigned char *fptr; unsigned char *fptr;
const png_chunk_t *chunk; const png_chunk_t *chunk;
const png_fctl_t *pfctl; const png_fctl_t *pfctl;
@ -339,13 +338,16 @@ _load(ImlibImage * im, int load_data)
fptr = (unsigned char *)im->fi->fdata; fptr = (unsigned char *)im->fi->fdata;
fptr += _PNG_SIG_SIZE; fptr += _PNG_SIG_SIZE;
seen_actl = false; seen_actl = false;
#ifdef IMLIB2_DEBUG
int ic = 0;
#endif
for (ic = 0;; ic++, fptr += 8 + len + 4) for (;; fptr += 8 + len + 4)
{ {
chunk = PCAST(const png_chunk_t *, fptr); chunk = PCAST(const png_chunk_t *, fptr);
len = htonl(chunk->hdr.len); len = htonl(chunk->hdr.len);
D("Scan %3d: %06lx: %6d: %.4s: ", ic, D("Scan %3d: %06lx: %6d: %.4s: ", ic++,
fptr - (unsigned char *)im->fi->fdata, len, chunk->hdr.name); fptr - (unsigned char *)im->fi->fdata, len, chunk->hdr.name);
if (!mm_check(fptr + len)) if (!mm_check(fptr + len))
break; break;
@ -428,13 +430,16 @@ _load(ImlibImage * im, int load_data)
png_process_data(png_ptr, info_ptr, fptr, _PNG_SIG_SIZE); png_process_data(png_ptr, info_ptr, fptr, _PNG_SIG_SIZE);
fptr += _PNG_SIG_SIZE; fptr += _PNG_SIG_SIZE;
#ifdef IMLIB2_DEBUG
ic = 0;
#endif
for (ic = 0;; ic++, fptr += 8 + len + 4) for (;; fptr += 8 + len + 4)
{ {
chunk = PCAST(const png_chunk_t *, fptr); chunk = PCAST(const png_chunk_t *, fptr);
len = htonl(chunk->hdr.len); len = htonl(chunk->hdr.len);
D("Chunk %3d: %06lx: %6d: %.4s: ", ic, D("Chunk %3d: %06lx: %6d: %.4s: ", ic++,
fptr - (unsigned char *)im->fi->fdata, len, chunk->hdr.name); fptr - (unsigned char *)im->fi->fdata, len, chunk->hdr.name);
if (!mm_check(fptr + len)) if (!mm_check(fptr + len))
break; break;