diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2010-04-03 11:55:28 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2010-04-03 11:55:28 +0000 |
commit | 49810d8191e9a806ceb8a92c68369d8dac261f0d (patch) | |
tree | d57d82c882eb92f0d0bcf409b43a54beadc91e04 /image/png.c | |
parent | 6835a312b7df68c23fec9930b8e0aec94b537e5f (diff) | |
download | netsurf-49810d8191e9a806ceb8a92c68369d8dac261f0d.tar.gz netsurf-49810d8191e9a806ceb8a92c68369d8dac261f0d.tar.bz2 |
Use mutator to modify content's title field.
svn path=/trunk/netsurf/; revision=10231
Diffstat (limited to 'image/png.c')
-rw-r--r-- | image/png.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/image/png.c b/image/png.c index 3e9b21a9e..0cef6ec6a 100644 --- a/image/png.c +++ b/image/png.c @@ -51,9 +51,6 @@ #define png_set_expand_gray_1_2_4_to_8(png) png_set_gray_1_2_4_to_8(png) #endif -/* I hate doing this, but without g_strdup_printf or similar, we're a tad stuck. */ -#define NSPNG_TITLE_LEN (100) - /* libpng uses names starting png_, so use nspng_ here to avoid clashes */ static void info_callback(png_structp png, png_infop info); @@ -265,6 +262,7 @@ bool nspng_convert(struct content *c) { const char *data; unsigned long size; + char title[100]; assert(c->data.png.png != NULL); assert(c->data.png.info != NULL); @@ -273,14 +271,11 @@ bool nspng_convert(struct content *c) png_destroy_read_struct(&c->data.png.png, &c->data.png.info, 0); - c->title = malloc(NSPNG_TITLE_LEN); - - if (c->title != NULL) { - snprintf(c->title, NSPNG_TITLE_LEN, messages_get("PNGTitle"), + snprintf(title, sizeof(title), messages_get("PNGTitle"), c->width, c->height, size); - } + content__set_title(c, title); - c->size += (c->width * c->height * 4) + NSPNG_TITLE_LEN; + c->size += (c->width * c->height * 4); assert(c->data.png.bitmap != NULL); @@ -296,7 +291,6 @@ bool nspng_convert(struct content *c) void nspng_destroy(struct content *c) { - free(c->title); if (c->data.png.bitmap != NULL) { bitmap_destroy(c->data.png.bitmap); } |