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

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebCString.cpp

Issue 2473093003: Fix up naming in CString. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/text/LineEnding.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 void WebCString::reset() { 51 void WebCString::reset() {
52 m_private.reset(); 52 m_private.reset();
53 } 53 }
54 54
55 void WebCString::assign(const WebCString& other) { 55 void WebCString::assign(const WebCString& other) {
56 assign(other.m_private.get()); 56 assign(other.m_private.get());
57 } 57 }
58 58
59 void WebCString::assign(const char* data, size_t length) { 59 void WebCString::assign(const char* data, size_t length) {
60 char* newData; 60 assign(WTF::CString(data, length).impl());
61 RefPtr<WTF::CStringBuffer> buffer =
62 WTF::CString::newUninitialized(length, newData).buffer();
63 memcpy(newData, data, length);
64 assign(buffer.get());
65 } 61 }
66 62
67 size_t WebCString::length() const { 63 size_t WebCString::length() const {
68 return m_private.isNull() ? 0 : m_private->length(); 64 return m_private.isNull() ? 0 : m_private->length();
69 } 65 }
70 66
71 const char* WebCString::data() const { 67 const char* WebCString::data() const {
72 return m_private.isNull() ? 0 : m_private->data(); 68 return m_private.isNull() ? 0 : m_private->data();
73 } 69 }
74 70
75 WebString WebCString::utf16() const { 71 WebString WebCString::utf16() const {
76 return WebString::fromUTF8(data(), length()); 72 return WebString::fromUTF8(data(), length());
77 } 73 }
78 74
79 WebCString::WebCString(const WTF::CString& s) { 75 WebCString::WebCString(const WTF::CString& s) {
80 assign(s.buffer()); 76 assign(s.impl());
81 } 77 }
82 78
83 WebCString& WebCString::operator=(const WTF::CString& s) { 79 WebCString& WebCString::operator=(const WTF::CString& s) {
84 assign(s.buffer()); 80 assign(s.impl());
85 return *this; 81 return *this;
86 } 82 }
87 83
88 WebCString::operator WTF::CString() const { 84 WebCString::operator WTF::CString() const {
89 return m_private.get(); 85 return m_private.get();
90 } 86 }
91 87
92 void WebCString::assign(WTF::CStringBuffer* p) { 88 void WebCString::assign(WTF::CStringImpl* p) {
93 m_private = p; 89 m_private = p;
94 } 90 }
95 91
96 } // namespace blink 92 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/text/LineEnding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698