Browse Source

* Fixed warning in a clever and tested way. Bordel de merde.

tags/v0.99.beta14
Jean-Yves Lamoureux jylam 18 years ago
parent
commit
2450e5ea28
1 changed files with 7 additions and 6 deletions
  1. +7
    -6
      cucul/import.c

+ 7
- 6
cucul/import.c View File

@@ -73,13 +73,13 @@ cucul_canvas_t * cucul_import_canvas(void const *data, unsigned int size,
return import_caca(data, size); return import_caca(data, size);


/* If we find ESC[ argv, we guess it's an ANSI file */ /* If we find ESC[ argv, we guess it's an ANSI file */
while(i<size-1)
while(i<size-1)
{ {
if((buf[i] == 0x1b) && (buf[i+1] == '[')) if((buf[i] == 0x1b) && (buf[i+1] == '['))
return import_ansi(data, size); return import_ansi(data, size);
i++; i++;
} }
/* Otherwise, import it as text */ /* Otherwise, import it as text */
return import_text(data, size); return import_text(data, size);
} }
@@ -211,9 +211,10 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
unsigned char const *buffer = (unsigned char const*)data; unsigned char const *buffer = (unsigned char const*)data;
unsigned int i; unsigned int i;
int x = 0, y = 0; int x = 0, y = 0;
unsigned int width = 80, height = 25;
int width = 80, height = 25;
int save_x = 0, save_y = 0; int save_x = 0, save_y = 0;
unsigned int j, skip;
unsigned int skip;
int j;
uint8_t fg, bg, save_fg, save_bg, bold, reverse; uint8_t fg, bg, save_fg, save_bg, bold, reverse;


fg = save_fg = CUCUL_COLOR_LIGHTGRAY; fg = save_fg = CUCUL_COLOR_LIGHTGRAY;
@@ -250,7 +251,7 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
i++; // ESC i++; // ESC
i++; // [ i++; // [


for(j = i; j < size; j++)
for(j = i; j < (int)size; j++)
if(IS_ALPHA(buffer[j])) if(IS_ALPHA(buffer[j]))
{ {
c = buffer[j]; c = buffer[j];
@@ -308,7 +309,7 @@ static cucul_canvas_t *import_ansi(void const *data, unsigned int size)
x = width; x = width;
break; break;
case 'm': case 'm':
for(j = 0; j < argc; j++)
for(j = 0; j < (int)argc; j++)
manage_modifiers(argv[j], &fg, &bg, manage_modifiers(argv[j], &fg, &bg,
&save_fg, &save_bg, &bold, &reverse); &save_fg, &save_bg, &bold, &reverse);
if(bold && fg < 8) if(bold && fg < 8)


Loading…
Cancel
Save