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:
authorygorshenin <mipt.vi002@gmail.com>2017-01-10 18:04:40 +0300
committerGitHub <noreply@github.com>2017-01-10 18:04:40 +0300
commit8c565db1db9fa09b10025b699197199843034b59 (patch)
tree3c5cf0734b84aecdeee0929d7d573cffcccc128c
parent26d472ea19f4b15d8a3bb567d539b01d508b835e (diff)
parent5fc11e9bea22f57793758c4909177404d39369cc (diff)
Merge pull request #5150 from mapsme/fix-warningbeta-565
Fix compile warnings
-rw-r--r--base/math.hpp10
-rw-r--r--coding/writer.hpp4
-rw-r--r--drape_frontend/visual_params.cpp2
-rw-r--r--drape_frontend/watch/feature_styler.cpp4
-rw-r--r--editor/changeset_wrapper.cpp2
-rw-r--r--editor/editor_notes.cpp4
-rw-r--r--editor/editor_notes.hpp4
-rw-r--r--generator/osm2type.cpp3
-rw-r--r--generator/sponsored_scoring.cpp2
-rw-r--r--geometry/point2d.hpp2
-rw-r--r--geometry/triangle2d.cpp10
-rw-r--r--map/framework.cpp5
-rw-r--r--routing/base/followed_polyline.hpp7
-rw-r--r--routing/bicycle_directions.cpp1
-rw-r--r--routing/geometry.hpp5
-rw-r--r--routing/index_graph_serialization.hpp2
-rw-r--r--routing/joint_index.hpp4
-rw-r--r--search/pre_ranker.cpp4
-rw-r--r--traffic/traffic_info.cpp2
19 files changed, 42 insertions, 35 deletions
diff --git a/base/math.hpp b/base/math.hpp
index a213d6a2a3..396be414ea 100644
--- a/base/math.hpp
+++ b/base/math.hpp
@@ -102,8 +102,8 @@ template <typename T> inline T sq(T const & x)
return x * x;
}
-template <typename T, typename TMin, typename TMax>
-inline T clamp(T x, TMin xmin, TMax xmax)
+template <typename T>
+inline T clamp(T const x, T const xmin, T const xmax)
{
if (x > xmax)
return xmax;
@@ -113,7 +113,7 @@ inline T clamp(T x, TMin xmin, TMax xmax)
}
template <typename T>
-inline T cyclicClamp(T x, T xmin, T xmax)
+inline T cyclicClamp(T const x, T const xmin, T const xmax)
{
if (x > xmax)
return xmin;
@@ -122,11 +122,11 @@ inline T cyclicClamp(T x, T xmin, T xmax)
return x;
}
-template <typename T> inline bool between_s(T a, T b, T x)
+template <typename T> inline bool between_s(T const a, T const b, T const x)
{
return (a <= x && x <= b);
}
-template <typename T> inline bool between_i(T a, T b, T x)
+template <typename T> inline bool between_i(T const a, T const b, T const x)
{
return (a < x && x < b);
}
diff --git a/coding/writer.hpp b/coding/writer.hpp
index b68c9e3891..9715388942 100644
--- a/coding/writer.hpp
+++ b/coding/writer.hpp
@@ -58,7 +58,7 @@ public:
memcpy(&m_Data[m_Pos], p, min(size, static_cast<size_t>(freeSize)));
- if (size > freeSize)
+ if (size > static_cast<size_t>(freeSize))
{
uint8_t const * it = reinterpret_cast<uint8_t const *>(p);
m_Data.insert(m_Data.end(), it + freeSize, it + size);
@@ -120,7 +120,7 @@ public:
inline uint64_t Size() const { return m_maxPos; }
private:
- inline uint64_t GetOffset() const { return m_writer.Pos() - m_pos; }
+ inline int64_t GetOffset() const { return m_writer.Pos() - m_pos; }
private:
WriterT & m_writer;
diff --git a/drape_frontend/visual_params.cpp b/drape_frontend/visual_params.cpp
index e690e976e9..79eb0a35cb 100644
--- a/drape_frontend/visual_params.cpp
+++ b/drape_frontend/visual_params.cpp
@@ -291,7 +291,7 @@ int GetDrawTileScale(m2::RectD const & r)
double GetZoomLevel(double scale)
{
static double const kLog2 = log(2.0);
- return my::clamp(fabs(log(scale) / kLog2), 1, scales::GetUpperStyleScale() + 1.0);
+ return my::clamp(fabs(log(scale) / kLog2), 1.0, scales::GetUpperStyleScale() + 1.0);
}
double GetNormalizedZoomLevel(double scale, int minZoom)
diff --git a/drape_frontend/watch/feature_styler.cpp b/drape_frontend/watch/feature_styler.cpp
index 3976e19ea3..0a104f07ed 100644
--- a/drape_frontend/watch/feature_styler.cpp
+++ b/drape_frontend/watch/feature_styler.cpp
@@ -34,9 +34,9 @@ namespace df
{
namespace watch
{
-
DrawRule::DrawRule(drule::BaseRule const * p, double depth)
- : m_rule(p), m_depth(my::clamp(depth, minDepth, maxDepth))
+ : m_rule(p)
+ , m_depth(my::clamp(depth, static_cast<double>(minDepth), static_cast<double>(maxDepth)))
{
}
diff --git a/editor/changeset_wrapper.cpp b/editor/changeset_wrapper.cpp
index 48ebfecf11..d161b4332b 100644
--- a/editor/changeset_wrapper.cpp
+++ b/editor/changeset_wrapper.cpp
@@ -72,7 +72,7 @@ vector<m2::PointD> NaiveSample(vector<m2::PointD> const & source, size_t count)
indexes.reserve(count);
minstd_rand engine;
- uniform_int_distribution<> distrib(0, source.size());
+ uniform_int_distribution<size_t> distrib(0, source.size());
while (count--)
{
diff --git a/editor/editor_notes.cpp b/editor/editor_notes.cpp
index bd9a66267a..9c25db4e85 100644
--- a/editor/editor_notes.cpp
+++ b/editor/editor_notes.cpp
@@ -202,13 +202,13 @@ vector<Note> const Notes::GetNotes() const
return {begin(m_notes), end(m_notes)};
}
-uint32_t Notes::NotUploadedNotesCount() const
+size_t Notes::NotUploadedNotesCount() const
{
lock_guard<mutex> g(m_mu);
return m_notes.size();
}
-uint32_t Notes::UploadedNotesCount() const
+size_t Notes::UploadedNotesCount() const
{
lock_guard<mutex> g(m_mu);
return m_uploadedNotesCount;
diff --git a/editor/editor_notes.hpp b/editor/editor_notes.hpp
index 06c540c448..34ea5b24b4 100644
--- a/editor/editor_notes.hpp
+++ b/editor/editor_notes.hpp
@@ -38,8 +38,8 @@ public:
vector<Note> const GetNotes() const;
- uint32_t NotUploadedNotesCount() const;
- uint32_t UploadedNotesCount() const;
+ size_t NotUploadedNotesCount() const;
+ size_t UploadedNotesCount() const;
private:
Notes(string const & fileName);
diff --git a/generator/osm2type.cpp b/generator/osm2type.cpp
index 3cf6cbdbca..9a97341bcc 100644
--- a/generator/osm2type.cpp
+++ b/generator/osm2type.cpp
@@ -12,6 +12,7 @@
#include "base/string_utils.hpp"
#include "std/bind.hpp"
+#include "std/cstdint.hpp"
#include "std/function.hpp"
#include "std/initializer_list.hpp"
#include "std/set.hpp"
@@ -686,7 +687,7 @@ namespace ftype
{
params.layer = atoi(v.c_str());
int8_t const bound = 10;
- params.layer = my::clamp(params.layer, -bound, bound);
+ params.layer = my::clamp(params.layer, static_cast<int8_t>(-bound), bound);
}
}
},
diff --git a/generator/sponsored_scoring.cpp b/generator/sponsored_scoring.cpp
index d6e963bdb9..76568aeeac 100644
--- a/generator/sponsored_scoring.cpp
+++ b/generator/sponsored_scoring.cpp
@@ -88,7 +88,7 @@ namespace impl
double GetLinearNormDistanceScore(double distance, double const maxDistance)
{
CHECK_NOT_EQUAL(maxDistance, 0.0, ("maxDistance cannot be 0."));
- distance = my::clamp(distance, 0, maxDistance);
+ distance = my::clamp(distance, 0.0, maxDistance);
return 1.0 - distance / maxDistance;
}
diff --git a/geometry/point2d.hpp b/geometry/point2d.hpp
index 85927ced7d..57984e4683 100644
--- a/geometry/point2d.hpp
+++ b/geometry/point2d.hpp
@@ -290,7 +290,7 @@ namespace m2
Point<T> PointAtSegment(Point<T> const & p1, Point<T> const & p2, T shiftFromP1)
{
Point<T> p12 = p2 - p1;
- shiftFromP1 = my::clamp(shiftFromP1, 0.0, p12.Length());
+ shiftFromP1 = my::clamp(shiftFromP1, static_cast<T>(0.0), static_cast<T>(p12.Length()));
return p1 + p12.Normalize() * shiftFromP1;
}
diff --git a/geometry/triangle2d.cpp b/geometry/triangle2d.cpp
index c143729d72..318394da50 100644
--- a/geometry/triangle2d.cpp
+++ b/geometry/triangle2d.cpp
@@ -57,8 +57,9 @@ m2::PointD GetRandomPointInsideTriangle(m2::TriangleD const & t)
{
size_t kDistribMax = 1000;
- default_random_engine engine(system_clock::now().time_since_epoch().count());
- uniform_int_distribution<> distrib(0, kDistribMax);
+ auto const seed = static_cast<uint32_t>(system_clock::now().time_since_epoch().count());
+ default_random_engine engine(seed);
+ uniform_int_distribution<size_t> distrib(0, kDistribMax);
double const r1 = sqrt(static_cast<double>(distrib(engine)) / kDistribMax);
double const r2 = static_cast<double>(distrib(engine)) / kDistribMax;
return t.m_points[0] * (1.0 - r1) + t.m_points[1] * r1 * (1.0 - r2) + t.m_points[2] * r2 * r1;
@@ -69,8 +70,9 @@ m2::PointD GetRandomPointInsideTriangles(vector<m2::TriangleD> const & v)
if (v.empty())
return m2::PointD();
- default_random_engine engine(system_clock::now().time_since_epoch().count());
- uniform_int_distribution<> distrib(0, v.size() - 1);
+ auto const seed = static_cast<uint32_t>(system_clock::now().time_since_epoch().count());
+ default_random_engine engine(seed);
+ uniform_int_distribution<size_t> distrib(0, v.size() - 1);
return GetRandomPointInsideTriangle(v[distrib(engine)]);
}
diff --git a/map/framework.cpp b/map/framework.cpp
index 2a6ec22004..37cba3d706 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -2307,10 +2307,11 @@ string Framework::CodeGe0url(Bookmark const * bmk, bool addName)
string Framework::CodeGe0url(double lat, double lon, double zoomLevel, string const & name)
{
- size_t const resultSize = MapsWithMe_GetMaxBufferSize(name.size());
+ size_t const resultSize = MapsWithMe_GetMaxBufferSize(static_cast<int>(name.size()));
string res(resultSize, 0);
- int const len = MapsWithMe_GenShortShowMapUrl(lat, lon, zoomLevel, name.c_str(), &res[0], res.size());
+ int const len = MapsWithMe_GenShortShowMapUrl(lat, lon, zoomLevel, name.c_str(), &res[0],
+ static_cast<int>(res.size()));
ASSERT_LESS_OR_EQUAL(len, res.size(), ());
res.resize(len);
diff --git a/routing/base/followed_polyline.hpp b/routing/base/followed_polyline.hpp
index 4ceaa5a4b2..600ca21e39 100644
--- a/routing/base/followed_polyline.hpp
+++ b/routing/base/followed_polyline.hpp
@@ -52,10 +52,11 @@ public:
m2::PointD m_pt;
size_t m_ind;
- Iter(m2::PointD pt, size_t ind) : m_pt(pt), m_ind(ind) {}
- Iter() : m_ind(-1) {}
+ static size_t constexpr kInvalidIndex = std::numeric_limits<size_t>::max();
- bool IsValid() const { return m_ind != -1; }
+ Iter(m2::PointD pt, size_t ind) : m_pt(pt), m_ind(ind) {}
+ Iter() : m_ind(kInvalidIndex) {}
+ bool IsValid() const { return m_ind != kInvalidIndex; }
};
const Iter GetCurrentIter() const { return m_current; }
diff --git a/routing/bicycle_directions.cpp b/routing/bicycle_directions.cpp
index 5f2a5395f5..b23387383c 100644
--- a/routing/bicycle_directions.cpp
+++ b/routing/bicycle_directions.cpp
@@ -181,6 +181,7 @@ void BicycleDirectionsEngine::Generate(IRoadGraph const & graph, vector<Junction
auto const it = m_adjacentEdges.insert(make_pair(uniNodeId, move(adjacentEdges)));
ASSERT(it.second, ());
+ UNUSED_VALUE(it);
m_pathSegments.push_back(move(pathSegment));
}
diff --git a/routing/geometry.hpp b/routing/geometry.hpp
index 28ff5a6262..dce2280cc9 100644
--- a/routing/geometry.hpp
+++ b/routing/geometry.hpp
@@ -26,18 +26,15 @@ public:
void Load(IVehicleModel const & vehicleModel, FeatureType const & feature);
bool IsOneWay() const { return m_isOneWay; }
-
// Kilometers per hour.
double GetSpeed() const { return m_speed; }
-
m2::PointD const & GetPoint(uint32_t pointId) const
{
ASSERT_LESS(pointId, m_points.size(), ());
return m_points[pointId];
}
- uint32_t GetPointsCount() const { return m_points.size(); }
-
+ uint32_t GetPointsCount() const { return static_cast<uint32_t>(m_points.size()); }
private:
Points m_points;
double m_speed = 0.0;
diff --git a/routing/index_graph_serialization.hpp b/routing/index_graph_serialization.hpp
index bc843c7de7..796f2fd97d 100644
--- a/routing/index_graph_serialization.hpp
+++ b/routing/index_graph_serialization.hpp
@@ -372,6 +372,7 @@ private:
bool const success = coding::GammaCoder::Encode(writer, static_cast<uint64_t>(value));
ASSERT(success, ());
+ UNUSED_VALUE(success);
}
template <class Source>
@@ -391,6 +392,7 @@ private:
bool const success = coding::DeltaCoder::Encode(writer, static_cast<uint64_t>(value));
ASSERT(success, ());
+ UNUSED_VALUE(success);
}
template <class Source>
diff --git a/routing/joint_index.hpp b/routing/joint_index.hpp
index 668e8e6f1b..af9dabe129 100644
--- a/routing/joint_index.hpp
+++ b/routing/joint_index.hpp
@@ -21,10 +21,10 @@ public:
uint32_t GetNumJoints() const
{
CHECK_GREATER(m_offsets.size(), 0, ());
- return m_offsets.size() - 1;
+ return static_cast<uint32_t>(m_offsets.size() - 1);
}
- uint32_t GetNumPoints() const { return m_points.size(); }
+ uint32_t GetNumPoints() const { return static_cast<uint32_t>(m_points.size()); }
RoadPoint GetPoint(Joint::Id jointId) const { return m_points[Begin(jointId)]; }
template <typename F>
diff --git a/search/pre_ranker.cpp b/search/pre_ranker.cpp
index b1e5ba7abf..fb8c62cc00 100644
--- a/search/pre_ranker.cpp
+++ b/search/pre_ranker.cpp
@@ -260,10 +260,10 @@ void PreRanker::FilterForViewportSearch()
{
auto const & p = m_results[i].GetInfo().m_center;
int dx = static_cast<int>((p.x - viewport.minX()) / sizeX * kNumXSlots);
- dx = my::clamp(dx, 0, kNumXSlots - 1);
+ dx = my::clamp(dx, 0, static_cast<int>(kNumXSlots) - 1);
int dy = static_cast<int>((p.y - viewport.minY()) / sizeY * kNumYSlots);
- dy = my::clamp(dy, 0, kNumYSlots - 1);
+ dy = my::clamp(dy, 0, static_cast<int>(kNumYSlots) - 1);
buckets[dx * kNumYSlots + dy].push_back(i);
}
diff --git a/traffic/traffic_info.cpp b/traffic/traffic_info.cpp
index 25d3d92889..ffa122fae7 100644
--- a/traffic/traffic_info.cpp
+++ b/traffic/traffic_info.cpp
@@ -277,6 +277,7 @@ void TrafficInfo::SerializeTrafficKeys(vector<RoadSegmentId> const & keys, vecto
uint64_t const fidDiff = static_cast<uint64_t>(fid - prevFid);
bool ok = coding::GammaCoder::Encode(bitWriter, fidDiff + 1);
ASSERT(ok, ());
+ UNUSED_VALUE(ok);
prevFid = fid;
}
@@ -284,6 +285,7 @@ void TrafficInfo::SerializeTrafficKeys(vector<RoadSegmentId> const & keys, vecto
{
bool ok = coding::GammaCoder::Encode(bitWriter, s + 1);
ASSERT(ok, ());
+ UNUSED_VALUE(ok);
}
for (auto const & val : oneWay)