| Index: dbus/message.cc
|
| diff --git a/dbus/message.cc b/dbus/message.cc
|
| index db8184e1ab7fcdaebce6b4508f6668999b881b3a..1666ddea6cac2b81be60cc157505408438da46e6 100644
|
| --- a/dbus/message.cc
|
| +++ b/dbus/message.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/format_macros.h"
|
| #include "base/logging.h"
|
| #include "base/stringprintf.h"
|
| +#include "dbus/object_path.h"
|
| #include "third_party/protobuf/src/google/protobuf/message_lite.h"
|
|
|
| namespace {
|
| @@ -157,10 +158,10 @@ std::string Message::ToStringInternal(const std::string& indent,
|
| break;
|
| }
|
| case OBJECT_PATH: {
|
| - std::string value;
|
| + ObjectPath value;
|
| if (!reader->PopObjectPath(&value))
|
| return kBrokenMessage;
|
| - output += indent + "object_path \"" + value + "\"\n";
|
| + output += indent + "object_path \"" + value.value() + "\"\n";
|
| break;
|
| }
|
| case ARRAY: {
|
| @@ -224,7 +225,7 @@ std::string Message::ToString() {
|
| std::string headers;
|
| AppendStringHeader("message_type", GetMessageTypeAsString(), &headers);
|
| AppendStringHeader("destination", GetDestination(), &headers);
|
| - AppendStringHeader("path", GetPath(), &headers);
|
| + AppendStringHeader("path", GetPath().value(), &headers);
|
| AppendStringHeader("interface", GetInterface(), &headers);
|
| AppendStringHeader("member", GetMember(), &headers);
|
| AppendStringHeader("error_name", GetErrorName(), &headers);
|
| @@ -244,7 +245,7 @@ void Message::SetDestination(const std::string& destination) {
|
| CHECK(success) << "Unable to allocate memory";
|
| }
|
|
|
| -void Message::SetPath(const std::string& path) {
|
| +void Message::SetPath(const ObjectPath& path) {
|
| const bool success = dbus_message_set_path(raw_message_,
|
| path.c_str());
|
| CHECK(success) << "Unable to allocate memory";
|
| @@ -287,9 +288,9 @@ std::string Message::GetDestination() {
|
| return destination ? destination : "";
|
| }
|
|
|
| -std::string Message::GetPath() {
|
| +ObjectPath Message::GetPath() {
|
| const char* path = dbus_message_get_path(raw_message_);
|
| - return path ? path : "";
|
| + return path ? ObjectPath(path) : "";
|
| }
|
|
|
| std::string Message::GetInterface() {
|
| @@ -489,7 +490,7 @@ void MessageWriter::AppendString(const std::string& value) {
|
| // bool AppendStringWithErrorChecking().
|
| }
|
|
|
| -void MessageWriter::AppendObjectPath(const std::string& value) {
|
| +void MessageWriter::AppendObjectPath(const ObjectPath& value) {
|
| const char* pointer = value.c_str();
|
| AppendBasic(DBUS_TYPE_OBJECT_PATH, &pointer);
|
| }
|
| @@ -586,7 +587,7 @@ void MessageWriter::AppendArrayOfStrings(
|
| }
|
|
|
| void MessageWriter::AppendArrayOfObjectPaths(
|
| - const std::vector<std::string>& object_paths) {
|
| + const std::vector<ObjectPath>& object_paths) {
|
| DCHECK(!container_is_open_);
|
| MessageWriter array_writer(message_);
|
| OpenArray("o", &array_writer);
|
| @@ -651,7 +652,7 @@ void MessageWriter::AppendVariantOfString(const std::string& value) {
|
| AppendVariantOfBasic(DBUS_TYPE_STRING, &pointer);
|
| }
|
|
|
| -void MessageWriter::AppendVariantOfObjectPath(const std::string& value) {
|
| +void MessageWriter::AppendVariantOfObjectPath(const ObjectPath& value) {
|
| const char* pointer = value.c_str();
|
| AppendVariantOfBasic(DBUS_TYPE_OBJECT_PATH, &pointer);
|
| }
|
| @@ -744,11 +745,11 @@ bool MessageReader::PopString(std::string* value) {
|
| return success;
|
| }
|
|
|
| -bool MessageReader::PopObjectPath(std::string* value) {
|
| +bool MessageReader::PopObjectPath(ObjectPath* value) {
|
| char* tmp_value = NULL;
|
| const bool success = PopBasic(DBUS_TYPE_OBJECT_PATH, &tmp_value);
|
| if (success)
|
| - value->assign(tmp_value);
|
| + *value = tmp_value;
|
| return success;
|
| }
|
|
|
| @@ -803,12 +804,12 @@ bool MessageReader::PopArrayOfStrings(
|
| }
|
|
|
| bool MessageReader::PopArrayOfObjectPaths(
|
| - std::vector<std::string> *object_paths) {
|
| + std::vector<ObjectPath> *object_paths) {
|
| MessageReader array_reader(message_);
|
| if (!PopArray(&array_reader))
|
| return false;
|
| while (array_reader.HasMoreData()) {
|
| - std::string object_path;
|
| + ObjectPath object_path;
|
| if (!array_reader.PopObjectPath(&object_path))
|
| return false;
|
| object_paths->push_back(object_path);
|
| @@ -880,11 +881,11 @@ bool MessageReader::PopVariantOfString(std::string* value) {
|
| return success;
|
| }
|
|
|
| -bool MessageReader::PopVariantOfObjectPath(std::string* value) {
|
| +bool MessageReader::PopVariantOfObjectPath(ObjectPath* value) {
|
| char* tmp_value = NULL;
|
| const bool success = PopVariantOfBasic(DBUS_TYPE_OBJECT_PATH, &tmp_value);
|
| if (success)
|
| - value->assign(tmp_value);
|
| + *value = tmp_value;
|
| return success;
|
| }
|
|
|
|
|