From e00a6c0abdc75244bc6c37944be12e93e29c9add Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" Date: Fri, 18 Jan 2013 18:20:57 +0000 Subject: Rename non-const payload() in base::Pickle to mutable_pyload() base::Pickle has two methods - one is declared const and another one is not. The non const version of the method is protected, which makes the const payload() inaccessible in non-const Pickle instances. Also made end_of_payload() public and removed non-const version of that method. Review URL: https://codereview.chromium.org/11959022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177711 0039d316-1c4b-4281-b951-d872f2087c98 --- base/pickle.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'base/pickle.h') diff --git a/base/pickle.h b/base/pickle.h index cd587de..62dcd15 100644 --- a/base/pickle.h +++ b/base/pickle.h @@ -278,26 +278,23 @@ class BASE_EXPORT Pickle { // The payload is the pickle data immediately following the header. size_t payload_size() const { return header_->payload_size; } + const char* payload() const { return reinterpret_cast(header_) + header_size_; } - protected: - char* payload() { - return reinterpret_cast(header_) + header_size_; - } - // Returns the address of the byte immediately following the currently valid // header + payload. - char* end_of_payload() { - // We must have a valid header_. - return payload() + payload_size(); - } const char* end_of_payload() const { // This object may be invalid. return header_ ? payload() + payload_size() : NULL; } + protected: + char* mutable_payload() { + return reinterpret_cast(header_) + header_size_; + } + size_t capacity() const { return capacity_; } -- cgit v1.1