Sfoglia il codice sorgente

* Minor documentation fixes.

tags/v0.99.beta14
Sam Hocevar sam 18 anni fa
parent
commit
44c286272c
2 ha cambiato i file con 13 aggiunte e 14 eliminazioni
  1. +0
    -1
      cucul/canvas.c
  2. +13
    -13
      cucul/import.c

+ 0
- 1
cucul/canvas.c Vedi File

@@ -143,7 +143,6 @@ int cucul_putchar(cucul_canvas_t *cv, int x, int y, unsigned long int ch)
* \param cv A handle to the libcucul canvas. * \param cv A handle to the libcucul canvas.
* \param x X coordinate. * \param x X coordinate.
* \param y Y coordinate. * \param y Y coordinate.
* \param ch The requested character value.
* \return This function always returns 0. * \return This function always returns 0.
*/ */
unsigned long int cucul_getchar(cucul_canvas_t *cv, int x, int y) unsigned long int cucul_getchar(cucul_canvas_t *cv, int x, int y)


+ 13
- 13
cucul/import.c Vedi File

@@ -76,42 +76,42 @@ static void ansi_parse_grcm(cucul_canvas_t *, struct ansi_grcm *,
* - \c ENOMEM Not enough memory to allocate canvas. * - \c ENOMEM Not enough memory to allocate canvas.
* - \c EINVAL Invalid format requested. * - \c EINVAL Invalid format requested.
* *
* \param A libcucul canvas in which to import the file. * \param cv A libcucul canvas in which to import the file.
* \param buffer A \e libcucul buffer containing the data to be loaded * \param data A memory area containing the data to be loaded into the canvas.
* into a canvas. * \param len The size in bytes of the memory area.
* \param format A string describing the input format. * \param format A string describing the input format.
* \return The number of bytes read, or -1 if an error occurred. * \return The number of bytes read, or -1 if an error occurred.
*/ */
long int cucul_import_memory(cucul_canvas_t *cv, void const *buf, long int cucul_import_memory(cucul_canvas_t *cv, void const *data,
unsigned long int len, char const *format) unsigned long int len, char const *format)
{ {
if(!strcasecmp("caca", format)) if(!strcasecmp("caca", format))
return import_caca(cv, buf, len); return import_caca(cv, data, len);
if(!strcasecmp("utf8", format)) if(!strcasecmp("utf8", format))
return import_ansi(cv, buf, len, 1); return import_ansi(cv, data, len, 1);
if(!strcasecmp("text", format)) if(!strcasecmp("text", format))
return import_text(cv, buf, len); return import_text(cv, data, len);
if(!strcasecmp("ansi", format)) if(!strcasecmp("ansi", format))
return import_ansi(cv, buf, len, 0); return import_ansi(cv, data, len, 0);


/* Autodetection */ /* Autodetection */
if(!strcasecmp("", format)) if(!strcasecmp("", format))
{ {
unsigned char const *str = buf; unsigned char const *str = data;
unsigned int i; unsigned int i;


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


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


/* Otherwise, import it as text */ /* Otherwise, import it as text */
return import_text(cv, buf, len); return import_text(cv, data, len);
} }


#if defined HAVE_ERRNO_H #if defined HAVE_ERRNO_H
@@ -140,7 +140,7 @@ long int cucul_import_memory(cucul_canvas_t *cv, void const *buf,
* cucul_import_file() may also fail and set \b errno for any of the * cucul_import_file() may also fail and set \b errno for any of the
* errors specified for the routine fopen(). * errors specified for the routine fopen().
* *
* \param A libcucul canvas in which to import the file. * \param cv A libcucul canvas in which to import the file.
* \param filename The name of the file to load. * \param filename The name of the file to load.
* \param format A string describing the input format. * \param format A string describing the input format.
* \return The number of bytes read, or -1 if an error occurred. * \return The number of bytes read, or -1 if an error occurred.


||||||
x
 
000:0
Caricamento…
Annulla
Salva