Ignore:
Timestamp:
Nov 12, 2006, 4:26:13 PM (16 years ago)
Author:
Sam Hocevar
Message:
  • Got rid of HAVE_ERRNO_H ifdefs by defining seterrno()/geterrno() functions.
  • More debugging information in the import/export and font functions.
File:
1 edited

Legend:

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

    r1349 r1362  
    2020
    2121#if !defined __KERNEL__
    22 #   if defined HAVE_ERRNO_H
    23 #       include <errno.h>
    24 #   endif
    2522#   include <stdio.h>
    2623#   include <stdlib.h>
     
    119116    }
    120117
    121 #if defined HAVE_ERRNO_H
    122     errno = EINVAL;
    123 #endif
     118    seterrno(EINVAL);
    124119    return -1;
    125120}
     
    158153{
    159154#if defined __KERNEL__
    160 #   if defined HAVE_ERRNO_H
    161     errno = ENOSYS;
    162 #   endif
     155    seterrno(ENOSYS);
    163156    return -1;
    164157#else
     
    179172    {
    180173        fclose(fp);
    181 #   if defined HAVE_ERRNO_H
    182         errno = ENOMEM;
    183 #   endif
     174        seterrno(ENOMEM);
    184175        return -1;
    185176    }
     
    237228
    238229    if(buf[0] != 0xca || buf[1] != 0xca || buf[2] != 'C' || buf[3] != 'V')
     230    {
     231        debug("caca import error: expected \\xca\\xcaCV header");
    239232        goto invalid_caca;
     233    }
    240234
    241235    control_size = sscanu32(buf + 4);
     
    249243
    250244    if(control_size < 16 + frames * 32)
     245    {
     246        debug("caca import error: control size %lu < expected %lu",
     247              (unsigned long int)control_size, 16 + frames * 32);
    251248        goto invalid_caca;
     249    }
    252250
    253251    for(expected_size = 0, f = 0; f < frames; f++)
     
    270268
    271269    if(expected_size != data_size)
     270    {
     271        debug("caca import error: data size %lu < expected %lu",
     272              (unsigned long int)data_size, (unsigned long int)expected_size);
    272273        goto invalid_caca;
     274    }
    273275
    274276    /* FIXME: read all frames, not only the first one */
     
    294296
    295297invalid_caca:
    296 #if defined HAVE_ERRNO_H
    297     errno = EINVAL;
    298 #endif
     298    seterrno(EINVAL);
    299299    return -1;
    300300}
Note: See TracChangeset for help on using the changeset viewer.