| Index: runtime/platform/text_buffer.cc
|
| diff --git a/runtime/platform/text_buffer.cc b/runtime/platform/text_buffer.cc
|
| index b44ed6941f06a7b0a2d16acfab7d2c0009fb4e82..c3636f1c38753993f99cf83674069c02c73320cc 100644
|
| --- a/runtime/platform/text_buffer.cc
|
| +++ b/runtime/platform/text_buffer.cc
|
| @@ -22,19 +22,16 @@ TextBuffer::TextBuffer(intptr_t buf_size) {
|
| Clear();
|
| }
|
|
|
| -
|
| TextBuffer::~TextBuffer() {
|
| free(buf_);
|
| buf_ = NULL;
|
| }
|
|
|
| -
|
| void TextBuffer::Clear() {
|
| msg_len_ = 0;
|
| buf_[0] = '\0';
|
| }
|
|
|
| -
|
| char* TextBuffer::Steal() {
|
| char* r = buf_;
|
| buf_ = NULL;
|
| @@ -43,7 +40,6 @@ char* TextBuffer::Steal() {
|
| return r;
|
| }
|
|
|
| -
|
| void TextBuffer::AddChar(char ch) {
|
| EnsureCapacity(sizeof(ch));
|
| buf_[msg_len_] = ch;
|
| @@ -51,7 +47,6 @@ void TextBuffer::AddChar(char ch) {
|
| buf_[msg_len_] = '\0';
|
| }
|
|
|
| -
|
| void TextBuffer::AddRaw(const uint8_t* buffer, intptr_t buffer_length) {
|
| EnsureCapacity(buffer_length);
|
| memmove(&buf_[msg_len_], buffer, buffer_length);
|
| @@ -59,7 +54,6 @@ void TextBuffer::AddRaw(const uint8_t* buffer, intptr_t buffer_length) {
|
| buf_[msg_len_] = '\0';
|
| }
|
|
|
| -
|
| intptr_t TextBuffer::Printf(const char* format, ...) {
|
| va_list args;
|
| va_start(args, format);
|
| @@ -82,7 +76,6 @@ intptr_t TextBuffer::Printf(const char* format, ...) {
|
| return len;
|
| }
|
|
|
| -
|
| // Write a UTF-32 code unit so it can be read by a JSON parser in a string
|
| // literal. Use official encoding from JSON specification. http://json.org/
|
| void TextBuffer::EscapeAndAddCodeUnit(uint32_t codeunit) {
|
| @@ -123,19 +116,16 @@ void TextBuffer::EscapeAndAddCodeUnit(uint32_t codeunit) {
|
| }
|
| }
|
|
|
| -
|
| // Write an incomplete UTF-16 code unit so it can be read by a JSON parser in a
|
| // string literal.
|
| void TextBuffer::EscapeAndAddUTF16CodeUnit(uint16_t codeunit) {
|
| Printf("\\u%04X", codeunit);
|
| }
|
|
|
| -
|
| void TextBuffer::AddString(const char* s) {
|
| Printf("%s", s);
|
| }
|
|
|
| -
|
| void TextBuffer::AddEscapedString(const char* s) {
|
| intptr_t len = strlen(s);
|
| for (int i = 0; i < len; i++) {
|
| @@ -143,7 +133,6 @@ void TextBuffer::AddEscapedString(const char* s) {
|
| }
|
| }
|
|
|
| -
|
| void TextBuffer::EnsureCapacity(intptr_t len) {
|
| intptr_t remaining = buf_size_ - msg_len_;
|
| if (remaining <= len) {
|
|
|