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

Unified Diff: base/pickle.cc

Issue 27370: Update clipboard classes to use string16 and FilePath instead of wstring.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/pickle.h ('k') | base/scoped_clipboard_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/pickle.cc
===================================================================
--- base/pickle.cc (revision 10811)
+++ base/pickle.cc (working copy)
@@ -218,6 +218,22 @@
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,9 +306,17 @@
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) {
return WriteInt(length) && WriteBytes(data, length);
}
« no previous file with comments | « base/pickle.h ('k') | base/scoped_clipboard_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698