From a14ff80f17b549d370b49d57a1a992ce4beb9553 Mon Sep 17 00:00:00 2001 From: Baldur Gudbjornsson Date: Mon, 11 Jul 2016 13:13:05 -0400 Subject: [PATCH] set style according to tizen styleguide Change-Id: I660c64be00afa6e19d0bc0c13d9f563673eb3880 --- src/mapzen/mapzen_geocode.c | 6 +- src/mapzen/mapzen_jsonparser.cpp | 11 ++- src/mapzen/mapzen_place.c | 8 +- src/mapzen_plugin.c | 187 +++++++++++++++++++-------------------- 4 files changed, 105 insertions(+), 107 deletions(-) diff --git a/src/mapzen/mapzen_geocode.c b/src/mapzen/mapzen_geocode.c index 0c12fa7..9d912df 100644 --- a/src/mapzen/mapzen_geocode.c +++ b/src/mapzen/mapzen_geocode.c @@ -47,7 +47,7 @@ int query_geocode_within_bounding_box(gchar *maps_key, char *address, coords_s t snprintf(tmpStr, sizeof(tmpStr), "&size=%d", num_results); STRCAT(url, tmpStr); - char* encoded = curl_escape(address, 0); + char *encoded = curl_escape(address, 0); snprintf(tmpStr, sizeof(tmpStr), "&text=%s", encoded); STRCAT(url, tmpStr); curl_free(encoded); @@ -76,7 +76,7 @@ int query_geocode_within_circle(gchar *maps_key, char *address, coords_s center, snprintf(tmpStr, sizeof(tmpStr), "&size=%d", num_results); STRCAT(url, tmpStr); - char* encoded = curl_escape(address, 0); + char *encoded = curl_escape(address, 0); snprintf(tmpStr, sizeof(tmpStr), "&text=%s", encoded); STRCAT(url, tmpStr); curl_free(encoded); @@ -102,7 +102,7 @@ int query_geocode(gchar *maps_key, char *address, int num_results, gpointer user snprintf(tmpStr, sizeof(tmpStr), "&size=%d", num_results); STRCAT(url, tmpStr); - char* encoded = curl_escape(address, 0); + char *encoded = curl_escape(address, 0); snprintf(tmpStr, sizeof(tmpStr), "&text=%s", encoded); STRCAT(url, tmpStr); curl_free(encoded); diff --git a/src/mapzen/mapzen_jsonparser.cpp b/src/mapzen/mapzen_jsonparser.cpp index 16988ec..9830db6 100644 --- a/src/mapzen/mapzen_jsonparser.cpp +++ b/src/mapzen/mapzen_jsonparser.cpp @@ -136,9 +136,10 @@ bool __get_string(const rapidjson::Value& obj, const char* key, char** value) (*value) = (gchar *)g_malloc(itr->value.GetStringLength() + sizeof(rapidjson::Document::Ch)); strncpy((*value), itr->value.GetString(), itr->value.GetStringLength()); memset((*value) + itr->value.GetStringLength(), 0, sizeof(rapidjson::Document::Ch)); - }//we had nothing - else + //we had nothing + } else { (*value) = NULL; + } //is this something return *value != NULL; } @@ -245,8 +246,8 @@ static void __parse_revgeocode_response(char *response, int size, int *status, m if(!something) { g_free(*respAddr); (*respAddr) = NULL; - }//forget the rest, we have one with something in it - else { + //forget the rest, we have one with something in it + } else { break; } } @@ -260,7 +261,6 @@ static void __parse_revgeocode_response(char *response, int size, int *status, m static void __parse_place_response(char *response, int size, GList **placeList) { - MAP_DEBUG("Inside __parse_place_response."); if (!response || !placeList) return; @@ -352,7 +352,6 @@ static void __parse_route_response(char *response, int size, int *status, mapzen if (!response || !status || !routeResp) return; *routeResp = NULL; - } void post_curl_response(char *response, int size, mapzen_resp_type type, void *user_data) diff --git a/src/mapzen/mapzen_place.c b/src/mapzen/mapzen_place.c index 111657a..8f3a0a0 100644 --- a/src/mapzen/mapzen_place.c +++ b/src/mapzen/mapzen_place.c @@ -43,14 +43,14 @@ int query_places(gchar *maps_key, gchar *search_str, gchar *categories, mapzen_b STRCPY(url, tmpStr); if (search_str != NULL) { - char* encoded = curl_escape(search_str, 0); + char *encoded = curl_escape(search_str, 0); snprintf(tmpStr, sizeof(tmpStr), "&text=%s", encoded); STRCAT(url, tmpStr); curl_free(encoded); } if (categories != NULL) { - char* encoded = curl_escape(categories, 0); + char *encoded = curl_escape(categories, 0); snprintf(tmpStr, sizeof(tmpStr), "&categories=%s", encoded); STRCAT(url, tmpStr); curl_free(encoded); @@ -62,7 +62,7 @@ int query_places(gchar *maps_key, gchar *search_str, gchar *categories, mapzen_b STRCPY(url, tmpStr); if (categories != NULL) { - char* encoded = curl_escape(categories, 0); + char *encoded = curl_escape(categories, 0); snprintf(tmpStr, sizeof(tmpStr), "&categories=%s", encoded); STRCAT(url, tmpStr); curl_free(encoded); @@ -108,7 +108,7 @@ int query_place_details(gchar *maps_key, gchar *ids, gpointer user_data) STRCPY(url, tmpStr); if (ids != NULL) { - char* encoded = curl_escape(ids, 0); + char *encoded = curl_escape(ids, 0); snprintf(tmpStr, sizeof(tmpStr), "&ids=%s", encoded); STRCAT(url, tmpStr); curl_free(encoded); diff --git a/src/mapzen_plugin.c b/src/mapzen_plugin.c index 0d2a9e2..c9ea500 100644 --- a/src/mapzen_plugin.c +++ b/src/mapzen_plugin.c @@ -1,18 +1,18 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ #include #include @@ -123,21 +123,21 @@ static maps_route_turn_type_e __convert_route_turn_type(int index) EXPORT_API int maps_plugin_multi_reverse_geocode(const maps_coordinates_list_h geocode_list, const maps_preference_h preference, maps_service_multi_reverse_geocode_cb callback, - void *user_data, int *request_id){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_create_map_view(maps_view_h hView, maps_plugin_map_view_ready_cb pCbFunc){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_destroy_map_view(maps_view_h hView){return MAPS_ERROR_NOT_SUPPORTED ;} + void *user_data, int *request_id) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_create_map_view(maps_view_h hView, maps_plugin_map_view_ready_cb pCbFunc) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_destroy_map_view(maps_view_h hView) { return MAPS_ERROR_NOT_SUPPORTED; } EXPORT_API int maps_plugin_render_map(maps_view_h hView, - const maps_coordinates_h coordinates, double zoom_factor, double rotation_angle){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_move_center(maps_view_h hView, int delta_x, int delta_y){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_set_scalebar(maps_view_h hView, bool enable){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_get_scalebar(maps_view_h hView, bool *enabled){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_draw_map(maps_view_h hView, Evas* canvas, int x, int y, int w, int h){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_on_object(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_screen_to_geography(maps_view_h hView, int x, int y, maps_coordinates_h *mapsCoord){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_geography_to_screen(maps_view_h hView, const maps_coordinates_h mapsCoord, int* x, int* y){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_get_min_zoom_level(maps_view_h hView, int *min_zoom_level){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_get_max_zoom_level(maps_view_h hView, int *max_zoom_level){return MAPS_ERROR_NOT_SUPPORTED ;} -EXPORT_API int maps_plugin_get_center(maps_view_h hView, maps_coordinates_h *center){return MAPS_ERROR_NOT_SUPPORTED ;} + const maps_coordinates_h coordinates, double zoom_factor, double rotation_angle) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_move_center(maps_view_h hView, int delta_x, int delta_y) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_set_scalebar(maps_view_h hView, bool enable) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_get_scalebar(maps_view_h hView, bool *enabled) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_draw_map(maps_view_h hView, Evas *canvas, int x, int y, int w, int h) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_on_object(maps_view_h hView, const maps_view_object_h object, maps_view_object_operation_e operation) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_screen_to_geography(maps_view_h hView, int x, int y, maps_coordinates_h *mapsCoord) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_geography_to_screen(maps_view_h hView, const maps_coordinates_h mapsCoord, int *x, int *y) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_get_min_zoom_level(maps_view_h hView, int *min_zoom_level) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_get_max_zoom_level(maps_view_h hView, int *max_zoom_level) { return MAPS_ERROR_NOT_SUPPORTED; } +EXPORT_API int maps_plugin_get_center(maps_view_h hView, maps_coordinates_h *center) { return MAPS_ERROR_NOT_SUPPORTED; } /*END MASSIVE TODO: */ @@ -148,9 +148,8 @@ EXPORT_API int maps_plugin_init_module(maps_plugin_h *plugin, const char* module return MAPS_ERROR_INVALID_PARAMETER; int ret = MAPS_ERROR_NONE; - if (!__plugin) { + if (!__plugin) ret = mapzen_init(); - } if (ret == MAPS_ERROR_NONE) { __maps_service_instance_count++; @@ -540,7 +539,7 @@ static void __mapzen_reverse_geocode_cb(mapzen_error_e result, int request_id, m maps_address_h addr = NULL; maps_address_create(&addr); - //TODO: housenumber?? + /*TODO: housenumber?? */ maps_address_set_street(addr, address->street); maps_address_set_city(addr, address->localadmin); maps_address_set_county(addr, address->county); @@ -658,10 +657,10 @@ static void __mapzen_route_cb(mapzen_error_e result, int request_id, mapzen_rout maps_route_maneuver_create(&man); mapzen_route_maneuver *maneuver = (mapzen_route_maneuver *) maneuver_data->data; - // Segment Origin and Destination + /* Segment Origin and Destination */ maps_coordinates_h segmentStartPoint; maps_coordinates_create(maneuver->start_point.latitude, maneuver->start_point.longitude, &segmentStartPoint); - maps_route_segment_set_origin(segment, segmentStartPoint); // origin + maps_route_segment_set_origin(segment, segmentStartPoint); /* origin */ maps_coordinates_destroy(segmentStartPoint); maps_coordinates_h segmentEndPoint; @@ -670,26 +669,26 @@ static void __mapzen_route_cb(mapzen_error_e result, int request_id, mapzen_rout MAPS_LOGD(">>> Segment start : %f, %f <<<", maneuver->start_point.latitude, maneuver->start_point.longitude); MAPS_LOGD(">>> Segment end : %f, %f <<<", maneuver->end_point.latitude, maneuver->end_point.longitude); - maps_route_segment_set_destination(segment, segmentEndPoint); // destination + maps_route_segment_set_destination(segment, segmentEndPoint); /* destination */ maps_coordinates_destroy(segmentEndPoint); - // Segment distance + /* Segment distance */ maps_route_segment_set_distance(segment, maneuver->distance); maps_route_segment_set_duration(segment, maneuver->time); - // Maneuver distance + /* Maneuver distance */ maps_route_maneuver_set_distance_to_next_instruction(man, maneuver->distance); maps_route_maneuver_set_time_to_next_instruction(man, maneuver->time); - //maps_route_maneuver_set_turn_type(man, __convert_route_turn_type(maneuver->turn_type)); + /*maps_route_maneuver_set_turn_type(man, __convert_route_turn_type(maneuver->turn_type)); */ - // maneuver_set_traffic_direction(man, (traffic_direction_e)action_id); + /* maneuver_set_traffic_direction(man, (traffic_direction_e)action_id); */ - // Maneuver Instruction + /* Maneuver Instruction */ if (maneuver->instruction) maps_route_maneuver_set_instruction_text(man, (char *) maneuver->instruction); - // Maneuver Street Name + /* Maneuver Street Name */ if (maneuver->street_name) { MAPS_LOGD("Street Name >>>> %s", maneuver->street_name); maps_route_maneuver_set_road_name(man, (char *) maneuver->street_name); @@ -697,7 +696,7 @@ static void __mapzen_route_cb(mapzen_error_e result, int request_id, mapzen_rout MAPS_LOGD("Street Name >>>> NIL"); } - /// Maneuver start position + /*/ Maneuver start position */ maps_coordinates_h coord; maps_coordinates_create(maneuver->start_point.latitude, maneuver->start_point.longitude, &coord); @@ -715,13 +714,13 @@ static void __mapzen_route_cb(mapzen_error_e result, int request_id, mapzen_rout maps_item_list_append(segment_list, (gpointer) segment, maps_route_segment_clone); maps_route_segment_destroy(segment); - // Fetching the next item from Maneuver/Segment list + /* Fetching the next item from Maneuver/Segment list */ maneuver_data = g_list_next(maneuver_data); } maps_route_set_segments(route, segment_list); maps_item_list_destroy(segment_list); - // Shape points - path + /* Shape points - path */ maps_item_list_h path_list = NULL; maps_item_list_create(&path_list); @@ -800,26 +799,26 @@ EXPORT_API int maps_plugin_search_route(const maps_coordinates_h origin, const m else if (transport_mode == MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT) route_req->type = COSTING_MULTIMODAL; else - route_req->type = COSTING_AUTO; // Keeping it as default + route_req->type = COSTING_AUTO; /* Keeping it as default */ - route_req->driving_style = DRIVING_STYLE_NORMAL; // Keeping it as default + route_req->driving_style = DRIVING_STYLE_NORMAL; /* Keeping it as default */ - // Unit + /* Unit */ maps_distance_unit_e unit; maps_preference_get_distance_unit(preference, &unit); switch (unit) { case MAPS_DISTANCE_UNIT_M: - route_req->unit = UNIT_M; //miles, not meters + route_req->unit = UNIT_M; /*miles, not meters */ break; case MAPS_DISTANCE_UNIT_KM: route_req->unit = UNIT_KM; break; case MAPS_DISTANCE_UNIT_FT: - //route_req->unit = ROUTE_UNIT_FT; + /*route_req->unit = ROUTE_UNIT_FT; */ break; case MAPS_DISTANCE_UNIT_YD: - //route_req->unit = ROUTE_UNIT_YD; + /*route_req->unit = ROUTE_UNIT_YD; */ break; } @@ -893,26 +892,26 @@ EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h *wayp else if (transport_mode == MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT) route_req->type = COSTING_MULTIMODAL; else - route_req->type = COSTING_AUTO; // Keeping it as default + route_req->type = COSTING_AUTO; /* Keeping it as default */ - route_req->driving_style = DRIVING_STYLE_NORMAL; // Keeping it as default + route_req->driving_style = DRIVING_STYLE_NORMAL; /* Keeping it as default */ - // Unit + /* Unit */ maps_distance_unit_e unit; maps_preference_get_distance_unit(preference, &unit); switch (unit) { case MAPS_DISTANCE_UNIT_M: - route_req->unit = UNIT_M; //miles, not meters + route_req->unit = UNIT_M; /*miles, not meters */ break; case MAPS_DISTANCE_UNIT_KM: route_req->unit = UNIT_KM; break; case MAPS_DISTANCE_UNIT_FT: - // route_req->unit = ROUTE_UNIT_FT; + /* route_req->unit = ROUTE_UNIT_FT; */ break; case MAPS_DISTANCE_UNIT_YD: - // route_req->unit = ROUTE_UNIT_YD; + /* route_req->unit = ROUTE_UNIT_YD; */ break; } @@ -936,7 +935,7 @@ EXPORT_API int maps_plugin_search_route_waypoints(const maps_coordinates_h *wayp route_req->avoids = PENALTY_NONE; } - // Waypoints + /* Waypoints */ route_req->way_points = NULL; if (waypoint_num != 0) { int index = 0; @@ -1044,19 +1043,19 @@ static void __mapzen_place_search_cb(mapzen_error_e result, int request_id, GLis } maps_item_list_destroy(cat_list); - // Don't have URLs yet.... - //maps_place_image_h place_image = NULL; - //maps_place_image_create(&place_image); - //no url at this time. - //maps_place_image_set_url(place_image, mapzen_place->icon_url); - //maps_item_list_h image_list; - //maps_item_list_create(&image_list); - //maps_item_list_append(image_list, (void *) place_image, maps_place_image_clone); - //maps_place_set_images(place, image_list); + /* Don't have URLs yet.... */ + /*maps_place_image_h place_image = NULL; */ + /*maps_place_image_create(&place_image); */ + /*no url at this time. */ + /*maps_place_image_set_url(place_image, mapzen_place->icon_url); */ + /*maps_item_list_h image_list; */ + /*maps_item_list_create(&image_list); */ + /*maps_item_list_append(image_list, (void *) place_image, maps_place_image_clone); */ + /*maps_place_set_images(place, image_list); */ - //maps_place_image_destroy(place_image); - //maps_item_list_remove_all(image_list, maps_place_image_destroy); - //maps_item_list_destroy(image_list); + /*maps_place_image_destroy(place_image); */ + /*maps_item_list_remove_all(image_list, maps_place_image_destroy); */ + /*maps_item_list_destroy(image_list); */ bool b = calldata_place->callback((maps_error_e)__convert_to_maps_error(result), calldata_place->reqID, index, total_count, place, calldata_place->data); if (!b) @@ -1084,7 +1083,7 @@ static void __mapzen_place_get_details_cb(mapzen_error_e result, int request_id, } else { guint total_count = 0; total_count = g_list_length(places); - // Should only have one result + /* Should only have one result */ if (total_count == 1) { maps_place_h place = NULL; MAPS_LOGD("Got places details result from ENGINE... count -> %d", total_count); @@ -1148,19 +1147,19 @@ static void __mapzen_place_get_details_cb(mapzen_error_e result, int request_id, } maps_item_list_destroy(cat_list); - // Don't have URLs yet.... - //maps_place_image_h place_image = NULL; - //maps_place_image_create(&place_image); - //no url at this time. - //maps_place_image_set_url(place_image, mapzen_place->icon_url); - //maps_item_list_h image_list; - //maps_item_list_create(&image_list); - //maps_item_list_append(image_list, (void *) place_image, maps_place_image_clone); - //maps_place_set_images(place, image_list); + /* Don't have URLs yet.... */ + /*maps_place_image_h place_image = NULL; */ + /*maps_place_image_create(&place_image); */ + /*no url at this time. */ + /*maps_place_image_set_url(place_image, mapzen_place->icon_url); */ + /*maps_item_list_h image_list; */ + /*maps_item_list_create(&image_list); */ + /*maps_item_list_append(image_list, (void *) place_image, maps_place_image_clone); */ + /*maps_place_set_images(place, image_list); */ - //maps_place_image_destroy(place_image); - //maps_item_list_remove_all(image_list, maps_place_image_destroy); - //maps_item_list_destroy(image_list); + /*maps_place_image_destroy(place_image); */ + /*maps_item_list_remove_all(image_list, maps_place_image_destroy); */ + /*maps_item_list_destroy(image_list); */ calldata_place->callback((maps_error_e)__convert_to_maps_error(result), calldata_place->reqID, place, calldata_place->data); return; @@ -1248,19 +1247,19 @@ static void __maps_service_search_place_list_cb(mapzen_error_e result, int reque } maps_item_list_destroy(cat_list); - // Don't have URLs yet.... - //maps_place_image_h place_image = NULL; - //maps_place_image_create(&place_image); - //no url at this time. - //maps_place_image_set_url(place_image, mapzen_place->icon_url); - //maps_item_list_h image_list; - //maps_item_list_create(&image_list); - //maps_item_list_append(image_list, (void *) place_image, maps_place_image_clone); - //maps_place_set_images(place, image_list); + /* Don't have URLs yet.... */ + /*maps_place_image_h place_image = NULL; */ + /*maps_place_image_create(&place_image); */ + /*no url at this time. */ + /*maps_place_image_set_url(place_image, mapzen_place->icon_url); */ + /*maps_item_list_h image_list; */ + /*maps_item_list_create(&image_list); */ + /*maps_item_list_append(image_list, (void *) place_image, maps_place_image_clone); */ + /*maps_place_set_images(place, image_list); */ - //maps_place_image_destroy(place_image); - //maps_item_list_remove_all(image_list, maps_place_image_destroy); - //maps_item_list_destroy(image_list); + /*maps_place_image_destroy(place_image); */ + /*maps_item_list_remove_all(image_list, maps_place_image_destroy); */ + /*maps_item_list_destroy(image_list); */ maps_item_list_append(place_list, place, maps_place_clone); maps_place_image_destroy(place); @@ -1566,7 +1565,7 @@ EXPORT_API int maps_plugin_search_place_list(const maps_area_h boundary, const m return __convert_to_maps_error(ret); } -EXPORT_API int maps_plugin_get_place_details(const char* uri, maps_service_get_place_details_cb callback, void* user_data, int* request_id) +EXPORT_API int maps_plugin_get_place_details(const char *uri, maps_service_get_place_details_cb callback, void *user_data, int *request_id) { if (!uri || !callback || !request_id) return MAPS_ERROR_INVALID_PARAMETER; -- 2.7.4