Profiler: Fix casts and signedness on integer values

This commit is contained in:
Paul "Dettorer" Hervot 2015-11-29 10:58:10 +01:00 committed by Paul Dettorer Hervot
parent 96c20a2ed2
commit 58180a2db0
3 changed files with 5 additions and 5 deletions

View File

@ -59,7 +59,7 @@ unsigned int ProfilingManager::RegisterTimingCategory(TimingCategory* category,
info.name = name; info.name = name;
info.parent = TimingCategoryInfo::NO_PARENT; info.parent = TimingCategoryInfo::NO_PARENT;
unsigned int id = (unsigned int)timing_categories.size(); unsigned int id = static_cast<unsigned int>(timing_categories.size());
timing_categories.push_back(std::move(info)); timing_categories.push_back(std::move(info));
return id; return id;
@ -140,7 +140,7 @@ static AggregatedDuration AggregateField(const std::vector<Duration>& v, size_t
result.max = std::max(result.max, value); result.max = std::max(result.max, value);
} }
if (len != 0) if (len != 0)
result.avg /= len; result.avg /= static_cast<const long>(len);
return result; return result;
} }
@ -177,7 +177,7 @@ ProfilingManager& GetProfilingManager() {
} }
SynchronizedRef<TimingResultsAggregator> GetTimingResultsAggregator() { SynchronizedRef<TimingResultsAggregator> GetTimingResultsAggregator() {
static SynchronizedWrapper<TimingResultsAggregator> aggregator(30); static SynchronizedWrapper<TimingResultsAggregator> aggregator(static_cast<size_t>(30));
return SynchronizedRef<TimingResultsAggregator>(aggregator); return SynchronizedRef<TimingResultsAggregator>(aggregator);
} }

View File

@ -64,7 +64,7 @@ public:
*/ */
Duration GetAccumulatedTime() { Duration GetAccumulatedTime() {
return Duration(std::atomic_exchange_explicit( return Duration(std::atomic_exchange_explicit(
&accumulated_duration, (Duration::rep)0, &accumulated_duration, static_cast<Duration::rep>(0),
std::memory_order_relaxed)); std::memory_order_relaxed));
} }

View File

@ -14,7 +14,7 @@ namespace Common {
namespace Profiling { namespace Profiling {
struct TimingCategoryInfo { struct TimingCategoryInfo {
static const unsigned int NO_PARENT = -1; static const unsigned int NO_PARENT = std::numeric_limits<unsigned>::max();
TimingCategory* category; TimingCategory* category;
const char* name; const char* name;