pike.git / src / modules / Image / encodings / xcf.c

version» Context lines:

pike.git/src/modules/Image/encodings/xcf.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: xcf.c,v 1.45 2003/10/24 23:33:08 nilsson Exp $ + || $Id: xcf.c,v 1.46 2003/10/24 23:34:42 nilsson Exp $   */      #include "global.h" - RCSID("$Id: xcf.c,v 1.45 2003/10/24 23:33:08 nilsson Exp $"); + RCSID("$Id: xcf.c,v 1.46 2003/10/24 23:34:42 nilsson Exp $");      #include "image_machine.h"      #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "module_support.h"   #include "interpret.h"   #include "object.h"   #include "svalue.h"
pike.git/src/modules/Image/encodings/xcf.c:329:    res = (char *)from->str;    from->str += len;    from->len -= len;    return res;   }      static struct buffer read_string( struct buffer *data )   {    struct buffer res = *data;    res.len = xcf_read_int( data ); -  fprintf(stderr, "string len %d\n", res.len); +     res.base_offset = (data->base_offset+(data->base_len-data->len));    res.str = (unsigned char *)read_data( data, res.len );    if(res.len > 0) res.len--; /* len includes ending \0 */    res.base_len = res.len;    if(!res.str)    Pike_error("String read failed\n");    return res;   }      static struct property read_property( struct buffer * data )
pike.git/src/modules/Image/encodings/xcf.c:641:   }      static struct layer read_layer( struct buffer *buff, struct buffer *initial )   {    struct layer res;    struct property tmp;    int lm_offset;    int h_offset;    ONERROR err;    -  fprintf(stderr, "in read layer\n"); +     MEMSET(&res, 0, sizeof(res));    SET_ONERROR( err, free_layer, &res );    res.width = read_uint( buff );    res.height = read_uint( buff );    res.type = xcf_read_int( buff );    res.name = read_string( buff );    -  fprintf(stderr, "lay prop\n"); +     do    {    tmp = read_property( buff );    if(tmp.type)    {    struct property *s=(struct property *)xalloc( sizeof(struct property ));    *s = tmp;    s->next = res.first_property;    res.first_property = s;    }    } while( tmp.type );       h_offset = xcf_read_int( buff );    lm_offset = xcf_read_int( buff ); -  fprintf(stderr, "lay lm\n"); +     if(lm_offset)    {    struct buffer loffset = *initial;    struct layer_mask *m=(struct layer_mask *)xalloc(sizeof(struct layer_mask));    res.mask = m;    read_data( &loffset, lm_offset );    MEMSET(m, 0, sizeof( struct layer_mask ));    *m = read_layer_mask( &loffset, initial );    } -  fprintf(stderr, "lay h\n"); +     if(h_offset)    {    struct buffer loffset = *initial;    read_data( &loffset, h_offset );    res.image_data = read_hierarchy( &loffset, initial );    }       UNSET_ONERROR( err );    return res;   }
pike.git/src/modules/Image/encodings/xcf.c:729:    {    tmp = read_property( data );    if(tmp.type)    {    struct property *s= (struct property *)xalloc( sizeof(struct property ));    *s = tmp;    s->next = res.first_property;    res.first_property = s;    }    } while( tmp.type ); -  fprintf(stderr, "read layer\n"); +     while( (offset = read_uint( data )) )    {    struct buffer layer_data = initial;    struct layer tmp;    read_data( &layer_data, offset ); -  fprintf(stderr, "call read layer\n"); +     tmp = read_layer( &layer_data, &initial );    if( tmp.width && tmp.height )    {    struct layer *s = (struct layer *)xalloc( sizeof(struct layer));    *s = tmp;    s->next = res.first_layer;    res.first_layer = s;    }    }