Browse Source

* Set the cucul_import_memory() buffer type to void const * instead of

unsigned char const * so that C++ programs won't complain.
                   ___  __  __  ____    ___   ___   ___
                  / _ \|  \/  |/ ___|  / _ \ / _ \ / _ \
                 | | | | |\/| | |  _  | (_) | (_) | (_) |
                 | |_| | |  | | |_| |  \__, |\__, |\__, |
                  \___/|_|  |_|\____|    /_/   /_/   /_/
tags/v0.99.beta14
Sam Hocevar sam 18 years ago
parent
commit
1cb8d02560
2 changed files with 6 additions and 5 deletions
  1. +1
    -1
      cucul/cucul.h
  2. +5
    -4
      cucul/import.c

+ 1
- 1
cucul/cucul.h View File

@@ -216,7 +216,7 @@ int cucul_free_font(cucul_font_t *);
* the current canvas to various text formats.
*
* @{ */
long int cucul_import_memory(cucul_canvas_t *, unsigned char const *,
long int cucul_import_memory(cucul_canvas_t *, void const *,
unsigned long int, char const *);
long int cucul_import_file(cucul_canvas_t *, char const *, char const *);
char const * const * cucul_get_import_list(void);


+ 5
- 4
cucul/import.c View File

@@ -82,7 +82,7 @@ static void ansi_parse_grcm(cucul_canvas_t *, struct ansi_grcm *,
* \param format A string describing the input format.
* \return The number of bytes read, or -1 if an error occurred.
*/
long int cucul_import_memory(cucul_canvas_t *cv, unsigned char const *buf,
long int cucul_import_memory(cucul_canvas_t *cv, void const *buf,
unsigned long int len, char const *format)
{
if(!strcasecmp("caca", format))
@@ -97,16 +97,17 @@ long int cucul_import_memory(cucul_canvas_t *cv, unsigned char const *buf,
/* Autodetection */
if(!strcasecmp("", format))
{
unsigned char const *str = buf;
unsigned int i;

/* If 4 first bytes are 0xcaca + 'CV' */
if(len >= 4 && buf[0] == 0xca &&
buf[1] == 0xca && buf[2] == 'C' && buf[3] == 'V')
if(len >= 4 && str[0] == 0xca &&
str[1] == 0xca && str[2] == 'C' && str[3] == 'V')
return import_caca(cv, buf, len);

/* If we find ESC[ argv, we guess it's an ANSI file */
for(i = 0; i + 1 < len; i++)
if((buf[i] == 0x1b) && (buf[i + 1] == '['))
if((str[i] == 0x1b) && (str[i + 1] == '['))
return import_ansi(cv, buf, len, 0);

/* Otherwise, import it as text */


Loading…
Cancel
Save