if(properties != f->MemberEnd()) {
//fill this out as we go
mapzen_place_resp_s *respPlaces = (mapzen_place_resp_s *)g_malloc0(sizeof(mapzen_place_resp_s));
+ if (!respPlaces)
+ return;
respPlaces->place_id = NULL;
respPlaces->categories = NULL;
for (auto& shape_pt : decoded_shape) {
coords_s *coords = (coords_s *)g_malloc0(sizeof(coords_s));
- coords->latitude = shape_pt.latitude;
- coords->longitude = shape_pt.longitude;
- if ((*shapePoints) == NULL)
- (*shapePoints) = g_list_append((*shapePoints), (gpointer)coords);
- else
- (*shapePoints) = g_list_insert_before((*shapePoints), NULL, (gpointer)coords);
-// MAP_DEBUG(">>>>> PROCESS __process_shape: lat,lon=%f,%f", coords->latitude, coords->longitude);
+ if (coords) {
+ coords->latitude = shape_pt.latitude;
+ coords->longitude = shape_pt.longitude;
+ if ((*shapePoints) == NULL)
+ (*shapePoints) = g_list_append((*shapePoints), (gpointer)coords);
+ else
+ (*shapePoints) = g_list_insert_before((*shapePoints), NULL, (gpointer)coords);
+ // MAP_DEBUG(">>>>> PROCESS __process_shape: lat,lon=%f,%f", coords->latitude, coords->longitude);
+ }
}
MAP_DEBUG(">>>>> END __process_shape");
}
MAP_DEBUG(">>>>> PROCESS __parse_maneuvers: street_name=%s", street_name.c_str());
maneuver_resp->street_name = (gchar *)g_malloc0(street_name.size() + 1);
if (maneuver_resp->street_name) {
- strcpy(maneuver_resp->street_name, street_name.c_str());
+ strncpy (maneuver_resp->street_name, street_name.c_str(), sizeof (maneuver_resp->street_name));
MAP_DEBUG(">>>>> PROCESS __parse_maneuvers: maneuver_resp->street_name=%s", maneuver_resp->street_name);
}
}
/* Add the request to queue */
add_to_geocode_list(req_details, callback, request_id, user_data);
} else {
+ if (!req_details)
+ return MAPZEN_ERROR_INVALID_PARAMETER;
+
MapzenGeocodeQueryData *queryData = (MapzenGeocodeQueryData *)g_malloc0(sizeof(MapzenGeocodeQueryData));
if (queryData != NULL) {
}
}
- if (req_details) {
- if (req_details->address) {
- g_free(req_details->address);
- req_details->address = NULL;
- }
- if (req_details->maps_key) {
- g_free(req_details->maps_key);
- req_details->maps_key = NULL;
- }
- if (req_details->boundary) {
- g_free(req_details->boundary);
- req_details->boundary = NULL;
- }
- g_free(req_details);
- req_details = NULL;
+ if (req_details->address) {
+ g_free(req_details->address);
+ req_details->address = NULL;
+ }
+ if (req_details->maps_key) {
+ g_free(req_details->maps_key);
+ req_details->maps_key = NULL;
}
+ if (req_details->boundary) {
+ g_free(req_details->boundary);
+ req_details->boundary = NULL;
+ }
+ g_free(req_details);
+ req_details = NULL;
}
return MAPZEN_ERROR_NONE;
/* Add the request to queue */
add_to_revgeocode_list(req_details, callback, request_id, user_data);
} else {
+ if (!req_details)
+ return MAPZEN_ERROR_INVALID_PARAMETER;
+
MapzenRevGeocodeQueryData *queryData = (MapzenRevGeocodeQueryData *)g_malloc0(sizeof(MapzenRevGeocodeQueryData));
if (queryData != NULL) {
query_revgeocode(req_details->maps_key, coords.latitude, coords.longitude, queryData);
}
- if (req_details) {
- if (req_details->maps_key) {
- g_free(req_details->maps_key);
- req_details->maps_key = NULL;
- }
- g_free(req_details);
- req_details = NULL;
+ if (req_details->maps_key) {
+ g_free(req_details->maps_key);
+ req_details->maps_key = NULL;
}
+ g_free(req_details);
+ req_details = NULL;
}
return MAPZEN_ERROR_NONE;
/* Add the request to queue */
add_to_route_list(req_details, callback, request_id, user_data);
} else {
+ if (!req_details)
+ return MAPZEN_ERROR_INVALID_PARAMETER;
+
MapzenRouteQueryData *queryData = (MapzenRouteQueryData *)g_malloc0(sizeof(MapzenRouteQueryData));
if (queryData != NULL) {
query_route(req_details->maps_key, req_details->from, req_details->to, req_details->type, req_details->avoids, req_details->driving_style, req_details->way_points, queryData);
}
- if (req_details) {
- if (req_details->maps_key) {
- g_free(req_details->maps_key);
- req_details->maps_key = NULL;
- }
- if (req_details->way_points) {
- if (g_list_length(req_details->way_points) > 0) {
- GList *list = NULL;
- list = g_list_first(req_details->way_points);
- while (list) {
- coords_s *data = (coords_s *)list->data;
- if (data) {
- req_details->way_points = g_list_remove(req_details->way_points, (gpointer)data);
-
- g_free(data);
- data = NULL;
- }
- list = g_list_first(req_details->way_points);
+ if (req_details->maps_key) {
+ g_free(req_details->maps_key);
+ req_details->maps_key = NULL;
+ }
+ if (req_details->way_points) {
+ if (g_list_length(req_details->way_points) > 0) {
+ GList *list = NULL;
+ list = g_list_first(req_details->way_points);
+ while (list) {
+ coords_s *data = (coords_s *)list->data;
+ if (data) {
+ req_details->way_points = g_list_remove(req_details->way_points, (gpointer)data);
+
+ g_free(data);
+ data = NULL;
}
+ list = g_list_first(req_details->way_points);
}
- g_list_free(req_details->way_points);
- req_details->way_points = NULL;
}
- g_free(req_details);
- req_details = NULL;
+ g_list_free(req_details->way_points);
+ req_details->way_points = NULL;
}
+ g_free(req_details);
+ req_details = NULL;
}
return MAPZEN_ERROR_NONE;
/* Add the request to queue */
add_to_place_list(req_details, callback, request_id, user_data);
} else {
+ if (!req_details)
+ return MAPZEN_ERROR_INVALID_PARAMETER;
+
MapzenPlaceQueryData *queryData = (MapzenPlaceQueryData *)g_malloc0(sizeof(MapzenPlaceQueryData));
if (queryData != NULL) {
query_places(req_details->maps_key, req_details->search_string, req_details->categories, req_details->boundary, req_details->num_res, queryData, REQ_TYPE_PLACES);
}
- if (req_details) {
- if (req_details->maps_key) {
- g_free(req_details->maps_key);
- req_details->maps_key = NULL;
- }
- if (req_details->boundary) {
- g_free(req_details->boundary);
- req_details->boundary = NULL;
- }
- if (req_details->search_string) {
- g_free(req_details->search_string);
- req_details->search_string = NULL;
- }
- if (req_details->categories) {
- g_free(req_details->categories);
- req_details->categories = NULL;
- }
- g_free(req_details);
- req_details = NULL;
+ if (req_details->maps_key) {
+ g_free(req_details->maps_key);
+ req_details->maps_key = NULL;
+ }
+ if (req_details->boundary) {
+ g_free(req_details->boundary);
+ req_details->boundary = NULL;
+ }
+ if (req_details->search_string) {
+ g_free(req_details->search_string);
+ req_details->search_string = NULL;
+ }
+ if (req_details->categories) {
+ g_free(req_details->categories);
+ req_details->categories = NULL;
}
+ g_free(req_details);
+ req_details = NULL;
}
return MAPZEN_ERROR_NONE;
/* Add the request to queue */
add_to_place_details_list(req_details, callback, request_id, user_data);
} else {
+ if (!req_details)
+ return MAPZEN_ERROR_INVALID_PARAMETER;
+
MapzenPlaceDetailsQueryData *queryData = (MapzenPlaceDetailsQueryData *)g_malloc0(sizeof(MapzenPlaceDetailsQueryData));
if (queryData != NULL) {
query_place_details(req_details->maps_key, req_details->uri, queryData);
}
- if (req_details) {
- if (req_details->maps_key) {
- g_free(req_details->maps_key);
- req_details->maps_key = NULL;
- }
- if (req_details->uri) {
- g_free(req_details->uri);
- req_details->uri = NULL;
- }
- g_free(req_details);
- req_details = NULL;
+ if (req_details->maps_key) {
+ g_free(req_details->maps_key);
+ req_details->maps_key = NULL;
+ }
+ if (req_details->uri) {
+ g_free(req_details->uri);
+ req_details->uri = NULL;
}
+ g_free(req_details);
+ req_details = NULL;
}
return MAPZEN_ERROR_NONE;
/* Add the request to queue */
add_to_places_list(req_details, callback, request_id, user_data);
} else {
+ if (!req_details)
+ return MAPZEN_ERROR_INVALID_PARAMETER;
+
MapzenPlaceListQueryData *queryData = (MapzenPlaceListQueryData *)g_malloc0(sizeof(MapzenPlaceListQueryData));
if (queryData != NULL) {
query_places(req_details->maps_key, req_details->search_string, req_details->categories, req_details->boundary, req_details->num_res, queryData, REQ_TYPE_PLACES_LIST);
}
- if (req_details) {
- if (req_details->maps_key) {
- g_free(req_details->maps_key);
- req_details->maps_key = NULL;
- }
- if (req_details->boundary) {
- g_free(req_details->boundary);
- req_details->boundary = NULL;
- }
- if (req_details->search_string) {
- g_free(req_details->search_string);
- req_details->search_string = NULL;
- }
- if (req_details->categories) {
- g_free(req_details->categories);
- req_details->categories = NULL;
- }
- g_free(req_details);
- req_details = NULL;
+ if (req_details->maps_key) {
+ g_free(req_details->maps_key);
+ req_details->maps_key = NULL;
+ }
+ if (req_details->boundary) {
+ g_free(req_details->boundary);
+ req_details->boundary = NULL;
+ }
+ if (req_details->search_string) {
+ g_free(req_details->search_string);
+ req_details->search_string = NULL;
+ }
+ if (req_details->categories) {
+ g_free(req_details->categories);
+ req_details->categories = NULL;
}
+ g_free(req_details);
+ req_details = NULL;
}
return MAPZEN_ERROR_NONE;