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.53 2005/01/23 13:30:05 nilsson Exp $ + || $Id: xcf.c,v 1.54 2008/01/22 13:16:45 grubba Exp $   */      #include "global.h"   #include "image_machine.h"      #include "pike_macros.h"   #include "object.h"   #include "module_support.h"   #include "interpret.h"   #include "object.h"
pike.git/src/modules/Image/encodings/xcf.c:43:   #define TILE_HEIGHT 64      #define STRING(X) static struct pike_string *s_##X   #include "xcf_constant_strings.h"   #undef STRING         struct buffer   {    struct pike_string *s; -  ptrdiff_t base_offset; -  ptrdiff_t base_len; -  size_t len; +     unsigned char *str; -  +  size_t len;   };      struct substring   {    struct pike_string *s;    ptrdiff_t offset;    ptrdiff_t len;   };      static struct program *substring_program;
pike.git/src/modules/Image/encodings/xcf.c:322:    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 ); -  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 )   {    struct property res;    res.type = read_uint( data );    if(res.type == PROP_COLORMAP)    {    unsigned int foo;    read_uint(data); /* bogus 'len'... */    foo = read_uint( data );    res.data.len = foo*3; -  res.data.base_offset = data->base_offset+(data->base_len-data->len); -  res.data.base_len = res.data.len; +     res.data.str = (unsigned char *)read_data( data,foo*3 );    res.data.s = data->s;    } else {    res.data.len = read_uint( data ); -  res.data.base_offset = data->base_offset+(data->base_len-data->len); -  res.data.base_len = res.data.len; +     res.data.str = (unsigned char *)read_data( data,res.data.len );    res.data.s = data->s;    }    res.next = NULL;    return res;   }         struct tile   {
pike.git/src/modules/Image/encodings/xcf.c:756:    s->next = res.first_channel;    res.first_channel = s;    }    }    UNSET_ONERROR( err );    return res;   }      static void push_buffer( struct buffer *b )   { -  push_substring( b->s, b->base_offset+(b->base_len-b->len), b->len ); +  push_substring( b->s, b->str - (unsigned char *)b->s->str, b->len );   /* push_string( make_shared_binary_string( (char *)b->str, b->len ) );*/   }      static void push_properties( struct property *p )   {    struct svalue *osp = sp;    while(p)    {    ref_push_string( s_type ); push_int( p->type );    ref_push_string( s_data ); push_buffer( &p->data );
pike.git/src/modules/Image/encodings/xcf.c:893:   {    struct pike_string *s;    struct buffer b;    struct gimp_image res;    ONERROR err;    get_all_args( "___decode", args, "%S", &s );    if(args > 1)    Pike_error("Too many arguments to Image.XCF.___decode()\n");       b.s = s; -  b.base_offset = 0; -  b.base_len = s->len; +     b.len = s->len;    b.str = (unsigned char *)s->str;       res = read_image( &b );    SET_ONERROR( err, free_image, &res );    push_image( &res );    UNSET_ONERROR( err );    free_image( &res );    stack_swap();    pop_stack();