From 8703b691515756fdbb180275fa465815c103c805 Mon Sep 17 00:00:00 2001 From: artemp Date: Thu, 6 Feb 2014 12:09:13 +0000 Subject: [PATCH] c++ * use c++ style casts * remove unused includes --- include/llmr/util/pbf.hpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/include/llmr/util/pbf.hpp b/include/llmr/util/pbf.hpp index 526bc68d3..b685d158c 100644 --- a/include/llmr/util/pbf.hpp +++ b/include/llmr/util/pbf.hpp @@ -8,12 +8,8 @@ * Author: Josh Haberman */ -#include -#include -#include #include - namespace llmr { struct pbf { @@ -73,7 +69,7 @@ pbf::operator bool() const { bool pbf::next() { if (data < end) { - value = (uint32_t)varint(); + value = static_cast(varint()); tag = value >> 3; return true; } @@ -134,8 +130,8 @@ double pbf::float64() { } std::string pbf::string() { - uint32_t bytes = (uint32_t)varint(); - const char *string = (const char *)data; + uint32_t bytes = static_cast(varint()); + const char *string = reinterpret_cast(data); skipBytes(bytes); return std::string(string, bytes); } @@ -146,7 +142,7 @@ bool pbf::boolean() { } pbf pbf::message() { - uint32_t bytes = (uint32_t)varint(); + uint32_t bytes = static_cast(varint()); const uint8_t *pos = data; skipBytes(bytes); return pbf(pos, bytes); @@ -165,7 +161,7 @@ void pbf::skipValue(uint32_t val) { skipBytes(8); break; case 2: // string/message - skipBytes((uint32_t)varint()); + skipBytes(static_cast(varint())); break; case 5: // 32 bit skipBytes(4);