Ignore:
Timestamp:
Apr 26, 2006, 2:18:35 PM (15 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Fixed documentation for import
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/cucul/import.c

    r896 r901  
    4646 *  \param buffer A \e libcucul buffer containing the data to be loaded
    4747 *         into a canvas.
    48  *  \param size The length of the memory area.
    4948 *  \param format A string describing the input format.
    5049 *  \return A libcucul canvas, or NULL in case of error.
    5150 */
    52 cucul_canvas_t * cucul_import_canvas(cucul_buffer_t *b, char const *format)
    53 {
    54     char const *buf = (char const*)b->data;
    55 
    56     if(b->size == 0 || b->data == NULL)
     51cucul_canvas_t * cucul_import_canvas(cucul_buffer_t *buffer, char const *format)
     52{
     53    char const *buf = (char const*)buffer->data;
     54
     55    if(buffer->size == 0 || buffer->data == NULL)
    5756        return NULL;
    5857
    5958    if(!strcasecmp("caca", format))
    60         return import_caca(b->data, b->size);
     59        return import_caca(buffer->data, buffer->size);
    6160    if(!strcasecmp("text", format))
    62         return import_text(b->data, b->size);
     61        return import_text(buffer->data, buffer->size);
    6362    if(!strcasecmp("ansi", format))
    64         return import_ansi(b->data, b->size);
     63        return import_ansi(buffer->data, buffer->size);
    6564
    6665    /* Autodetection */
     
    6968        unsigned int i=0;
    7069        /* if 4 first letters are CACA */
    71         if(b->size >= 4 &&
     70        if(buffer->size >= 4 &&
    7271            buf[0] == 'C' && buf[1] == 'A' && buf[2] == 'C' && buf[3] != 'A')
    73             return import_caca(b->data, b->size);
     72            return import_caca(buffer->data, buffer->size);
    7473
    7574        /* If we find ESC[ argv, we guess it's an ANSI file */
    76         while(i < b->size - 1)
     75        while(i < buffer->size - 1)
    7776        {
    7877            if((buf[i] == 0x1b) && (buf[i+1] == '['))
    79                 return import_ansi(b->data, b->size);
     78                return import_ansi(buffer->data, buffer->size);
    8079            i++;
    8180        }
    8281
    8382        /* Otherwise, import it as text */
    84         return import_text(b->data, b->size);
     83        return import_text(buffer->data, buffer->size);
    8584    }
    8685    return NULL;
Note: See TracChangeset for help on using the changeset viewer.