summaryrefslogtreecommitdiff
path: root/libappstream-glib/as-image.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-03-17 09:15:16 +0000
committerRichard Hughes <richard@hughsie.com>2014-03-17 09:15:16 +0000
commit1fa4ca1154e2a3dccfb2af020a504909baa722c5 (patch)
treeb3571f4294f9d09200e720cd01dbd7ff12ddb1ff /libappstream-glib/as-image.c
parent342fa73e00223f5b4a35b22f3517ef75f112f60a (diff)
downloadappstream-glib-1fa4ca1154e2a3dccfb2af020a504909baa722c5.tar.gz
trivial: Never use atoi()
Diffstat (limited to 'libappstream-glib/as-image.c')
-rw-r--r--libappstream-glib/as-image.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libappstream-glib/as-image.c b/libappstream-glib/as-image.c
index 3512a4d..87c9bf3 100644
--- a/libappstream-glib/as-image.c
+++ b/libappstream-glib/as-image.c
@@ -21,8 +21,6 @@
#include "config.h"
-#include <stdlib.h>
-
#include "as-image.h"
#include "as-node.h"
#include "as-utils.h"
@@ -218,13 +216,14 @@ as_image_node_parse (AsImage *image, GNode *node, GError **error)
AsImagePrivate *priv = GET_PRIVATE (image);
const gchar *tmp;
gchar *taken;
-
- tmp = as_node_get_attribute (node, "width");
- if (tmp != NULL)
- as_image_set_width (image, atoi (tmp));
- tmp = as_node_get_attribute (node, "height");
- if (tmp != NULL)
- as_image_set_height (image, atoi (tmp));
+ guint size;
+
+ size = as_node_get_attribute_as_int (node, "width");
+ if (size != G_MAXUINT)
+ as_image_set_width (image, size);
+ size = as_node_get_attribute_as_int (node, "height");
+ if (size != G_MAXUINT)
+ as_image_set_height (image, size);
tmp = as_node_get_attribute (node, "type");
if (tmp != NULL)
as_image_set_kind (image, as_image_kind_from_string (tmp));