提交 63abf1ec 编写于 作者: D Dong Li

build: fix compile warnings

上级 d14c36a6
......@@ -59,20 +59,16 @@ class LRUCache {
/**@brief Change cache's max capacity. New capacity must be larger than size
* in use. */
bool ChangeCapacity(int capacity) {
if (list_.size() > capacity) {
if (static_cast<int>(list_.size()) > capacity) {
return false;
}
capacity_ = capacity;
return true;
}
/**@brief return cache's in use. */
int Size() {
return list_.size();
}
int Size() { return list_.size(); }
/**@brief return cache's max capacity. */
int Capacity() {
return capacity_;
}
int Capacity() { return capacity_; }
protected:
/**@brief do something before remove a element from cache.
......@@ -123,7 +119,7 @@ Element *LRUCache<Key, Element>::Put(const Key &key, Element *value) {
return node_remove;
}
// reached capacity, remove value in list, remove key in map
if (map_.size() >= capacity_) {
if (static_cast<int>(map_.size()) >= capacity_) {
node_remove = ClearOne();
// ListReverseIterator ritr = list_.rbegin();
// while(ritr != list_.rend()) {
......@@ -136,7 +132,7 @@ Element *LRUCache<Key, Element>::Put(const Key &key, Element *value) {
// ++ritr;
// }
}
if (map_.size() >= capacity_) {
if (static_cast<int>(map_.size()) >= capacity_) {
std::cout << "LRUCache Warning: the cache size is temporarily increased!"
<< std::endl;
}
......@@ -223,9 +219,7 @@ class MapNodeCacheL2 : public LRUCache<Key, MapNode> {
* Return true if the element can be removed. Return false if the element
* can't be removed. Then the cache will try to find another element to
* remove. */
virtual bool Destroy(MapNode **value) {
return !((*value)->GetIsReserved());
}
virtual bool Destroy(MapNode **value) { return !((*value)->GetIsReserved()); }
};
} // namespace msf
......
......@@ -33,7 +33,7 @@ namespace perception {
template <typename PointT>
void TransformPointCloud(const Eigen::Matrix4d& trans_mat,
pcl::PointCloud<PointT>* cloud_in_out) {
for (int i = 0; i < cloud_in_out->size(); ++i) {
for (std::size_t i = 0; i < cloud_in_out->size(); ++i) {
PointT& p = cloud_in_out->at(i);
Eigen::Vector4d v(p.x, p.y, p.z, 1);
v = trans_mat * v;
......@@ -68,7 +68,7 @@ void TransformPointCloud(const pcl::PointCloud<PointType>& cloud_in,
if (cloud_out->points.size() < cloud_in.points.size()) {
cloud_out->points.resize(cloud_in.points.size());
}
for (int i = 0; i < cloud_in.size(); ++i) {
for (std::size_t i = 0; i < cloud_in.size(); ++i) {
const PointType& p = cloud_in.at(i);
Eigen::Vector4d v(p.x, p.y, p.z, 1);
v = trans_mat * v;
......
......@@ -154,7 +154,8 @@ void CommonSharedData<M>::RemoveStaleData() {
bool has_change = false;
for (auto iter = data_added_time_map_.begin();
iter != data_added_time_map_.end();) {
if (now - iter->second > FLAGS_shared_data_stale_time) {
if (now - iter->second >
static_cast<uint64_t>(FLAGS_shared_data_stale_time)) {
const size_t erase_cnt = data_map_.erase(iter->first);
if (erase_cnt != 1u) {
AWARN << "_data_map erase cnt:" << erase_cnt << " key:" << iter->first;
......
......@@ -20,6 +20,8 @@
#include "modules/perception/tool/data_generator/velodyne64.h"
#include <cmath>
namespace apollo {
namespace perception {
namespace data_generator {
......@@ -92,7 +94,8 @@ void Velodyne64::TransPointCloudMsgToPCL(
size_t points_num = 0;
for (size_t i = 0; i < in_cloud.size(); ++i) {
pcl_util::PointXYZIT& pt = in_cloud.points[i];
if (!isnan(pt.x) && !isnan(pt.y) && !isnan(pt.z) && !isnan(pt.intensity)) {
if (!std::isnan(pt.x) && !std::isnan(pt.y) && !std::isnan(pt.z) &&
!std::isnan(pt.intensity)) {
cloud->points[points_num].x = pt.x;
cloud->points[points_num].y = pt.y;
cloud->points[points_num].z = pt.z;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册