From aeffe1056f9ff6526d87a16ef55222899f5528f7 Mon Sep 17 00:00:00 2001 From: "ted.mielczarek@gmail.com" Date: Wed, 6 Mar 2013 14:04:42 +0000 Subject: Use stdint types everywhere R=mark at https://breakpad.appspot.com/535002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1121 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/processor/binarystream.cc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/processor/binarystream.cc') diff --git a/src/processor/binarystream.cc b/src/processor/binarystream.cc index 9ed3b702..bf92225b 100644 --- a/src/processor/binarystream.cc +++ b/src/processor/binarystream.cc @@ -40,7 +40,7 @@ namespace google_breakpad { using std::vector; binarystream &binarystream::operator>>(string &str) { - u_int16_t length; + uint16_t length; *this >> length; if (eof()) return *this; @@ -55,68 +55,68 @@ binarystream &binarystream::operator>>(string &str) { return *this; } -binarystream &binarystream::operator>>(u_int8_t &u8) { +binarystream &binarystream::operator>>(uint8_t &u8) { stream_.read((char *)&u8, 1); return *this; } -binarystream &binarystream::operator>>(u_int16_t &u16) { - u_int16_t temp; +binarystream &binarystream::operator>>(uint16_t &u16) { + uint16_t temp; stream_.read((char *)&temp, 2); if (!eof()) u16 = ntohs(temp); return *this; } -binarystream &binarystream::operator>>(u_int32_t &u32) { - u_int32_t temp; +binarystream &binarystream::operator>>(uint32_t &u32) { + uint32_t temp; stream_.read((char *)&temp, 4); if (!eof()) u32 = ntohl(temp); return *this; } -binarystream &binarystream::operator>>(u_int64_t &u64) { - u_int32_t lower, upper; +binarystream &binarystream::operator>>(uint64_t &u64) { + uint32_t lower, upper; *this >> lower >> upper; if (!eof()) - u64 = static_cast(lower) | (static_cast(upper) << 32); + u64 = static_cast(lower) | (static_cast(upper) << 32); return *this; } binarystream &binarystream::operator<<(const string &str) { if (str.length() > USHRT_MAX) { // truncate to 16-bit length - *this << static_cast(USHRT_MAX); + *this << static_cast(USHRT_MAX); stream_.write(str.c_str(), USHRT_MAX); } else { - *this << (u_int16_t)(str.length() & 0xFFFF); + *this << (uint16_t)(str.length() & 0xFFFF); stream_.write(str.c_str(), str.length()); } return *this; } -binarystream &binarystream::operator<<(u_int8_t u8) { +binarystream &binarystream::operator<<(uint8_t u8) { stream_.write((const char*)&u8, 1); return *this; } -binarystream &binarystream::operator<<(u_int16_t u16) { +binarystream &binarystream::operator<<(uint16_t u16) { u16 = htons(u16); stream_.write((const char*)&u16, 2); return *this; } -binarystream &binarystream::operator<<(u_int32_t u32) { +binarystream &binarystream::operator<<(uint32_t u32) { u32 = htonl(u32); stream_.write((const char*)&u32, 4); return *this; } -binarystream &binarystream::operator<<(u_int64_t u64) { +binarystream &binarystream::operator<<(uint64_t u64) { // write 64-bit ints as two 32-bit ints, so we can byte-swap them easily - u_int32_t lower = static_cast(u64 & 0xFFFFFFFF); - u_int32_t upper = static_cast(u64 >> 32); + uint32_t lower = static_cast(u64 & 0xFFFFFFFF); + uint32_t upper = static_cast(u64 >> 32); *this << lower << upper; return *this; } -- cgit v1.2.1