Browse Source

* Fix shadowing declarations.

tags/v0.99.beta14
Sam Hocevar sam 18 years ago
parent
commit
f1f00897c5
3 changed files with 24 additions and 24 deletions
  1. +5
    -5
      cucul/canvas.c
  2. +3
    -3
      cucul/export.c
  3. +16
    -16
      tools/makefont.c

+ 5
- 5
cucul/canvas.c View File

@@ -219,23 +219,23 @@ unsigned long int cucul_get_char(cucul_canvas_t *cv, int x, int y)
*/
int cucul_put_str(cucul_canvas_t *cv, int x, int y, char const *s)
{
unsigned int read;
unsigned int rd;

if(y < 0 || y >= (int)cv->height || x >= (int)cv->width)
return 0;

while(*s && x < -1)
{
x += cucul_utf32_is_fullwidth(cucul_utf8_to_utf32(s, &read)) ? 2 : 1;
s += read;
x += cucul_utf32_is_fullwidth(cucul_utf8_to_utf32(s, &rd)) ? 2 : 1;
s += rd;
}

while(*s && x < (int)cv->width)
{
uint32_t ch = cucul_utf8_to_utf32(s, &read);
uint32_t ch = cucul_utf8_to_utf32(s, &rd);
cucul_put_char(cv, x, y, ch);
x += cucul_utf32_is_fullwidth(ch) ? 2 : 1;
s += read;
s += rd;
}

return 0;


+ 3
- 3
cucul/export.c View File

@@ -894,9 +894,9 @@ static void *export_tga(cucul_canvas_t *cv, unsigned long int *bytes)
/* Swap bytes. What a waste of time. */
for(i = 0; i < w * h * 4; i += 4)
{
char w;
w = cur[i]; cur[i] = cur[i + 3]; cur[i + 3] = w;
w = cur[i + 1]; cur[i + 1] = cur[i + 2]; cur[i + 2] = w;
char c;
c = cur[i]; cur[i] = cur[i + 3]; cur[i + 3] = c;
c = cur[i + 1]; cur[i + 1] = cur[i + 2]; cur[i + 2] = c;
}

cucul_free_font(f);


+ 16
- 16
tools/makefont.c View File

@@ -91,7 +91,7 @@ int main(int argc, char *argv[])

FT_Bitmap img;
int stdwidth, fullwidth, height, blocks, glyphs, fullglyphs;
unsigned int n, b, i, index;
unsigned int n, b, i;
unsigned int stdsize, fullsize, control_size, data_size, current_offset;
uint8_t *glyph_data;
struct glyph *gtab;
@@ -225,7 +225,7 @@ int main(int argc, char *argv[])
printf("\n");

/* Render all glyphs, so that we can know their offset */
current_offset = n = index = 0;
current_offset = n = 0;
for(b = 0; blocklist[b + 1]; b += 2)
{
for(i = blocklist[b]; i < blocklist[b + 1]; i++)
@@ -419,16 +419,16 @@ static void fix_glyph(FT_Bitmap *i, uint32_t ch,

static int printf_unicode(struct glyph *g)
{
int written = 0;
int wr = 0;

written += printf("U+%.04X: \"", g->unicode);
wr += printf("U+%.04X: \"", g->unicode);

if(g->unicode < 0x20 || (g->unicode >= 0x7f && g->unicode <= 0xa0))
written += printf("\\x%.02x\"", g->unicode);
wr += printf("\\x%.02x\"", g->unicode);
else
written += printf("%s\"", g->buf);
wr += printf("%s\"", g->buf);

return written;
return wr;
}

static int printf_u32(char const *fmt, uint32_t i)
@@ -447,8 +447,8 @@ static int printf_hex(char const *fmt, uint8_t *data, int bytes)
{
char buf[BUFSIZ];
char *parser = buf;
int rewind = 0; /* we use this variable to rewind 2 bytes after \000
* was printed when the next char starts with "\", too. */
int rev = 0; /* we use this variable to rewind 2 bytes after \000
* was printed when the next char starts with "\", too. */

while(bytes--)
{
@@ -458,31 +458,31 @@ static int printf_hex(char const *fmt, uint8_t *data, int bytes)
{
parser += sprintf(parser, "\", \"");
written = 0;
rewind = 0;
rev = 0;
}

if(ch == '\\' || ch == '"')
{
parser -= rewind;
parser -= rev;
parser += sprintf(parser, "\\%c", ch);
rewind = 0;
rev = 0;
}
else if(ch >= 0x20 && ch < 0x7f)
{
parser += sprintf(parser, "%c", ch);
rewind = 0;
rev = 0;
}
else
{
parser -= rewind;
parser -= rev;
parser += sprintf(parser, "\\%.03o", ch);
rewind = ch ? 0 : 2;
rev = ch ? 0 : 2;
}

written++;
}

parser -= rewind;
parser -= rev;
parser[0] = '\0';

return printf(fmt, buf);


Loading…
Cancel
Save