Using cppcheck (with --enable=all flag).
[Verification] TCT result:
Before:
[filesystem] 100.00%
[mediacontroller] 100.00%
[messageport] 58.33%
After:
[filesystem] 100.00%
[mediacontroller] 100.00%
[messageport] 58.33%
Change-Id: Ic432cca30647544a11c6fe5ee7038372c9deae9e
Signed-off-by: Anna Niznik <a.niznik@samsung.com>
namespace FilesystemUtils {
std::string get_storage_dir_path(int id, storage_directory_e typeToCheck) {
LoggerD("Enter");
- int result = STORAGE_ERROR_NONE;
char* platformPath = NULL;
- result = storage_get_directory(id, typeToCheck, &platformPath);
+ int result = storage_get_directory(id, typeToCheck, &platformPath);
if (result != STORAGE_ERROR_NONE) {
LoggerD("Cannot retrieve path for type %i", typeToCheck);
return std::string();
PlatformResult HumanActivityMonitorManager::UnsetWristUpListener() {
LoggerD("Enter");
- int ret;
if (gesture_handle_) {
- ret = gesture_stop_recognition(gesture_handle_);
+ int ret = gesture_stop_recognition(gesture_handle_);
if (ret != GESTURE_ERROR_NONE) {
LOGGER(ERROR) << "Failed to stop WRIST_UP detection, error: " << ret;
}
PlatformResult HumanActivityMonitorManager::UnsetHrmListener() {
LoggerD("Enter");
- int ret;
if (hrm_sensor_listener_) {
- ret = sensor_listener_stop(hrm_sensor_listener_);
+ int ret = sensor_listener_stop(hrm_sensor_listener_);
if (ret != SENSOR_ERROR_NONE) {
LOGGER(ERROR) << "Failed to stop HRM sensor, error: " << ret;
return PlatformResult(ErrorCode::UNKNOWN_ERR,
PlatformResult HumanActivityMonitorManager::UnsetGpsListener() {
LoggerD("Enter");
- int ret;
if (location_handle_) {
- ret = location_manager_stop_batch(location_handle_);
+ int ret = location_manager_stop_batch(location_handle_);
if (ret != LOCATIONS_ERROR_NONE) {
LOGGER(ERROR) << "Failed to stop location manager, error: " << ret;
return PlatformResult(ErrorCode::UNKNOWN_ERR,
common::tools::ReportError(success, &result->get<picojson::object>());
}
- delete data;
+ delete[] data;
};
auto save_data_result = [this, callback_id](const std::shared_ptr<picojson::value>& result) {
free(value);
};
- int ret;
for (auto& field : metadata_fields) {
- ret = mc_client_get_metadata(metadata_h,
+ int ret = mc_client_get_metadata(metadata_h,
static_cast<mc_meta_e>(field.second),
&value);
if (ret != MEDIA_CONTROLLER_ERROR_NONE) {
bundle* bundle = bundle_create();
for (picojson::value::array::iterator it = data.begin();
- it != data.end(); it++) {
+ it != data.end(); ++it) {
bundle_add(bundle, (*it).get("key").to_str().c_str(),
(*it).get("value").to_str().c_str());
}