Use g_set_error_literal where appropriate. Bug #538640.

svn path=/trunk/; revision=20463
This commit is contained in:
Christian Persch 2008-06-19 12:47:48 +00:00
parent 1a30e12586
commit 446f41757b
31 changed files with 747 additions and 703 deletions

View File

@ -1,3 +1,37 @@
2008-06-19 Christian Persch <chpe@gnome.org>
* gdk-pixbuf/gdk-pixbuf-io.c:
* gdk-pixbuf/gdk-pixdata.c:
* gdk-pixbuf/io-ani.c:
* gdk-pixbuf/io-bmp.c:
* gdk-pixbuf/io-gdip-utils.c:
* gdk-pixbuf/io-gif.c:
* gdk-pixbuf/io-icns.c:
* gdk-pixbuf/io-ico.c:
* gdk-pixbuf/io-jasper.c:
* gdk-pixbuf/io-jpeg.c:
* gdk-pixbuf/io-pcx.c:
* gdk-pixbuf/io-png.c:
* gdk-pixbuf/io-pnm.c:
* gdk-pixbuf/io-ras.c:
* gdk-pixbuf/io-tga.c:
* gdk-pixbuf/io-tiff.c:
* gdk-pixbuf/io-wbmp.c:
* gdk-pixbuf/io-xbm.c:
* gdk-pixbuf/io-xpm.c:
* gtk/gtkfilechooserdefault.c:
* gtk/gtkfilesystemmodel.c:
* gtk/gtkiconfactory.c:
* gtk/gtkicontheme.c:
* gtk/gtkmain.c:
* gtk/gtkpagesetup.c:
* gtk/gtkpapersize.c:
* gtk/gtkprintoperation-win32.c:
* gtk/gtktextbufferserialize.c:
* tests/testfilechooser.c: Use g_set_error_literal where appropriate. Bug #538640.
* configure.in: Update glib requirement to 2.17.3.
2008-06-19 Johan Dahlin <jdahlin@async.com.br> 2008-06-19 Johan Dahlin <jdahlin@async.com.br>
* demos/testpixbuf.c (new_testrgb_window): * demos/testpixbuf.c (new_testrgb_window):

View File

@ -31,7 +31,7 @@ m4_define([gtk_api_version], [2.0])
m4_define([gtk_binary_version], [2.10.0]) m4_define([gtk_binary_version], [2.10.0])
# required versions of other packages # required versions of other packages
m4_define([glib_required_version], [2.17.1]) m4_define([glib_required_version], [2.17.3])
m4_define([pango_required_version], [1.20]) m4_define([pango_required_version], [1.20])
m4_define([atk_required_version], [1.13.0]) m4_define([atk_required_version], [1.13.0])
m4_define([cairo_required_version], [1.6]) m4_define([cairo_required_version], [1.6])

View File

@ -795,10 +795,10 @@ _gdk_pixbuf_get_module (guchar *buffer, guint size,
g_free (display_name); g_free (display_name);
} }
else else
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNKNOWN_TYPE, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("Unrecognized image file format")); _("Unrecognized image file format"));
return NULL; return NULL;
@ -1675,10 +1675,10 @@ save_to_callback_with_tmp_file (GdkPixbufModule *image_module,
buf = g_try_malloc (TMP_FILE_BUF_SIZE); buf = g_try_malloc (TMP_FILE_BUF_SIZE);
if (buf == NULL) { if (buf == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to save image to callback")); _("Insufficient memory to save image to callback"));
goto end; goto end;
} }
@ -1688,10 +1688,10 @@ save_to_callback_with_tmp_file (GdkPixbufModule *image_module,
f = fdopen (fd, "wb+"); f = fdopen (fd, "wb+");
if (f == NULL) { if (f == NULL) {
gint save_errno = errno; gint save_errno = errno;
g_set_error (error, g_set_error_literal (error,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (save_errno), g_file_error_from_errno (save_errno),
_("Failed to open temporary file")); _("Failed to open temporary file"));
goto end; goto end;
} }
@ -1714,10 +1714,10 @@ save_to_callback_with_tmp_file (GdkPixbufModule *image_module,
} }
if (ferror (f)) { if (ferror (f)) {
gint save_errno = errno; gint save_errno = errno;
g_set_error (error, g_set_error_literal (error,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (save_errno), g_file_error_from_errno (save_errno),
_("Failed to read from temporary file")); _("Failed to read from temporary file"));
goto end; goto end;
} }
retval = TRUE; retval = TRUE;
@ -2194,10 +2194,10 @@ save_to_buffer_callback (const gchar *data,
new_max = MAX (sdata->max*2, sdata->len + count); new_max = MAX (sdata->max*2, sdata->len + count);
new_buffer = g_try_realloc (sdata->buffer, new_max); new_buffer = g_try_realloc (sdata->buffer, new_max);
if (!new_buffer) { if (!new_buffer) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to save image into a buffer")); _("Insufficient memory to save image into a buffer"));
return FALSE; return FALSE;
} }
sdata->buffer = new_buffer; sdata->buffer = new_buffer;
@ -2245,10 +2245,10 @@ gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf,
sdata.max = initial_max; sdata.max = initial_max;
sdata.len = 0; sdata.len = 0;
if (!sdata.buffer) { if (!sdata.buffer) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to save image into a buffer")); _("Insufficient memory to save image into a buffer"));
return FALSE; return FALSE;
} }
@ -2292,9 +2292,9 @@ save_to_stream (const gchar *buffer,
&my_error); &my_error);
if (written < 0) { if (written < 0) {
if (!my_error) { if (!my_error) {
g_set_error (error, g_set_error_literal (error,
G_IO_ERROR, 0, G_IO_ERROR, 0,
_("Error writing to image stream")); _("Error writing to image stream"));
} }
else { else {
g_propagate_error (error, my_error); g_propagate_error (error, my_error);

View File

@ -143,18 +143,18 @@ gdk_pixdata_serialize (const GdkPixdata *pixdata,
} }
#define return_header_corrupt(error) { \ #define return_header_corrupt(error) { \
g_set_error (error, GDK_PIXBUF_ERROR, \ g_set_error_literal (error, GDK_PIXBUF_ERROR, \
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Image header corrupt")); \ GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Image header corrupt")); \
return FALSE; \ return FALSE; \
} }
#define return_invalid_format(error) { \ #define return_invalid_format(error) { \
g_set_error (error, GDK_PIXBUF_ERROR, \ g_set_error_literal (error, GDK_PIXBUF_ERROR, \
GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image format unknown")); \ GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image format unknown")); \
return FALSE; \ return FALSE; \
} }
#define return_pixel_corrupt(error) { \ #define return_pixel_corrupt(error) { \
g_set_error (error, GDK_PIXBUF_ERROR, \ g_set_error_literal (error, GDK_PIXBUF_ERROR, \
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Image pixel data corrupt")); \ GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Image pixel data corrupt")); \
return FALSE; \ return FALSE; \
} }
@ -482,9 +482,9 @@ gdk_pixbuf_from_pixdata (const GdkPixdata *pixdata,
if (check_overrun) if (check_overrun)
{ {
g_free (data); g_free (data);
g_set_error (error, GDK_PIXBUF_ERROR, g_set_error_literal (error, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Image pixel data corrupt")); _("Image pixel data corrupt"));
return NULL; return NULL;
} }
} }

View File

@ -238,10 +238,10 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
{ {
if (context->pos >= context->NumFrames) if (context->pos >= context->NumFrames)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Unexpected icon chunk in animation")); _("Unexpected icon chunk in animation"));
return FALSE; return FALSE;
} }
@ -331,10 +331,10 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
#endif #endif
if (!context->Flags & 0x2) if (!context->Flags & 0x2)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Unsupported animation type")); _("Unsupported animation type"));
return FALSE; return FALSE;
} }
if (context->NumFrames == 0 || if (context->NumFrames == 0 ||
@ -342,20 +342,20 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
context->NumSteps == 0 || context->NumSteps == 0 ||
context->NumSteps >= 1024) context->NumSteps >= 1024)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in animation")); _("Invalid header in animation"));
return FALSE; return FALSE;
} }
context->animation = g_object_new (GDK_TYPE_PIXBUF_ANI_ANIM, NULL); context->animation = g_object_new (GDK_TYPE_PIXBUF_ANI_ANIM, NULL);
if (!context->animation) if (!context->animation)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load animation")); _("Not enough memory to load animation"));
return FALSE; return FALSE;
} }
@ -374,10 +374,10 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
!context->animation->delay || !context->animation->delay ||
!context->animation->sequence) !context->animation->sequence)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load animation")); _("Not enough memory to load animation"));
return FALSE; return FALSE;
} }
@ -392,18 +392,18 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
{ {
if (context->chunk_size != 4 * context->NumSteps) if (context->chunk_size != 4 * context->NumSteps)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Malformed chunk in animation")); _("Malformed chunk in animation"));
return FALSE; return FALSE;
} }
if (!context->animation) if (!context->animation)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in animation")); _("Invalid header in animation"));
return FALSE; return FALSE;
} }
@ -418,18 +418,18 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
{ {
if (context->chunk_size != 4 * context->NumSteps) if (context->chunk_size != 4 * context->NumSteps)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Malformed chunk in animation")); _("Malformed chunk in animation"));
return FALSE; return FALSE;
} }
if (!context->animation) if (!context->animation)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in animation")); _("Invalid header in animation"));
return FALSE; return FALSE;
} }
for (i = 0; i < context->NumSteps; i++) for (i = 0; i < context->NumSteps; i++)
@ -437,10 +437,10 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
context->animation->sequence[i] = read_int32 (context); context->animation->sequence[i] = read_int32 (context);
if (context->animation->sequence[i] >= context->NumFrames) if (context->animation->sequence[i] >= context->NumFrames)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Malformed chunk in animation")); _("Malformed chunk in animation"));
return FALSE; return FALSE;
} }
} }
@ -449,19 +449,19 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
{ {
if (!context->animation) if (!context->animation)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in animation")); _("Invalid header in animation"));
return FALSE; return FALSE;
} }
context->title = g_try_malloc (context->chunk_size + 1); context->title = g_try_malloc (context->chunk_size + 1);
if (!context->title) if (!context->title)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load animation")); _("Not enough memory to load animation"));
return FALSE; return FALSE;
} }
context->title[context->chunk_size] = 0; context->title[context->chunk_size] = 0;
@ -476,19 +476,19 @@ ani_load_chunk (AniLoaderContext *context, GError **error)
{ {
if (!context->animation) if (!context->animation)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in animation")); _("Invalid header in animation"));
return FALSE; return FALSE;
} }
context->author = g_try_malloc (context->chunk_size + 1); context->author = g_try_malloc (context->chunk_size + 1);
if (!context->author) if (!context->author)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load animation")); _("Not enough memory to load animation"));
return FALSE; return FALSE;
} }
context->author[context->chunk_size] = 0; context->author[context->chunk_size] = 0;
@ -536,10 +536,10 @@ gdk_pixbuf__ani_image_load_increment (gpointer data,
tmp = g_try_realloc (context->buffer, context->buffer_size); tmp = g_try_realloc (context->buffer, context->buffer_size);
if (!tmp) if (!tmp)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load animation")); _("Not enough memory to load animation"));
return FALSE; return FALSE;
} }
context->byte = context->buffer = tmp; context->byte = context->buffer = tmp;
@ -563,10 +563,10 @@ gdk_pixbuf__ani_image_load_increment (gpointer data,
context->data_size == 0 || context->data_size == 0 ||
chunk_id != TAG_ACON) chunk_id != TAG_ACON)
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in animation")); _("Invalid header in animation"));
return FALSE; return FALSE;
} }
} }
@ -608,10 +608,10 @@ gdk_pixbuf__ani_image_begin_load (GdkPixbufModuleSizeFunc size_func,
if (!context->buffer) if (!context->buffer)
{ {
context_free (context); context_free (context);
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load animation")); _("Not enough memory to load animation"));
return NULL; return NULL;
} }

View File

@ -224,10 +224,10 @@ static gboolean grow_buffer (struct bmp_progressive_state *State,
guchar *tmp; guchar *tmp;
if (State->BufferSize == 0) { if (State->BufferSize == 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has bogus header data")); _("BMP image has bogus header data"));
State->read_state = READ_STATE_ERROR; State->read_state = READ_STATE_ERROR;
return FALSE; return FALSE;
} }
@ -235,10 +235,10 @@ static gboolean grow_buffer (struct bmp_progressive_state *State,
tmp = g_try_realloc (State->buff, State->BufferSize); tmp = g_try_realloc (State->buff, State->BufferSize);
if (!tmp) { if (!tmp) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load bitmap image")); _("Not enough memory to load bitmap image"));
State->read_state = READ_STATE_ERROR; State->read_state = READ_STATE_ERROR;
return FALSE; return FALSE;
} }
@ -261,10 +261,10 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
/* First check for the two first bytes content. A sane /* First check for the two first bytes content. A sane
BMP file must start with bytes 0x42 0x4D. */ BMP file must start with bytes 0x42 0x4D. */
if (*BFH != 0x42 || *(BFH + 1) != 0x4D) { if (*BFH != 0x42 || *(BFH + 1) != 0x4D) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has bogus header data")); _("BMP image has bogus header data"));
State->read_state = READ_STATE_ERROR; State->read_state = READ_STATE_ERROR;
return FALSE; return FALSE;
} }
@ -313,10 +313,10 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
State->Header.depth = lsb_16 (&BIH[10]); State->Header.depth = lsb_16 (&BIH[10]);
State->Compressed = BI_RGB; State->Compressed = BI_RGB;
} else { } else {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has unsupported header size")); _("BMP image has unsupported header size"));
State->read_state = READ_STATE_ERROR; State->read_state = READ_STATE_ERROR;
return FALSE; return FALSE;
} }
@ -332,10 +332,10 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
State->Header.n_colors = (1 << State->Header.depth); State->Header.n_colors = (1 << State->Header.depth);
if (State->Header.n_colors > (1 << State->Header.depth)) { if (State->Header.n_colors > (1 << State->Header.depth)) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has bogus header data")); _("BMP image has bogus header data"));
State->read_state = READ_STATE_ERROR; State->read_state = READ_STATE_ERROR;
return FALSE; return FALSE;
} }
@ -351,10 +351,10 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
if (State->Header.Negative && if (State->Header.Negative &&
(State->Compressed != BI_RGB && State->Compressed != BI_BITFIELDS)) (State->Compressed != BI_RGB && State->Compressed != BI_BITFIELDS))
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Topdown BMP images cannot be compressed")); _("Topdown BMP images cannot be compressed"));
State->read_state = READ_STATE_ERROR; State->read_state = READ_STATE_ERROR;
return FALSE; return FALSE;
} }
@ -364,10 +364,10 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
(State->Compressed == BI_RLE8 && State->Type != 8) || (State->Compressed == BI_RLE8 && State->Type != 8) ||
(State->Compressed == BI_BITFIELDS && !(State->Type == 16 || State->Type == 32)) || (State->Compressed == BI_BITFIELDS && !(State->Type == 16 || State->Type == 32)) ||
(State->Compressed > BI_BITFIELDS)) { (State->Compressed > BI_BITFIELDS)) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has bogus header data")); _("BMP image has bogus header data"));
State->read_state = READ_STATE_ERROR; State->read_state = READ_STATE_ERROR;
return FALSE; return FALSE;
} }
@ -387,10 +387,10 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
if ((State->Header.width & 7) != 0) if ((State->Header.width & 7) != 0)
State->LineWidth++; State->LineWidth++;
} else { } else {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has bogus header data")); _("BMP image has bogus header data"));
State->read_state = READ_STATE_ERROR; State->read_state = READ_STATE_ERROR;
return FALSE; return FALSE;
} }
@ -427,10 +427,10 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
(gint) State->Header.height); (gint) State->Header.height);
if (State->pixbuf == NULL) { if (State->pixbuf == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load bitmap image")); _("Not enough memory to load bitmap image"));
State->read_state = READ_STATE_ERROR; State->read_state = READ_STATE_ERROR;
return FALSE; return FALSE;
} }
@ -490,10 +490,10 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
State->BufferSize = 12; State->BufferSize = 12;
} }
} else { } else {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has bogus header data")); _("BMP image has bogus header data"));
State->read_state = READ_STATE_ERROR; State->read_state = READ_STATE_ERROR;
return FALSE; return FALSE;
} }
@ -711,10 +711,10 @@ static gboolean gdk_pixbuf__bmp_image_stop_load(gpointer data, GError **error)
if (context->read_state == READ_STATE_HEADERS) { if (context->read_state == READ_STATE_HEADERS) {
if (error && *error == NULL) { if (error && *error == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Premature end-of-file encountered")); _("Premature end-of-file encountered"));
} }
retval = FALSE; retval = FALSE;
} }
@ -1323,10 +1323,10 @@ gdk_pixbuf__bmp_image_save_to_callback (GdkPixbufSaveFunc save_func,
dst_line = buf = g_try_malloc (size); dst_line = buf = g_try_malloc (size);
if (!buf) { if (!buf) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for saving BMP file")); _("Couldn't allocate memory for saving BMP file"));
return FALSE; return FALSE;
} }
@ -1364,10 +1364,10 @@ save_to_file_cb (const gchar *buf,
} }
if (count) { if (count) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED, GDK_PIXBUF_ERROR_FAILED,
_("Couldn't write to BMP file")); _("Couldn't write to BMP file"));
return FALSE; return FALSE;
} }

View File

@ -107,7 +107,7 @@ gdip_set_error_from_gpstatus (GError **error, gint code, GpStatus status)
default: default:
msg = "Unknown error"; msg = "Unknown error";
} }
g_set_error (error, GDK_PIXBUF_ERROR, code, msg); g_set_error_literal (error, GDK_PIXBUF_ERROR, code, msg);
} }
static gboolean static gboolean
@ -733,7 +733,7 @@ stop_load (GpBitmap *bitmap, GdipContext *context, GError **error)
g_object_unref (G_OBJECT (animation)); g_object_unref (G_OBJECT (animation));
destroy_gdipcontext (context); destroy_gdipcontext (context);
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't create pixbuf")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't create pixbuf"));
return FALSE; return FALSE;
} }
@ -795,7 +795,7 @@ gdk_pixbuf__gdip_image_stop_load (gpointer data, GError **error)
if (!bitmap) { if (!bitmap) {
destroy_gdipcontext (context); destroy_gdipcontext (context);
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Couldn't load bitmap")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Couldn't load bitmap"));
return FALSE; return FALSE;
} }
@ -818,7 +818,7 @@ gdk_pixbuf__gdip_image_stop_vector_load (gpointer data, GError **error)
metafile = gdip_buffer_to_image ((gchar *)image_buffer->data, image_buffer->len, error); metafile = gdip_buffer_to_image ((gchar *)image_buffer->data, image_buffer->len, error);
if (!metafile) { if (!metafile) {
destroy_gdipcontext (context); destroy_gdipcontext (context);
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Couldn't load metafile")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Couldn't load metafile"));
return FALSE; return FALSE;
} }
@ -977,14 +977,14 @@ gdip_save_pixbuf (GdkPixbuf *pixbuf,
gboolean success; gboolean success;
if (!GetEncoderClsid (format, &clsid)) { if (!GetEncoderClsid (format, &clsid)) {
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Unsupported image format for GDI+")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Unsupported image format for GDI+"));
return FALSE; return FALSE;
} }
image = gdip_pixbuf_to_bitmap (pixbuf); image = gdip_pixbuf_to_bitmap (pixbuf);
if (image == NULL) { if (image == NULL) {
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Couldn't save")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Couldn't save"));
return FALSE; return FALSE;
} }

View File

@ -490,10 +490,10 @@ gif_lzw_fill_buffer (GifContext *context)
if (context->code_done) { if (context->code_done) {
if (context->code_curbit >= context->code_lastbit) { if (context->code_curbit >= context->code_lastbit) {
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("GIF file was missing some data (perhaps it was truncated somehow?)")); _("GIF file was missing some data (perhaps it was truncated somehow?)"));
return -2; return -2;
} }
@ -573,10 +573,10 @@ gif_lzw_clear_code (GifContext *context)
#define CHECK_LZW_SP() G_STMT_START { \ #define CHECK_LZW_SP() G_STMT_START { \
if ((guchar *)context->lzw_sp >= \ if ((guchar *)context->lzw_sp >= \
(guchar *)context->lzw_stack + sizeof (context->lzw_stack)) { \ (guchar *)context->lzw_stack + sizeof (context->lzw_stack)) { \
g_set_error (context->error, \ g_set_error_literal (context->error, \
GDK_PIXBUF_ERROR, \ GDK_PIXBUF_ERROR, \
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, \ GDK_PIXBUF_ERROR_CORRUPT_IMAGE, \
_("Stack overflow")); \ _("Stack overflow")); \
return -2; \ return -2; \
} \ } \
} G_STMT_END } G_STMT_END
@ -633,10 +633,10 @@ lzw_read_byte (GifContext *context)
unsigned char buf[260]; unsigned char buf[260];
/* FIXME - we should handle this case */ /* FIXME - we should handle this case */
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED, GDK_PIXBUF_ERROR_FAILED,
_("GIF image loader cannot understand this image.")); _("GIF image loader cannot understand this image."));
return -2; return -2;
if (ZeroDataBlock) { if (ZeroDataBlock) {
@ -662,20 +662,20 @@ lzw_read_byte (GifContext *context)
while (code >= context->lzw_clear_code) { while (code >= context->lzw_clear_code) {
if (code >= (1 << MAX_LZW_BITS)) { if (code >= (1 << MAX_LZW_BITS)) {
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Bad code encountered")); _("Bad code encountered"));
return -2; return -2;
} }
CHECK_LZW_SP (); CHECK_LZW_SP ();
*(context->lzw_sp)++ = context->lzw_table[1][code]; *(context->lzw_sp)++ = context->lzw_table[1][code];
if (code == context->lzw_table[0][code]) { if (code == context->lzw_table[0][code]) {
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Circular table entry in GIF file")); _("Circular table entry in GIF file"));
return -2; return -2;
} }
code = context->lzw_table[0][code]; code = context->lzw_table[0][code];
@ -860,10 +860,10 @@ gif_get_lzw (GifContext *context)
context->frame_height); context->frame_height);
if (!context->frame->pixbuf) { if (!context->frame->pixbuf) {
g_free (context->frame); g_free (context->frame);
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load GIF file")); _("Not enough memory to load GIF file"));
return -2; return -2;
} }
@ -950,10 +950,10 @@ gif_get_lzw (GifContext *context)
g_list_free (context->animation->frames); g_list_free (context->animation->frames);
context->animation->frames = NULL; context->animation->frames = NULL;
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to composite a frame in GIF file")); _("Not enough memory to composite a frame in GIF file"));
return -2; return -2;
} }
@ -1122,10 +1122,10 @@ gif_prepare_lzw (GifContext *context)
} }
if (context->lzw_set_code_size > MAX_LZW_BITS) { if (context->lzw_set_code_size > MAX_LZW_BITS) {
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("GIF image is corrupt (incorrect LZW compression)")); _("GIF image is corrupt (incorrect LZW compression)"));
return -2; return -2;
} }
@ -1172,10 +1172,10 @@ gif_init (GifContext *context)
if (strncmp ((char *) buf, "GIF", 3) != 0) { if (strncmp ((char *) buf, "GIF", 3) != 0) {
/* Not a GIF file */ /* Not a GIF file */
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("File does not appear to be a GIF file")); _("File does not appear to be a GIF file"));
return -2; return -2;
} }
@ -1293,10 +1293,10 @@ gif_get_frame_info (GifContext *context)
if (!context->has_global_cmap) { if (!context->has_global_cmap) {
context->state = GIF_DONE; context->state = GIF_DONE;
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("GIF image has no global colormap, and a frame inside it has no local colormap.")); _("GIF image has no global colormap, and a frame inside it has no local colormap."));
return -2; return -2;
} }
@ -1458,10 +1458,10 @@ gdk_pixbuf__gif_image_load (FILE *file, GError **error)
context = new_context (); context = new_context ();
if (context == NULL) { if (context == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load GIF file")); _("Not enough memory to load GIF file"));
return NULL; return NULL;
} }
@ -1471,10 +1471,10 @@ gdk_pixbuf__gif_image_load (FILE *file, GError **error)
if (gif_main_loop (context) == -1 || context->animation->frames == NULL) { if (gif_main_loop (context) == -1 || context->animation->frames == NULL) {
if (context->error && *(context->error) == NULL) if (context->error && *(context->error) == NULL)
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("GIF file was missing some data (perhaps it was truncated somehow?)")); _("GIF file was missing some data (perhaps it was truncated somehow?)"));
} }
pixbuf = gdk_pixbuf_animation_get_static_image (GDK_PIXBUF_ANIMATION (context->animation)); pixbuf = gdk_pixbuf_animation_get_static_image (GDK_PIXBUF_ANIMATION (context->animation));
@ -1505,10 +1505,10 @@ gdk_pixbuf__gif_image_begin_load (GdkPixbufModuleSizeFunc size_func,
context = new_context (); context = new_context ();
if (context == NULL) { if (context == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load GIF file")); _("Not enough memory to load GIF file"));
return NULL; return NULL;
} }
@ -1527,10 +1527,10 @@ gdk_pixbuf__gif_image_stop_load (gpointer data, GError **error)
gboolean retval = TRUE; gboolean retval = TRUE;
if (context->state != GIF_DONE || context->animation->frames == NULL) { if (context->state != GIF_DONE || context->animation->frames == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("GIF image was truncated or incomplete.")); _("GIF image was truncated or incomplete."));
retval = FALSE; retval = FALSE;
} }
@ -1620,10 +1620,10 @@ gdk_pixbuf__gif_image_load_animation (FILE *file,
context = new_context (); context = new_context ();
if (context == NULL) { if (context == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load GIF file")); _("Not enough memory to load GIF file"));
return NULL; return NULL;
} }
@ -1632,10 +1632,10 @@ gdk_pixbuf__gif_image_load_animation (FILE *file,
if (gif_main_loop (context) == -1 || context->animation->frames == NULL) { if (gif_main_loop (context) == -1 || context->animation->frames == NULL) {
if (context->error && *(context->error) == NULL) if (context->error && *(context->error) == NULL)
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("GIF file was missing some data (perhaps it was truncated somehow?)")); _("GIF file was missing some data (perhaps it was truncated somehow?)"));
g_object_unref (context->animation); g_object_unref (context->animation);
context->animation = NULL; context->animation = NULL;

View File

@ -357,9 +357,9 @@ icns_image_load (FILE *f, GError ** error)
g_byte_array_free (data, TRUE); g_byte_array_free (data, TRUE);
if (!pixbuf) if (!pixbuf)
g_set_error (error, GDK_PIXBUF_ERROR, g_set_error_literal (error, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Could not decode ICNS file")); _("Could not decode ICNS file"));
return pixbuf; return pixbuf;
} }

View File

@ -205,10 +205,10 @@ static void DecodeHeader(guchar *Data, gint Bytes,
/* First word should be 0 according to specs */ /* First word should be 0 according to specs */
if (((Data[1] << 8) + Data[0]) != 0) { if (((Data[1] << 8) + Data[0]) != 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in icon")); _("Invalid header in icon"));
return; return;
} }
@ -219,10 +219,10 @@ static void DecodeHeader(guchar *Data, gint Bytes,
/* If it is not a cursor make sure it is actually an icon */ /* If it is not a cursor make sure it is actually an icon */
if (!State->cursor && imgtype != 1) { if (!State->cursor && imgtype != 1) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in icon")); _("Invalid header in icon"));
return; return;
} }
@ -234,10 +234,10 @@ static void DecodeHeader(guchar *Data, gint Bytes,
if (State->HeaderSize>State->BytesInHeaderBuf) { if (State->HeaderSize>State->BytesInHeaderBuf) {
guchar *tmp=g_try_realloc(State->HeaderBuf,State->HeaderSize); guchar *tmp=g_try_realloc(State->HeaderBuf,State->HeaderSize);
if (!tmp) { if (!tmp) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load icon")); _("Not enough memory to load icon"));
return; return;
} }
State->HeaderBuf = tmp; State->HeaderBuf = tmp;
@ -271,10 +271,10 @@ static void DecodeHeader(guchar *Data, gint Bytes,
} }
if (State->DIBoffset < 0) { if (State->DIBoffset < 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in icon")); _("Invalid header in icon"));
return; return;
} }
@ -284,20 +284,20 @@ static void DecodeHeader(guchar *Data, gint Bytes,
State->HeaderSize = State->DIBoffset + 40; /* 40 = sizeof(InfoHeader) */ State->HeaderSize = State->DIBoffset + 40; /* 40 = sizeof(InfoHeader) */
if (State->HeaderSize < 0) { if (State->HeaderSize < 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in icon")); _("Invalid header in icon"));
return; return;
} }
if (State->HeaderSize>State->BytesInHeaderBuf) { if (State->HeaderSize>State->BytesInHeaderBuf) {
guchar *tmp=g_try_realloc(State->HeaderBuf,State->HeaderSize); guchar *tmp=g_try_realloc(State->HeaderBuf,State->HeaderSize);
if (!tmp) { if (!tmp) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load icon")); _("Not enough memory to load icon"));
return; return;
} }
State->HeaderBuf = tmp; State->HeaderBuf = tmp;
@ -316,20 +316,20 @@ static void DecodeHeader(guchar *Data, gint Bytes,
State->Header.width = State->Header.width =
(int)(BIH[7] << 24) + (BIH[6] << 16) + (BIH[5] << 8) + (BIH[4]); (int)(BIH[7] << 24) + (BIH[6] << 16) + (BIH[5] << 8) + (BIH[4]);
if (State->Header.width == 0) { if (State->Header.width == 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Icon has zero width")); _("Icon has zero width"));
return; return;
} }
State->Header.height = State->Header.height =
(int)((BIH[11] << 24) + (BIH[10] << 16) + (BIH[9] << 8) + (BIH[8]))/2; (int)((BIH[11] << 24) + (BIH[10] << 16) + (BIH[9] << 8) + (BIH[8]))/2;
/* /2 because the BIH height includes the transparency mask */ /* /2 because the BIH height includes the transparency mask */
if (State->Header.height == 0) { if (State->Header.height == 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Icon has zero height")); _("Icon has zero height"));
return; return;
} }
State->Header.depth = (BIH[15] << 8) + (BIH[14]); State->Header.depth = (BIH[15] << 8) + (BIH[14]);
@ -353,20 +353,20 @@ static void DecodeHeader(guchar *Data, gint Bytes,
State->HeaderSize+=I; State->HeaderSize+=I;
if (State->HeaderSize < 0) { if (State->HeaderSize < 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid header in icon")); _("Invalid header in icon"));
return; return;
} }
if (State->HeaderSize>State->BytesInHeaderBuf) { if (State->HeaderSize>State->BytesInHeaderBuf) {
guchar *tmp=g_try_realloc(State->HeaderBuf,State->HeaderSize); guchar *tmp=g_try_realloc(State->HeaderBuf,State->HeaderSize);
if (!tmp) { if (!tmp) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load icon")); _("Not enough memory to load icon"));
return; return;
} }
State->HeaderBuf = tmp; State->HeaderBuf = tmp;
@ -378,10 +378,10 @@ static void DecodeHeader(guchar *Data, gint Bytes,
if ((BIH[16] != 0) || (BIH[17] != 0) || (BIH[18] != 0) if ((BIH[16] != 0) || (BIH[17] != 0) || (BIH[18] != 0)
|| (BIH[19] != 0)) { || (BIH[19] != 0)) {
/* FIXME: is this the correct message? */ /* FIXME: is this the correct message? */
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Compressed icons are not supported")); _("Compressed icons are not supported"));
return; return;
} }
@ -411,10 +411,10 @@ static void DecodeHeader(guchar *Data, gint Bytes,
if ((State->Header.width & 7) != 0) if ((State->Header.width & 7) != 0)
State->LineWidth++; State->LineWidth++;
} else { } else {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Unsupported icon type")); _("Unsupported icon type"));
return; return;
} }
@ -426,10 +426,10 @@ static void DecodeHeader(guchar *Data, gint Bytes,
if (State->LineBuf == NULL) { if (State->LineBuf == NULL) {
State->LineBuf = g_try_malloc(State->LineWidth); State->LineBuf = g_try_malloc(State->LineWidth);
if (!State->LineBuf) { if (!State->LineBuf) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load icon")); _("Not enough memory to load icon"));
return; return;
} }
} }
@ -456,10 +456,10 @@ static void DecodeHeader(guchar *Data, gint Bytes,
State->Header.width, State->Header.width,
State->Header.height); State->Header.height);
if (!State->pixbuf) { if (!State->pixbuf) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load icon")); _("Not enough memory to load icon"));
return; return;
} }
if (State->cursor) { if (State->cursor) {
@ -505,10 +505,10 @@ gdk_pixbuf__ico_image_begin_load(GdkPixbufModuleSizeFunc size_func,
context->HeaderBuf = g_try_malloc(14 + 40 + 4*256 + 512); context->HeaderBuf = g_try_malloc(14 + 40 + 4*256 + 512);
if (!context->HeaderBuf) { if (!context->HeaderBuf) {
g_free (context); g_free (context);
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load ICO file")); _("Not enough memory to load ICO file"));
return NULL; return NULL;
} }
/* 4*256 for the colormap */ /* 4*256 for the colormap */
@ -970,10 +970,10 @@ fill_entry (IconEntry *icon,
gint n_channels, v, x, y; gint n_channels, v, x, y;
if (icon->width > 255 || icon->height > 255) { if (icon->width > 255 || icon->height > 255) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION, GDK_PIXBUF_ERROR_BAD_OPTION,
_("Image too large to be saved as ICO")); _("Image too large to be saved as ICO"));
return FALSE; return FALSE;
} }
@ -981,10 +981,10 @@ fill_entry (IconEntry *icon,
icon->hot_x = hot_x; icon->hot_x = hot_x;
icon->hot_y = hot_y; icon->hot_y = hot_y;
if (icon->hot_x >= icon->width || icon->hot_y >= icon->height) { if (icon->hot_x >= icon->width || icon->hot_y >= icon->height) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION, GDK_PIXBUF_ERROR_BAD_OPTION,
_("Cursor hotspot outside image")); _("Cursor hotspot outside image"));
return FALSE; return FALSE;
} }
} }

View File

@ -71,7 +71,8 @@ jasper_image_begin_load (GdkPixbufModuleSizeFunc size_func,
stream = jas_stream_memopen (NULL, -1); stream = jas_stream_memopen (NULL, -1);
if (!stream) { if (!stream) {
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for stream")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for stream"));
return NULL; return NULL;
} }
@ -100,7 +101,8 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
raw_image = jas_image_decode (context->stream, -1, 0); raw_image = jas_image_decode (context->stream, -1, 0);
if (!raw_image) { if (!raw_image) {
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Couldn't decode image")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Couldn't decode image"));
return FALSE; return FALSE;
} }
@ -115,10 +117,10 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
if (width == 0 || height == 0) { if (width == 0 || height == 0) {
jas_image_destroy(raw_image); jas_image_destroy(raw_image);
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed JPEG2000 has zero width or height")); _("Transformed JPEG2000 has zero width or height"));
return FALSE; return FALSE;
} }
} }
@ -131,7 +133,8 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
if ((num_components != 3 && num_components != 4 && num_components != 1) || if ((num_components != 3 && num_components != 4 && num_components != 1) ||
(colourspace_family != JAS_CLRSPC_FAM_RGB && colourspace_family != JAS_CLRSPC_FAM_GRAY)) { (colourspace_family != JAS_CLRSPC_FAM_RGB && colourspace_family != JAS_CLRSPC_FAM_GRAY)) {
jas_image_destroy (raw_image); jas_image_destroy (raw_image);
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image type currently not supported")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("Image type currently not supported"));
return FALSE; return FALSE;
} }
@ -142,14 +145,16 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
profile = jas_cmprof_createfromclrspc (JAS_CLRSPC_SRGB); profile = jas_cmprof_createfromclrspc (JAS_CLRSPC_SRGB);
if (!profile) { if (!profile) {
jas_image_destroy (raw_image); jas_image_destroy (raw_image);
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for color profile")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for color profile"));
return FALSE; return FALSE;
} }
image = jas_image_chclrspc (raw_image, profile, JAS_CMXFORM_INTENT_PER); image = jas_image_chclrspc (raw_image, profile, JAS_CMXFORM_INTENT_PER);
if (!image) { if (!image) {
jas_image_destroy (raw_image); jas_image_destroy (raw_image);
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for color profile")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for color profile"));
return FALSE; return FALSE;
} }
} else { } else {
@ -171,10 +176,10 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
data = g_try_malloc0 (context->width * context->height * bits_per_sample / 8); data = g_try_malloc0 (context->width * context->height * bits_per_sample / 8);
if (data == NULL) { if (data == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open JPEG 2000 file")); _("Insufficient memory to open JPEG 2000 file"));
return FALSE; return FALSE;
} }
context->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, context->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
@ -255,7 +260,8 @@ jasper_image_load_increment (gpointer data, const guchar *buf, guint size, GErro
struct jasper_context *context = (struct jasper_context *) data; struct jasper_context *context = (struct jasper_context *) data;
if (jas_stream_write (context->stream, buf, size) < 0) { if (jas_stream_write (context->stream, buf, size) < 0) {
g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory to buffer image data")); g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory to buffer image data"));
return FALSE; return FALSE;
} }

View File

@ -523,10 +523,10 @@ gdk_pixbuf__jpeg_image_load (FILE *f, GError **error)
* crappy JPEG library * crappy JPEG library
*/ */
if (error && *error == NULL) { if (error && *error == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load image, try exiting some applications to free memory")); _("Insufficient memory to load image, try exiting some applications to free memory"));
} }
return NULL; return NULL;
@ -662,10 +662,10 @@ gdk_pixbuf__jpeg_image_begin_load (GdkPixbufModuleSizeFunc size_func,
context->cinfo.src = (struct jpeg_source_mgr *) g_try_malloc (sizeof (my_source_mgr)); context->cinfo.src = (struct jpeg_source_mgr *) g_try_malloc (sizeof (my_source_mgr));
if (!context->cinfo.src) { if (!context->cinfo.src) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file")); _("Couldn't allocate memory for loading JPEG file"));
return NULL; return NULL;
} }
memset (context->cinfo.src, 0, sizeof (my_source_mgr)); memset (context->cinfo.src, 0, sizeof (my_source_mgr));
@ -914,10 +914,10 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
if (context->size_func) { if (context->size_func) {
(* context->size_func) (&width, &height, context->user_data); (* context->size_func) (&width, &height, context->user_data);
if (width == 0 || height == 0) { if (width == 0 || height == 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed JPEG has zero width or height.")); _("Transformed JPEG has zero width or height."));
return FALSE; return FALSE;
} }
} }
@ -938,10 +938,10 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
cinfo->output_height); cinfo->output_height);
if (context->pixbuf == NULL) { if (context->pixbuf == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file")); _("Couldn't allocate memory for loading JPEG file"));
return FALSE; return FALSE;
} }
@ -1058,10 +1058,10 @@ to_callback_do_write (j_compress_ptr cinfo, gsize length)
* which it should have. * which it should have.
*/ */
if (errmgr->error && *errmgr->error == NULL) { if (errmgr->error && *errmgr->error == NULL) {
g_set_error (errmgr->error, g_set_error_literal (errmgr->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
"write function failed"); "write function failed");
} }
siglongjmp (errmgr->setjmp_buffer, 1); siglongjmp (errmgr->setjmp_buffer, 1);
g_assert_not_reached (); g_assert_not_reached ();
@ -1171,19 +1171,19 @@ real_save_jpeg (GdkPixbuf *pixbuf,
*/ */
buf = g_try_malloc (w * 3 * sizeof (guchar)); buf = g_try_malloc (w * 3 * sizeof (guchar));
if (!buf) { if (!buf) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file")); _("Couldn't allocate memory for loading JPEG file"));
return FALSE; return FALSE;
} }
if (to_callback) { if (to_callback) {
to_callback_destmgr.buffer = g_try_malloc (TO_FUNCTION_BUF_SIZE); to_callback_destmgr.buffer = g_try_malloc (TO_FUNCTION_BUF_SIZE);
if (!to_callback_destmgr.buffer) { if (!to_callback_destmgr.buffer) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file")); _("Couldn't allocate memory for loading JPEG file"));
return FALSE; return FALSE;
} }
} }

View File

@ -184,7 +184,7 @@ gdk_pixbuf__pcx_begin_load(GdkPixbufModuleSizeFunc size_func,
context->header = g_try_malloc(sizeof(struct pcx_header)); context->header = g_try_malloc(sizeof(struct pcx_header));
if(!context->header) { if(!context->header) {
g_free(context); g_free(context);
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for header")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for header"));
return NULL; return NULL;
} }
@ -199,7 +199,7 @@ gdk_pixbuf__pcx_begin_load(GdkPixbufModuleSizeFunc size_func,
if(!context->buf) { if(!context->buf) {
g_free(context->header); g_free(context->header);
g_free(context); g_free(context);
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for context buffer")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for context buffer"));
return NULL; return NULL;
} }
context->buf_size = 512; context->buf_size = 512;
@ -557,7 +557,7 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
/* if context's buf isn't large enough to hold its current data plus the passed buf, increase its size */ /* if context's buf isn't large enough to hold its current data plus the passed buf, increase its size */
if(context->buf_pos + size > context->buf_size) { if(context->buf_pos + size > context->buf_size) {
if(!pcx_resize_context_buf(context, sizeof(guchar) * (context->buf_pos + size))) { if(!pcx_resize_context_buf(context, sizeof(guchar) * (context->buf_pos + size))) {
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for context buffer")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for context buffer"));
return FALSE; return FALSE;
} }
} }
@ -598,7 +598,7 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
width = context->width; width = context->width;
height = context->height; height = context->height;
if(width <= 0 || height <= 0) { if(width <= 0 || height <= 0) {
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Image has invalid width and/or height")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Image has invalid width and/or height"));
return FALSE; return FALSE;
} }
if (context->size_func) if (context->size_func)
@ -610,7 +610,7 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
switch(context->bpp) { switch(context->bpp) {
default: default:
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image has unsupported bpp")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image has unsupported bpp"));
return FALSE; return FALSE;
break; break;
case 1: case 1:
@ -639,7 +639,7 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
context->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, context->width, context->height); context->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, context->width, context->height);
if(!context->pixbuf) { if(!context->pixbuf) {
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't create new pixbuf")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't create new pixbuf"));
return FALSE; return FALSE;
} }
context->data = gdk_pixbuf_get_pixels(context->pixbuf); context->data = gdk_pixbuf_get_pixels(context->pixbuf);
@ -647,14 +647,14 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
context->line = g_try_malloc(sizeof(guchar) * context->bytesperline * context->num_planes); context->line = g_try_malloc(sizeof(guchar) * context->bytesperline * context->num_planes);
if(!context->line) { if(!context->line) {
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for line data")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for line data"));
return FALSE; return FALSE;
} }
if(context->bpp == 8) { if(context->bpp == 8) {
context->p_data = g_try_malloc(sizeof(guchar) * context->width * context->height); context->p_data = g_try_malloc(sizeof(guchar) * context->width * context->height);
if(!context->p_data) { if(!context->p_data) {
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for paletted data")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for paletted data"));
return FALSE; return FALSE;
} }
} }
@ -671,7 +671,7 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
if(context->current_task == PCX_TASK_LOAD_DATA) { if(context->current_task == PCX_TASK_LOAD_DATA) {
switch(context->bpp) { switch(context->bpp) {
default: default:
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image has unsupported bpp")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image has unsupported bpp"));
retval = FALSE; retval = FALSE;
break; break;
case 1: case 1:
@ -701,14 +701,14 @@ gdk_pixbuf__pcx_stop_load(gpointer data, GError **error)
struct pcx_context *context = (struct pcx_context *)data; struct pcx_context *context = (struct pcx_context *)data;
if(context->current_line != context->height) { if(context->current_line != context->height) {
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Didn't get all lines of PCX image")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Didn't get all lines of PCX image"));
free_pcx_context(context, FALSE); free_pcx_context(context, FALSE);
return FALSE; return FALSE;
} }
if(context->current_task == PCX_TASK_LOAD_PALETTE) { if(context->current_task == PCX_TASK_LOAD_PALETTE) {
if(!pcx_load_palette_8(context)) { if(!pcx_load_palette_8(context)) {
g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("No palette found at end of PCX data")); g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("No palette found at end of PCX data"));
free_pcx_context(context, FALSE); free_pcx_context(context, FALSE);
return FALSE; return FALSE;
} }

View File

@ -49,10 +49,10 @@ setup_png_transformations(png_structp png_read_ptr, png_infop png_info_ptr,
*/ */
bit_depth = png_get_bit_depth (png_read_ptr, png_info_ptr); bit_depth = png_get_bit_depth (png_read_ptr, png_info_ptr);
if (bit_depth < 1 || bit_depth > 16) { if (bit_depth < 1 || bit_depth > 16) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Bits per channel of PNG image is invalid.")); _("Bits per channel of PNG image is invalid."));
return FALSE; return FALSE;
} }
png_get_IHDR (png_read_ptr, png_info_ptr, png_get_IHDR (png_read_ptr, png_info_ptr,
@ -130,36 +130,36 @@ setup_png_transformations(png_structp png_read_ptr, png_infop png_info_ptr,
/* Check that the new info is what we want */ /* Check that the new info is what we want */
if (width == 0 || height == 0) { if (width == 0 || height == 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG has zero width or height.")); _("Transformed PNG has zero width or height."));
return FALSE; return FALSE;
} }
if (bit_depth != 8) { if (bit_depth != 8) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Bits per channel of transformed PNG is not 8.")); _("Bits per channel of transformed PNG is not 8."));
return FALSE; return FALSE;
} }
if ( ! (color_type == PNG_COLOR_TYPE_RGB || if ( ! (color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_RGB_ALPHA) ) { color_type == PNG_COLOR_TYPE_RGB_ALPHA) ) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG not RGB or RGBA.")); _("Transformed PNG not RGB or RGBA."));
return FALSE; return FALSE;
} }
channels = png_get_channels(png_read_ptr, png_info_ptr); channels = png_get_channels(png_read_ptr, png_info_ptr);
if ( ! (channels == 3 || channels == 4) ) { if ( ! (channels == 3 || channels == 4) ) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG has unsupported number of channels, must be 3 or 4.")); _("Transformed PNG has unsupported number of channels, must be 3 or 4."));
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@ -304,10 +304,10 @@ gdk_pixbuf__png_image_load (FILE *f, GError **error)
if (!pixbuf) { if (!pixbuf) {
if (error && *error == NULL) { if (error && *error == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load PNG file")); _("Insufficient memory to load PNG file"));
} }
@ -612,10 +612,10 @@ png_info_callback (png_structp png_read_ptr,
if (w == 0 || h == 0) { if (w == 0 || h == 0) {
lc->fatal_error_occurred = TRUE; lc->fatal_error_occurred = TRUE;
if (lc->error && *lc->error == NULL) { if (lc->error && *lc->error == NULL) {
g_set_error (lc->error, g_set_error_literal (lc->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED, GDK_PIXBUF_ERROR_FAILED,
_("Transformed PNG has zero width or height.")); _("Transformed PNG has zero width or height."));
} }
return; return;
} }
@ -678,10 +678,10 @@ png_row_callback (png_structp png_read_ptr,
if (row_num >= lc->pixbuf->height) { if (row_num >= lc->pixbuf->height) {
lc->fatal_error_occurred = TRUE; lc->fatal_error_occurred = TRUE;
if (lc->error && *lc->error == NULL) { if (lc->error && *lc->error == NULL) {
g_set_error (lc->error, g_set_error_literal (lc->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Fatal error reading PNG image file")); _("Fatal error reading PNG image file"));
} }
return; return;
} }
@ -819,18 +819,18 @@ static gboolean real_save_png (GdkPixbuf *pixbuf,
gchar *key = *kiter + 6; gchar *key = *kiter + 6;
int len = strlen (key); int len = strlen (key);
if (len <= 1 || len > 79) { if (len <= 1 || len > 79) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION, GDK_PIXBUF_ERROR_BAD_OPTION,
_("Keys for PNG text chunks must have at least 1 and at most 79 characters.")); _("Keys for PNG text chunks must have at least 1 and at most 79 characters."));
return FALSE; return FALSE;
} }
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
if ((guchar) key[i] > 127) { if ((guchar) key[i] > 127) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION, GDK_PIXBUF_ERROR_BAD_OPTION,
_("Keys for PNG text chunks must be ASCII characters.")); _("Keys for PNG text chunks must be ASCII characters."));
return FALSE; return FALSE;
} }
} }

View File

@ -244,10 +244,10 @@ pnm_read_next_value (PnmIOBuffer *inbuf, gint max_length, guint *value, GError *
/* get the value */ /* get the value */
result = strtol (buf, &endptr, 10); result = strtol (buf, &endptr, 10);
if (*endptr != '\0' || result < 0 || result > G_MAXUINT) { if (*endptr != '\0' || result < 0 || result > G_MAXUINT) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("PNM loader expected to find an integer, but didn't")); _("PNM loader expected to find an integer, but didn't"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
*value = result; *value = result;
@ -276,10 +276,10 @@ pnm_read_header (PnmLoaderContext *context)
return PNM_SUSPEND; return PNM_SUSPEND;
if (*inbuf->byte != 'P') { if (*inbuf->byte != 'P') {
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("PNM file has an incorrect initial byte")); _("PNM file has an incorrect initial byte"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
@ -306,10 +306,10 @@ pnm_read_header (PnmLoaderContext *context)
context->type = PNM_FORMAT_PPM_RAW; context->type = PNM_FORMAT_PPM_RAW;
break; break;
default: default:
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("PNM file is not in a recognized PNM subformat")); _("PNM file is not in a recognized PNM subformat"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
@ -331,10 +331,10 @@ pnm_read_header (PnmLoaderContext *context)
return retval; return retval;
if (!width) { if (!width) {
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("PNM file has an image width of 0")); _("PNM file has an image width of 0"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
@ -352,10 +352,10 @@ pnm_read_header (PnmLoaderContext *context)
return retval; return retval;
if (!height) { if (!height) {
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("PNM file has an image height of 0")); _("PNM file has an image height of 0"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
@ -375,18 +375,18 @@ pnm_read_header (PnmLoaderContext *context)
return retval; return retval;
if (context->maxval == 0) { if (context->maxval == 0) {
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Maximum color value in PNM file is 0")); _("Maximum color value in PNM file is 0"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
if (context->maxval > 65535) { if (context->maxval > 65535) {
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Maximum color value in PNM file is too large")); _("Maximum color value in PNM file is too large"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
@ -423,10 +423,10 @@ pnm_read_raw_scanline (PnmLoaderContext *context)
numpix = inbuf->nbytes / 3; numpix = inbuf->nbytes / 3;
break; break;
default: default:
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Raw PNM image type is invalid")); _("Raw PNM image type is invalid"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
if(context->maxval>255) if(context->maxval>255)
@ -453,10 +453,10 @@ pnm_read_raw_scanline (PnmLoaderContext *context)
offset = context->output_col * 3; offset = context->output_col * 3;
break; break;
default: default:
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Raw PNM image type is invalid")); _("Raw PNM image type is invalid"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
if(context->maxval>255) if(context->maxval>255)
@ -498,10 +498,10 @@ pnm_read_raw_scanline (PnmLoaderContext *context)
} }
break; break;
default: default:
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Raw PNM image type is invalid")); _("Raw PNM image type is invalid"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
@ -648,10 +648,10 @@ pnm_read_scanline (PnmLoaderContext *context)
return retval; return retval;
break; break;
default: default:
g_set_error (context->error, g_set_error_literal (context->error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNKNOWN_TYPE, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("PNM image loader does not support this PNM subformat")); _("PNM image loader does not support this PNM subformat"));
return PNM_FATAL_ERR; return PNM_FATAL_ERR;
} }
@ -703,10 +703,10 @@ gdk_pixbuf__pnm_image_load (FILE *f, GError **error)
/* we ran out of data? */ /* we ran out of data? */
if (context.pixbuf) if (context.pixbuf)
g_object_unref (context.pixbuf); g_object_unref (context.pixbuf);
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Premature end-of-file encountered")); _("Premature end-of-file encountered"));
return NULL; return NULL;
} }
@ -735,10 +735,10 @@ gdk_pixbuf__pnm_image_load (FILE *f, GError **error)
/* raw formats require exactly one whitespace */ /* raw formats require exactly one whitespace */
if (!g_ascii_isspace(*(inbuf->byte))) if (!g_ascii_isspace(*(inbuf->byte)))
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Raw PNM formats require exactly one whitespace before sample data")); _("Raw PNM formats require exactly one whitespace before sample data"));
return NULL; return NULL;
} }
inbuf->nbytes--; inbuf->nbytes--;
@ -762,10 +762,10 @@ gdk_pixbuf__pnm_image_load (FILE *f, GError **error)
if (!context.pixbuf) { if (!context.pixbuf) {
/* Failed to allocate memory */ /* Failed to allocate memory */
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for loading PNM image")); _("Cannot allocate memory for loading PNM image"));
return NULL; return NULL;
} }
@ -813,9 +813,9 @@ gdk_pixbuf__pnm_image_begin_load (GdkPixbufModuleSizeFunc size_func,
context = g_try_malloc (sizeof (PnmLoaderContext)); context = g_try_malloc (sizeof (PnmLoaderContext));
if (!context) { if (!context) {
g_set_error(error, GDK_PIXBUF_ERROR, g_set_error_literal (error, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load PNM context struct")); _("Insufficient memory to load PNM context struct"));
return NULL; return NULL;
} }
memset (context, 0, sizeof (PnmLoaderContext)); memset (context, 0, sizeof (PnmLoaderContext));
@ -863,10 +863,10 @@ gdk_pixbuf__pnm_image_stop_load (gpointer data,
pnm allows to put multiple images in a file pnm allows to put multiple images in a file
*/ */
if (context->inbuf.nbytes > 0) { if (context->inbuf.nbytes > 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Unexpected end of PNM image data")); _("Unexpected end of PNM image data"));
retval = FALSE; retval = FALSE;
} }
#endif #endif
@ -962,10 +962,10 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data,
/* raw formats require exactly one whitespace */ /* raw formats require exactly one whitespace */
if (!g_ascii_isspace(*(inbuf->byte))) if (!g_ascii_isspace(*(inbuf->byte)))
{ {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Raw PNM formats require exactly one whitespace before sample data")); _("Raw PNM formats require exactly one whitespace before sample data"));
return FALSE; return FALSE;
} }
inbuf->nbytes--; inbuf->nbytes--;
@ -991,10 +991,10 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data,
context->height); context->height);
if (context->pixbuf == NULL) { if (context->pixbuf == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load PNM file")); _("Insufficient memory to load PNM file"));
return FALSE; return FALSE;
} }

View File

@ -120,10 +120,10 @@ static gboolean RAS2State(struct rasterfile *RAS,
if ((gint)State->Header.width <= 0 || if ((gint)State->Header.width <= 0 ||
(gint)State->Header.height <= 0 || (gint)State->Header.height <= 0 ||
State->Header.maplength > 768) { State->Header.maplength > 768) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("RAS image has bogus header data")); _("RAS image has bogus header data"));
return FALSE; return FALSE;
} }
@ -142,18 +142,18 @@ static gboolean RAS2State(struct rasterfile *RAS,
State->LineWidth++; State->LineWidth++;
} }
else { else {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("RAS image has unknown type")); _("RAS image has unknown type"));
return FALSE; return FALSE;
} }
if (State->Header.type > 2 || State->Header.maptype > 1) { if (State->Header.type > 2 || State->Header.maptype > 1) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("unsupported RAS image variation")); _("unsupported RAS image variation"));
return FALSE; return FALSE;
} }
@ -165,10 +165,10 @@ static gboolean RAS2State(struct rasterfile *RAS,
State->LineBuf = g_try_malloc (State->LineWidth); State->LineBuf = g_try_malloc (State->LineWidth);
if (!State->LineBuf) { if (!State->LineBuf) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load RAS image")); _("Not enough memory to load RAS image"));
return FALSE; return FALSE;
} }
} }
@ -194,10 +194,10 @@ static gboolean RAS2State(struct rasterfile *RAS,
(gint) State->Header.height); (gint) State->Header.height);
if (!State->pixbuf) { if (!State->pixbuf) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load RAS image")); _("Not enough memory to load RAS image"));
return FALSE; return FALSE;
} }

View File

@ -149,9 +149,9 @@ static IOBuffer *io_buffer_new(GError **err)
IOBuffer *buffer; IOBuffer *buffer;
buffer = g_try_malloc(sizeof(IOBuffer)); buffer = g_try_malloc(sizeof(IOBuffer));
if (!buffer) { if (!buffer) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for IOBuffer struct")); _("Cannot allocate memory for IOBuffer struct"));
return NULL; return NULL;
} }
buffer->data = NULL; buffer->data = NULL;
@ -168,9 +168,9 @@ static IOBuffer *io_buffer_append(IOBuffer *buffer,
if (!buffer->data) { if (!buffer->data) {
buffer->data = g_try_malloc(len); buffer->data = g_try_malloc(len);
if (!buffer->data) { if (!buffer->data) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for IOBuffer data")); _("Cannot allocate memory for IOBuffer data"));
g_free(buffer); g_free(buffer);
return NULL; return NULL;
} }
@ -179,9 +179,9 @@ static IOBuffer *io_buffer_append(IOBuffer *buffer,
} else { } else {
guchar *tmp = g_try_realloc (buffer->data, buffer->size + len); guchar *tmp = g_try_realloc (buffer->data, buffer->size + len);
if (!tmp) { if (!tmp) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot realloc IOBuffer data")); _("Cannot realloc IOBuffer data"));
g_free(buffer); g_free(buffer);
return NULL; return NULL;
} }
@ -209,9 +209,9 @@ static IOBuffer *io_buffer_free_segment(IOBuffer *buffer,
new_size = buffer->size - count; new_size = buffer->size - count;
new_buf = g_try_malloc(new_size); new_buf = g_try_malloc(new_size);
if (!new_buf) { if (!new_buf) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate temporary IOBuffer data")); _("Cannot allocate temporary IOBuffer data"));
g_free(buffer->data); g_free(buffer->data);
g_free(buffer); g_free(buffer);
return NULL; return NULL;
@ -343,8 +343,8 @@ static gboolean fill_in_context(TGAContext *ctx, GError **err)
ctx->pbuf = get_contiguous_pixbuf (w, h, alpha); ctx->pbuf = get_contiguous_pixbuf (w, h, alpha);
if (!ctx->pbuf) { if (!ctx->pbuf) {
g_set_error(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, g_set_error_literal(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate new pixbuf")); _("Cannot allocate new pixbuf"));
return FALSE; return FALSE;
} }
@ -683,15 +683,15 @@ static gboolean try_colormap(TGAContext *ctx, GError **err)
ctx->cmap = g_try_malloc(sizeof(TGAColormap)); ctx->cmap = g_try_malloc(sizeof(TGAColormap));
if (!ctx->cmap) { if (!ctx->cmap) {
g_set_error(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, g_set_error_literal(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate colormap structure")); _("Cannot allocate colormap structure"));
return FALSE; return FALSE;
} }
ctx->cmap->size = LE16(ctx->hdr->cmap_n_colors); ctx->cmap->size = LE16(ctx->hdr->cmap_n_colors);
ctx->cmap->cols = g_try_malloc(sizeof(TGAColor) * ctx->cmap->size); ctx->cmap->cols = g_try_malloc(sizeof(TGAColor) * ctx->cmap->size);
if (!ctx->cmap->cols) { if (!ctx->cmap->cols) {
g_set_error(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, g_set_error_literal(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate colormap entries")); _("Cannot allocate colormap entries"));
return FALSE; return FALSE;
} }
@ -711,9 +711,9 @@ static gboolean try_colormap(TGAContext *ctx, GError **err)
if (ctx->hdr->cmap_bpp == 32) if (ctx->hdr->cmap_bpp == 32)
ctx->cmap->cols[n].a = *p++; ctx->cmap->cols[n].a = *p++;
} else { } else {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Unexpected bitdepth for colormap entries")); _("Unexpected bitdepth for colormap entries"));
return FALSE; return FALSE;
} }
} }
@ -729,9 +729,9 @@ static gboolean try_preload(TGAContext *ctx, GError **err)
if (ctx->in->size >= sizeof(TGAHeader)) { if (ctx->in->size >= sizeof(TGAHeader)) {
ctx->hdr = g_try_malloc(sizeof(TGAHeader)); ctx->hdr = g_try_malloc(sizeof(TGAHeader));
if (!ctx->hdr) { if (!ctx->hdr) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate TGA header memory")); _("Cannot allocate TGA header memory"));
return FALSE; return FALSE;
} }
g_memmove(ctx->hdr, ctx->in->data, sizeof(TGAHeader)); g_memmove(ctx->hdr, ctx->in->data, sizeof(TGAHeader));
@ -762,24 +762,24 @@ static gboolean try_preload(TGAContext *ctx, GError **err)
return FALSE; return FALSE;
if (LE16(ctx->hdr->width) == 0 || if (LE16(ctx->hdr->width) == 0 ||
LE16(ctx->hdr->height) == 0) { LE16(ctx->hdr->height) == 0) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("TGA image has invalid dimensions")); _("TGA image has invalid dimensions"));
return FALSE; return FALSE;
} }
if ((ctx->hdr->flags & TGA_INTERLEAVE_MASK) != TGA_INTERLEAVE_NONE) { if ((ctx->hdr->flags & TGA_INTERLEAVE_MASK) != TGA_INTERLEAVE_NONE) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNKNOWN_TYPE, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("TGA image type not supported")); _("TGA image type not supported"));
return FALSE; return FALSE;
} }
switch (ctx->hdr->type) { switch (ctx->hdr->type) {
case TGA_TYPE_PSEUDOCOLOR: case TGA_TYPE_PSEUDOCOLOR:
case TGA_TYPE_RLE_PSEUDOCOLOR: case TGA_TYPE_RLE_PSEUDOCOLOR:
if (ctx->hdr->bpp != 8) { if (ctx->hdr->bpp != 8) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNKNOWN_TYPE, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("TGA image type not supported")); _("TGA image type not supported"));
return FALSE; return FALSE;
} }
break; break;
@ -787,9 +787,9 @@ static gboolean try_preload(TGAContext *ctx, GError **err)
case TGA_TYPE_RLE_TRUECOLOR: case TGA_TYPE_RLE_TRUECOLOR:
if (ctx->hdr->bpp != 24 && if (ctx->hdr->bpp != 24 &&
ctx->hdr->bpp != 32) { ctx->hdr->bpp != 32) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNKNOWN_TYPE, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("TGA image type not supported")); _("TGA image type not supported"));
return FALSE; return FALSE;
} }
break; break;
@ -797,16 +797,16 @@ static gboolean try_preload(TGAContext *ctx, GError **err)
case TGA_TYPE_RLE_GRAYSCALE: case TGA_TYPE_RLE_GRAYSCALE:
if (ctx->hdr->bpp != 8 && if (ctx->hdr->bpp != 8 &&
ctx->hdr->bpp != 16) { ctx->hdr->bpp != 16) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNKNOWN_TYPE, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("TGA image type not supported")); _("TGA image type not supported"));
return FALSE; return FALSE;
} }
break; break;
default: default:
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNKNOWN_TYPE, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("TGA image type not supported")); _("TGA image type not supported"));
return FALSE; return FALSE;
} }
if (!fill_in_context(ctx, err)) if (!fill_in_context(ctx, err))
@ -851,9 +851,9 @@ static gpointer gdk_pixbuf__tga_begin_load(GdkPixbufModuleSizeFunc f0,
ctx = g_try_malloc(sizeof(TGAContext)); ctx = g_try_malloc(sizeof(TGAContext));
if (!ctx) { if (!ctx) {
g_set_error(err, GDK_PIXBUF_ERROR, g_set_error_literal(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for TGA context struct")); _("Cannot allocate memory for TGA context struct"));
return NULL; return NULL;
} }
@ -917,8 +917,8 @@ static gboolean gdk_pixbuf__tga_load_increment(gpointer data,
} else { } else {
while (ctx->in->size >= ctx->rowstride) { while (ctx->in->size >= ctx->rowstride) {
if (ctx->completed_lines >= ctx->pbuf->height) { if (ctx->completed_lines >= ctx->pbuf->height) {
g_set_error(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, g_set_error_literal(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED,
_("Excess data in file")); _("Excess data in file"));
return FALSE; return FALSE;
} }
if (!parse_data_for_row(ctx, err)) if (!parse_data_for_row(ctx, err))

View File

@ -7,7 +7,7 @@
* Authors: Mark Crichton <crichton@gimp.org> * Authors: Mark Crichton <crichton@gimp.org>
* Federico Mena-Quintero <federico@gimp.org> * Federico Mena-Quintero <federico@gimp.org>
* Jonathan Blandford <jrb@redhat.com> * Jonathan Blandford <jrb@redhat.com>
* Søren Sandmann <sandmann@daimi.au.dk> * S<EFBFBD>ren Sandmann <sandmann@daimi.au.dk>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -128,9 +128,9 @@ tiff_set_error (GError **error,
global_error = NULL; global_error = NULL;
} }
else { else {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
error_code, msg); error_code, msg);
} }
} }
@ -169,28 +169,28 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
} }
if (width <= 0 || height <= 0) { if (width <= 0 || height <= 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Width or height of TIFF image is zero")); _("Width or height of TIFF image is zero"));
return NULL; return NULL;
} }
rowstride = width * 4; rowstride = width * 4;
if (rowstride / 4 != width) { /* overflow */ if (rowstride / 4 != width) { /* overflow */
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Dimensions of TIFF image too large")); _("Dimensions of TIFF image too large"));
return NULL; return NULL;
} }
bytes = height * rowstride; bytes = height * rowstride;
if (bytes / rowstride != height) { /* overflow */ if (bytes / rowstride != height) { /* overflow */
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Dimensions of TIFF image too large")); _("Dimensions of TIFF image too large"));
return NULL; return NULL;
} }
@ -211,10 +211,10 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
pixels = g_try_malloc (bytes); pixels = g_try_malloc (bytes);
if (!pixels) { if (!pixels) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file")); _("Insufficient memory to open TIFF file"));
return NULL; return NULL;
} }
@ -223,10 +223,10 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
free_buffer, NULL); free_buffer, NULL);
if (!pixbuf) { if (!pixbuf) {
g_free (pixels); g_free (pixels);
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file")); _("Insufficient memory to open TIFF file"));
return NULL; return NULL;
} }
@ -535,10 +535,10 @@ gdk_pixbuf__tiff_image_load_increment (gpointer data, const guchar *buf,
g_return_val_if_fail (data != NULL, FALSE); g_return_val_if_fail (data != NULL, FALSE);
if (!make_available_at_least (context, size)) { if (!make_available_at_least (context, size)) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file")); _("Insufficient memory to open TIFF file"));
return FALSE; return FALSE;
} }
@ -754,10 +754,10 @@ save_to_file_cb (const gchar *buf,
} }
if (count) { if (count) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED, GDK_PIXBUF_ERROR_FAILED,
_("Couldn't write to TIFF file")); _("Couldn't write to TIFF file"));
return FALSE; return FALSE;
} }

View File

@ -240,10 +240,10 @@ static gboolean gdk_pixbuf__wbmp_image_load_increment(gpointer data,
context->need_width = FALSE; context->need_width = FALSE;
if (context->width <= 0) { if (context->width <= 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Image has zero width")); _("Image has zero width"));
return FALSE; return FALSE;
} }
@ -258,10 +258,10 @@ static gboolean gdk_pixbuf__wbmp_image_load_increment(gpointer data,
context->need_height = FALSE; context->need_height = FALSE;
if (context->height <= 0) { if (context->height <= 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Image has zero height")); _("Image has zero height"));
return FALSE; return FALSE;
} }
@ -269,10 +269,10 @@ static gboolean gdk_pixbuf__wbmp_image_load_increment(gpointer data,
context->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, context->width, context->height); context->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, context->width, context->height);
if (!context->pixbuf) { if (!context->pixbuf) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load image")); _("Not enough memory to load image"));
return FALSE; return FALSE;
} }
@ -328,10 +328,10 @@ static gboolean gdk_pixbuf__wbmp_image_load_increment(gpointer data,
if(size) { if(size) {
bv = save_rest(context, buf, size); bv = save_rest(context, buf, size);
if (!bv) { if (!bv) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Couldn't save the rest")); _("Couldn't save the rest"));
return FALSE; return FALSE;
} }

View File

@ -289,20 +289,20 @@ gdk_pixbuf__xbm_image_load_real (FILE *f,
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
if (!read_bitmap_file_data (f, &w, &h, &data, &x_hot, &y_hot)) { if (!read_bitmap_file_data (f, &w, &h, &data, &x_hot, &y_hot)) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid XBM file")); _("Invalid XBM file"));
return NULL; return NULL;
} }
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, w, h); pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, w, h);
if (pixbuf == NULL) { if (pixbuf == NULL) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load XBM image file")); _("Insufficient memory to load XBM image file"));
return NULL; return NULL;
} }
@ -447,10 +447,10 @@ gdk_pixbuf__xbm_image_load_increment (gpointer data,
if (fwrite (buf, sizeof (guchar), size, context->file) != size) { if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
gint save_errno = errno; gint save_errno = errno;
context->all_okay = FALSE; context->all_okay = FALSE;
g_set_error (error, g_set_error_literal (error,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (save_errno), g_file_error_from_errno (save_errno),
_("Failed to write to temporary file when loading XBM image")); _("Failed to write to temporary file when loading XBM image"));
return FALSE; return FALSE;
} }

View File

@ -462,52 +462,52 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
buffer = (*get_buf) (op_header, handle); buffer = (*get_buf) (op_header, handle);
if (!buffer) { if (!buffer) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("No XPM header found")); _("No XPM header found"));
return NULL; return NULL;
} }
items = sscanf (buffer, "%d %d %d %d %d %d", &w, &h, &n_col, &cpp, &x_hot, &y_hot); items = sscanf (buffer, "%d %d %d %d %d %d", &w, &h, &n_col, &cpp, &x_hot, &y_hot);
if (items != 4 && items != 6) { if (items != 4 && items != 6) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid XPM header")); _("Invalid XPM header"));
return NULL; return NULL;
} }
if (w <= 0) { if (w <= 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM file has image width <= 0")); _("XPM file has image width <= 0"));
return NULL; return NULL;
} }
if (h <= 0) { if (h <= 0) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM file has image height <= 0")); _("XPM file has image height <= 0"));
return NULL; return NULL;
} }
if (cpp <= 0 || cpp >= 32) { if (cpp <= 0 || cpp >= 32) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM has invalid number of chars per pixel")); _("XPM has invalid number of chars per pixel"));
return NULL; return NULL;
} }
if (n_col <= 0 || if (n_col <= 0 ||
n_col >= G_MAXINT / (cpp + 1) || n_col >= G_MAXINT / (cpp + 1) ||
n_col >= G_MAXINT / sizeof (XPMColor)) { n_col >= G_MAXINT / sizeof (XPMColor)) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM file has invalid number of colors")); _("XPM file has invalid number of colors"));
return NULL; return NULL;
} }
@ -516,19 +516,19 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
name_buf = g_try_malloc (n_col * (cpp + 1)); name_buf = g_try_malloc (n_col * (cpp + 1));
if (!name_buf) { if (!name_buf) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for loading XPM image")); _("Cannot allocate memory for loading XPM image"));
g_hash_table_destroy (color_hash); g_hash_table_destroy (color_hash);
return NULL; return NULL;
} }
colors = (XPMColor *) g_try_malloc (sizeof (XPMColor) * n_col); colors = (XPMColor *) g_try_malloc (sizeof (XPMColor) * n_col);
if (!colors) { if (!colors) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for loading XPM image")); _("Cannot allocate memory for loading XPM image"));
g_hash_table_destroy (color_hash); g_hash_table_destroy (color_hash);
g_free (name_buf); g_free (name_buf);
return NULL; return NULL;
@ -539,10 +539,10 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
buffer = (*get_buf) (op_cmap, handle); buffer = (*get_buf) (op_cmap, handle);
if (!buffer) { if (!buffer) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Cannot read XPM colormap")); _("Cannot read XPM colormap"));
g_hash_table_destroy (color_hash); g_hash_table_destroy (color_hash);
g_free (name_buf); g_free (name_buf);
g_free (colors); g_free (colors);
@ -577,10 +577,10 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, is_trans, 8, w, h); pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, is_trans, 8, w, h);
if (!pixbuf) { if (!pixbuf) {
g_set_error (error, g_set_error_literal (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for loading XPM image")); _("Cannot allocate memory for loading XPM image"));
g_hash_table_destroy (color_hash); g_hash_table_destroy (color_hash);
g_free (colors); g_free (colors);
g_free (name_buf); g_free (name_buf);
@ -771,10 +771,10 @@ gdk_pixbuf__xpm_image_load_increment (gpointer data,
if (fwrite (buf, sizeof (guchar), size, context->file) != size) { if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
gint save_errno = errno; gint save_errno = errno;
context->all_okay = FALSE; context->all_okay = FALSE;
g_set_error (error, g_set_error_literal (error,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (save_errno), g_file_error_from_errno (save_errno),
_("Failed to write to temporary file when loading XPM image")); _("Failed to write to temporary file when loading XPM image"));
return FALSE; return FALSE;
} }

View File

@ -6963,10 +6963,10 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser *chooser,
if (impl->local_only && !g_file_is_native (file)) if (impl->local_only && !g_file_is_native (file))
{ {
g_set_error (error, g_set_error_literal (error,
GTK_FILE_CHOOSER_ERROR, GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_BAD_FILENAME, GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
_("Cannot change to folder because it is not local")); _("Cannot change to folder because it is not local"));
g_object_unref (file); g_object_unref (file);
profile_end ("end - not local", NULL); profile_end ("end - not local", NULL);

View File

@ -694,10 +694,10 @@ _gtk_file_system_model_new (GtkFileSystem *file_system,
g_object_unref (model); g_object_unref (model);
g_object_unref (model); g_object_unref (model);
g_set_error (error, g_set_error_literal (error,
GTK_FILE_CHOOSER_ERROR, GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_NONEXISTENT, GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
_("Could not obtain root folder")); _("Could not obtain root folder"));
return NULL; return NULL;
} }

View File

@ -2857,7 +2857,7 @@ icon_source_start_element (GMarkupParseContext *context,
tmp = g_strdup_printf ("%s:%d:%d %s", "input", tmp = g_strdup_printf ("%s:%d:%d %s", "input",
line_number, char_number, error_msg); line_number, char_number, error_msg);
#if 0 #if 0
g_set_error (error, g_set_error_literal (error,
GTK_BUILDER_ERROR, GTK_BUILDER_ERROR,
error_domain, error_domain,
tmp); tmp);

View File

@ -2977,10 +2977,10 @@ gtk_icon_info_load_icon (GtkIconInfo *icon_info,
if (icon_info->load_error) if (icon_info->load_error)
g_propagate_error (error, icon_info->load_error); g_propagate_error (error, icon_info->load_error);
else else
g_set_error (error, g_set_error_literal (error,
GTK_ICON_THEME_ERROR, GTK_ICON_THEME_ERROR,
GTK_ICON_THEME_NOT_FOUND, GTK_ICON_THEME_NOT_FOUND,
_("Failed to load icon")); _("Failed to load icon"));
return NULL; return NULL;
} }

View File

@ -734,7 +734,7 @@ post_parse_hook (GOptionContext *context,
g_set_error (error, g_set_error (error,
G_OPTION_ERROR, G_OPTION_ERROR,
G_OPTION_ERROR_FAILED, G_OPTION_ERROR_FAILED,
"cannot open display: %s", _("Cannot open display: %s"),
display_name ? display_name : "" ); display_name ? display_name : "" );
return FALSE; return FALSE;

View File

@ -591,10 +591,10 @@ gtk_page_setup_load_key_file (GtkPageSetup *setup,
if (!g_key_file_has_group (key_file, group_name)) if (!g_key_file_has_group (key_file, group_name))
{ {
g_set_error (error, g_set_error_literal (error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE, GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file")); _("Not a valid page setup file"));
goto out; goto out;
} }

View File

@ -819,10 +819,10 @@ gtk_paper_size_new_from_key_file (GKeyFile *key_file,
group_name = freeme = g_key_file_get_start_group (key_file); group_name = freeme = g_key_file_get_start_group (key_file);
if (!group_name || !g_key_file_has_group (key_file, group_name)) if (!group_name || !g_key_file_has_group (key_file, group_name))
{ {
g_set_error (error, g_set_error_literal (error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE, GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file")); _("Not a valid page setup file"));
retval = FALSE; retval = FALSE;
goto out; goto out;
} }
@ -859,10 +859,10 @@ gtk_paper_size_new_from_key_file (GKeyFile *key_file,
width, height, GTK_UNIT_MM); width, height, GTK_UNIT_MM);
else else
{ {
g_set_error (error, g_set_error_literal (error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE, GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file")); _("Not a valid page setup file"));
retval = FALSE; retval = FALSE;
goto out; goto out;
} }

View File

@ -1483,10 +1483,10 @@ _gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
if (!printdlgex) if (!printdlgex)
{ {
result = GTK_PRINT_OPERATION_RESULT_ERROR; result = GTK_PRINT_OPERATION_RESULT_ERROR;
g_set_error (&priv->error, g_set_error_literal (&priv->error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_NOMEM, GTK_PRINT_ERROR_NOMEM,
_("Not enough free memory")); _("Not enough free memory"));
goto out; goto out;
} }
@ -1506,10 +1506,10 @@ _gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
if (!page_ranges) if (!page_ranges)
{ {
result = GTK_PRINT_OPERATION_RESULT_ERROR; result = GTK_PRINT_OPERATION_RESULT_ERROR;
g_set_error (&priv->error, g_set_error_literal (&priv->error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_NOMEM, GTK_PRINT_ERROR_NOMEM,
_("Not enough free memory")); _("Not enough free memory"));
goto out; goto out;
} }
@ -1554,30 +1554,30 @@ _gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
{ {
result = GTK_PRINT_OPERATION_RESULT_ERROR; result = GTK_PRINT_OPERATION_RESULT_ERROR;
if (hResult == E_OUTOFMEMORY) if (hResult == E_OUTOFMEMORY)
g_set_error (&priv->error, g_set_error_literal (&priv->error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_NOMEM, GTK_PRINT_ERROR_NOMEM,
_("Not enough free memory")); _("Not enough free memory"));
else if (hResult == E_INVALIDARG) else if (hResult == E_INVALIDARG)
g_set_error (&priv->error, g_set_error_literal (&priv->error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR, GTK_PRINT_ERROR_INTERNAL_ERROR,
_("Invalid argument to PrintDlgEx")); _("Invalid argument to PrintDlgEx"));
else if (hResult == E_POINTER) else if (hResult == E_POINTER)
g_set_error (&priv->error, g_set_error_literal (&priv->error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR, GTK_PRINT_ERROR_INTERNAL_ERROR,
_("Invalid pointer to PrintDlgEx")); _("Invalid pointer to PrintDlgEx"));
else if (hResult == E_HANDLE) else if (hResult == E_HANDLE)
g_set_error (&priv->error, g_set_error_literal (&priv->error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR, GTK_PRINT_ERROR_INTERNAL_ERROR,
_("Invalid handle to PrintDlgEx")); _("Invalid handle to PrintDlgEx"));
else /* E_FAIL */ else /* E_FAIL */
g_set_error (&priv->error, g_set_error_literal (&priv->error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_GENERAL, GTK_PRINT_ERROR_GENERAL,
_("Unspecified error")); _("Unspecified error"));
goto out; goto out;
} }
@ -1626,10 +1626,10 @@ _gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
if (job_id <= 0) if (job_id <= 0)
{ {
result = GTK_PRINT_OPERATION_RESULT_ERROR; result = GTK_PRINT_OPERATION_RESULT_ERROR;
g_set_error (&priv->error, g_set_error_literal (&priv->error,
GTK_PRINT_ERROR, GTK_PRINT_ERROR,
GTK_PRINT_ERROR_GENERAL, GTK_PRINT_ERROR_GENERAL,
_("Error from StartDoc")); _("Error from StartDoc"));
*do_print = FALSE; *do_print = FALSE;
cairo_surface_destroy (op_win32->surface); cairo_surface_destroy (op_win32->surface);
op_win32->surface = NULL; op_win32->surface = NULL;

View File

@ -1773,10 +1773,10 @@ read_headers (const gchar *start,
g_list_foreach (headers, (GFunc) g_free, NULL); g_list_foreach (headers, (GFunc) g_free, NULL);
g_list_free (headers); g_list_free (headers);
g_set_error (error, g_set_error_literal (error,
G_MARKUP_ERROR, G_MARKUP_ERROR,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,
_("Serialized data is malformed")); _("Serialized data is malformed"));
return NULL; return NULL;
} }
@ -1851,10 +1851,10 @@ _gtk_text_buffer_deserialize_rich_text (GtkTextBuffer *register_buffer,
header = headers->data; header = headers->data;
if (!header_is (header, "GTKTEXTBUFFERCONTENTS-0001")) if (!header_is (header, "GTKTEXTBUFFERCONTENTS-0001"))
{ {
g_set_error (error, g_set_error_literal (error,
G_MARKUP_ERROR, G_MARKUP_ERROR,
G_MARKUP_ERROR_PARSE, G_MARKUP_ERROR_PARSE,
_("Serialized data is malformed. First section isn't GTKTEXTBUFFERCONTENTS-0001")); _("Serialized data is malformed. First section isn't GTKTEXTBUFFERCONTENTS-0001"));
retval = FALSE; retval = FALSE;
goto out; goto out;

View File

@ -199,11 +199,13 @@ my_new_from_file_at_size (const char *filename,
g_return_val_if_fail (width > 0 && height > 0, NULL); g_return_val_if_fail (width > 0 && height > 0, NULL);
if (stat (filename, &st) != 0) { if (stat (filename, &st) != 0) {
int errsv = errno;
g_set_error (error, g_set_error (error,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errsv),
_("Could not get information for file '%s': %s"), _("Could not get information for file '%s': %s"),
filename, g_strerror (errno)); filename, g_strerror (errsv));
return NULL; return NULL;
} }
@ -212,11 +214,13 @@ my_new_from_file_at_size (const char *filename,
f = fopen (filename, "rb"); f = fopen (filename, "rb");
if (!f) { if (!f) {
int errsv = errno;
g_set_error (error, g_set_error (error,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errsv),
_("Failed to open file '%s': %s"), _("Failed to open file '%s': %s"),
filename, g_strerror (errno)); filename, g_strerror (errsv));
return NULL; return NULL;
} }