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
path: root/map
diff options
context:
space:
mode:
authoralexzatsepin <alexander.zatzepin@gmail.com>2016-10-21 20:11:19 +0300
committerArsentiy Milchakov <milcars@mapswithme.com>2016-10-21 20:34:02 +0300
commit5b4a5843fd783b497c25c980eaed62e7e25ece71 (patch)
tree5e622e92048717dbda91fd5aaa10568117cb8e0a /map
parent795cbd14c4071208b4c2f236d23413c8a972f5fb (diff)
[android] Reverted the returning empty string when rating is absent
Diffstat (limited to 'map')
-rw-r--r--map/place_page_info.cpp11
-rw-r--r--map/place_page_info.hpp1
2 files changed, 6 insertions, 6 deletions
diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp
index f1d2c4460b..2d5e30b1bf 100644
--- a/map/place_page_info.cpp
+++ b/map/place_page_info.cpp
@@ -10,6 +10,7 @@ namespace place_page
char const * const Info::kSubtitleSeparator = " • ";
char const * const Info::kStarSymbol = "★";
char const * const Info::kMountainSymbol = "▲";
+char const * const Info::kEmptyRatingSymbol = "-";
char const * const Info::kPricingSymbol = "$";
bool Info::IsFeature() const { return m_featureID.IsValid(); }
@@ -122,11 +123,9 @@ string Info::GetRatingFormatted() const
if (!IsSponsored())
return string();
- auto const rating = GetMetadata().Get(feature::Metadata::FMD_RATING);
- if (rating.empty())
- return rating;
-
- int const size = snprintf(nullptr, 0, m_localizedRatingString.c_str(), rating.c_str());
+ auto const r = GetMetadata().Get(feature::Metadata::FMD_RATING);
+ char const * rating = r.empty() ? kEmptyRatingSymbol : r.c_str();
+ int const size = snprintf(nullptr, 0, m_localizedRatingString.c_str(), rating);
if (size < 0)
{
LOG(LERROR, ("Incorrect size for string:", m_localizedRatingString, ", rating:", rating));
@@ -134,7 +133,7 @@ string Info::GetRatingFormatted() const
}
vector<char> buf(size + 1);
- snprintf(buf.data(), buf.size(), m_localizedRatingString.c_str(), rating.c_str());
+ snprintf(buf.data(), buf.size(), m_localizedRatingString.c_str(), rating);
return string(buf.begin(), buf.end());
}
diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp
index db316b300b..29f9bc42be 100644
--- a/map/place_page_info.hpp
+++ b/map/place_page_info.hpp
@@ -30,6 +30,7 @@ public:
static char const * const kSubtitleSeparator;
static char const * const kStarSymbol;
static char const * const kMountainSymbol;
+ static char const * const kEmptyRatingSymbol;
static char const * const kPricingSymbol;
bool IsFeature() const;