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

version» Context lines:

pike.git/src/modules/Image/encodings/xcf.c:1:   #include "global.h" - RCSID("$Id: xcf.c,v 1.14 2000/04/10 21:58:23 grubba Exp $"); + RCSID("$Id: xcf.c,v 1.15 2000/07/28 07:13:06 hubbe 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"   #include "threads.h"   #include "array.h"   #include "interpret.h"   #include "svalue.h"   #include "mapping.h"   #include "error.h"   #include "stralloc.h"   #include "builtin_functions.h"   #include "operators.h"   #include "dynamic_buffer.h" -  + #include "signal_handler.h"      #include "image.h"   #include "colortable.h"    -  + /* MUST BE INCLUDED LAST */ + #include "module_magic.h" +  +    extern struct program *image_colortable_program;   extern struct program *image_program;      /*   **! module Image   **! submodule XCF   **!   */      #define TILE_WIDTH 64
pike.git/src/modules/Image/encodings/xcf.c:147:   {    unsigned int res;    if(from->len < 4)    error("Not enough space for 4 bytes (uint32)\n");    res = from->str[0]<<24|from->str[1]<<16|from->str[2]<<8|from->str[3];    from->str += 4;    from->len -= 4;    return res;   }    - static int read_int( struct buffer *from ) + static int xcf_read_int( struct buffer *from )   {    return (int)read_uint( from );   }      static char *read_data( struct buffer * from, unsigned int len )   {    char *res;    if( from->len < len )    error("Not enough space for %ud bytes\n", len);    res = (char *)from->str;    from->str += len;    from->len -= len;    return res;   }      static struct buffer read_string( struct buffer *data )   {    struct buffer res; -  res.len = read_int( data ); +  res.len = xcf_read_int( data );    res.str = (unsigned char *)read_data( data, res.len );    if(res.len > 0) res.len--; /* len includes ending \0 */    if(!res.str)    error("String read failed\n");    return res;   }      static struct property read_property( struct buffer * data )   {    int i;
pike.git/src/modules/Image/encodings/xcf.c:490:    struct layer res;    struct property tmp;    int lm_offset;    int h_offset;    ONERROR err;       MEMSET(&res, 0, sizeof(res));    SET_ONERROR( err, free_layer, &res );    res.width = read_uint( buff );    res.height = read_uint( buff ); -  res.type = read_int( buff ); +  res.type = xcf_read_int( buff );    res.name = read_string( buff );          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 = read_int( buff ); -  lm_offset = read_int( buff ); +  h_offset = xcf_read_int( buff ); +  lm_offset = xcf_read_int( buff );       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 );    }
pike.git/src/modules/Image/encodings/xcf.c:558:    {    if(strlen((char *)data->str) == 13)    error("This is not an xcf file (%s)\n", data->str);    else    error("This is not an xcf file\n");    }    data->str+=14; data->len-=14;       res.width = read_uint( data );    res.height = read_uint( data ); -  res.type = read_int( data ); +  res.type = xcf_read_int( data );       SET_ONERROR( err, free_image, &res );       do    {    tmp = read_property( data );    if(tmp.type)    {    struct property *s= (struct property *)xalloc( sizeof(struct property ));    *s = tmp;
pike.git/src/modules/Image/encodings/xcf.c:1081:   **! ...   **! }),   **! ]),   **! }),   **! ])   **!</pre>   */      void image_xcf_f__decode_tiles( INT32 args )   { -  extern void check_signals(); +     struct object *io,*ao, *cmapo;    struct array *tiles;    struct image *i, *a=NULL;    struct neo_colortable *cmap = NULL;    rgb_group *colortable=NULL;    int rle, bpp, span;    unsigned int l, x=0, y=0, cx, cy;    get_all_args( "_decode_tiles", args, "%o%O%a%i%i%O",    &io, &ao, &tiles, &rle, &bpp, &cmapo);    if( !(i = (struct image *)get_storage( io, image_program )))
pike.git/src/modules/Image/encodings/xcf.c:1157:    fatal("Internal disaster in XCF module\n");    sp--;    }       if( (unsigned)(tile->len) < (unsigned)(eheight * ewidth * bpp ))    error("Too small tile, was %d bytes, I really need %d\n",    tile->len, eheight*ewidth * bpp);       s = (unsigned char *)tile->str;    -  check_signals(); /* Allow ^C */ +  check_signals(0,0,0); /* Allow ^C */       for(cy=0; cy<eheight; cy++)    {    for(cx=0; cx<ewidth; cx++)    {    rgb_group pix;    rgb_group apix;    int ind = (cx+cy*ewidth);       if(rle)