pike.git / src / post_modules / GTK2 / source / support.c

version» Context lines:

pike.git/src/post_modules/GTK2/source/support.c:155:    2/ use that array to build a pike X-image colormap.    3/ call Image.X.encode_pseudocolor( img, bpp, lpad, depth, colormp )    4/ copy the actual data to the image..    */    if (!colors_allocated) {   #define COLORMAP_SIZE 256    char allocated[COLORMAP_SIZE];    int j,i,r,g,b;    PFTIME("Creating colormap");    colors_allocated=1; -  MEMSET(allocated,0,sizeof(allocated)); +  memset(allocated,0,sizeof(allocated));    for (r=0; r<3; r++) for (g=0; g<4; g++) for (b=0; b<3; b++) {    GdkColor color;    color.red = (guint16)(r * (65535/2.0));    color.green = (guint16)(g * (65535/3.0));    color.blue = (guint16)(b * (65535/2.0));    color.pixel = 0;    if (gdk_color_alloc(col,&color))    if (color.pixel<COLORMAP_SIZE)    allocated[color.pixel]=1;    }
pike.git/src/post_modules/GTK2/source/support.c:240:    push_object(pike_cmap);    /* on stack: function img bpp linepad depth cmap*/    /* 6 5 4 3 2 1 */    PFTIME("Dithering image");    apply_svalue(Pike_sp-6,5);    if (TYPEOF(Pike_sp[-1]) != PIKE_T_STRING) {    gdk_image_destroy((void *)i);    Pike_error("Failed to convert image\n");    }    PFTIME("Converting image"); -  MEMCPY(i->mem,Pike_sp[-1].u.string->str,Pike_sp[-1].u.string->len); +  memcpy(i->mem,Pike_sp[-1].u.string->str,Pike_sp[-1].u.string->len);    pop_stack(); /* string */    pop_stack(); /* function */    }    }    TIMER_END();    return i;   }      int pgtk2_is_object_program(struct program *X);   
pike.git/src/post_modules/GTK2/source/support.c:341:    void *dest, long *mask, int len) {    struct svalue *s;    if ((s=simple_mapping_string_lookup(map,name))) {    if (TYPEOF(*s) == type) {    switch(type) {    case PIKE_T_STRING:   #ifdef PIKE_DEBUG    if (len!=sizeof(char *))    Pike_fatal("oddities detected\n");   #endif -  MEMCPY(((char **)dest),&s->u.string->str,sizeof(char *)); +  memcpy(dest,&s->u.string->str,sizeof(char *));    break;    case PIKE_T_INT:    if (len==2) {    short i=(short)s->u.integer; -  MEMCPY(((short *)dest),&i,2); +  memcpy(dest,&i,2);    } else if (len==4) -  MEMCPY(((int *)dest),&s->u.integer,len); +  memcpy(dest,&s->u.integer,len);    break;    case PIKE_T_FLOAT:    if (len==sizeof(FLOAT_TYPE)) -  MEMCPY(((FLOAT_TYPE *)dest),&s->u.float_number,len); +  memcpy(dest,&s->u.float_number,len);    else if (len==sizeof(double)) {    double d=s->u.float_number; -  MEMCPY(((double *)dest),&d,len); +  memcpy(dest,&d,len);    }    break;    }    if (mask)    *mask|=madd;    }    }   }      GdkAtom get_gdkatom(struct object *o) {
pike.git/src/post_modules/GTK2/source/support.c:581:    if (g_type_is_a(G_VALUE_TYPE(a),G_TYPE_BOXED)) {    gp=g_value_get_boxed(a);    if (G_VALUE_HOLDS(a,g_type_from_name("GdkColor"))) {    push_gdkobject(gp,color,0);    } else if (G_VALUE_HOLDS(a,g_type_from_name("GtkTreePath"))) {    push_pgdk2object(gp,pgtk2_tree_path_program,0);    } else if (G_VALUE_HOLDS(a,g_type_from_name("GdkRectangle"))) {    push_gdkobject(gp,rectangle,0);    } else if (G_VALUE_HOLDS(a,g_type_from_name("GdkRegion"))) {    push_gdkobject(gp,region,0); +  } else { +  /* Don't know how to push this sort of object, so push its name */ +  PGTK_PUSH_GCHAR(G_VALUE_TYPE_NAME(a));    }    } else {    obj=g_value_get_object(a);    if (obj)    push_gobject(obj);    }    return PUSHED_VALUE;   }      static int pgtk2_push_pike_object_param(const GValue *a) { -  struct object *o=g_value_get_pointer(a); -  if (o) -  ref_push_object(o); +  push_int64((LONGEST)g_value_get_pointer(a));    return PUSHED_VALUE;   }      static int pgtk2_push_gparamspec_param(const GValue *a) {    push_int(0);    return PUSHED_VALUE;   }      static struct push_callback {    int (*callback)(const GValue *);
pike.git/src/post_modules/GTK2/source/support.c:838:    mode=Pike_sp[-args].u.integer;    pgtk2_pop_n_elems(args);    if (mode!='O') {    push_undefined();    return;    }    push_string(make_shared_binary_string(__pgtk2_string_data+offset,len));   }      void pgtk2_clear_obj_struct(struct object *o) { -  MEMSET(Pike_fp->current_storage,0,sizeof(struct object_wrapper)); +  memset(Pike_fp->current_storage,0,sizeof(struct object_wrapper));   }      void pgtk2_setup_mixin(struct object *o, struct program *p) {    ptrdiff_t offset;    offset = low_get_storage(o->prog, p);    if(offset == -1)    Pike_error("This class can not be instantiated on its own.\n");    ((struct mixin_wrapper *)Pike_fp->current_storage)->offset = offset;   }   
pike.git/src/post_modules/GTK2/source/support.c:882:      /* double should be enough */   double pgtk2_get_float(struct svalue *s) {    if (TYPEOF(*s) == PIKE_T_FLOAT)    return s->u.float_number;    if (TYPEOF(*s) == PIKE_T_INT)    return (double)s->u.integer;   #ifdef AUTO_BIGNUM    if (is_bignum_object_in_svalue(s)) {    FLOAT_TYPE f; -  ref_push_string(literal_float_string); -  apply(s->u.object,"cast",1); +  ref_push_type_value(float_type_string); +  stack_swap(); +  f_cast();    f=Pike_sp[-1].u.float_number;    pop_stack();    return (double)f;    }   #endif    return 0.0;   }      void pgtk2_free_object(struct object *o) {    free_object(o);