diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 03:36:36 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-04 03:36:36 +0000 |
commit | 3a2a5d201631f31800a889164cb84b3c6784b8c2 (patch) | |
tree | 52f45c58258845ad6b0a9a9591e15b3cc225337c /base/pickle.cc | |
parent | 0bb1a6204af17f50ad0577f811a2c044b2bf62ff (diff) | |
download | chromium_src-3a2a5d201631f31800a889164cb84b3c6784b8c2.zip chromium_src-3a2a5d201631f31800a889164cb84b3c6784b8c2.tar.gz chromium_src-3a2a5d201631f31800a889164cb84b3c6784b8c2.tar.bz2 |
Update clipboard classes to use string16 and FilePath instead of wstring.
Update callers as well.
This patch builds on a patch by mark.a.lindner@gmail.com which can be found at http://codereview.chromium.org/28294
Review URL: http://codereview.chromium.org/27370
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/pickle.cc')
-rw-r--r-- | base/pickle.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/base/pickle.cc b/base/pickle.cc index aac59df..c2b3341 100644 --- a/base/pickle.cc +++ b/base/pickle.cc @@ -218,6 +218,22 @@ bool Pickle::ReadWString(void** iter, std::wstring* result) const { return true; } +bool Pickle::ReadString16(void** iter, string16* result) const { + DCHECK(iter); + + int len; + if (!ReadLength(iter, &len)) + return false; + if (!IteratorHasRoomFor(*iter, len)) + return false; + + char16* chars = reinterpret_cast<char16*>(*iter); + result->assign(chars, len); + + UpdateIter(iter, len * sizeof(char16)); + return true; +} + bool Pickle::ReadBytes(void** iter, const char** data, int length) const { DCHECK(iter); DCHECK(data); @@ -290,7 +306,15 @@ bool Pickle::WriteWString(const std::wstring& value) { return false; return WriteBytes(value.data(), - static_cast<int>(value.size() * sizeof(value.data()[0]))); + static_cast<int>(value.size() * sizeof(wchar_t))); +} + +bool Pickle::WriteString16(const string16& value) { + if (!WriteInt(static_cast<int>(value.size()))) + return false; + + return WriteBytes(value.data(), + static_cast<int>(value.size()) * sizeof(char16)); } bool Pickle::WriteData(const char* data, int length) { |