diff options
author | kj7.sung <kj7.sung@samsung.com> | 2016-11-23 14:04:04 +0900 |
---|---|---|
committer | kj7.sung <kj7.sung@samsung.com> | 2016-11-23 14:04:04 +0900 |
commit | 3a0286431194401067c96510f64222e35a2e2ac8 (patch) | |
tree | a0ef2721a962105c157cf036899f9776e0e39c85 | |
parent | a773e0f04d613eaab6d00d8ff5b81da794651ead (diff) | |
download | lbs-server-3a0286431194401067c96510f64222e35a2e2ac8.tar.gz lbs-server-3a0286431194401067c96510f64222e35a2e2ac8.tar.bz2 lbs-server-3a0286431194401067c96510f64222e35a2e2ac8.zip |
Fix svace issuesubmit/tizen/20161123.234422submit/tizen/20161123.082735accepted/tizen/wearable/20161125.003419accepted/tizen/mobile/20161125.003339accepted/tizen/ivi/20161125.003439accepted/tizen/common/20161124.170036
Change-Id: I4593a860ce442bb7611428cccf322356b00156e5
Signed-off-by: kj7.sung <kj7.sung@samsung.com>
-rw-r--r-- | module/nps_module.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/module/nps_module.c b/module/nps_module.c index 145357b..7a35f42 100644 --- a/module/nps_module.c +++ b/module/nps_module.c @@ -240,34 +240,43 @@ static int get_last_position(gpointer handle, LocationPosition **position, Locat snprintf(location, sizeof(location), "%s", str); free(str); + index = 0; last_location[index] = (char *)strtok_r(location, ";", &last); - while (last_location[index++] != NULL) { - if (index == MAX_NPS_LOC_ITEM) + while (last_location[index] != NULL) { + switch (index) { + case 0: + latitude = strtod(last_location[index], NULL); + break; + case 1: + longitude = strtod(last_location[index], NULL); + break; + case 2: + altitude = strtod(last_location[index], NULL); + break; + case 3: + speed = strtod(last_location[index], NULL); + break; + case 4: + direction = strtod(last_location[index], NULL); + break; + case 5: + hor_accuracy = strtod(last_location[index], NULL); + break; + default: break; + } + if (++index == MAX_NPS_LOC_ITEM) break; last_location[index] = (char *)strtok_r(NULL, ";", &last); } - - if (index != MAX_NPS_LOC_ITEM) { - MOD_NPS_LOGD("Error item index"); - return LOCATION_ERROR_NOT_AVAILABLE; - } - index = 0; - latitude = strtod(last_location[index++], NULL); - longitude = strtod(last_location[index++], NULL); - altitude = strtod(last_location[index++], NULL); - speed = strtod(last_location[index++], NULL); - direction = strtod(last_location[index++], NULL); - hor_accuracy = strtod(last_location[index], NULL); } } - level = LOCATION_ACCURACY_LEVEL_STREET; - if (timestamp) status = LOCATION_STATUS_3D_FIX; else return LOCATION_ERROR_NOT_AVAILABLE; + level = LOCATION_ACCURACY_LEVEL_STREET; *position = location_position_new((guint) timestamp, latitude, longitude, altitude, status); *velocity = location_velocity_new((guint) timestamp, speed, direction, 0.0); *accuracy = location_accuracy_new(level, hor_accuracy, -1.0); |