Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2013-08-27 17:29:33 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:00:18 +0300
commite15c2864244149eb06b84dc6e4d83bd878a70f78 (patch)
tree99e193090a544baf36b962666421ae120239940b /platform
parent6e6b6e9c933af74bd54fbf095e2281e9da7f8cdc (diff)
Factor out JsonHandle as a smart pointer on json_t.
Diffstat (limited to 'platform')
-rw-r--r--platform/platform_tests/jansson_test.cpp4
-rw-r--r--platform/servers_list.cpp8
-rw-r--r--platform/wifi_location_service.cpp4
3 files changed, 8 insertions, 8 deletions
diff --git a/platform/platform_tests/jansson_test.cpp b/platform/platform_tests/jansson_test.cpp
index a3f819cc02..efad4dc094 100644
--- a/platform/platform_tests/jansson_test.cpp
+++ b/platform/platform_tests/jansson_test.cpp
@@ -11,8 +11,8 @@ UNIT_TEST(Jansson_Smoke)
"\"accuracy\":22.0},\"access_token\":\"2:vC65Xv0mxMtsNVf4:hY5YSIkuFfnAU77z\"}";
my::Json root(str);
- TEST(json_is_object(root), ());
- json_t * location = json_object_get(root, "location");
+ TEST(json_is_object(root.get()), ());
+ json_t * location = json_object_get(root.get(), "location");
TEST(json_is_object(location), ());
json_t * lat = json_object_get(location, "latitude");
diff --git a/platform/servers_list.cpp b/platform/servers_list.cpp
index f0e10bd12a..2448affac9 100644
--- a/platform/servers_list.cpp
+++ b/platform/servers_list.cpp
@@ -21,16 +21,16 @@ bool ParseServerList(string const & jsonStr, vector<string> & outUrls)
try
{
my::Json root(jsonStr.c_str());
- for (size_t i = 0; i < json_array_size(root); ++i)
+ for (size_t i = 0; i < json_array_size(root.get()); ++i)
{
- char const * url = json_string_value(json_array_get(root, i));
+ char const * url = json_string_value(json_array_get(root.get(), i));
if (url)
outUrls.push_back(url);
}
}
- catch (std::exception const & e)
+ catch (my::Json::Exception const & ex)
{
- LOG(LERROR, ("Can't parse server list json", e.what(), jsonStr));
+ LOG(LERROR, ("Can't parse server list json:", ex.Msg(), jsonStr));
}
return !outUrls.empty();
}
diff --git a/platform/wifi_location_service.cpp b/platform/wifi_location_service.cpp
index 3fd394c5a8..1989eb9d7e 100644
--- a/platform/wifi_location_service.cpp
+++ b/platform/wifi_location_service.cpp
@@ -29,9 +29,9 @@ namespace location
{
bool success = false;
my::Json root(response.Data().c_str());
- if (json_is_object(root))
+ if (json_is_object(root.get()))
{
- json_t * location = json_object_get(root, "location");
+ json_t * location = json_object_get(root.get(), "location");
if (json_is_object(location))
{
json_t * lat = json_object_get(location, "latitude");