[libgxps] Use g_ascii_strtoll() instead of strtol in gxps_value_get_int()
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] Use g_ascii_strtoll() instead of strtol in gxps_value_get_int()
- Date: Sun, 6 Nov 2011 11:23:14 +0000 (UTC)
commit c5f7d532226bdeaf9bfb92868257c54fa70b056c
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Thu Nov 3 19:07:03 2011 +0100
Use g_ascii_strtoll() instead of strtol in gxps_value_get_int()
libgxps/gxps-parse-utils.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/libgxps/gxps-parse-utils.c b/libgxps/gxps-parse-utils.c
index 9854103..b92eca2 100644
--- a/libgxps/gxps-parse-utils.c
+++ b/libgxps/gxps-parse-utils.c
@@ -256,17 +256,18 @@ gboolean
gxps_value_get_int (const gchar *value,
gint *int_value)
{
- long l;
+ gint64 result;
gchar *endptr;
+ if (!value)
+ return FALSE;
+
errno = 0;
- l = strtol (value, &endptr, 0);
- if (errno || endptr == value) {
- g_warning ("Error converting value %s to int\n", value);
+ result = g_ascii_strtoll (value, &endptr, 10);
+ if (errno || endptr == value || result > G_MAXINT || result < G_MININT)
return FALSE;
- }
- *int_value = (gint)l;
+ *int_value = result;
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]