Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1149)

Unified Diff: content/browser/speech/chunked_byte_buffer.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/speech/chunked_byte_buffer.cc
diff --git a/content/browser/speech/chunked_byte_buffer.cc b/content/browser/speech/chunked_byte_buffer.cc
index 5fcf5d18fe624437ead9bfc223b354be64df4bb9..7ae9f46ecfef33558f193f4aa8adab1095f066ca 100644
--- a/content/browser/speech/chunked_byte_buffer.cc
+++ b/content/browser/speech/chunked_byte_buffer.cc
@@ -6,22 +6,21 @@
#include <algorithm>
-#include "base/basictypes.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
namespace {
-static const size_t kHeaderLength = sizeof(uint32);
+static const size_t kHeaderLength = sizeof(uint32_t);
static_assert(sizeof(size_t) >= kHeaderLength,
"chunked byte buffer not supported on this architecture");
-uint32 ReadBigEndian32(const uint8* buffer) {
- return (static_cast<uint32>(buffer[3])) |
- (static_cast<uint32>(buffer[2]) << 8) |
- (static_cast<uint32>(buffer[1]) << 16) |
- (static_cast<uint32>(buffer[0]) << 24);
+uint32_t ReadBigEndian32(const uint8_t* buffer) {
+ return (static_cast<uint32_t>(buffer[3])) |
+ (static_cast<uint32_t>(buffer[2]) << 8) |
+ (static_cast<uint32_t>(buffer[1]) << 16) |
+ (static_cast<uint32_t>(buffer[0]) << 24);
}
} // namespace
@@ -37,16 +36,16 @@ ChunkedByteBuffer::~ChunkedByteBuffer() {
Clear();
}
-void ChunkedByteBuffer::Append(const uint8* start, size_t length) {
+void ChunkedByteBuffer::Append(const uint8_t* start, size_t length) {
size_t remaining_bytes = length;
- const uint8* next_data = start;
+ const uint8_t* next_data = start;
while (remaining_bytes > 0) {
DCHECK(partial_chunk_ != NULL);
size_t insert_length = 0;
bool header_completed = false;
bool content_completed = false;
- std::vector<uint8>* insert_target;
+ std::vector<uint8_t>* insert_target;
if (partial_chunk_->header.size() < kHeaderLength) {
const size_t bytes_to_complete_header =
@@ -96,16 +95,16 @@ void ChunkedByteBuffer::Append(const uint8* start, size_t length) {
}
void ChunkedByteBuffer::Append(const std::string& string) {
- Append(reinterpret_cast<const uint8*>(string.data()), string.size());
+ Append(reinterpret_cast<const uint8_t*>(string.data()), string.size());
}
bool ChunkedByteBuffer::HasChunks() const {
return !chunks_.empty();
}
-scoped_ptr< std::vector<uint8> > ChunkedByteBuffer::PopChunk() {
+scoped_ptr<std::vector<uint8_t>> ChunkedByteBuffer::PopChunk() {
if (chunks_.empty())
- return scoped_ptr< std::vector<uint8> >();
+ return scoped_ptr<std::vector<uint8_t>>();
scoped_ptr<Chunk> chunk(*chunks_.begin());
chunks_.weak_erase(chunks_.begin());
DCHECK_EQ(chunk->header.size(), kHeaderLength);
@@ -121,9 +120,7 @@ void ChunkedByteBuffer::Clear() {
total_bytes_stored_ = 0;
}
-ChunkedByteBuffer::Chunk::Chunk()
- : content(new std::vector<uint8>()) {
-}
+ChunkedByteBuffer::Chunk::Chunk() : content(new std::vector<uint8_t>()) {}
ChunkedByteBuffer::Chunk::~Chunk() {
}
« no previous file with comments | « content/browser/speech/chunked_byte_buffer.h ('k') | content/browser/speech/chunked_byte_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698