pike.git / src / modules / _Image_GIF / image_gif.c

version» Context lines:

pike.git/src/modules/_Image_GIF/image_gif.c:20:   **!   **! Advanced stuff:   **! <ref>render_block</ref>, <ref>header_block</ref>,   **! <ref>end_block</ref>, <ref>netscape_loop_block</ref>   **!   **! Very advanced stuff:   **! <ref>_render_block</ref>, <ref>_gce_block</ref>   **!   **! see also: Image, Image.Image, Image.Colortable   */ - #include "global.h" +    #include "module.h" -  +    #include "config.h"      #ifdef WITH_GIF      #include <math.h>   #include <ctype.h>    - #include "stralloc.h" + #include "pike_compiler.h"   #include "pike_macros.h" - #include "object.h" +    #include "constants.h"   #include "interpret.h" - #include "svalue.h" +    #include "threads.h" - #include "array.h" +    #include "pike_error.h" - #include "threads.h" + #include "pike_types.h"      #include "../Image/image.h"   #include "../Image/colortable.h"      #include "builtin_functions.h"   #include "operators.h" - #include "mapping.h" +    #include "bignum.h"   #include "module_support.h"      #include "gif_lzw.h"      #endif /* WITH_GIF */      #ifdef WITH_GIF      #define sp Pike_sp
pike.git/src/modules/_Image_GIF/image_gif.c:204:    xs=sp[-args].u.integer;    ys=sp[1-args].u.integer;       if (TYPEOF(sp[2-args]) == T_INT)    {    numcolors=sp[2-args].u.integer;    if (numcolors<2) numcolors=2;    globalpalette=0;    }    else if (TYPEOF(sp[2-args]) == T_OBJECT && -  (nct=(struct neo_colortable*) -  get_storage(sp[2-args].u.object,image_colortable_program))) +  (nct=get_storage(sp[2-args].u.object,image_colortable_program)))    {    numcolors=image_colortable_size(nct);    globalpalette=1;    }    else    Pike_error("Image.GIF.header_block(): illegal argument 3 (expected int or colortable object)\n");       if (args>=4) {    if (TYPEOF(sp[3-args]) != T_INT)    Pike_error("Image.GIF.header_block(): illegal argument 4 (expected int)\n");
pike.git/src/modules/_Image_GIF/image_gif.c:251:    TYPEOF(sp[9-args]) != T_INT)    Pike_error("Image.GIF.header_block(): illegal argument 8..10 (expected int)\n");    alphacolor.r=(unsigned char)(sp[7-args].u.integer);    alphacolor.g=(unsigned char)(sp[8-args].u.integer);    alphacolor.b=(unsigned char)(sp[9-args].u.integer);    alphaentry=1;    }       if (numcolors+alphaentry>256)    Pike_error("Image.GIF.header_block(): too many colors (%ld%s)\n", -  DO_NOT_WARN((long)(numcolors + alphaentry)), +  (long)(numcolors + alphaentry),    alphaentry?" including alpha channel color":"");       while ((1<<bpp)<numcolors+alphaentry) bpp++;       sprintf(buf,"GIF8%ca%c%c%c%c%c%c%c",    gif87a?'7':'9',    xs&255, (xs>>8)&255, /* width */    ys&255, (ys>>8)&255, /* height */    ((globalpalette<<7)    | ((bpp-1)<<4) /* color resolution = 2^bpp */
pike.git/src/modules/_Image_GIF/image_gif.c:273:    | ((bpp)-1)), /* palette size = 2^bpp */    bkgi,    aspect);       push_string(make_shared_binary_string(buf,13));       if (globalpalette)    {    ps=begin_shared_string((1<<bpp)*3);    image_colortable_write_rgb(nct,(unsigned char *)ps->str); -  MEMSET(ps->str + (numcolors + alphaentry) * 3, 0, +  memset(ps->str + (numcolors + alphaentry) * 3, 0,    ((1 << bpp) - numcolors - alphaentry) * 3);       if (alphaentry)    {    ps->str[3*numcolors+0]=alphacolor.r;    ps->str[3*numcolors+1]=alphacolor.g;    ps->str[3*numcolors+2]=alphacolor.b;    }    /* note: same as _calculated_ 'alphaidx'    in image_gif_render_block */
pike.git/src/modules/_Image_GIF/image_gif.c:314:   **!   **! The result of this function is always ";" or "\x3b",   **! but I recommend using this function anyway for code clearity.   **!   **! see also: header_block, end_block   */      void image_gif_end_block(INT32 args)   {    pop_n_elems(args); -  push_constant_text("\x3b"); +  push_static_text("\x3b");   }      /*   **! method string _gce_block(int transparency,int transparency_index,int delay,int user_input,int disposal);   **!   **! This function gives back a Graphic Control Extension block.   **! A GCE block has the scope of the following render block.   **!   **! arg int transparency   **! arg int transparency_index
pike.git/src/modules/_Image_GIF/image_gif.c:543:    if (lzw.outpos-i==0)    {    push_string(make_shared_binary_string("\0",1));    numstrings++;    break;    }    else if (lzw.outpos-i>=255)    {    ps=begin_shared_string(256);    *((unsigned char*)(ps->str))=255; -  MEMCPY(ps->str+1,lzw.out+i,255); +  memcpy(ps->str+1,lzw.out+i,255);    push_string(end_shared_string(ps));    numstrings++;    if (numstrings>32) /* shrink stack */    {    f_add(numstrings);    numstrings=1;    }    i+=255;    }    else    {    ps=begin_shared_string(lzw.outpos-i+2); -  ps->str[0] = DO_NOT_WARN((char)(lzw.outpos-i)); -  MEMCPY(ps->str+1,lzw.out+i,lzw.outpos-i); +  ps->str[0] = (char)(lzw.outpos-i); +  memcpy(ps->str+1,lzw.out+i,lzw.outpos-i);    ps->str[lzw.outpos-i+1]=0;    push_string(end_shared_string(ps));    numstrings++;    break;    }      CHRONO("gif _render_block push of packed data end");       image_gif_lzw_free(&lzw);   
pike.git/src/modules/_Image_GIF/image_gif.c:721:    int delay=0;    int user_input=0;    int disposal=0;    int numstrings=0;    int interlace=0;    int bpp;    struct pike_string *ps;      CHRONO("gif render_block begin");    +  alphacolor.r=alphacolor.g=alphacolor.b=0; +     if (args<2)    Pike_error("Image.GIF.render_block(): Too few arguments\n");    if (TYPEOF(sp[-args]) != T_OBJECT || -  !(img=(struct image*)get_storage(sp[-args].u.object,image_program))) +  !(img=get_storage(sp[-args].u.object,image_program)))    Pike_error("Image.GIF.render_block(): Illegal argument 1 (expected image object)\n");    else if (!img->img)    Pike_error("Image.GIF.render_block(): given image has no image\n");    if (TYPEOF(sp[1-args]) != T_OBJECT || -  !(nct=(struct neo_colortable*) -  get_storage(sp[1-args].u.object,image_colortable_program))) +  !(nct=get_storage(sp[1-args].u.object,image_colortable_program)))    Pike_error("Image.GIF.render_block(): Illegal argument 2 (expected colortable object)\n");       if (args>=4)    {    if (TYPEOF(sp[2-args]) != T_INT)    Pike_error("Image:GIF.render_block(): Illegal argument 3 (expected int)\n");    if (TYPEOF(sp[3-args]) != T_INT)    Pike_error("Image:GIF.render_block(): Illegal argument 4 (expected int)\n");    xpos=sp[2-args].u.integer;    ypos=sp[3-args].u.integer;    }    else xpos=ypos=0;       numcolors=image_colortable_size(nct);    if (numcolors==0)    Pike_error("Image.GIF.render_block(): no colors in colortable\n");    else if (numcolors>256)    Pike_error("Image.GIF.render_block(): too many colors in given colortable: "    "%ld (256 is max)\n", -  DO_NOT_WARN((long)numcolors)); +  (long)numcolors);       if (args>=5)    {    if (TYPEOF(sp[4-args]) != T_INT)    Pike_error("Image:GIF.render_block(): Illegal argument 5 (expected int)\n");    localpalette=sp[4-args].u.integer;    }    else localpalette=0;    if (args>=6)    {    if (TYPEOF(sp[5-args]) == T_OBJECT && -  (alpha=(struct image*)get_storage(sp[5-args].u.object,image_program))) +  (alpha=get_storage(sp[5-args].u.object,image_program)))    {    if (!alpha->img)    Pike_error("Image.GIF.render_block(): given alpha channel has no image\n");    else if (alpha->xsize != img->xsize ||    alpha->ysize != img->ysize)    Pike_error("Image.GIF.render_block(): given alpha channel differ in size from given image\n");    alphaidx=numcolors;    n=9;    -  alphacolor.r=alphacolor.g=alphacolor.b=0; +     if (args>=9)    {    if (TYPEOF(sp[6-args]) != T_INT ||    TYPEOF(sp[7-args]) != T_INT ||    TYPEOF(sp[8-args]) != T_INT)    Pike_error("Image.GIF.render_block(): illegal argument 7..9 (expected int)\n");    alphacolor.r=(unsigned char)(sp[6-args].u.integer);    alphacolor.g=(unsigned char)(sp[7-args].u.integer);    alphacolor.b=(unsigned char)(sp[8-args].u.integer);   
pike.git/src/modules/_Image_GIF/image_gif.c:887:   CHRONO("render_block index end");       if (alpha)    {    rgb_group *a=alpha->img;    int n2=img->xsize*img->ysize;    unsigned char *d=(unsigned char *)ps->str;    while (n2--)    {    if (!(a->r||a->g||a->b)) -  *d = DO_NOT_WARN((unsigned char)alphaidx); +  *d = (unsigned char)alphaidx;    d++;    a++;    }    }       ps=end_shared_string(ps);       push_int(xpos);    push_int(ypos);    push_int(img->xsize);    push_int(img->ysize);    push_int(bpp);    push_string(ps);    if (localpalette)    {   CHRONO("gif render_block write local colortable begin");    ps=begin_shared_string((1<<bpp)*3);    image_colortable_write_rgb(nct,(unsigned char *)ps->str); -  MEMSET(ps->str+(numcolors+alphaentry)*3,0,((1<<bpp)-numcolors)*3); +  memset(ps->str+(numcolors+alphaentry)*3,0,((1<<bpp)-numcolors)*3);    if (alphaentry)    {    ps->str[3*alphaidx+0]=alphacolor.r;    ps->str[3*alphaidx+1]=alphacolor.g;    ps->str[3*alphaidx+2]=alphacolor.b;    }    push_string(end_shared_string(ps));   CHRONO("gif render_block write local colortable end");    }    else
pike.git/src/modules/_Image_GIF/image_gif.c:1025:    int trans=0;    ptrdiff_t tridx=0;       int n=0;    int arg=2;       if (args<1)    Pike_error("Image.GIF.encode(): Too few arguments\n");       if (TYPEOF(sp[-args]) != T_OBJECT || -  !(img=(struct image*)get_storage(imgobj=sp[-args].u.object, +  !(img=get_storage(imgobj=sp[-args].u.object,    image_program)))    Pike_error("Image.GIF.encode(): Illegal argument 1 (expected image object)\n");    add_ref(imgobj);          if (args>=2) {    if (TYPEOF(sp[1-args]) == T_INT)    {    if (args!=4)    {    n=sp[1-args].u.integer;    if (n>256) n=256; if (n<2) n=2;       ref_push_object(imgobj);    push_int(n);    nctobj=clone_object(image_colortable_program,2); -  nct=(struct neo_colortable*) -  get_storage(nctobj,image_colortable_program); +  nct=get_storage(nctobj,image_colortable_program);    if (!nct)    Pike_error("Image.GIF.encode(): Internal error; colortable isn't colortable\n");    arg=2;    }    else arg=1;    }    else if (TYPEOF(sp[1-args]) != T_OBJECT)    Pike_error("Image.GIF.encode(): Illegal argument 2 (expected image or colortable object or int)\n"); -  else if ((nct=(struct neo_colortable*) -  get_storage(nctobj=sp[1-args].u.object,image_colortable_program))) +  else if ((nct=get_storage(nctobj=sp[1-args].u.object,image_colortable_program)))    {    add_ref(nctobj);    }    else    {    nctobj=NULL;    arg=1;    }    }    /* check transparency arguments */    if (args-arg>0) {    if (TYPEOF(sp[arg-args]) == T_OBJECT && -  (alpha=(struct image*) -  get_storage(alphaobj=sp[arg-args].u.object,image_program))) +  (alpha=get_storage(alphaobj=sp[arg-args].u.object,image_program)))    {    add_ref(alphaobj);    if (args-arg>1) {    if (args-arg<4 ||    TYPEOF(sp[1+arg-args]) != T_INT ||    TYPEOF(sp[2+arg-args]) != T_INT ||    TYPEOF(sp[3+arg-args]) != T_INT)    Pike_error("Image.GIF.encode: Illegal arguments %d..%d (expected int)\n",arg+2,arg+4);    else    {
pike.git/src/modules/_Image_GIF/image_gif.c:1113:    rgb_group tr;    unsigned char trd;       /* make a colortable if we don't have one */    if (!nct)    {    add_ref(imgobj);    push_object(imgobj);    push_int(256);    nctobj=clone_object(image_colortable_program,2); -  nct=(struct neo_colortable*) -  get_storage(nctobj,image_colortable_program); +  nct=get_storage(nctobj,image_colortable_program);    if (!nct)    Pike_error("Image.GIF.encode(): Internal error; colortable isn't colortable\n");    }       tr.r=(unsigned char)sp[arg-args].u.integer;    tr.g=(unsigned char)sp[1+arg-args].u.integer;    tr.b=(unsigned char)sp[2+arg-args].u.integer;       image_colortable_index_8bit_image(nct,&tr,&trd,1,1);       tridx=trd;    trans=2;    }    }    /* make a colortable if we don't have one */    if (!nct)    {    ref_push_object(imgobj);    if (alpha) push_int(255); else push_int(256);    nctobj=clone_object(image_colortable_program,2); -  nct=(struct neo_colortable*) -  get_storage(nctobj,image_colortable_program); +  nct=get_storage(nctobj,image_colortable_program);    if (!nct)    Pike_error("Image.GIF.encode(): Internal error; colortable isn't colortable\n");    }       if (fs) image_colortable_internal_floyd_steinberg(nct);       pop_n_elems(args);       /* build header */   
pike.git/src/modules/_Image_GIF/image_gif.c:1324:    n++;       (*len)-=(sz+1);    (*s)+=(sz+1);    }    if (*len) { (*len)-=1; (*s)+=1; }       if (!n)    push_empty_string();    else -  f_add(DO_NOT_WARN(n)); +  f_add(n);       f_aggregate(3);   }      static void _decode_get_render(unsigned char **s,    size_t *len)   {    int n=0,bpp;    size_t sz;   
pike.git/src/modules/_Image_GIF/image_gif.c:1662:    struct lzwc *c;    struct lzwc *last_last_seq = NULL;      #ifdef GIF_DEBUG    int debug=0;      fprintf(stderr,"_gif_decode_lzw(%lx,%lu,%d,%lx,%lx,%lx,%lu,%d)\n",    s,len,obits,ncto,dest,alpha,dlen,tidx);   #endif    -  nct=(struct neo_colortable*)get_storage(ncto,image_colortable_program); +  nct=get_storage(ncto,image_colortable_program);    if (!nct || nct->type!=NCT_FLAT) return; /* uh? */       if (len<2) return;    q=s[0]|(s[1]<<8);    bit=16;    s+=2; len-=2;       last=clearcode;      #define MAX_GIF_CODE 4096    -  c=(struct lzwc*)xalloc(sizeof(struct lzwc)*MAX_GIF_CODE); +  if (maxcode > MAX_GIF_CODE) return;    -  +  c=xalloc(sizeof(struct lzwc)*MAX_GIF_CODE); +     for (n=0; n<clearcode; n++)    c[n].prev=0xffff,c[n].len=1,c[n].c=n;    c[clearcode].len=0;    c[endcode].len=0;    last_last_seq = c+clearcode;       while (bit>0)    {    /* get next code */   
pike.git/src/modules/_Image_GIF/image_gif.c:1816:   static void gif_deinterlace(rgb_group *s,    unsigned long xsize,    unsigned long ysize)   {    rgb_group *tmp;    unsigned long y,n;       tmp=malloc(xsize*ysize*sizeof(rgb_group));    if (!tmp) return;    -  MEMCPY(tmp,s,xsize*ysize*sizeof(rgb_group)); +  memcpy(tmp,s,xsize*ysize*sizeof(rgb_group));       n=0;    for (y=0; y<ysize; y+=8) -  MEMCPY(s+y*xsize,tmp+n++*xsize,xsize*sizeof(rgb_group)); +  memcpy(s+y*xsize,tmp+n++*xsize,xsize*sizeof(rgb_group));    for (y=4; y<ysize; y+=8) -  MEMCPY(s+y*xsize,tmp+n++*xsize,xsize*sizeof(rgb_group)); +  memcpy(s+y*xsize,tmp+n++*xsize,xsize*sizeof(rgb_group));    for (y=2; y<ysize; y+=4) -  MEMCPY(s+y*xsize,tmp+n++*xsize,xsize*sizeof(rgb_group)); +  memcpy(s+y*xsize,tmp+n++*xsize,xsize*sizeof(rgb_group));    for (y=1; y<ysize; y+=2) -  MEMCPY(s+y*xsize,tmp+n++*xsize,xsize*sizeof(rgb_group)); +  memcpy(s+y*xsize,tmp+n++*xsize,xsize*sizeof(rgb_group));       free(tmp);   }      void image_gif__decode(INT32 args)   {    struct array *a,*b=NULL;    int n,i;    struct object *o,*o2,*cto,*lcto;    int transparency_index=0,transparency=0,
pike.git/src/modules/_Image_GIF/image_gif.c:1914:       push_svalue(b->item+1);    push_svalue(b->item+2);       interlace=b->item[5].u.integer;       if (TYPEOF(b->item[6]) == T_STRING)    {    push_svalue(b->item+6);    lcto=clone_object(image_colortable_program,1); +  push_object(lcto);    }    else    {    lcto=cto; -  if (lcto) add_ref(lcto); +  if (lcto) { +  ref_push_object(lcto); +  } else { +  push_int(0);    } -  +  }       push_int(b->item[3].u.integer);    push_int(b->item[4].u.integer);    o=clone_object(image_program,2); -  img=(struct image*)get_storage(o,image_program); +  img=get_storage(o,image_program);    push_object(o); -  +  +  /* Swap colortable and image program */ +  stack_swap(); +     if (transparency)    {    push_int(b->item[3].u.integer);    push_int(b->item[4].u.integer);    o2=clone_object(image_program,2); -  aimg=(struct image*)get_storage(o2,image_program); +  aimg=get_storage(o2,image_program);    push_object(o2);    if (lcto)    _gif_decode_lzw((unsigned char *)    b->item[8].u.string->str, /* lzw string */    b->item[8].u.string->len, /* lzw len */    b->item[7].u.integer, /* lzw bits */    lcto, /* colortable */    img->img,    aimg->img,    img->xsize*img->ysize,
pike.git/src/modules/_Image_GIF/image_gif.c:1959:    b->item[8].u.string->str, /* lzw string */    b->item[8].u.string->len, /* lzw len */    b->item[7].u.integer, /* lzw bits */    lcto, /* colortable */    img->img,    NULL,    img->xsize*img->ysize,    0);    }    +  /* Swap colortable and image program */ +  stack_swap(); +     if (interlace)    {    gif_deinterlace(img->img,img->xsize,img->ysize);    if (aimg)    gif_deinterlace(aimg->img,aimg->xsize,aimg->ysize);    }    -  if (lcto) push_object(lcto); -  else push_int(0); -  +     push_int(interlace);    push_int(transparency_index);    push_int(delay);    push_int(user_input);    push_int(disposal);       f_aggregate(11);    n++;       transparency=disposal=user_input=delay=0;
pike.git/src/modules/_Image_GIF/image_gif.c:2088:       for (n=4; n<a->size; n++)    if (TYPEOF(a->item[n]) == T_ARRAY    && (b=a->item[n].u.array)->size==11    && TYPEOF(b->item[0]) == T_INT    && b->item[0].u.integer==GIF_RENDER    && TYPEOF(b->item[3]) == T_OBJECT    && get_storage(b->item[3].u.object, image_program) )    {    if (TYPEOF(b->item[4]) == T_OBJECT) -  alpha=(struct image*)get_storage(b->item[4].u.object, +  alpha=get_storage(b->item[4].u.object,    image_program);    else    alpha=NULL;       if (alpha)    {    push_svalue(b->item+3);    push_svalue(b->item+4);    push_svalue(b->item+1);    push_svalue(b->item+2);
pike.git/src/modules/_Image_GIF/image_gif.c:2174:       for (n=4; n<a->size; n++)    if (TYPEOF(a->item[n]) == T_ARRAY    && (b=a->item[n].u.array)->size==11    && TYPEOF(b->item[0]) == T_INT    && b->item[0].u.integer==GIF_RENDER    && TYPEOF(b->item[3]) == T_OBJECT    && get_storage(b->item[3].u.object, image_program) )    {    if (TYPEOF(b->item[4]) == T_OBJECT) -  alpha=(struct image*)get_storage(b->item[4].u.object, +  alpha=get_storage(b->item[4].u.object,    image_program);    else    alpha=NULL;       if (alpha)    { -  push_constant_text("image"); +  push_static_text("image");    push_svalue(b->item+3); -  push_constant_text("alpha"); +  push_static_text("alpha");    push_svalue(b->item+4); -  push_constant_text("xoffset"); +  push_static_text("xoffset");    push_svalue(b->item+1); -  push_constant_text("yoffset"); +  push_static_text("yoffset");    push_svalue(b->item+2);    f_aggregate_mapping(8);    push_object(clone_object(image_layer_program,1));    numlayers++;    }    else    { -  push_constant_text("image"); +  push_static_text("image");    push_svalue(b->item+3); -  push_constant_text("xoffset"); +  push_static_text("xoffset");    push_svalue(b->item+1); -  push_constant_text("yoffset"); +  push_static_text("yoffset");    push_svalue(b->item+2);    f_aggregate_mapping(6);    push_object(clone_object(image_layer_program,1));    numlayers++;    }    }       f_aggregate(numlayers);    stack_swap();    pop_stack();
pike.git/src/modules/_Image_GIF/image_gif.c:2245:   **! The weird name of this function (not <tt>_decode</tt>   **! as the other decoders) is because gif was the first   **! decoder and was written before the API was finally   **! defined. Sorry about that. /Mirar   */      void image_gif_decode_map(INT32 args)   {    image_gif_decode_layer(args);    -  push_constant_text("image"); -  push_constant_text("alpha"); -  push_constant_text("xsize"); -  push_constant_text("ysize"); +  push_static_text("image"); +  push_static_text("alpha"); +  push_static_text("xsize"); +  push_static_text("ysize");    f_aggregate(4);   #define stack_swap_behind() do { struct svalue _=sp[-2]; sp[-2]=sp[-3]; sp[-3]=_; } while(0)    stack_dup();    stack_swap_behind();    f_rows(2);    f_call_function(1);    f_mkmapping(2); -  push_constant_text("type"); -  push_constant_text("image/gif"); +  ref_push_string(literal_type_string); +  push_static_text("image/gif");    f_aggregate_mapping(2);    f_add(2);   }      /*   **! method string _encode(array data)   **! Encodes GIF data; reverses _decode.   **!   **! arg array data   **! data as returned from _encode
pike.git/src/modules/_Image_GIF/image_gif.c:2303:    push_svalue(a->item+5); /* colortable */    push_svalue(a->item+1); /* x */    push_svalue(a->item+2); /* y */       push_int(localp);       if (TYPEOF(a->item[4]) == T_OBJECT)    {    struct neo_colortable *nct;    -  nct=(struct neo_colortable*) -  get_storage(a->item[4].u.object,image_colortable_program); +  nct=get_storage(a->item[4].u.object,image_colortable_program);    if (!nct)    {    free_array(a);    Pike_error("Image.GIF._encode_render: Passed object is not colortable\n");    }       if (nct->type!=NCT_FLAT)    {    free_array(a);    Pike_error("Image.GIF._encode_render: Passed colortable is not flat (sorry9\n");
pike.git/src/modules/_Image_GIF/image_gif.c:2385:    for (i=0;;)    if (s->len-i==0)    {    push_string(make_shared_binary_string("\0",1));    n++;    }    else if (s->len-i>=255)    {    d=begin_shared_string(256);    *((unsigned char*)(d->str))=255; -  MEMCPY(d->str+1,s->str+i,255); +  memcpy(d->str+1,s->str+i,255);    push_string(end_shared_string(d));    n++;    if (n>32) /* shrink stack */    {    f_add(n);    n=1;    }    i+=255;    }    else    {    d=begin_shared_string(s->len-i+2); -  d->str[0] = DO_NOT_WARN(s->len - i); -  MEMCPY(d->str+1, s->str+i, d->len-i); +  d->str[0] = s->len - i; +  memcpy(d->str+1, s->str+i, d->len-i);    d->str[d->len-i+1]=0;    push_string(end_shared_string(d));    n++;    break;    }       f_add(n);       free_array(a);   }
pike.git/src/modules/_Image_GIF/image_gif.c:2561:       clearcode=(1<<obits);    endcode=clearcode+1;    bits=obits+1;    mask=(unsigned short)((1<<bits)-1);    m=endcode;    maxcode=(1<<bits);       last=clearcode;    -  c=(struct lzwc*)xalloc(sizeof(struct lzwc)*MAX_GIF_CODE); +  c=xalloc(sizeof(struct lzwc)*MAX_GIF_CODE);    -  dest0=(unsigned char*)malloc(dlen0=len*4); +  dest0=malloc(dlen0=len*4);    if (!dest0)    {    free(c);    Pike_error("Image.GIF.lzw_decode: out of memory\n");    }    dest=dest0; dlen=dlen0;       for (n=0; n<clearcode; n++) {    c[n].prev=0xffff;    c[n].len=1; -  c[n].c = DO_NOT_WARN((unsigned short)n); +  c[n].c = (unsigned short)n;    }    c[clearcode].len=0;    c[endcode].len=0;       last_last_seq = c+clearcode;       if (len>1)    {    if (reversebits) q=s[1]|(s[0]<<8);    else q=s[0]|(s[1]<<8);
pike.git/src/modules/_Image_GIF/image_gif.c:2618:    q>>=bits;    }    bit-=bits;      #ifdef GIF_DEBUG    fprintf(stderr,"code=%3d 0x%02x bits=%d bit=%2d *s=0x%02x len=%d\n",n,n,bits,bit,*s,len);   #endif       if (n==m)    { -  c[n].prev = DO_NOT_WARN((unsigned short)last); +  c[n].prev = (unsigned short)last;    c[n].c=last_last_seq->c;    c[n].len=c[last].len+1;    }    else if (n>=m)    {   #ifdef GIF_DEBUG    fprintf(stderr,"cancel; illegal code, %d>=%d at %lx\n",n,m,s);   #endif    break; /* illegal code */    }
pike.git/src/modules/_Image_GIF/image_gif.c:2692:    lc=myc->c;    *(--d)=(unsigned char)lc;    if (myc->prev==0xffff) break;    myc=c+myc->prev;    }       last_last_seq = myc;       if (last!=clearcode)    { -  c[m].prev = DO_NOT_WARN((unsigned short)last); +  c[m].prev = (unsigned short)last;    c[m].len=c[last].len+1;    c[m].c=lc;    }    last=n;       m++;    if (m>=maxcode - earlychange) {    if (m==MAX_GIF_CODE - earlychange)    {   #ifdef GIF_DEBUG
pike.git/src/modules/_Image_GIF/image_gif.c:2744:    push_string(make_shared_binary_string((char*)dest0,dest-dest0));    free(dest0);   }      /** module *******************************************/      struct program *image_encoding_gif_program=NULL;      PIKE_MODULE_INIT   { - #ifdef DYNAMIC_MODULE + #ifndef FAKE_DYNAMIC_LOAD    image_program = PIKE_MODULE_IMPORT(Image, image_program);    image_colortable_program=PIKE_MODULE_IMPORT(Image, image_colortable_program);    image_layer_program = PIKE_MODULE_IMPORT(Image, image_layer_program); - #endif /* DYNAMIC_MODULE */ + #endif       if (!image_program || !image_colortable_program || !image_layer_program) {    yyerror("Could not load Image module.");    return;    }       ADD_FUNCTION("render_block", image_gif_render_block,    tFunc(tObj tObj    tOr(tInt,tVoid) tOr(tInt,tVoid) tOr(tInt,tVoid)    tOr3(tInt,tObj,tVoid)