| Index: net/tools/balsa/simple_buffer.cc
|
| diff --git a/net/tools/balsa/simple_buffer.cc b/net/tools/balsa/simple_buffer.cc
|
| index 5e02a7b8d68df34da71dee928d9c8061e7480399..fb954ceeaa368f0e2bb485dcbda265a4e8c04cba 100644
|
| --- a/net/tools/balsa/simple_buffer.cc
|
| +++ b/net/tools/balsa/simple_buffer.cc
|
| @@ -21,16 +21,14 @@ namespace net {
|
| static const int kInitialSimpleBufferSize = 10;
|
|
|
| SimpleBuffer::SimpleBuffer()
|
| - : storage_(new char[kInitialSimpleBufferSize]),
|
| - write_idx_(0),
|
| - read_idx_(0),
|
| - storage_size_(kInitialSimpleBufferSize) {
|
| + : storage_(new char[kInitialSimpleBufferSize]),
|
| + write_idx_(0),
|
| + read_idx_(0),
|
| + storage_size_(kInitialSimpleBufferSize) {
|
| }
|
|
|
| SimpleBuffer::SimpleBuffer(int size)
|
| - : write_idx_(0),
|
| - read_idx_(0),
|
| - storage_size_(size) {
|
| + : write_idx_(0), read_idx_(0), storage_size_(size) {
|
| // Callers may try to allocate overly large blocks, but negative sizes are
|
| // obviously wrong.
|
| CHECK_GE(size, 0);
|
| @@ -41,7 +39,6 @@ SimpleBuffer::~SimpleBuffer() {
|
| delete[] storage_;
|
| }
|
|
|
| -
|
| ////////////////////////////////////////////////////////////////////////////////
|
|
|
| int SimpleBuffer::ReadableBytes() const {
|
| @@ -52,7 +49,7 @@ int SimpleBuffer::ReadableBytes() const {
|
|
|
| std::string SimpleBuffer::str() const {
|
| std::string s;
|
| - char * readable_ptr;
|
| + char* readable_ptr;
|
| int readable_size;
|
| GetReadablePtr(&readable_ptr, &readable_size);
|
| s.append(readable_ptr, readable_ptr + readable_size);
|
| @@ -102,7 +99,7 @@ int SimpleBuffer::Write(const char* bytes, int size) {
|
| // stores a pointer into the simple buffer in *ptr,
|
| // and stores the number of characters which are allowed
|
| // to be written in *size.
|
| -inline void SimpleBuffer::GetWritablePtr(char **ptr, int* size) const {
|
| +inline void SimpleBuffer::GetWritablePtr(char** ptr, int* size) const {
|
| *ptr = storage_ + write_idx_;
|
| *size = SimpleBuffer::BytesFree();
|
| }
|
| @@ -112,7 +109,7 @@ inline void SimpleBuffer::GetWritablePtr(char **ptr, int* size) const {
|
| // stores a pointer into the simple buffer in *ptr,
|
| // and stores the number of characters which are allowed
|
| // to be read in *size.
|
| -void SimpleBuffer::GetReadablePtr(char **ptr, int* size) const {
|
| +void SimpleBuffer::GetReadablePtr(char** ptr, int* size) const {
|
| *ptr = storage_ + read_idx_;
|
| *size = write_idx_ - read_idx_;
|
| }
|
| @@ -121,7 +118,7 @@ void SimpleBuffer::GetReadablePtr(char **ptr, int* size) const {
|
|
|
| // returns the number of bytes read into 'bytes'
|
| int SimpleBuffer::Read(char* bytes, int size) {
|
| - char * read_ptr = NULL;
|
| + char* read_ptr = NULL;
|
| int read_size = 0;
|
| GetReadablePtr(&read_ptr, &read_size);
|
| if (read_size > size) {
|
| @@ -145,7 +142,7 @@ void SimpleBuffer::Clear() {
|
| // old data that is already read, and reallocate large storage as needed.
|
| bool SimpleBuffer::Reserve(int size) {
|
| if (size > 0 && BytesFree() < size) {
|
| - char * read_ptr = NULL;
|
| + char* read_ptr = NULL;
|
| int read_size = 0;
|
| GetReadablePtr(&read_ptr, &read_size);
|
|
|
|
|