diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-24 15:59:40 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-24 15:59:40 +0000 |
commit | 38715910ea552ad5198b6dba8bca3a57f46c1e9a (patch) | |
tree | 6f24b031d0261aa086892229cbd6a5cd8cb23668 /chromeos/dbus/cryptohome_client.cc | |
parent | 1d82a58776d3b5233028bdc7f59c52a21a835177 (diff) | |
download | chromium_src-38715910ea552ad5198b6dba8bca3a57f46c1e9a.zip chromium_src-38715910ea552ad5198b6dba8bca3a57f46c1e9a.tar.gz chromium_src-38715910ea552ad5198b6dba8bca3a57f46c1e9a.tar.bz2 |
chromeos: Make dbus::MessageReader memory ownership explicit
Make memory returned by MessageReader::PopArrayOfBytes()
const to make it clearer that ownership remains with the
MessageReader.
Also update PopArrayOfStrings() and PopArrayOfObjectPaths()
to clear the passed-in vectors before appending to them.
BUG=none
TBR=isherman@chromium.org,mvanouwerkerk@chromium.org
Review URL: https://codereview.chromium.org/176693003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252922 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/cryptohome_client.cc')
-rw-r--r-- | chromeos/dbus/cryptohome_client.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/chromeos/dbus/cryptohome_client.cc b/chromeos/dbus/cryptohome_client.cc index f0bbd18..c58ea20 100644 --- a/chromeos/dbus/cryptohome_client.cc +++ b/chromeos/dbus/cryptohome_client.cc @@ -357,7 +357,7 @@ class CryptohomeClientImpl : public CryptohomeClient { if (!response.get()) return false; dbus::MessageReader reader(response.get()); - uint8* bytes = NULL; + const uint8* bytes = NULL; size_t length = 0; if (!reader.PopArrayOfBytes(&bytes, &length) || !reader.PopBool(successful)) @@ -737,7 +737,7 @@ class CryptohomeClientImpl : public CryptohomeClient { return; } dbus::MessageReader reader(response); - uint8* bytes = NULL; + const uint8* bytes = NULL; size_t length = 0; if (!reader.PopArrayOfBytes(&bytes, &length)) { callback.Run(DBUS_METHOD_CALL_FAILURE, std::vector<uint8>()); @@ -827,7 +827,7 @@ class CryptohomeClientImpl : public CryptohomeClient { return; } dbus::MessageReader reader(response); - uint8* data_buffer = NULL; + const uint8* data_buffer = NULL; size_t data_length = 0; bool result = false; if (!reader.PopArrayOfBytes(&data_buffer, &data_length) || @@ -835,7 +835,7 @@ class CryptohomeClientImpl : public CryptohomeClient { callback.Run(DBUS_METHOD_CALL_FAILURE, false, std::string()); return; } - std::string data(reinterpret_cast<char*>(data_buffer), data_length); + std::string data(reinterpret_cast<const char*>(data_buffer), data_length); callback.Run(DBUS_METHOD_CALL_SUCCESS, result, data); } @@ -900,7 +900,7 @@ class CryptohomeClientImpl : public CryptohomeClient { dbus::MessageReader reader(signal); int async_id = 0; bool return_status = false; - uint8* return_data_buffer = NULL; + const uint8* return_data_buffer = NULL; size_t return_data_length = 0; if (!reader.PopInt32(&async_id) || !reader.PopBool(&return_status) || @@ -909,7 +909,7 @@ class CryptohomeClientImpl : public CryptohomeClient { return; } if (!async_call_status_data_handler_.is_null()) { - std::string return_data(reinterpret_cast<char*>(return_data_buffer), + std::string return_data(reinterpret_cast<const char*>(return_data_buffer), return_data_length); async_call_status_data_handler_.Run(async_id, return_status, return_data); } |