[libgdata] core: Use g_ascii_strto[u]ll() instead of strto[u]l()



commit 7cc30298b050da7a02eb990b6ad2dc40b4f57dbc
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Aug 9 16:00:17 2014 +0100

    core: Use g_ascii_strto[u]ll() instead of strto[u]l()
    
    The GLib functions are locale-independent. While there are few
    situations where a locale-independent server-provided string would be
    parsed differently by strtoul() in different user locales, it’s best to
    be safe (and consistent with our use of g_ascii_strtod(), which more
    easily causes problems).

 configure.ac                                      |    2 --
 gdata/atom/gdata-link.c                           |    2 +-
 gdata/exif/gdata-exif-tags.c                      |    2 +-
 gdata/gd/gdata-gd-feed-link.c                     |    2 +-
 gdata/gd/gdata-gd-reminder.c                      |    6 +++---
 gdata/gdata-batch-feed.c                          |    4 ++--
 gdata/gdata-feed.c                                |    6 +++---
 gdata/media/gdata-media-content.c                 |    8 ++++----
 gdata/media/gdata-media-thumbnail.c               |    8 ++++----
 gdata/services/calendar/gdata-calendar-calendar.c |    2 +-
 gdata/services/calendar/gdata-calendar-event.c    |    2 +-
 gdata/services/calendar/gdata-calendar-feed.c     |    2 +-
 gdata/services/picasaweb/gdata-picasaweb-album.c  |    8 ++++----
 gdata/services/picasaweb/gdata-picasaweb-file.c   |   10 +++++-----
 gdata/services/picasaweb/gdata-picasaweb-user.c   |    2 +-
 gdata/services/youtube/gdata-youtube-content.c    |    2 +-
 gdata/services/youtube/gdata-youtube-group.c      |    2 +-
 gdata/services/youtube/gdata-youtube-video.c      |   10 +++++-----
 18 files changed, 39 insertions(+), 41 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 69104a4..4d0ad8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,8 +149,6 @@ PKG_CHECK_MODULES(UHTTPMOCK, libuhttpmock-0.0)
 # Various necessary functions and headers
 AC_CHECK_FUNCS([strchr])
 AC_CHECK_FUNCS([strstr])
-AC_CHECK_FUNCS([strtol])
-AC_CHECK_FUNCS([strtoul])
 AC_CHECK_HEADERS([sys/time.h])
 
 # Internationalisation support
diff --git a/gdata/atom/gdata-link.c b/gdata/atom/gdata-link.c
index 5c927e6..3e3d435 100644
--- a/gdata/atom/gdata-link.c
+++ b/gdata/atom/gdata-link.c
@@ -329,7 +329,7 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
        if (length == NULL)
                self->priv->length = -1;
        else
-               self->priv->length = strtoul ((gchar*) length, NULL, 10);
+               self->priv->length = g_ascii_strtoull ((gchar*) length, NULL, 10);
        xmlFree (length);
 
        return TRUE;
diff --git a/gdata/exif/gdata-exif-tags.c b/gdata/exif/gdata-exif-tags.c
index cd7bf45..51bd223 100644
--- a/gdata/exif/gdata-exif-tags.c
+++ b/gdata/exif/gdata-exif-tags.c
@@ -146,7 +146,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
        } else if (xmlStrcmp (node->name, (xmlChar*) "iso") == 0) {
                /* exif:iso */
                xmlChar *iso = xmlNodeListGetString (doc, node->children, TRUE);
-               self->priv->iso = strtol ((gchar*) iso, NULL, 10);
+               self->priv->iso = g_ascii_strtoll ((gchar*) iso, NULL, 10);
                xmlFree (iso);
        } else if (xmlStrcmp (node->name, (xmlChar*) "time") == 0) {
                /* exif:time */
diff --git a/gdata/gd/gdata-gd-feed-link.c b/gdata/gd/gdata-gd-feed-link.c
index 3354895..eb75106 100644
--- a/gdata/gd/gdata-gd-feed-link.c
+++ b/gdata/gd/gdata-gd-feed-link.c
@@ -245,7 +245,7 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
        self->priv->uri = (gchar*) href;
 
        count_hint = xmlGetProp (root_node, (xmlChar*) "countHint");
-       self->priv->count_hint = (count_hint != NULL) ? strtol ((char*) count_hint, NULL, 10) : -1;
+       self->priv->count_hint = (count_hint != NULL) ? g_ascii_strtoll ((char*) count_hint, NULL, 10) : -1;
        xmlFree (count_hint);
 
        return gdata_parser_boolean_from_property (root_node, "readOnly", &(self->priv->is_read_only), 0, 
error);
diff --git a/gdata/gd/gdata-gd-reminder.c b/gdata/gd/gdata-gd-reminder.c
index fab5f23..2e8d7b7 100644
--- a/gdata/gd/gdata-gd-reminder.c
+++ b/gdata/gd/gdata-gd-reminder.c
@@ -263,15 +263,15 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
        /* Relative time */
        relative_time = xmlGetProp (root_node, (xmlChar*) "days");
        if (relative_time != NULL) {
-               relative_time_int = strtol ((gchar*) relative_time, NULL, 10) * 60 * 24;
+               relative_time_int = g_ascii_strtoll ((gchar*) relative_time, NULL, 10) * 60 * 24;
        } else {
                relative_time = xmlGetProp (root_node, (xmlChar*) "hours");
                if (relative_time != NULL) {
-                       relative_time_int = strtol ((gchar*) relative_time, NULL, 10) * 60;
+                       relative_time_int = g_ascii_strtoll ((gchar*) relative_time, NULL, 10) * 60;
                } else {
                        relative_time = xmlGetProp (root_node, (xmlChar*) "minutes");
                        if (relative_time != NULL)
-                               relative_time_int = strtol ((gchar*) relative_time, NULL, 10);
+                               relative_time_int = g_ascii_strtoll ((gchar*) relative_time, NULL, 10);
                }
        }
        xmlFree (relative_time);
diff --git a/gdata/gdata-batch-feed.c b/gdata/gdata-batch-feed.c
index 26e8320..16d2b48 100644
--- a/gdata/gdata-batch-feed.c
+++ b/gdata/gdata-batch-feed.c
@@ -81,7 +81,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                        if (xmlStrcmp (entry_node->name, (xmlChar*) "id") == 0) {
                                /* batch:id */
                                xmlChar *id_string = xmlNodeListGetString (doc, entry_node->children, TRUE);
-                               id = strtoul ((char*) id_string, NULL, 10);
+                               id = g_ascii_strtoull ((char*) id_string, NULL, 10);
                                xmlFree (id_string);
                        } else if (xmlStrcmp (entry_node->name, (xmlChar*) "status") == 0) {
                                /* batch:status */
@@ -89,7 +89,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                                xmlNode *child_node;
 
                                status_code_string = xmlGetProp (entry_node, (xmlChar*) "code");
-                               status_code = strtoul ((char*) status_code_string, NULL, 10);
+                               status_code = g_ascii_strtoull ((char*) status_code_string, NULL, 10);
                                xmlFree (status_code_string);
 
                                status_reason = (gchar*) xmlGetProp (entry_node, (xmlChar*) "reason");
diff --git a/gdata/gdata-feed.c b/gdata/gdata-feed.c
index b82fb21..55492fd 100644
--- a/gdata/gdata-feed.c
+++ b/gdata/gdata-feed.c
@@ -491,7 +491,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                        if (total_results_string == NULL)
                                return gdata_parser_error_required_content_missing (node, error);
 
-                       self->priv->total_results = strtoul ((gchar*) total_results_string, NULL, 10);
+                       self->priv->total_results = g_ascii_strtoull ((gchar*) total_results_string, NULL, 
10);
                        xmlFree (total_results_string);
                } else if (xmlStrcmp (node->name, (xmlChar*) "startIndex") == 0) {
                        /* openSearch:startIndex */
@@ -506,7 +506,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                        if (start_index_string == NULL)
                                return gdata_parser_error_required_content_missing (node, error);
 
-                       self->priv->start_index = strtoul ((gchar*) start_index_string, NULL, 10);
+                       self->priv->start_index = g_ascii_strtoull ((gchar*) start_index_string, NULL, 10);
                        xmlFree (start_index_string);
                } else if (xmlStrcmp (node->name, (xmlChar*) "itemsPerPage") == 0) {
                        /* openSearch:itemsPerPage */
@@ -521,7 +521,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                        if (items_per_page_string == NULL)
                                return gdata_parser_error_required_content_missing (node, error);
 
-                       self->priv->items_per_page = strtoul ((gchar*) items_per_page_string, NULL, 10);
+                       self->priv->items_per_page = g_ascii_strtoull ((gchar*) items_per_page_string, NULL, 
10);
                        xmlFree (items_per_page_string);
                } else {
                        return GDATA_PARSABLE_CLASS (gdata_feed_parent_class)->parse_xml (parsable, doc, 
node, user_data, error);
diff --git a/gdata/media/gdata-media-content.c b/gdata/media/gdata-media-content.c
index 4dd936c..9d6527b 100644
--- a/gdata/media/gdata-media-content.c
+++ b/gdata/media/gdata-media-content.c
@@ -338,21 +338,21 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
 
        /* Parse duration */
        duration = xmlGetProp (root_node, (xmlChar*) "duration");
-       duration_int64 = (duration == NULL) ? 0 : strtol ((gchar*) duration, NULL, 10);
+       duration_int64 = (duration == NULL) ? 0 : g_ascii_strtoll ((gchar*) duration, NULL, 10);
        xmlFree (duration);
 
        /* Parse filesize */
        filesize = xmlGetProp (root_node, (xmlChar*) "fileSize");
-       filesize_ulong = (filesize == NULL) ? 0 : strtoul ((gchar*) filesize, NULL, 10);
+       filesize_ulong = (filesize == NULL) ? 0 : g_ascii_strtoull ((gchar*) filesize, NULL, 10);
        xmlFree (filesize);
 
        /* Parse height and width */
        height = xmlGetProp (root_node, (xmlChar*) "height");
-       height_uint = (height == NULL) ? 0 : strtoul ((gchar*) height, NULL, 10);
+       height_uint = (height == NULL) ? 0 : g_ascii_strtoull ((gchar*) height, NULL, 10);
        xmlFree (height);
 
        width = xmlGetProp (root_node, (xmlChar*) "width");
-       width_uint = (width == NULL) ? 0 : strtoul ((gchar*) width, NULL, 10);
+       width_uint = (width == NULL) ? 0 : g_ascii_strtoull ((gchar*) width, NULL, 10);
        xmlFree (width);
 
        /* Other properties */
diff --git a/gdata/media/gdata-media-thumbnail.c b/gdata/media/gdata-media-thumbnail.c
index 4008d9e..13fa96e 100644
--- a/gdata/media/gdata-media-thumbnail.c
+++ b/gdata/media/gdata-media-thumbnail.c
@@ -200,11 +200,11 @@ parse_time (const gchar *time_string)
 
        g_return_val_if_fail (time_string != NULL, 0);
 
-       hours = strtoul (time_string, &end_pointer, 10);
+       hours = g_ascii_strtoull (time_string, &end_pointer, 10);
        if (end_pointer != time_string + 2)
                return -1;
 
-       minutes = strtoul (time_string + 3, &end_pointer, 10);
+       minutes = g_ascii_strtoull (time_string + 3, &end_pointer, 10);
        if (end_pointer != time_string + 5)
                return -1;
 
@@ -251,11 +251,11 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
 
        /* Get the width and height */
        width = xmlGetProp (root_node, (xmlChar*) "width");
-       width_uint = (width == NULL) ? 0 : strtoul ((gchar*) width, NULL, 10);
+       width_uint = (width == NULL) ? 0 : g_ascii_strtoull ((gchar*) width, NULL, 10);
        xmlFree (width);
 
        height = xmlGetProp (root_node, (xmlChar*) "height");
-       height_uint = (height == NULL) ? 0 : strtoul ((gchar*) height, NULL, 10);
+       height_uint = (height == NULL) ? 0 : g_ascii_strtoull ((gchar*) height, NULL, 10);
        xmlFree (height);
 
        /* Get and parse the time */
diff --git a/gdata/services/calendar/gdata-calendar-calendar.c 
b/gdata/services/calendar/gdata-calendar-calendar.c
index 713fc83..dcfcbcf 100644
--- a/gdata/services/calendar/gdata-calendar-calendar.c
+++ b/gdata/services/calendar/gdata-calendar-calendar.c
@@ -380,7 +380,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                        xmlChar *times_cleaned = xmlGetProp (node, (xmlChar*) "value");
                        if (times_cleaned == NULL)
                                return gdata_parser_error_required_property_missing (node, "value", error);
-                       self->priv->times_cleaned = strtoul ((gchar*) times_cleaned, NULL, 10);
+                       self->priv->times_cleaned = g_ascii_strtoull ((gchar*) times_cleaned, NULL, 10);
                        xmlFree (times_cleaned);
                } else if (xmlStrcmp (node->name, (xmlChar*) "hidden") == 0) {
                        /* gCal:hidden */
diff --git a/gdata/services/calendar/gdata-calendar-event.c b/gdata/services/calendar/gdata-calendar-event.c
index ed8c554..498dc4d 100644
--- a/gdata/services/calendar/gdata-calendar-event.c
+++ b/gdata/services/calendar/gdata-calendar-event.c
@@ -572,7 +572,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                        if (value == NULL)
                                return gdata_parser_error_required_property_missing (node, "value", error);
                        else
-                               value_uint = strtoul ((gchar*) value, NULL, 10);
+                               value_uint = g_ascii_strtoull ((gchar*) value, NULL, 10);
                        xmlFree (value);
 
                        gdata_calendar_event_set_sequence (self, value_uint);
diff --git a/gdata/services/calendar/gdata-calendar-feed.c b/gdata/services/calendar/gdata-calendar-feed.c
index a54cf0c..a6021b0 100644
--- a/gdata/services/calendar/gdata-calendar-feed.c
+++ b/gdata/services/calendar/gdata-calendar-feed.c
@@ -147,7 +147,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                xmlChar *times_cleaned = xmlGetProp (node, (xmlChar*) "value");
                if (times_cleaned == NULL)
                        return gdata_parser_error_required_property_missing (node, "value", error);
-               self->priv->times_cleaned = strtoul ((gchar*) times_cleaned, NULL, 10);
+               self->priv->times_cleaned = g_ascii_strtoull ((gchar*) times_cleaned, NULL, 10);
                xmlFree (times_cleaned);
        } else {
                return GDATA_PARSABLE_CLASS (gdata_calendar_feed_parent_class)->parse_xml (parsable, doc, 
node, user_data, error);
diff --git a/gdata/services/picasaweb/gdata-picasaweb-album.c 
b/gdata/services/picasaweb/gdata-picasaweb-album.c
index 0b41cfe..db9ba87 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-album.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-album.c
@@ -709,7 +709,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                                return gdata_parser_error_required_content_missing (node, error);
                        }
 
-                       self->priv->num_photos = strtoul ((char*) num_photos, NULL, 10);
+                       self->priv->num_photos = g_ascii_strtoull ((char*) num_photos, NULL, 10);
                        xmlFree (num_photos);
                } else if (xmlStrcmp (node->name, (xmlChar*) "numphotosremaining") == 0) {
                        /* gphoto:numphotosremaining */
@@ -719,7 +719,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                                return gdata_parser_error_required_content_missing (node, error);
                        }
 
-                       self->priv->num_photos_remaining = strtoul ((char*) num_photos_remaining, NULL, 10);
+                       self->priv->num_photos_remaining = g_ascii_strtoull ((char*) num_photos_remaining, 
NULL, 10);
                        xmlFree (num_photos_remaining);
                } else if (xmlStrcmp (node->name, (xmlChar*) "bytesUsed") == 0) {
                        /* gphoto:bytesUsed */
@@ -729,7 +729,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                                return gdata_parser_error_required_content_missing (node, error);
                        }
 
-                       self->priv->bytes_used = strtol ((char*) bytes_used, NULL, 10);
+                       self->priv->bytes_used = g_ascii_strtoll ((char*) bytes_used, NULL, 10);
                        xmlFree (bytes_used);
                } else if (xmlStrcmp (node->name, (xmlChar*) "commentingEnabled") == 0) {
                        /* gphoto:commentingEnabled */
@@ -750,7 +750,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                                return gdata_parser_error_required_content_missing (node, error);
                        }
 
-                       self->priv->comment_count = strtoul ((char*) comment_count, NULL, 10);
+                       self->priv->comment_count = g_ascii_strtoull ((char*) comment_count, NULL, 10);
                        xmlFree (comment_count);
                } else {
                        return GDATA_PARSABLE_CLASS (gdata_picasaweb_album_parent_class)->parse_xml 
(parsable, doc, node, user_data, error);
diff --git a/gdata/services/picasaweb/gdata-picasaweb-file.c b/gdata/services/picasaweb/gdata-picasaweb-file.c
index 30f9197..0f04cb9 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-file.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-file.c
@@ -921,17 +921,17 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                } else if (xmlStrcmp (node->name, (xmlChar*) "width") == 0) {
                        /* gphoto:width */
                        xmlChar *width = xmlNodeListGetString (doc, node->children, TRUE);
-                       self->priv->width = strtoul ((gchar*) width, NULL, 10);
+                       self->priv->width = g_ascii_strtoull ((gchar*) width, NULL, 10);
                        xmlFree (width);
                } else if (xmlStrcmp (node->name, (xmlChar*) "height") == 0) {
                        /* gphoto:height */
                        xmlChar *height = xmlNodeListGetString (doc, node->children, TRUE);
-                       self->priv->height = strtoul ((gchar*) height, NULL, 10);
+                       self->priv->height = g_ascii_strtoull ((gchar*) height, NULL, 10);
                        xmlFree (height);
                } else if (xmlStrcmp (node->name, (xmlChar*) "size") == 0) {
                        /* gphoto:size */
                        xmlChar *size = xmlNodeListGetString (doc, node->children, TRUE);
-                       self->priv->size = strtoul ((gchar*) size, NULL, 10);
+                       self->priv->size = g_ascii_strtoull ((gchar*) size, NULL, 10);
                        xmlFree (size);
                } else if (xmlStrcmp (node->name, (xmlChar*) "timestamp") == 0) {
                        /* gphoto:timestamp */
@@ -953,7 +953,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                } else if (xmlStrcmp (node->name, (xmlChar*) "commentCount") == 0) {
                        /* gphoto:commentCount */
                        xmlChar *comment_count = xmlNodeListGetString (doc, node->children, TRUE);
-                       self->priv->comment_count = strtoul ((gchar*) comment_count, NULL, 10);
+                       self->priv->comment_count = g_ascii_strtoull ((gchar*) comment_count, NULL, 10);
                        xmlFree (comment_count);
                } else if (xmlStrcmp (node->name, (xmlChar*) "access") == 0) {
                        /* gphoto:access */
@@ -963,7 +963,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                } else if (xmlStrcmp (node->name, (xmlChar*) "rotation") == 0) {
                        /* gphoto:rotation */
                        xmlChar *rotation = xmlNodeListGetString (doc, node->children, TRUE);
-                       gdata_picasaweb_file_set_rotation (self, strtoul ((gchar*) rotation, NULL, 10));
+                       gdata_picasaweb_file_set_rotation (self, g_ascii_strtoull ((gchar*) rotation, NULL, 
10));
                        xmlFree (rotation);
                } else {
                        return GDATA_PARSABLE_CLASS (gdata_picasaweb_file_parent_class)->parse_xml (parsable, 
doc, node, user_data, error);
diff --git a/gdata/services/picasaweb/gdata-picasaweb-user.c b/gdata/services/picasaweb/gdata-picasaweb-user.c
index 4c91633..91aebe9 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-user.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-user.c
@@ -241,7 +241,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
        } else if (xmlStrcmp (node->name, (xmlChar*) "maxPhotosPerAlbum") == 0) {
                /* gphoto:max-photos-per-album */
                xmlChar *max_photos_per_album = xmlNodeListGetString (doc, node->children, TRUE);
-               self->priv->max_photos_per_album = strtol ((char*) max_photos_per_album, NULL, 10);
+               self->priv->max_photos_per_album = g_ascii_strtoll ((char*) max_photos_per_album, NULL, 10);
                xmlFree (max_photos_per_album);
        } else if (xmlStrcmp (node->name, (xmlChar*) "x-allowDownloads") == 0) { /* RHSTODO: see if this 
comes with the user */
                /* gphoto:allowDownloads */
diff --git a/gdata/services/youtube/gdata-youtube-content.c b/gdata/services/youtube/gdata-youtube-content.c
index 9480092..9a5d73f 100644
--- a/gdata/services/youtube/gdata-youtube-content.c
+++ b/gdata/services/youtube/gdata-youtube-content.c
@@ -114,7 +114,7 @@ pre_parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *root_node, gpointe
        GDATA_PARSABLE_CLASS (gdata_youtube_content_parent_class)->pre_parse_xml (parsable, doc, root_node, 
user_data, error);
 
        format = xmlGetProp (root_node, (xmlChar*) "format");
-       GDATA_YOUTUBE_CONTENT (parsable)->priv->format = (format == NULL) ? GDATA_YOUTUBE_FORMAT_UNKNOWN : 
strtoul ((gchar*) format, NULL, 10);
+       GDATA_YOUTUBE_CONTENT (parsable)->priv->format = (format == NULL) ? GDATA_YOUTUBE_FORMAT_UNKNOWN : 
g_ascii_strtoull ((gchar*) format, NULL, 10);
 
        return TRUE;
 }
diff --git a/gdata/services/youtube/gdata-youtube-group.c b/gdata/services/youtube/gdata-youtube-group.c
index b2fe427..49a7e18 100644
--- a/gdata/services/youtube/gdata-youtube-group.c
+++ b/gdata/services/youtube/gdata-youtube-group.c
@@ -112,7 +112,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                        if (duration == NULL)
                                return gdata_parser_error_required_property_missing (node, "seconds", error);
 
-                       self->priv->duration = strtoul ((gchar*) duration, NULL, 10);
+                       self->priv->duration = g_ascii_strtoull ((gchar*) duration, NULL, 10);
                        xmlFree (duration);
                } else if (xmlStrcmp (node->name, (xmlChar*) "private") == 0) {
                        /* yt:private */
diff --git a/gdata/services/youtube/gdata-youtube-video.c b/gdata/services/youtube/gdata-youtube-video.c
index f347ddf..2d5e7a2 100644
--- a/gdata/services/youtube/gdata-youtube-video.c
+++ b/gdata/services/youtube/gdata-youtube-video.c
@@ -744,12 +744,12 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                        view_count = xmlGetProp (node, (xmlChar*) "viewCount");
                        if (view_count == NULL)
                                return gdata_parser_error_required_property_missing (node, "viewCount", 
error);
-                       self->priv->view_count = strtoul ((gchar*) view_count, NULL, 10);
+                       self->priv->view_count = g_ascii_strtoull ((gchar*) view_count, NULL, 10);
                        xmlFree (view_count);
 
                        /* Favourite count */
                        favorite_count = xmlGetProp (node, (xmlChar*) "favoriteCount");
-                       self->priv->favorite_count = (favorite_count != NULL) ? strtoul ((gchar*) 
favorite_count, NULL, 10) : 0;
+                       self->priv->favorite_count = (favorite_count != NULL) ? g_ascii_strtoull ((gchar*) 
favorite_count, NULL, 10) : 0;
                        xmlFree (favorite_count);
                } else if (xmlStrcmp (node->name, (xmlChar*) "noembed") == 0) {
                        /* yt:noembed */
@@ -823,7 +823,7 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                        if (num_raters == NULL)
                                num_raters_uint = 0;
                        else
-                               num_raters_uint = strtoul ((gchar*) num_raters, NULL, 10);
+                               num_raters_uint = g_ascii_strtoull ((gchar*) num_raters, NULL, 10);
                        xmlFree (num_raters);
 
                        average = xmlGetProp (node, (xmlChar*) "average");
@@ -833,8 +833,8 @@ parse_xml (GDataParsable *parsable, xmlDoc *doc, xmlNode *node, gpointer user_da
                                average_double = g_ascii_strtod ((gchar*) average, NULL);
                        xmlFree (average);
 
-                       self->priv->rating.min = strtoul ((gchar*) min, NULL, 10);
-                       self->priv->rating.max = strtoul ((gchar*) max, NULL, 10);
+                       self->priv->rating.min = g_ascii_strtoull ((gchar*) min, NULL, 10);
+                       self->priv->rating.max = g_ascii_strtoull ((gchar*) max, NULL, 10);
                        self->priv->rating.count = num_raters_uint;
                        self->priv->rating.average = average_double;
                } else if (xmlStrcmp (node->name, (xmlChar*) "comments") == 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]