Browse Source

* Switch a few unsigned int variables to size_t where appropriate.

* Synchronise parameter types in the C++ bindings with the C API.
tags/v0.99.beta14
Sam Hocevar sam 16 years ago
parent
commit
8f832a3b47
9 changed files with 24 additions and 24 deletions
  1. +6
    -6
      cucul/import.c
  2. +3
    -3
      cucul/triangle.c
  3. +3
    -3
      cxx/cucul++.cpp
  4. +5
    -4
      cxx/cucul++.h
  5. +1
    -1
      examples/export.c
  6. +1
    -1
      examples/figfont.c
  7. +1
    -1
      examples/spritedit.c
  8. +3
    -4
      src/cacaserver.c
  9. +1
    -1
      src/img2txt.c

+ 6
- 6
cucul/import.c View File

@@ -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;
}



+ 3
- 3
cucul/triangle.c View File

@@ -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);


+ 3
- 3
cxx/cucul++.cpp View File

@@ -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);
}


+ 5
- 4
cxx/cucul++.h View File

@@ -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();



+ 1
- 1
examples/export.c View File

@@ -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();


+ 1
- 1
examples/figfont.c View File

@@ -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)


+ 1
- 1
examples/spritedit.c View File

@@ -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;



+ 3
- 4
src/cacaserver.c View File

@@ -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)
{


+ 1
- 1
src/img2txt.c View File

@@ -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;


Loading…
Cancel
Save