diff --git a/cucul/import.c b/cucul/import.c index 0502839..ef1a960 100644 --- a/cucul/import.c +++ b/cucul/import.c @@ -222,9 +222,9 @@ char const * const * cucul_get_import_list(void) static ssize_t import_caca(cucul_canvas_t *cv, void const *data, size_t size) { uint8_t const *buf = (uint8_t const *)data; - unsigned int control_size, data_size, expected_size, frames, f, n; + size_t control_size, data_size, expected_size; + unsigned int frames, f, n, offset; uint16_t version, flags; - unsigned int offset; int32_t xmin = 0, ymin = 0, xmax = 0, ymax = 0; if(size < 20) @@ -247,8 +247,8 @@ static ssize_t import_caca(cucul_canvas_t *cv, void const *data, size_t size) if(control_size < 16 + frames * 32) { - debug("caca import error: control size %lu < expected %lu", - (unsigned long int)control_size, 16 + frames * 32); + debug("caca import error: control size %u < expected %u", + (unsigned int)control_size, 16 + frames * 32); goto invalid_caca; } @@ -279,8 +279,8 @@ static ssize_t import_caca(cucul_canvas_t *cv, void const *data, size_t size) if(expected_size != data_size) { - debug("caca import error: data size %lu < expected %lu", - (unsigned long int)data_size, (unsigned long int)expected_size); + debug("caca import error: data size %u < expected %u", + (unsigned int)data_size, (unsigned int)expected_size); goto invalid_caca; } diff --git a/cucul/triangle.c b/cucul/triangle.c index 6880556..d08f7db 100644 --- a/cucul/triangle.c +++ b/cucul/triangle.c @@ -90,7 +90,7 @@ int cucul_fill_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, int x3, int y3, uint32_t ch) { int x, y, xmin, xmax, ymin, ymax; - long int xx1, xx2, xa, xb, sl21, sl31, sl32; + int xx1, xx2, xa, xb, sl21, sl31, sl32; /* Bubble-sort y1 <= y2 <= y3 */ if(y1 > y2) @@ -109,7 +109,7 @@ int cucul_fill_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, x3 *= 0x10000; ymin = y1 < 0 ? 0 : y1; - ymax = y3 + 1 < (int)cv->height ? y3 + 1 : (int)cv->height; + ymax = y3 + 1 < cv->height ? y3 + 1 : cv->height; if(ymin < y2) { @@ -143,7 +143,7 @@ int cucul_fill_triangle(cucul_canvas_t *cv, int x1, int y1, int x2, int y2, } xmin = xx1 < 0 ? 0 : xx1; - xmax = xx2 + 1 < (int)cv->width ? xx2 + 1 : (int)cv->width; + xmax = xx2 + 1 < cv->width ? xx2 + 1 : cv->width; for(x = xmin; x < xmax; x++) cucul_put_char(cv, x, y, ch); diff --git a/cxx/cucul++.cpp b/cxx/cucul++.cpp index eed6f94..ae39b39 100644 --- a/cxx/cucul++.cpp +++ b/cxx/cucul++.cpp @@ -279,7 +279,7 @@ char const *const * Cucul::getImportList(void) return cucul_get_import_list(); } -long int Cucul::importMemory(void const *buf, unsigned long int len, char const *fmt) +long int Cucul::importMemory(void const *buf, size_t len, char const *fmt) { return cucul_import_memory(cv, buf, len, fmt); } @@ -294,7 +294,7 @@ char const *const * Cucul::getExportList(void) return cucul_get_export_list(); } -void *Cucul::exportMemory(char const *fmt, unsigned long int *len) +void *Cucul::exportMemory(char const *fmt, size_t *len) { return cucul_export_memory(cv, fmt, len); } @@ -308,7 +308,7 @@ Dither::~Dither() cucul_free_dither(dither); } -void Dither::setPalette(unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]) +void Dither::setPalette(uint32_t r[], uint32_t g[], uint32_t b[], uint32_t a[]) { cucul_set_dither_palette(dither, r, g, b, a); } diff --git a/cxx/cucul++.h b/cxx/cucul++.h index 309c1a7..0dfb96f 100644 --- a/cxx/cucul++.h +++ b/cxx/cucul++.h @@ -68,8 +68,8 @@ __class Dither unsigned int, unsigned int, unsigned int, unsigned int); ~Dither(); - void setPalette(unsigned int r[], unsigned int g[], - unsigned int b[], unsigned int a[]); + void setPalette(uint32_t r[], uint32_t g[], + uint32_t b[], uint32_t a[]); void setBrightness(float); void setGamma(float); void setContrast(float); @@ -136,13 +136,14 @@ __class Cucul int freeFrame(unsigned int); char const * const * getImportList(void); - long int importMemory(void const *, unsigned long int, char const *); + long int importMemory(void const *, size_t, char const *); long int importFile(char const *, char const *); char const * const * getExportList(void); - void *exportMemory(char const *, unsigned long int *); + void *exportMemory(char const *, size_t *); static int Rand(int, int); static char const * getVersion(); + protected: cucul_canvas_t *get_cucul_canvas_t(); diff --git a/examples/export.c b/examples/export.c index f5e6afc..ac6b870 100644 --- a/examples/export.c +++ b/examples/export.c @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) void *buffer; char *file, *format; char const * const * exports, * const * p; - unsigned long int len; + size_t len; int x, y; exports = cucul_get_export_list(); diff --git a/examples/figfont.c b/examples/figfont.c index e143dd1..f49e775 100644 --- a/examples/figfont.c +++ b/examples/figfont.c @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) { cucul_canvas_t *cv; void *buffer; - unsigned long int len; + size_t len; uint8_t color = 0; if(argc < 3) diff --git a/examples/spritedit.c b/examples/spritedit.c index 28d829a..fba3180 100644 --- a/examples/spritedit.c +++ b/examples/spritedit.c @@ -49,7 +49,7 @@ char *guy[] = { int main(int argc, char **argv) { cucul_canvas_t *sprite; - unsigned long int len; + size_t len; void *buffer; int i; diff --git a/src/cacaserver.c b/src/cacaserver.c index ffe3de9..7deec73 100644 --- a/src/cacaserver.c +++ b/src/cacaserver.c @@ -112,7 +112,7 @@ struct server cucul_canvas_t *canvas; void *buffer; - unsigned long int buflen; + size_t buflen; int client_count; struct client *clients; @@ -222,8 +222,7 @@ restart: for(;;) { - long int needed; - ssize_t wanted; + ssize_t needed, wanted; needed = cucul_import_memory(server->canvas, server->input, server->read, "caca"); @@ -243,7 +242,7 @@ restart: goto restart; server->read += wanted; } - + /* Free the previous export buffer, if any */ if(server->buffer) { diff --git a/src/img2txt.c b/src/img2txt.c index cc3dc0f..057c72f 100644 --- a/src/img2txt.c +++ b/src/img2txt.c @@ -95,7 +95,7 @@ int main(int argc, char **argv) /* libcucul context */ cucul_canvas_t *cv; void *export; - unsigned long int len; + size_t len; struct image *i; unsigned int cols = 0, lines = 0, font_width = 6, font_height = 10; char *format = NULL;