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

View File

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

View File

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

View File

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

View File

@ -107,7 +107,7 @@ gdip_set_error_from_gpstatus (GError **error, gint code, GpStatus status)
default:
msg = "Unknown error";
}
g_set_error (error, GDK_PIXBUF_ERROR, code, msg);
g_set_error_literal (error, GDK_PIXBUF_ERROR, code, msg);
}
static gboolean
@ -733,7 +733,7 @@ stop_load (GpBitmap *bitmap, GdipContext *context, GError **error)
g_object_unref (G_OBJECT (animation));
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;
}
@ -795,7 +795,7 @@ gdk_pixbuf__gdip_image_stop_load (gpointer data, GError **error)
if (!bitmap) {
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;
}
@ -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);
if (!metafile) {
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;
}
@ -977,14 +977,14 @@ gdip_save_pixbuf (GdkPixbuf *pixbuf,
gboolean success;
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;
}
image = gdip_pixbuf_to_bitmap (pixbuf);
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;
}

View File

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

View File

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

View File

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

View File

@ -71,7 +71,8 @@ jasper_image_begin_load (GdkPixbufModuleSizeFunc size_func,
stream = jas_stream_memopen (NULL, -1);
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;
}
@ -100,7 +101,8 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
raw_image = jas_image_decode (context->stream, -1, 0);
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;
}
@ -115,10 +117,10 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
if (width == 0 || height == 0) {
jas_image_destroy(raw_image);
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed JPEG2000 has zero width or height"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed JPEG2000 has zero width or height"));
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) ||
(colourspace_family != JAS_CLRSPC_FAM_RGB && colourspace_family != JAS_CLRSPC_FAM_GRAY)) {
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;
}
@ -142,14 +145,16 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
profile = jas_cmprof_createfromclrspc (JAS_CLRSPC_SRGB);
if (!profile) {
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;
}
image = jas_image_chclrspc (raw_image, profile, JAS_CMXFORM_INTENT_PER);
if (!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;
}
} 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);
if (data == NULL) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open JPEG 2000 file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open JPEG 2000 file"));
return FALSE;
}
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;
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;
}

View File

@ -523,10 +523,10 @@ gdk_pixbuf__jpeg_image_load (FILE *f, GError **error)
* crappy JPEG library
*/
if (error && *error == NULL) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load image, try exiting some applications to free memory"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load image, try exiting some applications to free memory"));
}
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));
if (!context->cinfo.src) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file"));
return NULL;
}
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) {
(* context->size_func) (&width, &height, context->user_data);
if (width == 0 || height == 0) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed JPEG has zero width or height."));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed JPEG has zero width or height."));
return FALSE;
}
}
@ -938,10 +938,10 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data,
cinfo->output_height);
if (context->pixbuf == NULL) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file"));
return FALSE;
}
@ -1058,10 +1058,10 @@ to_callback_do_write (j_compress_ptr cinfo, gsize length)
* which it should have.
*/
if (errmgr->error && *errmgr->error == NULL) {
g_set_error (errmgr->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
"write function failed");
g_set_error_literal (errmgr->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
"write function failed");
}
siglongjmp (errmgr->setjmp_buffer, 1);
g_assert_not_reached ();
@ -1171,19 +1171,19 @@ real_save_jpeg (GdkPixbuf *pixbuf,
*/
buf = g_try_malloc (w * 3 * sizeof (guchar));
if (!buf) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file"));
return FALSE;
}
if (to_callback) {
to_callback_destmgr.buffer = g_try_malloc (TO_FUNCTION_BUF_SIZE);
if (!to_callback_destmgr.buffer) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Couldn't allocate memory for loading JPEG file"));
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));
if(!context->header) {
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;
}
@ -199,7 +199,7 @@ gdk_pixbuf__pcx_begin_load(GdkPixbufModuleSizeFunc size_func,
if(!context->buf) {
g_free(context->header);
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;
}
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->buf_pos + size > context->buf_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;
}
}
@ -598,7 +598,7 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
width = context->width;
height = context->height;
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;
}
if (context->size_func)
@ -610,7 +610,7 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
switch(context->bpp) {
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;
break;
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);
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;
}
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);
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;
}
if(context->bpp == 8) {
context->p_data = g_try_malloc(sizeof(guchar) * context->width * context->height);
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;
}
}
@ -671,7 +671,7 @@ gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
if(context->current_task == PCX_TASK_LOAD_DATA) {
switch(context->bpp) {
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;
break;
case 1:
@ -701,14 +701,14 @@ gdk_pixbuf__pcx_stop_load(gpointer data, GError **error)
struct pcx_context *context = (struct pcx_context *)data;
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);
return FALSE;
}
if(context->current_task == PCX_TASK_LOAD_PALETTE) {
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);
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);
if (bit_depth < 1 || bit_depth > 16) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Bits per channel of PNG image is invalid."));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Bits per channel of PNG image is invalid."));
return FALSE;
}
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 */
if (width == 0 || height == 0) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG has zero width or height."));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG has zero width or height."));
return FALSE;
}
if (bit_depth != 8) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Bits per channel of transformed PNG is not 8."));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Bits per channel of transformed PNG is not 8."));
return FALSE;
}
if ( ! (color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_RGB_ALPHA) ) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG not RGB or RGBA."));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG not RGB or RGBA."));
return FALSE;
}
channels = png_get_channels(png_read_ptr, png_info_ptr);
if ( ! (channels == 3 || channels == 4) ) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG has unsupported number of channels, must be 3 or 4."));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Transformed PNG has unsupported number of channels, must be 3 or 4."));
return FALSE;
}
return TRUE;
@ -304,10 +304,10 @@ gdk_pixbuf__png_image_load (FILE *f, GError **error)
if (!pixbuf) {
if (error && *error == NULL) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load PNG file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load PNG file"));
}
@ -612,10 +612,10 @@ png_info_callback (png_structp png_read_ptr,
if (w == 0 || h == 0) {
lc->fatal_error_occurred = TRUE;
if (lc->error && *lc->error == NULL) {
g_set_error (lc->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED,
_("Transformed PNG has zero width or height."));
g_set_error_literal (lc->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED,
_("Transformed PNG has zero width or height."));
}
return;
}
@ -678,10 +678,10 @@ png_row_callback (png_structp png_read_ptr,
if (row_num >= lc->pixbuf->height) {
lc->fatal_error_occurred = TRUE;
if (lc->error && *lc->error == NULL) {
g_set_error (lc->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Fatal error reading PNG image file"));
g_set_error_literal (lc->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Fatal error reading PNG image file"));
}
return;
}
@ -819,18 +819,18 @@ static gboolean real_save_png (GdkPixbuf *pixbuf,
gchar *key = *kiter + 6;
int len = strlen (key);
if (len <= 1 || len > 79) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION,
_("Keys for PNG text chunks must have at least 1 and at most 79 characters."));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION,
_("Keys for PNG text chunks must have at least 1 and at most 79 characters."));
return FALSE;
}
for (i = 0; i < len; i++) {
if ((guchar) key[i] > 127) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION,
_("Keys for PNG text chunks must be ASCII characters."));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_BAD_OPTION,
_("Keys for PNG text chunks must be ASCII characters."));
return FALSE;
}
}

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@
* Authors: Mark Crichton <crichton@gimp.org>
* Federico Mena-Quintero <federico@gimp.org>
* 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
* modify it under the terms of the GNU Lesser General Public
@ -128,9 +128,9 @@ tiff_set_error (GError **error,
global_error = NULL;
}
else {
g_set_error (error,
GDK_PIXBUF_ERROR,
error_code, msg);
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
error_code, msg);
}
}
@ -169,28 +169,28 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
}
if (width <= 0 || height <= 0) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Width or height of TIFF image is zero"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Width or height of TIFF image is zero"));
return NULL;
}
rowstride = width * 4;
if (rowstride / 4 != width) { /* overflow */
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Dimensions of TIFF image too large"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Dimensions of TIFF image too large"));
return NULL;
}
bytes = height * rowstride;
if (bytes / rowstride != height) { /* overflow */
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Dimensions of TIFF image too large"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Dimensions of TIFF image too large"));
return NULL;
}
@ -211,10 +211,10 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
pixels = g_try_malloc (bytes);
if (!pixels) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file"));
return NULL;
}
@ -223,10 +223,10 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
free_buffer, NULL);
if (!pixbuf) {
g_free (pixels);
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file"));
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);
if (!make_available_at_least (context, size)) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file"));
return FALSE;
}
@ -754,10 +754,10 @@ save_to_file_cb (const gchar *buf,
}
if (count) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED,
_("Couldn't write to TIFF file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED,
_("Couldn't write to TIFF file"));
return FALSE;
}

View File

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

View File

@ -289,20 +289,20 @@ gdk_pixbuf__xbm_image_load_real (FILE *f,
GdkPixbuf *pixbuf;
if (!read_bitmap_file_data (f, &w, &h, &data, &x_hot, &y_hot)) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid XBM file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid XBM file"));
return NULL;
}
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, w, h);
if (pixbuf == NULL) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load XBM image file"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to load XBM image file"));
return NULL;
}
@ -447,10 +447,10 @@ gdk_pixbuf__xbm_image_load_increment (gpointer data,
if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
gint save_errno = errno;
context->all_okay = FALSE;
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
_("Failed to write to temporary file when loading XBM image"));
g_set_error_literal (error,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
_("Failed to write to temporary file when loading XBM image"));
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);
if (!buffer) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("No XPM header found"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("No XPM header found"));
return NULL;
}
items = sscanf (buffer, "%d %d %d %d %d %d", &w, &h, &n_col, &cpp, &x_hot, &y_hot);
if (items != 4 && items != 6) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid XPM header"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Invalid XPM header"));
return NULL;
}
if (w <= 0) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM file has image width <= 0"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM file has image width <= 0"));
return NULL;
}
if (h <= 0) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM file has image height <= 0"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM file has image height <= 0"));
return NULL;
}
if (cpp <= 0 || cpp >= 32) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM has invalid number of chars per pixel"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM has invalid number of chars per pixel"));
return NULL;
}
if (n_col <= 0 ||
n_col >= G_MAXINT / (cpp + 1) ||
n_col >= G_MAXINT / sizeof (XPMColor)) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM file has invalid number of colors"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("XPM file has invalid number of colors"));
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));
if (!name_buf) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for loading XPM image"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for loading XPM image"));
g_hash_table_destroy (color_hash);
return NULL;
}
colors = (XPMColor *) g_try_malloc (sizeof (XPMColor) * n_col);
if (!colors) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for loading XPM image"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for loading XPM image"));
g_hash_table_destroy (color_hash);
g_free (name_buf);
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);
if (!buffer) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Cannot read XPM colormap"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Cannot read XPM colormap"));
g_hash_table_destroy (color_hash);
g_free (name_buf);
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);
if (!pixbuf) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for loading XPM image"));
g_set_error_literal (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Cannot allocate memory for loading XPM image"));
g_hash_table_destroy (color_hash);
g_free (colors);
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) {
gint save_errno = errno;
context->all_okay = FALSE;
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
_("Failed to write to temporary file when loading XPM image"));
g_set_error_literal (error,
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
_("Failed to write to temporary file when loading XPM image"));
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))
{
g_set_error (error,
GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
_("Cannot change to folder because it is not local"));
g_set_error_literal (error,
GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
_("Cannot change to folder because it is not local"));
g_object_unref (file);
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_set_error (error,
GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
_("Could not obtain root folder"));
g_set_error_literal (error,
GTK_FILE_CHOOSER_ERROR,
GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
_("Could not obtain root folder"));
return NULL;
}

View File

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

View File

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

View File

@ -734,7 +734,7 @@ post_parse_hook (GOptionContext *context,
g_set_error (error,
G_OPTION_ERROR,
G_OPTION_ERROR_FAILED,
"cannot open display: %s",
_("Cannot open display: %s"),
display_name ? display_name : "" );
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))
{
g_set_error (error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file"));
g_set_error_literal (error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file"));
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);
if (!group_name || !g_key_file_has_group (key_file, group_name))
{
g_set_error (error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file"));
g_set_error_literal (error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file"));
retval = FALSE;
goto out;
}
@ -859,10 +859,10 @@ gtk_paper_size_new_from_key_file (GKeyFile *key_file,
width, height, GTK_UNIT_MM);
else
{
g_set_error (error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file"));
g_set_error_literal (error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INVALID_FILE,
_("Not a valid page setup file"));
retval = FALSE;
goto out;
}

View File

@ -1483,10 +1483,10 @@ _gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
if (!printdlgex)
{
result = GTK_PRINT_OPERATION_RESULT_ERROR;
g_set_error (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_NOMEM,
_("Not enough free memory"));
g_set_error_literal (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_NOMEM,
_("Not enough free memory"));
goto out;
}
@ -1506,10 +1506,10 @@ _gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
if (!page_ranges)
{
result = GTK_PRINT_OPERATION_RESULT_ERROR;
g_set_error (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_NOMEM,
_("Not enough free memory"));
g_set_error_literal (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_NOMEM,
_("Not enough free memory"));
goto out;
}
@ -1554,30 +1554,30 @@ _gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
{
result = GTK_PRINT_OPERATION_RESULT_ERROR;
if (hResult == E_OUTOFMEMORY)
g_set_error (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_NOMEM,
_("Not enough free memory"));
g_set_error_literal (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_NOMEM,
_("Not enough free memory"));
else if (hResult == E_INVALIDARG)
g_set_error (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR,
_("Invalid argument to PrintDlgEx"));
g_set_error_literal (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR,
_("Invalid argument to PrintDlgEx"));
else if (hResult == E_POINTER)
g_set_error (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR,
_("Invalid pointer to PrintDlgEx"));
g_set_error_literal (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR,
_("Invalid pointer to PrintDlgEx"));
else if (hResult == E_HANDLE)
g_set_error (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR,
_("Invalid handle to PrintDlgEx"));
g_set_error_literal (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_INTERNAL_ERROR,
_("Invalid handle to PrintDlgEx"));
else /* E_FAIL */
g_set_error (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_GENERAL,
_("Unspecified error"));
g_set_error_literal (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_GENERAL,
_("Unspecified error"));
goto out;
}
@ -1626,10 +1626,10 @@ _gtk_print_operation_platform_backend_run_dialog (GtkPrintOperation *op,
if (job_id <= 0)
{
result = GTK_PRINT_OPERATION_RESULT_ERROR;
g_set_error (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_GENERAL,
_("Error from StartDoc"));
g_set_error_literal (&priv->error,
GTK_PRINT_ERROR,
GTK_PRINT_ERROR_GENERAL,
_("Error from StartDoc"));
*do_print = FALSE;
cairo_surface_destroy (op_win32->surface);
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_free (headers);
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_PARSE,
_("Serialized data is malformed"));
g_set_error_literal (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_PARSE,
_("Serialized data is malformed"));
return NULL;
}
@ -1851,10 +1851,10 @@ _gtk_text_buffer_deserialize_rich_text (GtkTextBuffer *register_buffer,
header = headers->data;
if (!header_is (header, "GTKTEXTBUFFERCONTENTS-0001"))
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_PARSE,
_("Serialized data is malformed. First section isn't GTKTEXTBUFFERCONTENTS-0001"));
g_set_error_literal (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_PARSE,
_("Serialized data is malformed. First section isn't GTKTEXTBUFFERCONTENTS-0001"));
retval = FALSE;
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);
if (stat (filename, &st) != 0) {
int errsv = errno;
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (errno),
g_file_error_from_errno (errsv),
_("Could not get information for file '%s': %s"),
filename, g_strerror (errno));
filename, g_strerror (errsv));
return NULL;
}
@ -212,11 +214,13 @@ my_new_from_file_at_size (const char *filename,
f = fopen (filename, "rb");
if (!f) {
int errsv = errno;
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (errno),
g_file_error_from_errno (errsv),
_("Failed to open file '%s': %s"),
filename, g_strerror (errno));
filename, g_strerror (errsv));
return NULL;
}