Fixed svace defects
[platform/core/location/maps-plugin-mapquest.git] / src / mapquest / mapquest_jsonparser.c
index e549a5c..eff18bf 100644 (file)
@@ -19,6 +19,7 @@
 #include "mapquest_jsonparser.h"
 #include "mapquest_queue.h"
 #include "mapquest_debug.h"
+#include "mapquest_util.h"
 
 #define ROUTE_UNIT_CONVERSION_MILE_TO_M(x)     (1609.34 * (x))
 #define ROUTE_UNIT_CONVERSION_MILE_TO_KM(x)    (1.60934 * (x))
@@ -300,7 +301,7 @@ static void __parse_revgeocode_address(JsonNode *node, mapquest_address_resp_s *
                                /* Street Address */
                                if (streetAddr != NULL) {
                                        (*respAddr)->street_add = (gchar *)g_malloc(strlen((char *)streetAddr) + 1);
-                                       strcpy((*respAddr)->street_add, (char *) streetAddr);
+                                       STRCPY((*respAddr)->street_add, (char *) streetAddr);
                                } else {
                                        MAP_DEBUG("street is NULL");
                                        (*respAddr)->street_add = NULL;
@@ -309,7 +310,7 @@ static void __parse_revgeocode_address(JsonNode *node, mapquest_address_resp_s *
                                /* Neighbourhood */
                                if (neighbourhood != NULL) {
                                        (*respAddr)->neighbourhood =    (gchar *)g_malloc(strlen((char *)neighbourhood) + 1);
-                                       strcpy((*respAddr)->neighbourhood, (char *) neighbourhood);
+                                       STRCPY((*respAddr)->neighbourhood, (char *) neighbourhood);
                                } else {
                                        MAP_DEBUG("neighbourhood is NULL");
                                        (*respAddr)->neighbourhood = NULL;
@@ -318,7 +319,7 @@ static void __parse_revgeocode_address(JsonNode *node, mapquest_address_resp_s *
                                /* City */
                                if (city != NULL) {
                                        (*respAddr)->city = (gchar *)g_malloc(strlen((char *)city) + 1);
-                                       strcpy((*respAddr)->city, (char *) city);
+                                       STRCPY((*respAddr)->city, (char *) city);
                                } else {
                                        MAP_DEBUG("city is NULL");
                                        (*respAddr)->city = NULL;
@@ -327,7 +328,7 @@ static void __parse_revgeocode_address(JsonNode *node, mapquest_address_resp_s *
                                /* County */
                                if (county != NULL) {
                                        (*respAddr)->county = (gchar *)g_malloc(strlen((char *)county) + 1);
-                                       strcpy((*respAddr)->county, (char *) county);
+                                       STRCPY((*respAddr)->county, (char *) county);
                                } else {
                                        MAP_DEBUG("county is NULL");
                                        (*respAddr)->county = NULL;
@@ -336,7 +337,7 @@ static void __parse_revgeocode_address(JsonNode *node, mapquest_address_resp_s *
                                /* State */
                                if (state != NULL) {
                                        (*respAddr)->state = (gchar *)g_malloc(strlen((char *)state) + 1);
-                                       strcpy((*respAddr)->state, (char *) state);
+                                       STRCPY((*respAddr)->state, (char *) state);
                                } else {
                                        MAP_DEBUG("state is NULL");
                                        (*respAddr)->state = NULL;
@@ -345,7 +346,7 @@ static void __parse_revgeocode_address(JsonNode *node, mapquest_address_resp_s *
                                /* Country */
                                if (country != NULL) {
                                        (*respAddr)->country = (gchar *)g_malloc(strlen((char *)country) + 1);
-                                       strcpy((*respAddr)->country, (char *) country);
+                                       STRCPY((*respAddr)->country, (char *) country);
                                } else {
                                        MAP_DEBUG("country is NULL");
                                        (*respAddr)->country = NULL;
@@ -358,7 +359,7 @@ static void __parse_revgeocode_address(JsonNode *node, mapquest_address_resp_s *
                                /* Postal Code */
                                if (postalCode != NULL) {
                                        (*respAddr)->postal_code = (gchar *)g_malloc(strlen((char *)postalCode) + 1);
-                                       strcpy((*respAddr)->postal_code, (char *) postalCode);
+                                       STRCPY((*respAddr)->postal_code, (char *) postalCode);
                                } else {
                                        MAP_DEBUG("postal_code is NULL");
                                        (*respAddr)->postal_code = NULL;
@@ -651,7 +652,7 @@ static void __maneuver_foreach(JsonObject *object, const gchar *member_name, Jso
                int length = json_array_get_length(streetsArray);
 
                char street_name[512];
-               strcpy(street_name, "");
+               STRCPY(street_name, "");
                int index = 0;
                for (index = 0; index < length; index++) {
                        char *name = (char *) json_array_get_string_element(streetsArray, index);
@@ -659,7 +660,7 @@ static void __maneuver_foreach(JsonObject *object, const gchar *member_name, Jso
                                if (index == 0) {
                                        strncpy(street_name, name, sizeof(street_name)-1);
                                } else {
-                                       strcat(street_name, "/");
+                                       STRCAT(street_name, "/");
                                        strncat(street_name, name, sizeof(street_name)-strlen(street_name)-1);
                                }
                        }
@@ -668,7 +669,7 @@ static void __maneuver_foreach(JsonObject *object, const gchar *member_name, Jso
                if (strlen(street_name) > 0) {
                        (*maneuver)->street_name = (gchar *)g_malloc0((strlen((char *)street_name)) + 1);
                        if ((*maneuver)->street_name)
-                               strcpy((*maneuver)->street_name, (char *) street_name);
+                               STRCPY((*maneuver)->street_name, (char *) street_name);
                } else {
                        (*maneuver)->street_name = NULL;
                }