Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/common Modified Files: evas_font_load.c evas_image_load.c evas_image_main.c Log Message: disable stringshare... something fishy. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_font_load.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- evas_font_load.c 28 Nov 2005 15:18:00 -0000 1.25 +++ evas_font_load.c 29 Nov 2005 09:02:51 -0000 1.26 @@ -13,21 +13,22 @@ RGBA_Font_Source * evas_common_font_source_memory_load(const char *name, const void *data, int data_size) { - int error; + int error, len; RGBA_Font_Source *fs; - fs = calloc(1, sizeof(RGBA_Font_Source) + data_size); + len = strlen(name); + fs = calloc(1, sizeof(RGBA_Font_Source) + len + 1 + data_size); if (!fs) return NULL; - fs->name = evas_stringshare_add(name); + fs->name = ((char *)fs) + sizeof(RGBA_Font_Source); + strcpy(fs->name, name); fs->file = NULL; - fs->data = ((unsigned char *)fs) + sizeof(RGBA_Font_Source); + fs->data = fs->name + len + 1; fs->current_size = 0; memcpy(fs->data, data, data_size); fs->data_size = data_size; error = FT_New_Memory_Face(evas_ft_lib, fs->data, fs->data_size, 0, &(fs->ft.face)); if (error) { - evas_stringshare_del(fs->name); free(fs); return NULL; } @@ -45,12 +46,14 @@ RGBA_Font_Source * evas_common_font_source_load(const char *name) { - int error; + int error, len; RGBA_Font_Source *fs; - fs = calloc(1, sizeof(RGBA_Font_Source)); + len = strlen(name); + fs = calloc(1, sizeof(RGBA_Font_Source) + len + 1); if (!fs) return NULL; - fs->name = evas_stringshare_add(name); + fs->name = ((char *)fs) + sizeof(RGBA_Font_Source); + strcpy(fs->name, name); fs->file = fs->name; fs->data = NULL; fs->data_size = 0; @@ -58,7 +61,6 @@ error = FT_New_Face(evas_ft_lib, fs->file, 0, &(fs->ft.face)); if (error) { - evas_stringshare_del(fs->name); free(fs); return NULL; } @@ -124,7 +126,6 @@ fonts_src = evas_object_list_remove(fonts_src, fs); FT_Done_Face(fs->ft.face); - if (fs->name) evas_stringshare_del(fs->name); free(fs); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_image_load.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- evas_image_load.c 28 Nov 2005 15:18:00 -0000 1.22 +++ evas_image_load.c 29 Nov 2005 09:02:51 -0000 1.23 @@ -200,8 +200,15 @@ fclose(f); return -1; } - lines = (unsigned char **) alloca(h * sizeof(unsigned char *)); + lines = (unsigned char **) malloc(h * sizeof(unsigned char *)); + if (!lines) + { + evas_common_image_surface_free(im->image); + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); + fclose(f); + return -1; + } if (hasg) { png_set_gray_to_rgb(png_ptr); @@ -211,6 +218,7 @@ for (i = 0; i < h; i++) lines[i] = ((unsigned char *)(im->image->data)) + (i * w * sizeof(DATA32)); png_read_image(png_ptr, lines); + free(lines); png_read_end(png_ptr, info_ptr); png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); fclose(f); @@ -343,10 +351,16 @@ jpeg_destroy_decompress(&cinfo); return -1; } - data = alloca(w * 16 * 3); + data = malloc(w * 16 * 3); + if (!data) + { + jpeg_destroy_decompress(&cinfo); + return -1; + } evas_common_image_surface_alloc(im->image); if (!im->image->data) { + free(data); jpeg_destroy_decompress(&cinfo); return -1; } @@ -397,6 +411,7 @@ } } } + free(data); /* end data decoding */ jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); @@ -442,9 +457,15 @@ jpeg_destroy_decompress(&cinfo); return -1; } - data = alloca(w * 16 * 3); + data = malloc(w * 16 * 3); + if (!data) + { + jpeg_destroy_decompress(&cinfo); + return -1; + } if (!im->image->data) { + free(data); jpeg_destroy_decompress(&cinfo); return -1; } @@ -497,6 +518,7 @@ } } } + free(data); /* end data decoding */ jpeg_finish_decompress(&cinfo); jpeg_destroy_decompress(&cinfo); @@ -936,14 +958,15 @@ // im->timestamp = mod_time; if (file) { - im->info.file = evas_stringshare_add(file); + im->info.file = strdup(file); // im->info.real_file = real_file; } else { // if (real_file) free(real_file); } - if (key) im->info.key = evas_stringshare_add(key); + if (key) + im->info.key = strdup(key); evas_common_image_ref(im); return im; } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_image_main.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- evas_image_main.c 28 Nov 2005 15:18:00 -0000 1.21 +++ evas_image_main.c 29 Nov 2005 09:02:51 -0000 1.22 @@ -227,10 +227,10 @@ evas_common_image_free(RGBA_Image *im) { if (im->image) evas_common_image_surface_free(im->image); - if (im->info.file) evas_stringshare_del(im->info.file); -// if (im->info.real_file) evas_stringshare_del(im->info.real_file); - if (im->info.key) evas_stringshare_del(im->info.key); - if (im->info.comment) evas_stringshare_del(im->info.comment); + if (im->info.file) free(im->info.file); + if (im->info.real_file) free(im->info.real_file); + if (im->info.key) free(im->info.key); + if (im->info.comment) free(im->info.comment); free(im); } @@ -335,9 +335,8 @@ if (im->flags & RGBA_IMAGE_INDEXED) return; if ((!im->info.file) && (!im->info.key)) return; l1 = 0; -// if (im->info.real_file) l1 = strlen(im->info.real_file); -// else - if (im->info.file) l1 = strlen(im->info.file); + if (im->info.real_file) l1 = strlen(im->info.real_file); + else if (im->info.file) l1 = strlen(im->info.file); l2 = 0; if (im->info.key) l2 = strlen(im->info.key); snprintf(buf, sizeof(buf), "%llx", im->timestamp); @@ -345,9 +344,8 @@ key = malloc(l1 + 5 + l2 + 5 + l3 +1); if (!key) return; key[0] = 0; -// if (im->info.real_file) strcpy(key, im->info.real_file); -// else - if (im->info.file) strcpy(key, im->info.file); + if (im->info.real_file) strcpy(key, im->info.real_file); + else if (im->info.file) strcpy(key, im->info.file); strcat(key, "//://"); if (im->info.key) strcat(key, im->info.key); strcat(key, "//://"); @@ -367,9 +365,8 @@ if (!(im->flags & RGBA_IMAGE_INDEXED)) return; if ((!im->info.file) && (!im->info.key)) return; l1 = 0; -// if (im->info.real_file) l1 = strlen(im->info.real_file); -// else - if (im->info.file) l1 = strlen(im->info.file); + if (im->info.real_file) l1 = strlen(im->info.real_file); + else if (im->info.file) l1 = strlen(im->info.file); l2 = 0; if (im->info.key) l2 = strlen(im->info.key); snprintf(buf, sizeof(buf), "%llx", im->timestamp); @@ -377,9 +374,8 @@ key = malloc(l1 + 5 + l2 + 5 + l3 +1); if (!key) return; key[0] = 0; -// if (im->info.real_file) strcpy(key, im->info.real_file); -// else - if (im->info.file) strcpy(key, im->info.file); + if (im->info.real_file) strcpy(key, im->info.real_file); + else if (im->info.file) strcpy(key, im->info.file); strcat(key, "//://"); if (im->info.key) strcat(key, im->info.key); strcat(key, "//://"); @@ -427,7 +423,7 @@ free(str); if (im) { -// if (real_filename) free(real_filename); + if (real_filename) free(real_filename); return im; } @@ -437,7 +433,6 @@ im = (RGBA_Image *)l; ok = 0; -/* if ((real_filename) && (im->info.real_file)) { if ((im->info.real_file) && @@ -446,7 +441,6 @@ ok++; } else - */ { if ((filename) && (im->info.file) && (!strcmp(filename, im->info.file))) @@ -463,11 +457,11 @@ ok++; if (ok >= 3) { -// if (real_filename) free(real_filename); + if (real_filename) free(real_filename); return im; } } -// if (real_filename) free(real_filename); + if (real_filename) free(real_filename); return NULL; } @@ -478,7 +472,7 @@ ram += sizeof(struct _RGBA_Image); if (im->info.file) ram += strlen(im->info.file); -// if (im->info.real_file) ram += strlen(im->info.real_file); + if (im->info.real_file) ram += strlen(im->info.real_file); if (im->info.key) ram += strlen(im->info.key); if (im->info.comment) ram += strlen(im->info.comment); if ((im->image) && (im->image->data) && (!im->image->no_free)) ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs