From: chanywa Date: Thu, 4 Aug 2016 08:01:00 +0000 (+0900) Subject: fixed to return NOT_FOUND, not INVALID_PARAMETER, if a member variable of the handle... X-Git-Tag: submit/tizen/20160805.024428^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a30f85c3106b0d7dc8f64a9c3b0869480c0ab4b;p=platform%2Fcore%2Fapi%2Fmaps-service.git fixed to return NOT_FOUND, not INVALID_PARAMETER, if a member variable of the handle is NULL Change-Id: I5f2856c18d6c9f1865190e4bbcbccd71748d7692 --- diff --git a/src/api/maps_place.cpp b/src/api/maps_place.cpp index 4f945a6..641bb52 100644 --- a/src/api/maps_place.cpp +++ b/src/api/maps_place.cpp @@ -395,6 +395,8 @@ EXPORT_API int maps_place_foreach_property(const maps_place_h place, return MAPS_ERROR_NOT_SUPPORTED; if (!place || !callback) return MAPS_ERROR_INVALID_PARAMETER; + if (!((maps_place_s *) place)->properties) + return MAPS_ERROR_NOT_FOUND; return maps_item_hashtable_foreach(((maps_place_s *) place)->properties, callback, user_data); } @@ -409,6 +411,8 @@ EXPORT_API int maps_place_foreach_category(const maps_place_h place, return MAPS_ERROR_INVALID_PARAMETER; if (!__is_supported(place, MAPS_PLACE_CATEGORIES)) return MAPS_ERROR_NOT_SUPPORTED; + if (!((maps_place_s *) place)->categories) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(((maps_place_s *) place)->categories, maps_place_category_clone, callback, user_data); } @@ -423,6 +427,8 @@ EXPORT_API int maps_place_foreach_attribute(const maps_place_h place, return MAPS_ERROR_INVALID_PARAMETER; if (!__is_supported(place, MAPS_PLACE_ATTRIBUTES)) return MAPS_ERROR_NOT_SUPPORTED; + if (!((maps_place_s *) place)->attribute) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(((maps_place_s *) place)->attribute, maps_place_attribute_clone, callback, user_data); } @@ -437,6 +443,8 @@ EXPORT_API int maps_place_foreach_contact(const maps_place_h place, return MAPS_ERROR_INVALID_PARAMETER; if (!__is_supported(place, MAPS_PLACE_CONTACTS)) return MAPS_ERROR_NOT_SUPPORTED; + if (!((maps_place_s *) place)->contacts) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(((maps_place_s *) place)->contacts, maps_place_contact_clone, callback, user_data); } @@ -451,6 +459,8 @@ EXPORT_API int maps_place_foreach_editorial(const maps_place_h place, return MAPS_ERROR_INVALID_PARAMETER; if (!__is_supported(place, MAPS_PLACE_EDITORIALS)) return MAPS_ERROR_NOT_SUPPORTED; + if (!((maps_place_s *) place)->editorials) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(((maps_place_s *) place)->editorials, maps_place_editorial_clone, callback, user_data); } @@ -465,6 +475,8 @@ EXPORT_API int maps_place_foreach_image(const maps_place_h place, return MAPS_ERROR_INVALID_PARAMETER; if (!__is_supported(place, MAPS_PLACE_IMAGE)) return MAPS_ERROR_NOT_SUPPORTED; + if (!((maps_place_s *) place)->images) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(((maps_place_s *) place)->images, maps_place_image_clone, callback, user_data); } @@ -479,6 +491,8 @@ EXPORT_API int maps_place_foreach_review(const maps_place_h place, return MAPS_ERROR_INVALID_PARAMETER; if (!__is_supported(place, MAPS_PLACE_REVIEWS)) return MAPS_ERROR_NOT_SUPPORTED; + if (!((maps_place_s *) place)->reviews) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(((maps_place_s *) place)->reviews, maps_place_review_clone, callback, user_data); } diff --git a/src/api/maps_place_filter.cpp b/src/api/maps_place_filter.cpp index 6437088..a54e6da 100644 --- a/src/api/maps_place_filter.cpp +++ b/src/api/maps_place_filter.cpp @@ -107,8 +107,8 @@ EXPORT_API int maps_place_filter_get(const maps_place_filter_h filter, return MAPS_ERROR_NOT_SUPPORTED; if (!filter) return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)-> - table, key, value); + return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)->table, + key, value); } EXPORT_API int maps_place_filter_foreach_property(const maps_place_filter_h filter, @@ -119,8 +119,10 @@ EXPORT_API int maps_place_filter_foreach_property(const maps_place_filter_h filt return MAPS_ERROR_NOT_SUPPORTED; if (!filter || !callback) return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_foreach(((maps_place_filter_s *) filter)-> - table, callback, user_data); + if (!((maps_place_filter_s *) filter)->table) + return MAPS_ERROR_NOT_FOUND; + return maps_item_hashtable_foreach(((maps_place_filter_s *) filter)->table, + callback, user_data); } EXPORT_API int maps_place_filter_get_keyword(const maps_place_filter_h filter, @@ -130,8 +132,8 @@ EXPORT_API int maps_place_filter_get_keyword(const maps_place_filter_h filter, return MAPS_ERROR_NOT_SUPPORTED; if (!filter || !keyword) return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)-> - table, "MAPS_PLACE_FILTER_KEYWORD", keyword); + return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)->table, + "MAPS_PLACE_FILTER_KEYWORD", keyword); } EXPORT_API int maps_place_filter_get_place_name(const maps_place_filter_h filter, @@ -141,8 +143,8 @@ EXPORT_API int maps_place_filter_get_place_name(const maps_place_filter_h filter return MAPS_ERROR_NOT_SUPPORTED; if (!filter || !place_name) return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)-> - table, "MAPS_PLACE_FILTER_PLACE_NAME", place_name); + return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)->table, + "MAPS_PLACE_FILTER_PLACE_NAME", place_name); } EXPORT_API int maps_place_filter_get_category(const maps_place_filter_h filter, @@ -163,8 +165,8 @@ EXPORT_API int maps_place_filter_get_place_address(const maps_place_filter_h fil return MAPS_ERROR_NOT_SUPPORTED; if (!filter || !place_address) return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)-> - table, "MAPS_PLACE_FILTER_PLACE_ADDRESS", place_address); + return maps_item_hashtable_get_string(((maps_place_filter_s *) filter)->table, + "MAPS_PLACE_FILTER_PLACE_ADDRESS", place_address); } /*----------------------------------------------------------------------------*/ @@ -176,8 +178,8 @@ EXPORT_API int maps_place_filter_set(maps_place_filter_h filter, return MAPS_ERROR_NOT_SUPPORTED; if (!filter) return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)-> - table, key, value); + return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)->table, + key, value); } EXPORT_API int maps_place_filter_set_keyword(maps_place_filter_h filter, @@ -187,8 +189,8 @@ EXPORT_API int maps_place_filter_set_keyword(maps_place_filter_h filter, return MAPS_ERROR_NOT_SUPPORTED; if (!filter || !keyword) return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)-> - table, "MAPS_PLACE_FILTER_KEYWORD", keyword); + return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)->table, + "MAPS_PLACE_FILTER_KEYWORD", keyword); } EXPORT_API int maps_place_filter_set_place_name(maps_place_filter_h filter, @@ -198,8 +200,8 @@ EXPORT_API int maps_place_filter_set_place_name(maps_place_filter_h filter, return MAPS_ERROR_NOT_SUPPORTED; if (!filter || !place_name) return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)-> - table, "MAPS_PLACE_FILTER_PLACE_NAME", place_name); + return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)->table, + "MAPS_PLACE_FILTER_PLACE_NAME", place_name); } EXPORT_API int maps_place_filter_set_category(maps_place_filter_h filter, @@ -221,6 +223,6 @@ EXPORT_API int maps_place_filter_set_place_address(maps_place_filter_h filter, return MAPS_ERROR_NOT_SUPPORTED; if (!filter || !place_address) return MAPS_ERROR_INVALID_PARAMETER; - return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)-> - table, "MAPS_PLACE_FILTER_PLACE_ADDRESS", place_address); + return maps_item_hashtable_set_string(((maps_place_filter_s *) filter)->table, + "MAPS_PLACE_FILTER_PLACE_ADDRESS", place_address); } diff --git a/src/api/maps_route.cpp b/src/api/maps_route.cpp index 7a9fc70..9b50508 100644 --- a/src/api/maps_route.cpp +++ b/src/api/maps_route.cpp @@ -302,6 +302,8 @@ EXPORT_API int maps_route_foreach_path(const maps_route_h route, return MAPS_ERROR_NOT_SUPPORTED; if (!callback) return MAPS_ERROR_INVALID_PARAMETER; + if (!((maps_route_s *) route)->path) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(((maps_route_s *) route)->path, maps_coordinates_clone, callback, user_data); @@ -320,6 +322,8 @@ EXPORT_API int maps_route_foreach_segment(const maps_route_h route, return MAPS_ERROR_NOT_SUPPORTED; if (!callback) return MAPS_ERROR_INVALID_PARAMETER; + if (!((maps_route_s *) route)->segments) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(((maps_route_s *) route)->segments, maps_route_segment_clone, callback, user_data); @@ -333,6 +337,8 @@ EXPORT_API int maps_route_foreach_property(const maps_route_h route, return MAPS_ERROR_NOT_SUPPORTED; if (!route || !callback) return MAPS_ERROR_INVALID_PARAMETER; + if (!((maps_route_s *) route)->properties) + return MAPS_ERROR_NOT_FOUND; return maps_item_hashtable_foreach(((maps_route_s *) route)->properties, callback, user_data); } diff --git a/src/api/maps_route_segment.cpp b/src/api/maps_route_segment.cpp index ceaa889..53512ac 100644 --- a/src/api/maps_route_segment.cpp +++ b/src/api/maps_route_segment.cpp @@ -234,6 +234,8 @@ EXPORT_API int maps_route_segment_foreach_path(const maps_route_segment_h segmen return MAPS_ERROR_NOT_SUPPORTED; if (!callback) return MAPS_ERROR_INVALID_PARAMETER; + if (!((maps_route_segment_s *) segment)->path) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(((maps_route_segment_s *) segment)->path, maps_coordinates_clone, callback, user_data); @@ -251,9 +253,11 @@ EXPORT_API int maps_route_segment_foreach_maneuver(const maps_route_segment_h se return MAPS_ERROR_NOT_SUPPORTED; if (!callback) return MAPS_ERROR_INVALID_PARAMETER; + if (!((maps_route_segment_s *) segment)->maneuvers) + return MAPS_ERROR_NOT_FOUND; - return maps_item_list_foreach(((maps_route_segment_s *) segment)-> - maneuvers, maps_route_maneuver_clone, callback, user_data); + return maps_item_list_foreach(((maps_route_segment_s *) segment)->maneuvers, + maps_route_maneuver_clone, callback, user_data); } int _maps_route_segment_is_data_supported(const maps_route_segment_h segment, diff --git a/src/api/maps_view.cpp b/src/api/maps_view.cpp index c32286b..55b3308 100644 --- a/src/api/maps_view.cpp +++ b/src/api/maps_view.cpp @@ -231,6 +231,8 @@ int _maps_view_on_overlay_update_all(maps_view_h view) return MAPS_ERROR_INVALID_PARAMETER; maps_view_s *v = (maps_view_s *)view; + if (!v->view_objects) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(v->view_objects, NULL, _maps_view_object_overlay_cb, v->clipper); } @@ -1605,6 +1607,8 @@ EXPORT_API int maps_view_foreach_object(maps_view_h view, maps_view_object_cb ca if (!view || !callback) return MAPS_ERROR_INVALID_PARAMETER; maps_view_s *v = (maps_view_s *)view; + if (!v->view_objects) + return MAPS_ERROR_NOT_FOUND; return maps_item_list_foreach(v->view_objects, NULL, callback, user_data); } diff --git a/src/api/maps_view_object.cpp b/src/api/maps_view_object.cpp index 707fa47..a8a624e 100644 --- a/src/api/maps_view_object.cpp +++ b/src/api/maps_view_object.cpp @@ -639,6 +639,8 @@ EXPORT_API int maps_view_object_polyline_foreach_point(maps_view_object_h polyli maps_view_polyline_data_s *p = __get_polyline_data(polyline); if (!p) return MAPS_ERROR_INVALID_PARAMETER; + if (!p->points) + return MAPS_ERROR_NOT_FOUND; /* Iterate over polyline trajectory */ return maps_coordinates_list_foreach(p->points, callback, user_data); @@ -774,6 +776,8 @@ EXPORT_API int maps_view_object_polygon_foreach_point(maps_view_object_h polygon maps_view_polygon_data_s *p = __get_polygon_data(polygon); if (!p) return MAPS_ERROR_INVALID_PARAMETER; + if (!p->points) + return MAPS_ERROR_NOT_FOUND; /* Iterate over polygon border */ return maps_coordinates_list_foreach(p->points, callback, user_data);