Changeset 1551 for zzuf


Ignore:
Timestamp:
Jan 3, 2007, 11:12:02 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Better debug messages in load-stream.c.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/load-stream.c

    r1543 r1551  
    101101            int fd = fileno(ret); \
    102102            _zz_register(fd); \
    103             debug(STR(fn) "(\"%s\", \"%s\") = %p", path, mode, ret); \
     103            debug(STR(fn) "(\"%s\", \"%s\") = [%i]", path, mode, fd); \
    104104        } \
    105105    } while(0)
     
    128128
    129129    ret = fseek_orig(stream, offset, whence);
    130     debug("fseek(%p, %li, %i) = %i", stream, offset, whence, ret);
     130    debug("fseek([%i], %li, %i) = %i", fd, offset, whence, ret);
    131131    if(ret != 0)
    132132        return ret;
     
    161161    pos = ftell(stream);
    162162    ret = fread_orig(ptr, size, nmemb, stream);
    163     debug("fread(%p, %li, %li, %p) = %li",
    164           ptr, (long int)size, (long int)nmemb, stream, (long int)ret);
     163    debug("fread(%p, %li, %li, [%i]) = %li",
     164          ptr, (long int)size, (long int)nmemb, fd, (long int)ret);
    165165    if(ret >= 0)
    166166    {
     
    190190            ret = ch; \
    191191        } \
    192         debug(STR(fn)"(%p) = 0x%02x", stream, ret); \
     192        if(ret >= 0x20 && ret <= 0x7f) \
     193            debug(STR(fn)"([%i]) = 0x%02x '%c'", fd, ret, (char)ret); \
     194        else \
     195            debug(STR(fn)"([%i]) = 0x%02x", fd, ret); \
    193196    } while(0)
    194197
     
    242245    }
    243246
    244     debug("fgets(%p, %i, %p) = %p", s, size, stream, ret);
     247    debug("fgets(%p, %i, [%i]) = %p", s, size, fd, ret);
    245248    return ret;
    246249}
     
    264267    else
    265268        _zz_addpos(fd, 1); /* revert what we did */
    266     debug("ungetc(0x%02x, %p) = 0x%02x", c, stream, ret);
     269    if(ret >= 0x20 && ret <= 0x7f)
     270        debug("ungetc(0x%02x, [%i]) = 0x%02x '%c'", c, fd, ret, ret);
     271    else
     272        debug("ungetc(0x%02x, [%i]) = 0x%02x", c, fd, ret);
    267273    return ret;
    268274}
     
    279285
    280286    ret = fclose_orig(fp);
    281     debug("fclose(%p) = %i", fp, ret);
     287    debug("fclose([%i]) = %i", fd, ret);
    282288    _zz_unregister(fd);
    283289
     
    330336        } \
    331337        if(need_delim) \
    332             debug(STR(fn) "(%p, %p, 0x%02x, %p) = %li", \
    333                   lineptr, n, delim, stream, (long int)ret); \
     338            debug(STR(fn) "(%p, %p, 0x%02x, [%i]) = %li", \
     339                  lineptr, n, delim, fd, (long int)ret); \
    334340        else \
    335             debug(STR(fn) "(%p, %p, %p) = %li", \
    336                   lineptr, n, stream, (long int)ret); \
     341            debug(STR(fn) "(%p, %p, [%i]) = %li", \
     342                  lineptr, n, fd, (long int)ret); \
    337343        return ret; \
    338344    } while(0)
Note: See TracChangeset for help on using the changeset viewer.