+[Version] capi-maps-service_0.6.13
+[Date] 13 Jul 2017
+[Title] Apply to use std::nothrow when allocating memory with new operator
+[Developer] Seechan Kim <cbible.kim@samsung.com>
+
[Version] capi-maps-service_0.6.12
[Date] 16 May 2017
[Title] Fix gesture bugs when using a mouse device
Name: capi-maps-service
Summary: Tizen Maps Service API
-Version: 0.6.12
+Version: 0.6.13
Release: 1
Group: Location/API
License: Apache-2.0
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_geocode(maps, address, preference,
+ session::command *cmd = new (std::nothrow) session::command_geocode(maps, address, preference,
callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_geocode_inside_bounds(maps,
+ session::command *cmd = new (std::nothrow) session::command_geocode_inside_bounds(maps,
address, bounds, preference, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_geocode_by_structured_address(maps,
+ session::command *cmd = new (std::nothrow) session::command_geocode_by_structured_address(maps,
address, preference, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_reverse_geocode(maps, latitude,
+ session::command *cmd = new (std::nothrow) session::command_reverse_geocode(maps, latitude,
longitude, preference, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_search_place(maps, position,
+ session::command *cmd = new (std::nothrow) session::command_search_place(maps, position,
distance, preference, filter, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_search_by_area_place(maps,
+ session::command *cmd = new (std::nothrow) session::command_search_by_area_place(maps,
boundary, preference, filter, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_search_by_address_place(maps,
+ session::command *cmd = new (std::nothrow) session::command_search_by_address_place(maps,
address, boundary, preference, filter, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_search_place_list(maps,
+ session::command *cmd = new (std::nothrow) session::command_search_place_list(maps,
boundary, preference, filter, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_get_place_details(maps,
+ session::command *cmd = new (std::nothrow) session::command_get_place_details(maps,
url, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_search_route(maps, preference,
+ session::command *cmd = new (std::nothrow) session::command_search_route(maps, preference,
origin, destination, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_search_route_waypoints(maps,
+ session::command *cmd = new (std::nothrow) session::command_search_route_waypoints(maps,
preference, waypoint_list, waypoint_num, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_cancel_request(maps, request_id);
+ session::command *cmd = new (std::nothrow) session::command_cancel_request(maps, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
if (ret) MAPS_LOGE("Failed to run command.(%d)", ret);
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
- session::command *cmd = new session::command_multi_reverse_geocode(maps,
+ session::command *cmd = new (std::nothrow) session::command_multi_reverse_geocode(maps,
coordinates_list, preference, callback, user_data, request_id);
int ret = (cmd && cmd->plugin()) ? cmd->run() : MAPS_ERROR_INVALID_PARAMETER;
v->gesture_available[MAPS_VIEW_GESTURE_NONE] = false;
/* Gesture Processing */
- v->finger_stream = new view::finger_event_stream(v);
+ v->finger_stream = new (std::nothrow) view::finger_event_stream(v);
if (!v->finger_stream) {
//LCOV_EXCL_START
MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
if (enabled) {
if (!v->inertial_gesture) {
- v->inertial_gesture = new view::inertial_gesture(view);
+ v->inertial_gesture = new (std::nothrow) view::inertial_gesture(view);
if (!v->inertial_gesture) {
//LCOV_EXCL_START
MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
}
if (!v->inertial_camera) {
- v->inertial_camera = new view::inertial_camera(view);
+ v->inertial_camera = new (std::nothrow) view::inertial_camera(view);
if (!v->inertial_camera) {
//LCOV_EXCL_START
MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
v->finger_stream->set_gesture_detector(v->inertial_gesture);
} else {
- v->finger_stream->set_gesture_detector(new view::gesture_detector_statemachine(view));
+ v->finger_stream->set_gesture_detector(new (std::nothrow) view::gesture_detector_statemachine(view));
if (v->inertial_gesture) {
/* Unset Inertial Camera */
#include <dlog.h>
#include <glib.h>
+#include <new>
/*#include "stdio.h"
public:
void push_back(const T &value)
{
- T *clone = new T(value);
+ T *clone = new (std::nothrow) T(value);
if (clone) {
g_array_append_val(parray, clone);
current_size++;
if (func) {
/* need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_geocode_handler(plugin(),
- callback, user_data, my_req_id);
+ handler = new (std::nothrow) command_geocode_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_geocode_handler(plugin(),
- callback,
- user_data,
- my_req_id);
+ handler = new (std::nothrow) command_geocode_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_geocode_handler(plugin(),
- callback,
- user_data,
- my_req_id);
+ handler = new (std::nothrow) command_geocode_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_reverse_geocode_handler(plugin(),
- callback,
- user_data,
- my_req_id);
+ handler = new (std::nothrow) command_reverse_geocode_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_multi_reverse_geocode_handler(plugin(), callback, user_data, my_req_id);
+ handler = new (std::nothrow) command_multi_reverse_geocode_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_search_place_handler(plugin(),
- callback,
- user_data,
- my_req_id);
+ handler = new (std::nothrow) command_search_place_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
error = func(position, distance, filter, preference,
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_search_place_handler(plugin(),
- callback,
- user_data,
- my_req_id);
+ handler = new (std::nothrow) command_search_place_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
error = func(boundary, filter,
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_search_place_handler(plugin(),
- callback,
- user_data,
- my_req_id);
+ handler = new (std::nothrow) command_search_place_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
error = func(address.c_str(), boundary, filter, preference,
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_search_place_list_handler(plugin(),
- callback,
- user_data,
- my_req_id);
+ handler = new (std::nothrow) command_search_place_list_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
error = func(boundary, filter, preference,
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_get_place_details_handler(plugin(),
- callback, user_data, my_req_id);
+ handler = new (std::nothrow) command_get_place_details_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
error = func(url.c_str(),
- command_get_place_details_handler::foreach_place_details_cb,
- handler, &handler->plg_req_id);
+ command_get_place_details_handler::foreach_place_details_cb,
+ handler, &handler->plg_req_id);
pr.update(my_req_id, handler);
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_search_route_handler(plugin(),
- callback, user_data, my_req_id);
+ handler = new (std::nothrow) command_search_route_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
*request_id = command::command_request_id++;
my_req_id = *request_id;
- waypoint_list = new maps_coordinates_h[num];
- for (int index = 0; index < num; index++) {
- if (list[index] != NULL) {
- maps_coordinates_clone(list[index],
- &waypoint_list[index]);
+ waypoint_list = new (std::nothrow) maps_coordinates_h[num];
+ if (waypoint_list) {
+ for (int index = 0; index < num; index++) {
+ if (list[index] != NULL)
+ maps_coordinates_clone(list[index], &waypoint_list[index]);
}
}
}
session::command_search_route_waypoints::~command_search_route_waypoints()
{
- for (int index = 0; index < waypoint_num; index++) {
- if (waypoint_list[index] != NULL) {
- maps_coordinates_destroy(waypoint_list[index]);
+ if (waypoint_list) {
+ for (int index = 0; index < waypoint_num; index++) {
+ if (waypoint_list[index] != NULL)
+ maps_coordinates_destroy(waypoint_list[index]);
}
+ delete [] waypoint_list;
}
- delete [] waypoint_list;
}
int session::command_search_route_waypoints::run()
{
+ if (!waypoint_list)
+ return MAPS_ERROR_OUT_OF_MEMORY;
+
if (error != MAPS_ERROR_NONE)
return error;
if (func) {
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
- handler = new command_search_route_handler(plugin(),
- callback,
- user_data,
- my_req_id);
+ handler = new (std::nothrow) command_search_route_handler(plugin(),
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
error = func(waypoint_list, waypoint_num, preference,
coords = center_clone;
}
session::command *cmd =
- new session::command_view_set_center(get_maps(), _gd->_view, coords);
+ new (std::nothrow) session::command_view_set_center(get_maps(), _gd->_view, coords);
maps_coordinates_destroy(center_clone);
return cmd;
}
MAPS_LOGD("MAPS_VIEW_ACTION_ZOOM_IN");
if (zoom_factor == .0 || !zoom_changed)
maps_view_get_zoom_factor(_gd->_view, &zoom_factor);
- return new session::command_view_zoom(get_maps(), _gd->_view, zoom_factor + 1.);
+ return new (std::nothrow) session::command_view_zoom(get_maps(), _gd->_view, zoom_factor + 1.);
}
case MAPS_VIEW_ACTION_ZOOM_OUT: {
MAPS_LOGD("MAPS_VIEW_ACTION_ZOOM_OUT");
if (zoom_factor == .0 || !zoom_changed)
maps_view_get_zoom_factor(_gd->_view, &zoom_factor);
- return new session::command_view_zoom(get_maps(), _gd->_view, zoom_factor - 1.);
+ return new (std::nothrow) session::command_view_zoom(get_maps(), _gd->_view, zoom_factor - 1.);
}
case MAPS_VIEW_ACTION_ZOOM_AND_SCROLL: {
MAPS_LOGD("MAPS_VIEW_ACTION_ZOOM_AND_SCROLL");
coords = center_clone;
}
session::command *cmd =
- new session::command_view_set_center(get_maps(), _gd->_view, coords);
+ new (std::nothrow) session::command_view_set_center(get_maps(), _gd->_view, coords);
maps_coordinates_destroy(center_clone);
return cmd;
}
if (rotation_angle == .0)
maps_view_get_orientation(_gd->_view, &rotation_angle);
rotation_angle -= (int(rotation_angle) / 360) * 360;
- return new session::command_view_zoom_rotate(get_maps(), _gd->_view, zoom_factor, rotation_angle);
+ return new (std::nothrow) session::command_view_zoom_rotate(get_maps(), _gd->_view, zoom_factor, rotation_angle);
} else if (zoom_changed) {
if (zoom_factor == .0)
maps_view_get_zoom_factor(_gd->_view, &zoom_factor);
MAPS_LOGI("\t set new zoom command: %f\n", zoom_factor);
- return new session::command_view_zoom(get_maps(), _gd->_view, zoom_factor);
+ return new (std::nothrow) session::command_view_zoom(get_maps(), _gd->_view, zoom_factor);
} else if (rotation_changed) {
if (rotation_angle == .0)
maps_view_get_orientation(_gd->_view, &rotation_angle);
rotation_angle -= (int(rotation_angle) / 360) * 360;
- return new session::command_view_rotate(get_maps(), _gd->_view, rotation_angle);
+ return new (std::nothrow) session::command_view_rotate(get_maps(), _gd->_view, rotation_angle);
}
break;
}
view::finger_event_stream::finger_event_stream(maps_view_h v)
: _d(NULL)
{
- /* TODO: extract in dedicated factory in maps_view.cpp */
/* Issuing an instance of gestuer detector */
- _d = new gesture_detector_statemachine(v);
- /*_d = new inertial_gesture(v);*/
- /*_d = new gesture_detector(v);*/
+ _d = new (std::nothrow) gesture_detector_statemachine(v);
+ if (!_d)
+ MAPS_LOGE("Failed to create a gesture detector statemachine.");
/* All fingers are un-pressed initially */
for(int i = 0; i < MAX_FINGERS; i ++) {
{
if (!d)
return;
+ if (!_d)
+ _d = d;
if (d != _d) {
_d->halt_gesture();
delete _d;
void view::finger_event_stream::tap(Evas_Event_Mouse_Down *ev)
{
MAPS_LOGI("finger_event_stream::tap");
- if (!ev)
+ if (!ev || !_d)
return;
/*
void view::finger_event_stream::move(Evas_Event_Mouse_Move *ev)
{
- if (!ev)
+ if (!ev || !_d)
return;
if (_finger_pressed[0] == false)
void view::finger_event_stream::up(Evas_Event_Mouse_Up *ev)
{
MAPS_LOGI("finger_event_stream::up");
- if (!ev)
+ if (!ev || !_d)
return;
/* Process finger up */
void view::finger_event_stream::multi_tap(Evas_Event_Multi_Down *ev)
{
MAPS_LOGI("finger_event_stream::multi_tap");
- if (!ev)
+ if (!ev || !_d)
return;
const int finger_no = (ev->device > 0 ? 1 : 0);
void view::finger_event_stream::multi_move(Evas_Event_Multi_Move *ev)
{
- if (!ev)
+ if (!ev || !_d)
return;
const int finger_no = (ev->device > 0 ? 1 : 0);
void view::finger_event_stream::multi_up(Evas_Event_Multi_Up *ev)
{
MAPS_LOGI("finger_event_stream::multi_up");
- if (!ev)
+ if (!ev || !_d)
return;
const int finger_no = (ev->device > 0 ? 1 : 0);
{
reset();
- _d = new gesture_detector_statemachine(view);
+ _d = new (std::nothrow) gesture_detector_statemachine(view);
//_maps_view_set_idle_listener(view, on_idle, this);
}
void view::inertial_gesture::tap(int finger_no, const touch_point &tp)
{
- MAPS_LOGI("TRANSITION finger %d tap time: %d",
- finger_no, tp._timestamp);
+ MAPS_LOGI("TRANSITION finger %d tap time: %d", finger_no, tp._timestamp);
_maps_view_halt_inertial_camera(_view);
else
return (derivative - __ACCEL * dt);*/
- /* Exponential spped down */
+ /* Exponential speed down */
if (_d->_info._fingers_pressed <= 1)
return (derivative * .9);
else