Chromium Code Reviews| Index: third_party/WebKit/Source/wtf/text/CString.h |
| diff --git a/third_party/WebKit/Source/wtf/text/CString.h b/third_party/WebKit/Source/wtf/text/CString.h |
| index 08e51027e774748d32f6336d76d19f32af7a41e7..cec3fce820e75905da27600e8abedebf27d0e4b1 100644 |
| --- a/third_party/WebKit/Source/wtf/text/CString.h |
| +++ b/third_party/WebKit/Source/wtf/text/CString.h |
| @@ -64,6 +64,11 @@ public: |
| CString(CStringBuffer* buffer) : m_buffer(buffer) { } |
| static CString newUninitialized(size_t length, char*& characterBuffer); |
| + std::string toStdString() const |
| + { |
| + return std::string(data(), length()); |
|
Mikhail
2015/09/30 14:02:01
length() includes NULL terminator, so should be 'l
Primiano Tucci (use gerrit)
2015/09/30 15:08:28
Just tried: String("").length() returns 0 not 1.
Mikhail
2015/09/30 15:58:39
Right. CStringBuffer's length != its size, sorry f
|
| + } |
| + |
| const char* data() const |
| { |
| return m_buffer ? m_buffer->data() : 0; |