More useful title info for images.

This commit is contained in:
Michael Drake 2012-10-24 18:22:45 +01:00
parent 719a36972b
commit a526209e74
19 changed files with 197 additions and 142 deletions

View File

@ -687,17 +687,17 @@ SelectMenu:Auswahl
# Content titles
#
DrawTitle:Draw Bild (%lux%lu, %lu bytes)
GIFTitle:GIF Bild (%lux%lu, %lu bytes)
BMPTitle:BMP Bild (%lux%lu, %lu bytes)
ICOTitle:ICO Bild (%lux%lu, %lu bytes)
JPEGTitle:JPEG Bild (%ux%u, %lu bytes)
PNGTitle:PNG Bild (%lux%lu, %lu bytes)
JNGTitle:JNG Bild (%lux%lu, %lu bytes)
MNGTitle:MNG Bild (%lux%lu, %lu bytes)
WebPTitle:WebP Bild (%lux%lu, %lu bytes)
SpriteTitle:Sprite Bild (%lux%lu, %lu bytes)
ArtWorksTitle:ArtWorks Bild (%lux%lu, %lu bytes)
GIFTitle:%s (GIF Bild %lux%lu pixels)
BMPTitle:%s (BMP Bild %lux%lu pixels)
ICOTitle:%s (ICO Bild %lux%lu pixels)
PNGTitle:%s (PNG Bild %lux%lu pixels)
JNGTitle:%s (JNG Bild %lux%lu pixels)
MNGTitle:%s (MNG Bild %lux%lu pixels)
JPEGTitle:%s (JPEG Bild %lux%lu pixels)
WebPTitle:%s (WebP Bild %lux%lu pixels)
DrawTitle:%s (Drawfile Bild %lux%lu pixels)
SpriteTitle:%s (Sprite Bild %lux%lu pixels)
ArtWorksTitle:%s (ArtWorks Bild %lux%lu pixels)
# HTML page character set
#

View File

@ -687,17 +687,17 @@ SelectMenu:Select
# Content titles
#
DrawTitle:Draw image (%lux%lu, %lu bytes)
GIFTitle:GIF image (%lux%lu, %lu bytes)
BMPTitle:BMP image (%lux%lu, %lu bytes)
ICOTitle:ICO image (%lux%lu, %lu bytes)
JPEGTitle:JPEG image (%ux%u, %lu bytes)
PNGTitle:PNG image (%lux%lu, %lu bytes)
JNGTitle:JNG image (%lux%lu, %lu bytes)
MNGTitle:MNG image (%lux%lu, %lu bytes)
WebPTitle:WebP image (%lux%lu, %lu bytes)
SpriteTitle:Sprite image (%lux%lu, %lu bytes)
ArtWorksTitle:ArtWorks image (%lux%lu, %lu bytes)
GIFTitle:%s (GIF image %lux%lu pixels)
BMPTitle:%s (BMP image %lux%lu pixels)
ICOTitle:%s (ICO image %lux%lu pixels)
PNGTitle:%s (PNG image %lux%lu pixels)
JNGTitle:%s (JNG image %lux%lu pixels)
MNGTitle:%s (MNG image %lux%lu pixels)
JPEGTitle:%s (JPEG image %lux%lu pixels)
WebPTitle:%s (WebP image %lux%lu pixels)
DrawTitle:%s (Drawfile image %lux%lu pixels)
SpriteTitle:%s (Sprite image %lux%lu pixels)
ArtWorksTitle:%s (ArtWorks image %lux%lu pixels)
# HTML page character set
#

View File

@ -687,17 +687,17 @@ SelectMenu:Sélection
# Content titles
#
DrawTitle:Image Draw (%lux%lu, %lu octets)
GIFTitle:Image GIF (%lux%lu, %lu octets)
BMPTitle:Image BMP (%lux%lu, %lu octets)
ICOTitle:Image BMP (%lux%lu, %lu octets)
JPEGTitle:Image JPEG (%ux%u, %lu octets)
PNGTitle:Image PNG (%lux%lu, %lu octets)
JNGTitle:Image JNG (%lux%lu, %lu octets)
MNGTitle:Image MNG (%lux%lu, %lu octets)
WebPTitle:Image WebP (%lux%lu, %lu octets)
SpriteTitle:Image Sprite (%lux%lu, %lu octets)
ArtWorksTitle:Image ArtWorks (%lux%lu, %lu octets)
GIFTitle:%s (Image GIF %lux%lu pixels)
BMPTitle:%s (Image BMP %lux%lu pixels)
ICOTitle:%s (Image BMP %lux%lu pixels)
PNGTitle:%s (Image PNG %lux%lu pixels)
JNGTitle:%s (Image JNG %lux%lu pixels)
MNGTitle:%s (Image MNG %lux%lu pixels)
JPEGTitle:%s (Image JPEG %lux%lu pixels)
WebPTitle:%s (Image WebP %lux%lu pixels)
DrawTitle:%s (Image Drawfile %lux%lu pixels)
SpriteTitle:%s (Image Sprite %lux%lu pixels)
ArtWorksTitle:%s (Image ArtWorks %lux%lu pixels)
# HTML page character set
#

View File

@ -687,17 +687,17 @@ SelectMenu:Seleziona
# Content titles
#
DrawTitle:Immagine Draw (%lux%lu, %lu byte)
GIFTitle:Immagine GIF (%lux%lu, %lu byte)
BMPTitle:Immagine BMP (%lux%lu, %lu byte)
ICOTitle:Immagine ICO (%lux%lu, %lu byte)
JPEGTitle:Immagine JPEG (%ux%u, %lu byte)
PNGTitle:Immagine PNG (%lux%lu, %lu byte)
JNGTitle:Immagine JNG (%lux%lu, %lu byte)
MNGTitle:Immagine MNG (%lux%lu, %lu byte)
WebPTitle:Immagine WebP (%lux%lu, %lu byte)
SpriteTitle:Immagine Sprite (%lux%lu, %lu byte)
ArtWorksTitle:Immagine ArtWorks (%lux%lu, %lu byte)
GIFTitle:%s (Immagine GIF %lux%lu pixels)
BMPTitle:%s (Immagine BMP %lux%lu pixels)
ICOTitle:%s (Immagine ICO %lux%lu pixels)
PNGTitle:%s (Immagine PNG %lux%lu pixels)
JNGTitle:%s (Immagine JNG %lux%lu pixels)
MNGTitle:%s (Immagine MNG %lux%lu pixels)
JPEGTitle:%s (Immagine JPEG %lux%lu pixels)
WebPTitle:%s (Immagine WebP %lux%lu pixels)
DrawTitle:%s (Immagine Drawfile %lux%lu pixels)
SpriteTitle:%s (Immagine Sprite %lux%lu pixels)
ArtWorksTitle:%s (Immagine ArtWorks %lux%lu pixels)
# HTML page character set
#

View File

@ -687,17 +687,17 @@ SelectMenu:Select
# Content titles
#
DrawTitle:Draw image (%lux%lu, %lu bytes)
GIFTitle:GIF image (%lux%lu, %lu bytes)
BMPTitle:BMP image (%lux%lu, %lu bytes)
ICOTitle:ICO image (%lux%lu, %lu bytes)
JPEGTitle:JPEG image (%ux%u, %lu bytes)
PNGTitle:PNG image (%lux%lu, %lu bytes)
JNGTitle:JNG image (%lux%lu, %lu bytes)
MNGTitle:MNG image (%lux%lu, %lu bytes)
WebPTitle:WebP image (%lux%lu, %lu bytes)
SpriteTitle:Sprite image (%lux%lu, %lu bytes)
ArtWorksTitle:ArtWorks image (%lux%lu, %lu bytes)
GIFTitle:%s (GIF image %lux%lu pixels)
BMPTitle:%s (BMP image %lux%lu pixels)
ICOTitle:%s (ICO image %lux%lu pixels)
PNGTitle:%s (PNG image %lux%lu pixels)
JNGTitle:%s (JNG image %lux%lu pixels)
MNGTitle:%s (MNG image %lux%lu pixels)
JPEGTitle:%s (JPEG image %lux%lu pixels)
WebPTitle:%s (WebP image %lux%lu pixels)
DrawTitle:%s (Drawfile image %lux%lu pixels)
SpriteTitle:%s (Sprite image %lux%lu pixels)
ArtWorksTitle:%s (ArtWorks image %lux%lu pixels)
# HTML page character set
#

View File

@ -26,7 +26,7 @@ S_HTTP := challenge.c generics.c primitives.c parameter.c \
S_DESKTOP := cookies.c history_global_core.c hotlist.c knockout.c \
mouse.c options.c plot_style.c print.c search.c searchweb.c \
scrollbar.c sslcert.c textarea.c thumbnail.c tree.c \
scrollbar.c sslcert.c textarea.c thumbnail.c tree.c treeview.c \
tree_url_node.c version.c
# Javascript sources

View File

@ -132,7 +132,7 @@ static bool nsbmp_convert(struct content *c)
uint32_t swidth;
const char *data;
unsigned long size;
char title[100];
char title[512];
/* set the bmp data */
data = content__get_source_data(c, &size);
@ -158,7 +158,8 @@ static bool nsbmp_convert(struct content *c)
c->height = bmp->bmp->height;
LOG(("BMP width %u height %u", c->width, c->height));
snprintf(title, sizeof(title), messages_get("BMPTitle"),
c->width, c->height, size);
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);
swidth = bmp->bmp->bitmap_callbacks.bitmap_get_bpp(bmp->bmp->bitmap) *
bmp->bmp->width;

View File

@ -242,7 +242,7 @@ static bool nsgif_convert(struct content *c)
union content_msg_data msg_data;
const char *data;
unsigned long size;
char title[100];
char title[512];
/* Get the animation */
data = content__get_source_data(c, &size);
@ -279,7 +279,8 @@ static bool nsgif_convert(struct content *c)
c->width = gif->gif->width;
c->height = gif->gif->height;
snprintf(title, sizeof(title), messages_get("GIFTitle"),
c->width, c->height, size);
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);
c->size += (gif->gif->width * gif->gif->height * 4) + 16 + 44;

View File

@ -100,7 +100,7 @@ static bool nsico_convert(struct content *c)
union content_msg_data msg_data;
const char *data;
unsigned long size;
char title[100];
char title[512];
/* set the ico data */
data = content__get_source_data(c, &size);
@ -125,8 +125,9 @@ static bool nsico_convert(struct content *c)
/* Store our content width and description */
c->width = ico->ico->width;
c->height = ico->ico->height;
snprintf(title, sizeof(title), messages_get("ICOTitle"),
c->width, c->height, size);
snprintf(title, sizeof(title), messages_get("ICOTitle"),
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);
c->size += (ico->ico->width * ico->ico->height * 4) + 16 + 44;

View File

@ -289,7 +289,7 @@ static bool nsjpeg_convert(struct content *c)
union content_msg_data msg_data;
const char *data;
unsigned long size;
char title[100];
char title[512];
/* check image header is valid and get width/height */
data = content__get_source_data(c, &size);
@ -325,8 +325,9 @@ static bool nsjpeg_convert(struct content *c)
image_cache_add(c, NULL, jpeg_cache_convert);
snprintf(title, sizeof(title), messages_get("JPEGTitle"),
c->width, c->height, size);
snprintf(title, sizeof(title), messages_get("JPEGTitle"),
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);
content_set_ready(c);

View File

@ -541,7 +541,7 @@ static bool nsmng_convert(struct content *c)
nsmng_content *mng = (nsmng_content *) c;
mng_retcode status;
unsigned long size;
char title[100];
char title[512];
assert(c != NULL);
@ -556,9 +556,9 @@ static bool nsmng_convert(struct content *c)
/* Set the title
*/
snprintf(title, sizeof(title),
messages_get("MNGTitle"),
c->width, c->height, size);
snprintf(title, sizeof(title), messages_get("MNGTitle"),
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);
c->size += c->width * c->height * 4;
@ -599,7 +599,7 @@ static bool nsjpng_convert(struct content *c)
nsmng_content *mng = (nsmng_content *) c;
mng_retcode status;
unsigned long size;
char title[100];
char title[512];
mng_handle handle;
assert(c != NULL);
@ -614,9 +614,9 @@ static bool nsjpng_convert(struct content *c)
}
/* Set the title */
snprintf(title, sizeof(title),
messages_get("PNGTitle"),
c->width, c->height, size);
snprintf(title, sizeof(title), messages_get("PNGTitle"),
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);
c->size += c->width * c->height * 4;

View File

@ -510,7 +510,7 @@ png_cache_convert_error:
static bool nspng_convert(struct content *c)
{
nspng_content *png_c = (nspng_content *) c;
char title[100];
char title[512];
assert(png_c->png != NULL);
assert(png_c->info != NULL);
@ -520,7 +520,8 @@ static bool nspng_convert(struct content *c)
/* set title text */
snprintf(title, sizeof(title), messages_get("PNGTitle"),
c->width, c->height, c->size);
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);

View File

@ -78,7 +78,7 @@ static bool webp_convert(struct content *c)
unsigned char *imagebuf = NULL;
unsigned long size;
int width = 0, height = 0;
char title[100];
char title[512];
int res = 0;
uint8_t *res_p = NULL;
@ -117,7 +117,8 @@ static bool webp_convert(struct content *c)
c->width = width;
c->height = height;
snprintf(title, sizeof(title), messages_get("WebPTitle"),
width, height, size);
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);
bitmap_modified(webp->bitmap);

View File

@ -2323,61 +2323,61 @@ nl.all.SelectMenu:Select
# Content titles
#
en.all.DrawTitle:Draw image (%lux%lu, %lu bytes)
de.all.DrawTitle:Draw Bild (%lux%lu, %lu bytes)
fr.all.DrawTitle:Image Draw (%lux%lu, %lu octets)
it.all.DrawTitle:Immagine Draw (%lux%lu, %lu byte)
nl.all.DrawTitle:Draw image (%lux%lu, %lu bytes)
en.all.GIFTitle:GIF image (%lux%lu, %lu bytes)
de.all.GIFTitle:GIF Bild (%lux%lu, %lu bytes)
fr.all.GIFTitle:Image GIF (%lux%lu, %lu octets)
it.all.GIFTitle:Immagine GIF (%lux%lu, %lu byte)
nl.all.GIFTitle:GIF image (%lux%lu, %lu bytes)
en.all.BMPTitle:BMP image (%lux%lu, %lu bytes)
de.all.BMPTitle:BMP Bild (%lux%lu, %lu bytes)
fr.all.BMPTitle:Image BMP (%lux%lu, %lu octets)
it.all.BMPTitle:Immagine BMP (%lux%lu, %lu byte)
nl.all.BMPTitle:BMP image (%lux%lu, %lu bytes)
en.all.ICOTitle:ICO image (%lux%lu, %lu bytes)
de.all.ICOTitle:ICO Bild (%lux%lu, %lu bytes)
fr.all.ICOTitle:Image BMP (%lux%lu, %lu octets)
it.all.ICOTitle:Immagine ICO (%lux%lu, %lu byte)
nl.all.ICOTitle:ICO image (%lux%lu, %lu bytes)
en.all.JPEGTitle:JPEG image (%ux%u, %lu bytes)
de.all.JPEGTitle:JPEG Bild (%ux%u, %lu bytes)
fr.all.JPEGTitle:Image JPEG (%ux%u, %lu octets)
it.all.JPEGTitle:Immagine JPEG (%ux%u, %lu byte)
nl.all.JPEGTitle:JPEG image (%ux%u, %lu bytes)
en.all.PNGTitle:PNG image (%lux%lu, %lu bytes)
de.all.PNGTitle:PNG Bild (%lux%lu, %lu bytes)
fr.all.PNGTitle:Image PNG (%lux%lu, %lu octets)
it.all.PNGTitle:Immagine PNG (%lux%lu, %lu byte)
nl.all.PNGTitle:PNG image (%lux%lu, %lu bytes)
en.all.JNGTitle:JNG image (%lux%lu, %lu bytes)
de.all.JNGTitle:JNG Bild (%lux%lu, %lu bytes)
fr.all.JNGTitle:Image JNG (%lux%lu, %lu octets)
it.all.JNGTitle:Immagine JNG (%lux%lu, %lu byte)
nl.all.JNGTitle:JNG image (%lux%lu, %lu bytes)
en.all.MNGTitle:MNG image (%lux%lu, %lu bytes)
de.all.MNGTitle:MNG Bild (%lux%lu, %lu bytes)
fr.all.MNGTitle:Image MNG (%lux%lu, %lu octets)
it.all.MNGTitle:Immagine MNG (%lux%lu, %lu byte)
nl.all.MNGTitle:MNG image (%lux%lu, %lu bytes)
en.all.WebPTitle:WebP image (%lux%lu, %lu bytes)
de.all.WebPTitle:WebP Bild (%lux%lu, %lu bytes)
fr.all.WebPTitle:Image WebP (%lux%lu, %lu octets)
it.all.WebPTitle:Immagine WebP (%lux%lu, %lu byte)
nl.all.WebPTitle:WebP image (%lux%lu, %lu bytes)
en.all.SpriteTitle:Sprite image (%lux%lu, %lu bytes)
de.all.SpriteTitle:Sprite Bild (%lux%lu, %lu bytes)
fr.all.SpriteTitle:Image Sprite (%lux%lu, %lu octets)
it.all.SpriteTitle:Immagine Sprite (%lux%lu, %lu byte)
nl.all.SpriteTitle:Sprite image (%lux%lu, %lu bytes)
en.all.ArtWorksTitle:ArtWorks image (%lux%lu, %lu bytes)
de.all.ArtWorksTitle:ArtWorks Bild (%lux%lu, %lu bytes)
fr.all.ArtWorksTitle:Image ArtWorks (%lux%lu, %lu octets)
it.all.ArtWorksTitle:Immagine ArtWorks (%lux%lu, %lu byte)
nl.all.ArtWorksTitle:ArtWorks image (%lux%lu, %lu bytes)
en.all.DrawTitle:%s (Draw image %lux%lu pixels)
de.all.DrawTitle:%s (Draw Bild %lux%lu pixels)
fr.all.DrawTitle:%s (Image Draw %lux%lu pixels)
it.all.DrawTitle:%s (Immagine Draw %lux%lu pixels)
nl.all.DrawTitle:%s (Draw image %lux%lu pixels)
en.all.GIFTitle:%s (GIF image %lux%lu pixels)
de.all.GIFTitle:%s (GIF Bild %lux%lu pixels)
fr.all.GIFTitle:%s (Image GIF %lux%lu pixels)
it.all.GIFTitle:%s (Immagine GIF %lux%lu pixels)
nl.all.GIFTitle:%s (GIF image %lux%lu pixels)
en.all.BMPTitle:%s (BMP image %lux%lu pixels)
de.all.BMPTitle:%s (BMP Bild %lux%lu pixels)
fr.all.BMPTitle:%s (Image BMP %lux%lu pixels)
it.all.BMPTitle:%s (Immagine BMP %lux%lu pixels)
nl.all.BMPTitle:%s (BMP image %lux%lu pixels)
en.all.ICOTitle:%s (ICO image %lux%lu pixels)
de.all.ICOTitle:%s (ICO Bild %lux%lu pixels)
fr.all.ICOTitle:%s (Image BMP %lux%lu pixels)
it.all.ICOTitle:%s (Immagine ICO %lux%lu pixels)
nl.all.ICOTitle:%s (ICO image %lux%lu pixels)
en.all.JPEGTitle:%s (JPEG image %lux%lu pixels)
de.all.JPEGTitle:%s (JPEG Bild %lux%lu pixels)
fr.all.JPEGTitle:%s (Image JPEG %lux%lu pixels)
it.all.JPEGTitle:%s (Immagine JPEG %lux%lu pixels)
nl.all.JPEGTitle:%s (JPEG image %lux%lu pixels)
en.all.PNGTitle:%s (PNG image %lux%lu pixels)
de.all.PNGTitle:%s (PNG Bild %lux%lu pixels)
fr.all.PNGTitle:%s (Image PNG %lux%lu pixels)
it.all.PNGTitle:%s (Immagine PNG %lux%lu pixels)
nl.all.PNGTitle:%s (PNG image %lux%lu pixels)
en.all.JNGTitle:%s (JNG image %lux%lu pixels)
de.all.JNGTitle:%s (JNG Bild %lux%lu pixels)
fr.all.JNGTitle:%s (Image JNG %lux%lu pixels)
it.all.JNGTitle:%s (Immagine JNG %lux%lu pixels)
nl.all.JNGTitle:%s (JNG image %lux%lu pixels)
en.all.MNGTitle:%s (MNG image %lux%lu pixels)
de.all.MNGTitle:%s (MNG Bild %lux%lu pixels)
fr.all.MNGTitle:%s (Image MNG %lux%lu pixels)
it.all.MNGTitle:%s (Immagine MNG %lux%lu pixels)
nl.all.MNGTitle:%s (MNG image %lux%lu pixels)
en.all.WebPTitle:%s (WebP image %lux%lu pixels)
de.all.WebPTitle:%s (WebP Bild %lux%lu pixels)
fr.all.WebPTitle:%s (Image WebP %lux%lu pixels)
it.all.WebPTitle:%s (Immagine WebP %lux%lu pixels)
nl.all.WebPTitle:%s (WebP image %lux%lu pixels)
en.all.SpriteTitle:%s (Sprite image %lux%lu pixels)
de.all.SpriteTitle:%s (Sprite Bild %lux%lu pixels)
fr.all.SpriteTitle:%s (Image Sprite %lux%lu pixels)
it.all.SpriteTitle:%s (Immagine Sprite %lux%lu pixels)
nl.all.SpriteTitle:%s (Sprite image %lux%lu pixels)
en.all.ArtWorksTitle:%s (ArtWorks image %lux%lu pixels)
de.all.ArtWorksTitle:%s (ArtWorks Bild %lux%lu pixels)
fr.all.ArtWorksTitle:%s (Image ArtWorks %lux%lu pixels)
it.all.ArtWorksTitle:%s (Immagine ArtWorks %lux%lu pixels)
nl.all.ArtWorksTitle:%s (ArtWorks image %lux%lu pixels)
# HTML page character set
#

View File

@ -172,7 +172,7 @@ bool artworks_convert(struct content *c)
void *init_routine;
os_error *error;
int used = -1; /* slightly better with older OSLib versions */
char title[100];
char title[512];
/* check whether AWViewer has been seen and we can therefore
locate the ArtWorks rendering modules */
@ -263,8 +263,9 @@ bool artworks_convert(struct content *c)
c->width = (aw->x1 - aw->x0) / 512;
c->height = (aw->y1 - aw->y0) / 512;
snprintf(title, sizeof(title), messages_get("ArtWorksTitle"),
c->width, c->height, source_size);
snprintf(title, sizeof(title), messages_get("ArtWorksTitle"),
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);
content_set_ready(c);
content_set_done(c);

View File

@ -113,7 +113,7 @@ bool draw_convert(struct content *c)
const void *data;
os_box bbox;
os_error *error;
char title[100];
char title[512];
source_data = content__get_source_data(c, &source_size);
data = source_data;
@ -141,8 +141,9 @@ bool draw_convert(struct content *c)
draw->x0 = bbox.x0;
draw->y0 = bbox.y0;
snprintf(title, sizeof(title), messages_get("DrawTitle"), c->width,
c->height, source_size);
snprintf(title, sizeof(title), messages_get("DrawTitle"),
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);
content_set_ready(c);

View File

@ -111,7 +111,7 @@ bool sprite_convert(struct content *c)
const char *source_data;
unsigned long source_size;
const void *sprite_data;
char title[100];
char title[512];
source_data = content__get_source_data(c, &source_size);
@ -140,8 +140,9 @@ bool sprite_convert(struct content *c)
c->width = w;
c->height = h;
snprintf(title, sizeof(title), messages_get("SpriteTitle"), c->width,
c->height, source_size);
snprintf(title, sizeof(title), messages_get("SpriteTitle"),
nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
c->width, c->height);
content__set_title(c, title);
content_set_ready(c);
content_set_done(c);

View File

@ -1563,6 +1563,38 @@ const char *nsurl_access(const nsurl *url)
}
/* exported interface, documented in nsurl.h */
const char *nsurl_access_leaf(const nsurl *url)
{
size_t path_len;
const char *path;
const char *leaf;
if (url->components.path == NULL)
return "";
path = lwc_string_data(url->components.path);
path_len = lwc_string_length(url->components.path);
if (path_len == 0)
return "";
if (path_len == 1 && *path == '/')
return "/";
leaf = path + path_len;
do {
leaf--;
} while ((leaf != path) && (*leaf != '/'));
if (*leaf == '/')
leaf++;
return leaf;
}
/* exported interface, documented in nsurl.h */
size_t nsurl_length(const nsurl *url)
{

View File

@ -182,6 +182,20 @@ bool nsurl_has_component(const nsurl *url, nsurl_component part);
const char *nsurl_access(const nsurl *url);
/**
* Access a URL's path leaf as a string
*
* \param url NetSurf URL to retrieve a string pointer for.
* \return the required string
*
* The returned string is owned by the NetSurf URL object. It will die
* with the NetSurf URL object. Keep a reference to the URL if you need it.
*
* The returned string has a trailing '\0'.
*/
const char *nsurl_access_leaf(const nsurl *url);
/**
* Find the length of a NetSurf URL object's URL, as returned by nsurl_access
*