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/mng.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/mng.c')
-rw-r--r-- | image/mng.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/image/mng.c b/image/mng.c index 2c9d6fd8a..012301d98 100644 --- a/image/mng.c +++ b/image/mng.c @@ -302,10 +302,9 @@ bool nsmng_process_data(struct content *c, char *data, unsigned int size) bool nsmng_convert(struct content *c) { mng_retcode status; - - union content_msg_data msg_data; const char *data; unsigned long size; + char title[100]; assert(c != NULL); @@ -319,25 +318,19 @@ bool nsmng_convert(struct content *c) /* Set the title */ - c->title = malloc(100); - if (!c->title) { - msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - return false; - } - if (c->type == CONTENT_MNG) { - snprintf(c->title, 100, messages_get("MNGTitle"), + snprintf(title, sizeof(title), messages_get("MNGTitle"), c->width, c->height, size); } else if (c->type == CONTENT_PNG) { - snprintf(c->title, 100, messages_get("PNGTitle"), + snprintf(title, sizeof(title), messages_get("PNGTitle"), c->width, c->height, size); } else { - snprintf(c->title, 100, messages_get("JNGTitle"), + snprintf(title, sizeof(title), messages_get("JNGTitle"), c->width, c->height, size); } + content__set_title(c, title); - c->size += c->width * c->height * 4 + 100; + c->size += c->width * c->height * 4; c->status = CONTENT_STATUS_DONE; /* Done: update status bar */ content_set_status(c, ""); @@ -528,8 +521,6 @@ void nsmng_destroy(struct content *c) if (c->bitmap) bitmap_destroy(c->bitmap); - - free(c->title); } |