texture-cache: remove unused base64 code path
This was introduced in b0c6cf3f to support image data for web search providers, which do not exist anymore. Just remove it. https://bugzilla.gnome.org/show_bug.cgi?id=736936
This commit is contained in:
parent
ea552ea157
commit
2dc41c944e
@ -405,67 +405,6 @@ out:
|
|||||||
return rotated_pixbuf;
|
return rotated_pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkPixbuf*
|
|
||||||
decode_image (const char *val)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
GError *error = NULL;
|
|
||||||
GdkPixbuf *res = NULL;
|
|
||||||
struct {
|
|
||||||
const char *prefix;
|
|
||||||
const char *mime_type;
|
|
||||||
} formats[] = {
|
|
||||||
{ "data:image/x-icon;base64,", "image/x-icon" },
|
|
||||||
{ "data:image/png;base64,", "image/png" }
|
|
||||||
};
|
|
||||||
|
|
||||||
g_return_val_if_fail (val, NULL);
|
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS (formats); i++)
|
|
||||||
{
|
|
||||||
if (g_str_has_prefix (val, formats[i].prefix))
|
|
||||||
{
|
|
||||||
gsize len;
|
|
||||||
guchar *data = NULL;
|
|
||||||
char *unescaped;
|
|
||||||
|
|
||||||
unescaped = g_uri_unescape_string (val + strlen (formats[i].prefix), NULL);
|
|
||||||
if (unescaped)
|
|
||||||
{
|
|
||||||
data = g_base64_decode (unescaped, &len);
|
|
||||||
g_free (unescaped);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
GdkPixbufLoader *loader;
|
|
||||||
|
|
||||||
loader = gdk_pixbuf_loader_new_with_mime_type (formats[i].mime_type, &error);
|
|
||||||
if (loader &&
|
|
||||||
gdk_pixbuf_loader_write (loader, data, len, &error) &&
|
|
||||||
gdk_pixbuf_loader_close (loader, &error))
|
|
||||||
{
|
|
||||||
res = gdk_pixbuf_loader_get_pixbuf (loader);
|
|
||||||
g_object_ref (res);
|
|
||||||
}
|
|
||||||
g_object_unref (loader);
|
|
||||||
g_free (data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!res)
|
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
g_warning ("%s\n", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
g_warning ("incorrect data uri");
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GdkPixbuf *
|
static GdkPixbuf *
|
||||||
impl_load_pixbuf_file (const char *uri,
|
impl_load_pixbuf_file (const char *uri,
|
||||||
int available_width,
|
int available_width,
|
||||||
@ -478,9 +417,6 @@ impl_load_pixbuf_file (const char *uri,
|
|||||||
char *contents = NULL;
|
char *contents = NULL;
|
||||||
gsize size;
|
gsize size;
|
||||||
|
|
||||||
if (g_str_has_prefix (uri, "data:"))
|
|
||||||
return decode_image (uri);
|
|
||||||
|
|
||||||
file = g_file_new_for_uri (uri);
|
file = g_file_new_for_uri (uri);
|
||||||
if (g_file_load_contents (file, NULL, &contents, &size, NULL, error))
|
if (g_file_load_contents (file, NULL, &contents, &size, NULL, error))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user