4
* An object oriented GL/GLES Abstraction/Utility Layer
6
* Copyright (C) 2011 Intel Corporation.
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2 of the License, or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the
20
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
* Boston, MA 02111-1307, USA.
24
* Robert Bragg <robert@linux.intel.com>
31
#include "cogl-types.h"
32
#include "cogl-util.h"
33
#include "cogl-error-private.h"
38
cogl_error_free (CoglError *error)
40
g_error_free ((GError *)error);
44
cogl_error_copy (CoglError *error)
46
return (CoglError *)g_error_copy ((GError *)error);
50
cogl_error_matches (CoglError *error,
54
return g_error_matches ((GError *)error, domain, code);
57
#define ERROR_OVERWRITTEN_WARNING \
58
"CoglError set over the top of a previous CoglError or " \
59
"uninitialized memory.\nThis indicates a bug in someone's " \
60
"code. You must ensure an error is NULL before it's set.\n" \
61
"The overwriting error message was: %s"
64
_cogl_set_error (CoglError **error,
74
va_start (args, format);
78
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
83
new = g_error_new_valist (domain, code, format, args);
87
*error = (CoglError *)new;
89
g_warning (ERROR_OVERWRITTEN_WARNING, new->message);
93
_cogl_set_error_literal (CoglError **error,
98
_cogl_set_error (error, domain, code, "%s", message);
102
_cogl_propagate_error (CoglError **dest,
105
_COGL_RETURN_IF_FAIL (src != NULL);
108
cogl_error_free (src);
110
g_warning (ERROR_OVERWRITTEN_WARNING, src->message);
115
/* This function is only used from the gdk-pixbuf image backend so it
116
* should only be called if we are using the system GLib. It would be
117
* difficult to get this to work without the system glib because we
118
* would need to somehow call the same g_error_free function that
119
* gdk-pixbuf is using */
120
#ifdef COGL_HAS_GLIB_SUPPORT
122
_cogl_propagate_gerror (CoglError **dest,
125
_cogl_propagate_error (dest, (CoglError *) src);
127
#endif /* COGL_HAS_GLIB_SUPPORT */