diff options
author | mdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-23 00:03:10 +0000 |
---|---|---|
committer | mdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-23 00:03:10 +0000 |
commit | c272d08ceb9a6b960ace9be9c22600034f7e240e (patch) | |
tree | 0c7ee36cb0f3d6ac381aa1be66ccd309659c2c6d /base/pickle.h | |
parent | 4a7e43e76fb9ff1ae2c78ed62ee802e5c855aa56 (diff) | |
download | chromium_src-c272d08ceb9a6b960ace9be9c22600034f7e240e.zip chromium_src-c272d08ceb9a6b960ace9be9c22600034f7e240e.tar.gz chromium_src-c272d08ceb9a6b960ace9be9c22600034f7e240e.tar.bz2 |
Remove Pickle::WriteSize() now that it has no remaining callers. Also rename
Pickle::WriteLong() to WriteLongUsingDangerousNonPortableLessPersistableForm()
and add a strongly-worded comment against its use; it is used only for IPC
which is safe. (These methods write variable amounts of data to pickles,
depending on architecture, and aren't safe if pickles are persisted.)
Review URL: http://codereview.chromium.org/9641005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128347 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/pickle.h')
-rw-r--r-- | base/pickle.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/base/pickle.h b/base/pickle.h index 47e3bf6..baa20f6 100644 --- a/base/pickle.h +++ b/base/pickle.h @@ -31,7 +31,6 @@ class BASE_EXPORT PickleIterator { bool ReadBool(bool* result) WARN_UNUSED_RESULT; bool ReadInt(int* result) WARN_UNUSED_RESULT; bool ReadLong(long* result) WARN_UNUSED_RESULT; - bool ReadSize(size_t* result) WARN_UNUSED_RESULT; bool ReadUInt16(uint16* result) WARN_UNUSED_RESULT; bool ReadUInt32(uint32* result) WARN_UNUSED_RESULT; bool ReadInt64(int64* result) WARN_UNUSED_RESULT; @@ -148,9 +147,6 @@ class BASE_EXPORT Pickle { bool ReadLong(PickleIterator* iter, long* result) const { return iter->ReadLong(result); } - bool ReadSize(PickleIterator* iter, size_t* result) const { - return iter->ReadSize(result); - } bool ReadUInt16(PickleIterator* iter, uint16* result) const { return iter->ReadUInt16(result); } @@ -195,10 +191,12 @@ class BASE_EXPORT Pickle { bool WriteInt(int value) { return WriteBytes(&value, sizeof(value)); } - bool WriteLong(long value) { - return WriteBytes(&value, sizeof(value)); - } - bool WriteSize(size_t value) { + // WARNING: DO NOT USE THIS METHOD IF PICKLES ARE PERSISTED IN ANY WAY. + // It will write whatever a "long" is on this architecture. On 32-bit + // platforms, it is 32 bits. On 64-bit platforms, it is 64 bits. If persisted + // pickles are still around after upgrading to 64-bit, or if they are copied + // between dissimilar systems, YOUR PICKLES WILL HAVE GONE BAD. + bool WriteLongUsingDangerousNonPortableLessPersistableForm(long value) { return WriteBytes(&value, sizeof(value)); } bool WriteUInt16(uint16 value) { |