summaryrefslogtreecommitdiff
path: root/gtk/gtkcelllayout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2007-07-03 17:22:24 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2007-07-03 17:22:24 +0000
commit22fa07d55d0831f27a648b179fda8bf07f4310c0 (patch)
tree1caffa3b53897516082f7979c497998f3fde8621 /gtk/gtkcelllayout.c
parent34e44d63ea119511fb1f3612537438d7eaf7609d (diff)
downloadgtk+-22fa07d55d0831f27a648b179fda8bf07f4310c0.tar.gz
Report errors about integer parsing back up. (#452988)
2007-07-03 Matthias Clasen <mclasen@redhat.com> * gtk/gtkcelllayout.c (attributes_text_element): Report errors about integer parsing back up. (#452988) * tests/buildertest.c: Add an extra check. svn path=/trunk/; revision=18364
Diffstat (limited to 'gtk/gtkcelllayout.c')
-rw-r--r--gtk/gtkcelllayout.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gtk/gtkcelllayout.c b/gtk/gtkcelllayout.c
index 9fba57bf0f..7ec9356945 100644
--- a/gtk/gtkcelllayout.c
+++ b/gtk/gtkcelllayout.c
@@ -17,9 +17,10 @@
* Boston, MA 02111-1307, USA.
*/
+#include <config.h>
#include <string.h>
#include <stdlib.h>
-#include <config.h>
+#include <errno.h>
#include "gtkcelllayout.h"
#include "gtkintl.h"
#include "gtkalias.h"
@@ -346,12 +347,27 @@ attributes_text_element (GMarkupParseContext *context,
GError **error)
{
AttributesSubParserData *parser_data = (AttributesSubParserData*)user_data;
+ glong l;
+ gchar *endptr;
if (!parser_data->attr_name)
return;
+
+ errno = 0;
+ l = strtol (text, &endptr, 0);
+ if (errno || endptr == text)
+ {
+ g_set_error (error,
+ GTK_BUILDER_ERROR,
+ GTK_BUILDER_ERROR_INVALID_VALUE,
+ "Could not parse integer `%s'",
+ text);
+ return;
+ }
+
gtk_cell_layout_add_attribute (parser_data->cell_layout,
parser_data->renderer,
- parser_data->attr_name, atoi (text));
+ parser_data->attr_name, l);
g_free (parser_data->attr_name);
parser_data->attr_name = NULL;
}