summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authoravi <avi@chromium.org>2015-12-22 10:12:45 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-22 18:13:52 +0000
commit22437c690d92b7440913d190bf5474785ccd73ec (patch)
tree76dbcdd2610bc4deb60e3d4954a14c4d1abc9ff6 /dbus
parent73a178bda739c022e3d2ecd79f1c2c1e3e574aa6 (diff)
downloadchromium_src-22437c690d92b7440913d190bf5474785ccd73ec.zip
chromium_src-22437c690d92b7440913d190bf5474785ccd73ec.tar.gz
chromium_src-22437c690d92b7440913d190bf5474785ccd73ec.tar.bz2
Switch to standard integer types in dbus/.
BUG=138542 TBR=hashimoto@chromium.org Review URL: https://codereview.chromium.org/1541193002 Cr-Commit-Position: refs/heads/master@{#366617}
Diffstat (limited to 'dbus')
-rw-r--r--dbus/bus.cc4
-rw-r--r--dbus/bus.h4
-rw-r--r--dbus/bus_unittest.cc1
-rw-r--r--dbus/dbus_statistics.cc1
-rw-r--r--dbus/dbus_statistics_unittest.cc2
-rw-r--r--dbus/end_to_end_async_unittest.cc3
-rw-r--r--dbus/exported_object.cc4
-rw-r--r--dbus/file_descriptor.h1
-rw-r--r--dbus/message.cc103
-rw-r--r--dbus/message.h74
-rw-r--r--dbus/message_unittest.cc91
-rw-r--r--dbus/mock_bus.h5
-rw-r--r--dbus/object_manager.cc2
-rw-r--r--dbus/object_manager.h5
-rw-r--r--dbus/object_manager_unittest.cc6
-rw-r--r--dbus/object_proxy.cc2
-rw-r--r--dbus/object_proxy.h1
-rw-r--r--dbus/property.cc97
-rw-r--r--dbus/property.h68
-rw-r--r--dbus/property_unittest.cc29
-rw-r--r--dbus/string_util.cc2
-rw-r--r--dbus/test_service.cc6
-rw-r--r--dbus/values_util.cc14
-rw-r--r--dbus/values_util.h6
-rw-r--r--dbus/values_util_unittest.cc70
25 files changed, 320 insertions, 281 deletions
diff --git a/dbus/bus.cc b/dbus/bus.cc
index 3a4fe21..554ccb8 100644
--- a/dbus/bus.cc
+++ b/dbus/bus.cc
@@ -4,6 +4,8 @@
#include "dbus/bus.h"
+#include <stddef.h>
+
#include "base/bind.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
@@ -678,7 +680,7 @@ void Bus::SendWithReply(DBusMessage* request,
CHECK(success) << "Unable to allocate memory";
}
-void Bus::Send(DBusMessage* request, uint32* serial) {
+void Bus::Send(DBusMessage* request, uint32_t* serial) {
DCHECK(connection_);
AssertOnDBusThread();
diff --git a/dbus/bus.h b/dbus/bus.h
index 27d149c..e5e0b1c 100644
--- a/dbus/bus.h
+++ b/dbus/bus.h
@@ -6,6 +6,7 @@
#define DBUS_BUS_H_
#include <dbus/dbus.h>
+#include <stdint.h>
#include <map>
#include <set>
@@ -14,6 +15,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/platform_thread.h"
@@ -462,7 +464,7 @@ class CHROME_DBUS_EXPORT Bus : public base::RefCountedThreadSafe<Bus> {
// be stored in |serial|.
//
// BLOCKING CALL.
- virtual void Send(DBusMessage* request, uint32* serial);
+ virtual void Send(DBusMessage* request, uint32_t* serial);
// Adds the message filter function. |filter_function| will be called
// when incoming messages are received.
diff --git a/dbus/bus_unittest.cc b/dbus/bus_unittest.cc
index 27d9bb2..250717e 100644
--- a/dbus/bus_unittest.cc
+++ b/dbus/bus_unittest.cc
@@ -5,6 +5,7 @@
#include "dbus/bus.h"
#include "base/bind.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
diff --git a/dbus/dbus_statistics.cc b/dbus/dbus_statistics.cc
index 9abec65..e6eb5a2 100644
--- a/dbus/dbus_statistics.cc
+++ b/dbus/dbus_statistics.cc
@@ -7,6 +7,7 @@
#include <set>
#include "base/logging.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
diff --git a/dbus/dbus_statistics_unittest.cc b/dbus/dbus_statistics_unittest.cc
index 6260a63..e39b9b5 100644
--- a/dbus/dbus_statistics_unittest.cc
+++ b/dbus/dbus_statistics_unittest.cc
@@ -4,8 +4,8 @@
#include "dbus/dbus_statistics.h"
-#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace dbus {
diff --git a/dbus/end_to_end_async_unittest.cc b/dbus/end_to_end_async_unittest.cc
index 3854721..121c660 100644
--- a/dbus/end_to_end_async_unittest.cc
+++ b/dbus/end_to_end_async_unittest.cc
@@ -2,11 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <stddef.h>
+
#include <algorithm>
#include <string>
#include <vector>
#include "base/bind.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
diff --git a/dbus/exported_object.cc b/dbus/exported_object.cc
index 669b871..3054c35 100644
--- a/dbus/exported_object.cc
+++ b/dbus/exported_object.cc
@@ -4,6 +4,8 @@
#include "dbus/exported_object.h"
+#include <stdint.h>
+
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
@@ -148,7 +150,7 @@ void ExportedObject::OnExported(OnExportedCallback on_exported_callback,
void ExportedObject::SendSignalInternal(base::TimeTicks start_time,
DBusMessage* signal_message) {
- uint32 serial = 0;
+ uint32_t serial = 0;
bus_->Send(signal_message, &serial);
dbus_message_unref(signal_message);
// Record time spent to send the the signal. This is not accurate as the
diff --git a/dbus/file_descriptor.h b/dbus/file_descriptor.h
index 41f7b4e..b4f95cb 100644
--- a/dbus/file_descriptor.h
+++ b/dbus/file_descriptor.h
@@ -5,7 +5,6 @@
#ifndef DBUS_FILE_DESCRIPTOR_H_
#define DBUS_FILE_DESCRIPTOR_H_
-#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/move.h"
#include "dbus/dbus_export.h"
diff --git a/dbus/message.cc b/dbus/message.cc
index 0bf76d4..2de3861 100644
--- a/dbus/message.cc
+++ b/dbus/message.cc
@@ -6,7 +6,6 @@
#include <string>
-#include "base/basictypes.h"
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
@@ -36,7 +35,7 @@ void AppendStringHeader(const std::string& header_name,
// Appends the header name and the value to |output|, if the value is
// nonzero.
void AppendUint32Header(const std::string& header_name,
- uint32 header_value,
+ uint32_t header_value,
std::string* output) {
if (header_value != 0) {
*output += (header_name + ": " + base::UintToString(header_value) + "\n");
@@ -99,7 +98,7 @@ std::string Message::ToStringInternal(const std::string& indent,
const DataType type = reader->GetDataType();
switch (type) {
case BYTE: {
- uint8 value = 0;
+ uint8_t value = 0;
if (!reader->PopByte(&value))
return kBrokenMessage;
output += indent + "byte " + base::UintToString(value) + "\n";
@@ -113,45 +112,45 @@ std::string Message::ToStringInternal(const std::string& indent,
break;
}
case INT16: {
- int16 value = 0;
+ int16_t value = 0;
if (!reader->PopInt16(&value))
return kBrokenMessage;
- output += indent + "int16 " + base::IntToString(value) + "\n";
+ output += indent + "int16_t " + base::IntToString(value) + "\n";
break;
}
case UINT16: {
- uint16 value = 0;
+ uint16_t value = 0;
if (!reader->PopUint16(&value))
return kBrokenMessage;
- output += indent + "uint16 " + base::UintToString(value) + "\n";
+ output += indent + "uint16_t " + base::UintToString(value) + "\n";
break;
}
case INT32: {
- int32 value = 0;
+ int32_t value = 0;
if (!reader->PopInt32(&value))
return kBrokenMessage;
- output += indent + "int32 " + base::IntToString(value) + "\n";
+ output += indent + "int32_t " + base::IntToString(value) + "\n";
break;
}
case UINT32: {
- uint32 value = 0;
+ uint32_t value = 0;
if (!reader->PopUint32(&value))
return kBrokenMessage;
- output += indent + "uint32 " + base::UintToString(value) + "\n";
+ output += indent + "uint32_t " + base::UintToString(value) + "\n";
break;
}
case INT64: {
- int64 value = 0;
+ int64_t value = 0;
if (!reader->PopInt64(&value))
return kBrokenMessage;
- output += (indent + "int64 " + base::Int64ToString(value) + "\n");
+ output += (indent + "int64_t " + base::Int64ToString(value) + "\n");
break;
}
case UINT64: {
- uint64 value = 0;
+ uint64_t value = 0;
if (!reader->PopUint64(&value))
return kBrokenMessage;
- output += (indent + "uint64 " + base::Uint64ToString(value) + "\n");
+ output += (indent + "uint64_t " + base::Uint64ToString(value) + "\n");
break;
}
case DOUBLE: {
@@ -294,11 +293,11 @@ bool Message::SetSender(const std::string& sender) {
return dbus_message_set_sender(raw_message_, sender.c_str());
}
-void Message::SetSerial(uint32 serial) {
+void Message::SetSerial(uint32_t serial) {
dbus_message_set_serial(raw_message_, serial);
}
-void Message::SetReplySerial(uint32 reply_serial) {
+void Message::SetReplySerial(uint32_t reply_serial) {
dbus_message_set_reply_serial(raw_message_, reply_serial);
}
@@ -337,11 +336,11 @@ std::string Message::GetSignature() {
return signature ? signature : "";
}
-uint32 Message::GetSerial() {
+uint32_t Message::GetSerial() {
return dbus_message_get_serial(raw_message_);
}
-uint32 Message::GetReplySerial() {
+uint32_t Message::GetReplySerial() {
return dbus_message_get_reply_serial(raw_message_);
}
@@ -462,7 +461,7 @@ MessageWriter::MessageWriter(Message* message)
MessageWriter::~MessageWriter() {
}
-void MessageWriter::AppendByte(uint8 value) {
+void MessageWriter::AppendByte(uint8_t value) {
AppendBasic(DBUS_TYPE_BYTE, &value);
}
@@ -476,27 +475,27 @@ void MessageWriter::AppendBool(bool value) {
AppendBasic(DBUS_TYPE_BOOLEAN, &dbus_value);
}
-void MessageWriter::AppendInt16(int16 value) {
+void MessageWriter::AppendInt16(int16_t value) {
AppendBasic(DBUS_TYPE_INT16, &value);
}
-void MessageWriter::AppendUint16(uint16 value) {
+void MessageWriter::AppendUint16(uint16_t value) {
AppendBasic(DBUS_TYPE_UINT16, &value);
}
-void MessageWriter::AppendInt32(int32 value) {
+void MessageWriter::AppendInt32(int32_t value) {
AppendBasic(DBUS_TYPE_INT32, &value);
}
-void MessageWriter::AppendUint32(uint32 value) {
+void MessageWriter::AppendUint32(uint32_t value) {
AppendBasic(DBUS_TYPE_UINT32, &value);
}
-void MessageWriter::AppendInt64(int64 value) {
+void MessageWriter::AppendInt64(int64_t value) {
AppendBasic(DBUS_TYPE_INT64, &value);
}
-void MessageWriter::AppendUint64(uint64 value) {
+void MessageWriter::AppendUint64(uint64_t value) {
AppendBasic(DBUS_TYPE_UINT64, &value);
}
@@ -587,7 +586,7 @@ void MessageWriter::CloseContainer(MessageWriter* writer) {
container_is_open_ = false;
}
-void MessageWriter::AppendArrayOfBytes(const uint8* values, size_t length) {
+void MessageWriter::AppendArrayOfBytes(const uint8_t* values, size_t length) {
DCHECK(!container_is_open_);
MessageWriter array_writer(message_);
OpenArray("y", &array_writer);
@@ -629,12 +628,12 @@ bool MessageWriter::AppendProtoAsArrayOfBytes(
LOG(ERROR) << "Unable to serialize supplied protocol buffer";
return false;
}
- AppendArrayOfBytes(reinterpret_cast<const uint8*>(serialized_proto.data()),
+ AppendArrayOfBytes(reinterpret_cast<const uint8_t*>(serialized_proto.data()),
serialized_proto.size());
return true;
}
-void MessageWriter::AppendVariantOfByte(uint8 value) {
+void MessageWriter::AppendVariantOfByte(uint8_t value) {
AppendVariantOfBasic(DBUS_TYPE_BYTE, &value);
}
@@ -644,27 +643,27 @@ void MessageWriter::AppendVariantOfBool(bool value) {
AppendVariantOfBasic(DBUS_TYPE_BOOLEAN, &dbus_value);
}
-void MessageWriter::AppendVariantOfInt16(int16 value) {
+void MessageWriter::AppendVariantOfInt16(int16_t value) {
AppendVariantOfBasic(DBUS_TYPE_INT16, &value);
}
-void MessageWriter::AppendVariantOfUint16(uint16 value) {
+void MessageWriter::AppendVariantOfUint16(uint16_t value) {
AppendVariantOfBasic(DBUS_TYPE_UINT16, &value);
}
-void MessageWriter::AppendVariantOfInt32(int32 value) {
+void MessageWriter::AppendVariantOfInt32(int32_t value) {
AppendVariantOfBasic(DBUS_TYPE_INT32, &value);
}
-void MessageWriter::AppendVariantOfUint32(uint32 value) {
+void MessageWriter::AppendVariantOfUint32(uint32_t value) {
AppendVariantOfBasic(DBUS_TYPE_UINT32, &value);
}
-void MessageWriter::AppendVariantOfInt64(int64 value) {
+void MessageWriter::AppendVariantOfInt64(int64_t value) {
AppendVariantOfBasic(DBUS_TYPE_INT64, &value);
}
-void MessageWriter::AppendVariantOfUint64(uint64 value) {
+void MessageWriter::AppendVariantOfUint64(uint64_t value) {
AppendVariantOfBasic(DBUS_TYPE_UINT64, &value);
}
@@ -733,7 +732,7 @@ bool MessageReader::HasMoreData() {
return dbus_type != DBUS_TYPE_INVALID;
}
-bool MessageReader::PopByte(uint8* value) {
+bool MessageReader::PopByte(uint8_t* value) {
return PopBasic(DBUS_TYPE_BYTE, value);
}
@@ -747,27 +746,27 @@ bool MessageReader::PopBool(bool* value) {
return success;
}
-bool MessageReader::PopInt16(int16* value) {
+bool MessageReader::PopInt16(int16_t* value) {
return PopBasic(DBUS_TYPE_INT16, value);
}
-bool MessageReader::PopUint16(uint16* value) {
+bool MessageReader::PopUint16(uint16_t* value) {
return PopBasic(DBUS_TYPE_UINT16, value);
}
-bool MessageReader::PopInt32(int32* value) {
+bool MessageReader::PopInt32(int32_t* value) {
return PopBasic(DBUS_TYPE_INT32, value);
}
-bool MessageReader::PopUint32(uint32* value) {
+bool MessageReader::PopUint32(uint32_t* value) {
return PopBasic(DBUS_TYPE_UINT32, value);
}
-bool MessageReader::PopInt64(int64* value) {
+bool MessageReader::PopInt64(int64_t* value) {
return PopBasic(DBUS_TYPE_INT64, value);
}
-bool MessageReader::PopUint64(uint64* value) {
+bool MessageReader::PopUint64(uint64_t* value) {
return PopBasic(DBUS_TYPE_UINT64, value);
}
@@ -807,7 +806,7 @@ bool MessageReader::PopVariant(MessageReader* sub_reader) {
return PopContainer(DBUS_TYPE_VARIANT, sub_reader);
}
-bool MessageReader::PopArrayOfBytes(const uint8** bytes, size_t* length) {
+bool MessageReader::PopArrayOfBytes(const uint8_t** bytes, size_t* length) {
MessageReader array_reader(message_);
if (!PopArray(&array_reader))
return false;
@@ -862,8 +861,8 @@ bool MessageReader::PopArrayOfBytesAsProto(
DCHECK(protobuf != NULL);
const char* serialized_buf = NULL;
size_t buf_size = 0;
- if (!PopArrayOfBytes(
- reinterpret_cast<const uint8**>(&serialized_buf), &buf_size)) {
+ if (!PopArrayOfBytes(reinterpret_cast<const uint8_t**>(&serialized_buf),
+ &buf_size)) {
LOG(ERROR) << "Error reading array of bytes";
return false;
}
@@ -874,7 +873,7 @@ bool MessageReader::PopArrayOfBytesAsProto(
return true;
}
-bool MessageReader::PopVariantOfByte(uint8* value) {
+bool MessageReader::PopVariantOfByte(uint8_t* value) {
return PopVariantOfBasic(DBUS_TYPE_BYTE, value);
}
@@ -886,27 +885,27 @@ bool MessageReader::PopVariantOfBool(bool* value) {
return success;
}
-bool MessageReader::PopVariantOfInt16(int16* value) {
+bool MessageReader::PopVariantOfInt16(int16_t* value) {
return PopVariantOfBasic(DBUS_TYPE_INT16, value);
}
-bool MessageReader::PopVariantOfUint16(uint16* value) {
+bool MessageReader::PopVariantOfUint16(uint16_t* value) {
return PopVariantOfBasic(DBUS_TYPE_UINT16, value);
}
-bool MessageReader::PopVariantOfInt32(int32* value) {
+bool MessageReader::PopVariantOfInt32(int32_t* value) {
return PopVariantOfBasic(DBUS_TYPE_INT32, value);
}
-bool MessageReader::PopVariantOfUint32(uint32* value) {
+bool MessageReader::PopVariantOfUint32(uint32_t* value) {
return PopVariantOfBasic(DBUS_TYPE_UINT32, value);
}
-bool MessageReader::PopVariantOfInt64(int64* value) {
+bool MessageReader::PopVariantOfInt64(int64_t* value) {
return PopVariantOfBasic(DBUS_TYPE_INT64, value);
}
-bool MessageReader::PopVariantOfUint64(uint64* value) {
+bool MessageReader::PopVariantOfUint64(uint64_t* value) {
return PopVariantOfBasic(DBUS_TYPE_UINT64, value);
}
diff --git a/dbus/message.h b/dbus/message.h
index 780e6c5..7dffe0e 100644
--- a/dbus/message.h
+++ b/dbus/message.h
@@ -5,11 +5,13 @@
#ifndef DBUS_MESSAGE_H_
#define DBUS_MESSAGE_H_
+#include <dbus/dbus.h>
+#include <stddef.h>
+#include <stdint.h>
#include <string>
#include <vector>
-#include <dbus/dbus.h>
-#include "base/basictypes.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "dbus/dbus_export.h"
#include "dbus/file_descriptor.h"
@@ -99,8 +101,8 @@ class CHROME_DBUS_EXPORT Message {
bool SetMember(const std::string& member);
bool SetErrorName(const std::string& error_name);
bool SetSender(const std::string& sender);
- void SetSerial(uint32 serial);
- void SetReplySerial(uint32 reply_serial);
+ void SetSerial(uint32_t serial);
+ void SetReplySerial(uint32_t reply_serial);
// SetSignature() does not exist as we cannot do it.
// Gets the destination, the path, the interface, the member, etc.
@@ -113,8 +115,8 @@ class CHROME_DBUS_EXPORT Message {
std::string GetSender();
std::string GetSignature();
// Gets the serial and reply serial numbers. Returns 0 if not set.
- uint32 GetSerial();
- uint32 GetReplySerial();
+ uint32_t GetSerial();
+ uint32_t GetReplySerial();
// Returns the string representation of this message. Useful for
// debugging. The output is truncated as needed (ex. strings are truncated
@@ -270,14 +272,14 @@ class CHROME_DBUS_EXPORT MessageWriter {
~MessageWriter();
// Appends a byte to the message.
- void AppendByte(uint8 value);
+ void AppendByte(uint8_t value);
void AppendBool(bool value);
- void AppendInt16(int16 value);
- void AppendUint16(uint16 value);
- void AppendInt32(int32 value);
- void AppendUint32(uint32 value);
- void AppendInt64(int64 value);
- void AppendUint64(uint64 value);
+ void AppendInt16(int16_t value);
+ void AppendUint16(uint16_t value);
+ void AppendInt32(int32_t value);
+ void AppendUint32(uint32_t value);
+ void AppendInt64(int64_t value);
+ void AppendUint64(uint64_t value);
void AppendDouble(double value);
void AppendString(const std::string& value);
void AppendObjectPath(const ObjectPath& value);
@@ -308,7 +310,7 @@ class CHROME_DBUS_EXPORT MessageWriter {
// Appends the array of bytes. Arrays of bytes are often used for
// exchanging binary blobs hence it's worth having a specialized
// function.
- void AppendArrayOfBytes(const uint8* values, size_t length);
+ void AppendArrayOfBytes(const uint8_t* values, size_t length);
// Appends the array of strings. Arrays of strings are often used for
// exchanging lists of names hence it's worth having a specialized
@@ -332,14 +334,14 @@ class CHROME_DBUS_EXPORT MessageWriter {
// widely used in D-Bus services so it's worth having a specialized
// function. For instance, The third parameter of
// "org.freedesktop.DBus.Properties.Set" is a variant.
- void AppendVariantOfByte(uint8 value);
+ void AppendVariantOfByte(uint8_t value);
void AppendVariantOfBool(bool value);
- void AppendVariantOfInt16(int16 value);
- void AppendVariantOfUint16(uint16 value);
- void AppendVariantOfInt32(int32 value);
- void AppendVariantOfUint32(uint32 value);
- void AppendVariantOfInt64(int64 value);
- void AppendVariantOfUint64(uint64 value);
+ void AppendVariantOfInt16(int16_t value);
+ void AppendVariantOfUint16(uint16_t value);
+ void AppendVariantOfInt32(int32_t value);
+ void AppendVariantOfUint32(uint32_t value);
+ void AppendVariantOfInt64(int64_t value);
+ void AppendVariantOfUint64(uint64_t value);
void AppendVariantOfDouble(double value);
void AppendVariantOfString(const std::string& value);
void AppendVariantOfObjectPath(const ObjectPath& value);
@@ -380,14 +382,14 @@ class CHROME_DBUS_EXPORT MessageReader {
// Gets the byte at the current iterator position.
// Returns true and advances the iterator on success.
// Returns false if the data type is not a byte.
- bool PopByte(uint8* value);
+ bool PopByte(uint8_t* value);
bool PopBool(bool* value);
- bool PopInt16(int16* value);
- bool PopUint16(uint16* value);
- bool PopInt32(int32* value);
- bool PopUint32(uint32* value);
- bool PopInt64(int64* value);
- bool PopUint64(uint64* value);
+ bool PopInt16(int16_t* value);
+ bool PopUint16(uint16_t* value);
+ bool PopInt32(int32_t* value);
+ bool PopUint32(uint32_t* value);
+ bool PopInt64(int64_t* value);
+ bool PopUint64(uint64_t* value);
bool PopDouble(double* value);
bool PopString(std::string* value);
bool PopObjectPath(ObjectPath* value);
@@ -411,7 +413,7 @@ class CHROME_DBUS_EXPORT MessageReader {
// Ownership of the memory pointed to by |bytes| remains with the
// MessageReader; |bytes| must be copied if the contents will be referenced
// after the MessageReader is destroyed.
- bool PopArrayOfBytes(const uint8** bytes, size_t* length);
+ bool PopArrayOfBytes(const uint8_t** bytes, size_t* length);
// Gets the array of strings at the current iterator position. |strings| is
// cleared before being modified. Returns true and advances the iterator on
@@ -446,14 +448,14 @@ class CHROME_DBUS_EXPORT MessageReader {
// Variants are widely used in D-Bus services so it's worth having a
// specialized function. For instance, The return value type of
// "org.freedesktop.DBus.Properties.Get" is a variant.
- bool PopVariantOfByte(uint8* value);
+ bool PopVariantOfByte(uint8_t* value);
bool PopVariantOfBool(bool* value);
- bool PopVariantOfInt16(int16* value);
- bool PopVariantOfUint16(uint16* value);
- bool PopVariantOfInt32(int32* value);
- bool PopVariantOfUint32(uint32* value);
- bool PopVariantOfInt64(int64* value);
- bool PopVariantOfUint64(uint64* value);
+ bool PopVariantOfInt16(int16_t* value);
+ bool PopVariantOfUint16(uint16_t* value);
+ bool PopVariantOfInt32(int32_t* value);
+ bool PopVariantOfUint32(uint32_t* value);
+ bool PopVariantOfInt64(int64_t* value);
+ bool PopVariantOfUint64(uint64_t* value);
bool PopVariantOfDouble(double* value);
bool PopVariantOfString(std::string* value);
bool PopVariantOfObjectPath(ObjectPath* value);
diff --git a/dbus/message_unittest.cc b/dbus/message_unittest.cc
index 2c13d08..efe5400 100644
--- a/dbus/message_unittest.cc
+++ b/dbus/message_unittest.cc
@@ -4,9 +4,9 @@
#include "dbus/message.h"
+#include <stddef.h>
#include <stdint.h>
-#include "base/basictypes.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/posix/eintr_wrapper.h"
@@ -32,7 +32,7 @@ TEST(MessageTest, AppendAndPopByte) {
// Should fail as the type is not bool here.
ASSERT_FALSE(reader.PopBool(&bool_value));
- uint8 byte_value = 0;
+ uint8_t byte_value = 0;
ASSERT_TRUE(reader.PopByte(&byte_value));
EXPECT_EQ(123, byte_value); // Should match with the input.
ASSERT_FALSE(reader.HasMoreData()); // Should not have more data to read.
@@ -59,14 +59,14 @@ TEST(MessageTest, AppendAndPopBasicDataTypes) {
writer.AppendString("string");
writer.AppendObjectPath(ObjectPath("/object/path"));
- uint8 byte_value = 0;
+ uint8_t byte_value = 0;
bool bool_value = false;
- int16 int16_value = 0;
- uint16 uint16_value = 0;
- int32 int32_value = 0;
- uint32 uint32_value = 0;
- int64 int64_value = 0;
- uint64 uint64_value = 0;
+ int16_t int16_value = 0;
+ uint16_t uint16_value = 0;
+ int32_t int32_value = 0;
+ uint32_t uint32_value = 0;
+ int64_t int64_value = 0;
+ uint64_t uint64_value = 0;
double double_value = 0;
std::string string_value;
ObjectPath object_path_value;
@@ -174,14 +174,14 @@ TEST(MessageTest, AppendAndPopVariantDataTypes) {
writer.AppendVariantOfString("string");
writer.AppendVariantOfObjectPath(ObjectPath("/object/path"));
- uint8 byte_value = 0;
+ uint8_t byte_value = 0;
bool bool_value = false;
- int16 int16_value = 0;
- uint16 uint16_value = 0;
- int32 int32_value = 0;
- uint32 uint32_value = 0;
- int64 int64_value = 0;
- uint64 uint64_value = 0;
+ int16_t int16_value = 0;
+ uint16_t uint16_value = 0;
+ int32_t int32_value = 0;
+ uint32_t uint32_value = 0;
+ int64_t int64_value = 0;
+ uint64_t uint64_value = 0;
double double_value = 0;
std::string string_value;
ObjectPath object_path_value;
@@ -230,14 +230,14 @@ TEST(MessageTest, AppendAndPopVariantDataTypes) {
TEST(MessageTest, ArrayOfBytes) {
scoped_ptr<Response> message(Response::CreateEmpty());
MessageWriter writer(message.get());
- std::vector<uint8> bytes;
+ std::vector<uint8_t> bytes;
bytes.push_back(1);
bytes.push_back(2);
bytes.push_back(3);
writer.AppendArrayOfBytes(bytes.data(), bytes.size());
MessageReader reader(message.get());
- const uint8* output_bytes = NULL;
+ const uint8_t* output_bytes = NULL;
size_t length = 0;
ASSERT_EQ("ay", reader.GetDataSignature());
ASSERT_TRUE(reader.PopArrayOfBytes(&output_bytes, &length));
@@ -251,11 +251,11 @@ TEST(MessageTest, ArrayOfBytes) {
TEST(MessageTest, ArrayOfBytes_Empty) {
scoped_ptr<Response> message(Response::CreateEmpty());
MessageWriter writer(message.get());
- std::vector<uint8> bytes;
+ std::vector<uint8_t> bytes;
writer.AppendArrayOfBytes(bytes.data(), bytes.size());
MessageReader reader(message.get());
- const uint8* output_bytes = NULL;
+ const uint8_t* output_bytes = NULL;
size_t length = 0;
ASSERT_EQ("ay", reader.GetDataSignature());
ASSERT_TRUE(reader.PopArrayOfBytes(&output_bytes, &length));
@@ -376,7 +376,7 @@ TEST(MessageTest, CreateComplexMessageAndReadIt) {
// The second value in the array.
{
MessageWriter variant_writer(NULL);
- // Open a variant of a struct that contains a string and an int32.
+ // Open a variant of a struct that contains a string and an int32_t.
array_writer.OpenVariant("(si)", &variant_writer);
{
MessageWriter struct_writer(NULL);
@@ -391,14 +391,14 @@ TEST(MessageTest, CreateComplexMessageAndReadIt) {
// The third value in the array.
{
MessageWriter variant_writer(NULL);
- // Open a variant of an array of string-to-int64 dict entries.
+ // Open a variant of an array of string-to-int64_t dict entries.
array_writer.OpenVariant("a{sx}", &variant_writer);
{
- // Opens an array of string-to-int64 dict entries.
+ // Opens an array of string-to-int64_t dict entries.
MessageWriter dict_array_writer(NULL);
variant_writer.OpenArray("{sx}", &dict_array_writer);
{
- // Opens a string-to-int64 dict entries.
+ // Opens a string-to-int64_t dict entries.
MessageWriter dict_entry_writer(NULL);
dict_array_writer.OpenDictEntry(&dict_entry_writer);
dict_entry_writer.AppendString("foo");
@@ -413,23 +413,24 @@ TEST(MessageTest, CreateComplexMessageAndReadIt) {
writer.CloseContainer(&array_writer);
}
// What we have created looks like this:
- EXPECT_EQ("message_type: MESSAGE_METHOD_RETURN\n"
- "signature: av\n"
- "\n"
- "array [\n"
- " variant bool true\n"
- " variant struct {\n"
- " string \"string\"\n"
- " int32 123\n"
- " }\n"
- " variant array [\n"
- " dict entry {\n"
- " string \"foo\"\n"
- " int64 1234567890123456789\n"
- " }\n"
- " ]\n"
- "]\n",
- message->ToString());
+ EXPECT_EQ(
+ "message_type: MESSAGE_METHOD_RETURN\n"
+ "signature: av\n"
+ "\n"
+ "array [\n"
+ " variant bool true\n"
+ " variant struct {\n"
+ " string \"string\"\n"
+ " int32_t 123\n"
+ " }\n"
+ " variant array [\n"
+ " dict entry {\n"
+ " string \"foo\"\n"
+ " int64_t 1234567890123456789\n"
+ " }\n"
+ " ]\n"
+ "]\n",
+ message->ToString());
MessageReader reader(message.get());
ASSERT_EQ("av", reader.GetDataSignature());
@@ -453,7 +454,7 @@ TEST(MessageTest, CreateComplexMessageAndReadIt) {
std::string string_value;
ASSERT_TRUE(struct_reader.PopString(&string_value));
EXPECT_EQ("string", string_value);
- int32 int32_value = 0;
+ int32_t int32_value = 0;
ASSERT_TRUE(struct_reader.PopInt32(&int32_value));
EXPECT_EQ(123, int32_value);
ASSERT_FALSE(struct_reader.HasMoreData());
@@ -475,7 +476,7 @@ TEST(MessageTest, CreateComplexMessageAndReadIt) {
std::string string_value;
ASSERT_TRUE(dict_entry_reader.PopString(&string_value));
EXPECT_EQ("foo", string_value);
- int64 int64_value = 0;
+ int64_t int64_value = 0;
ASSERT_TRUE(dict_entry_reader.PopInt64(&int64_value));
EXPECT_EQ(INT64_C(1234567890123456789), int64_value);
}
@@ -557,7 +558,7 @@ TEST(MessageTest, Response) {
}
TEST(MessageTest, Response_FromMethodCall) {
- const uint32 kSerial = 123;
+ const uint32_t kSerial = 123;
MethodCall method_call("com.example.Interface", "SomeMethod");
method_call.SetSerial(kSerial);
@@ -570,7 +571,7 @@ TEST(MessageTest, Response_FromMethodCall) {
}
TEST(MessageTest, ErrorResponse_FromMethodCall) {
- const uint32 kSerial = 123;
+ const uint32_t kSerial = 123;
const char kErrorMessage[] = "error message";
MethodCall method_call("com.example.Interface", "SomeMethod");
diff --git a/dbus/mock_bus.h b/dbus/mock_bus.h
index 6000067..40b090b 100644
--- a/dbus/mock_bus.h
+++ b/dbus/mock_bus.h
@@ -5,6 +5,8 @@
#ifndef DBUS_MOCK_BUS_H_
#define DBUS_MOCK_BUS_H_
+#include <stdint.h>
+
#include "dbus/bus.h"
#include "dbus/object_path.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -45,8 +47,7 @@ class MockBus : public Bus {
MOCK_METHOD3(SendWithReply, void(DBusMessage* request,
DBusPendingCall** pending_call,
int timeout_ms));
- MOCK_METHOD2(Send, void(DBusMessage* request,
- uint32* serial));
+ MOCK_METHOD2(Send, void(DBusMessage* request, uint32_t* serial));
MOCK_METHOD2(AddFilter, void(DBusHandleMessageFunction handle_message,
void* user_data));
MOCK_METHOD2(RemoveFilter, void(DBusHandleMessageFunction handle_message,
diff --git a/dbus/object_manager.cc b/dbus/object_manager.cc
index 3f253fa..9215d84 100644
--- a/dbus/object_manager.cc
+++ b/dbus/object_manager.cc
@@ -4,6 +4,8 @@
#include "dbus/object_manager.h"
+#include <stddef.h>
+
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
diff --git a/dbus/object_manager.h b/dbus/object_manager.h
index 23a88cd..266b53e 100644
--- a/dbus/object_manager.h
+++ b/dbus/object_manager.h
@@ -5,8 +5,11 @@
#ifndef DBUS_OBJECT_MANAGER_H_
#define DBUS_OBJECT_MANAGER_H_
+#include <stdint.h>
+
#include <map>
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "dbus/object_path.h"
@@ -36,7 +39,7 @@
// public:
// struct Properties : public dbus::PropertySet {
// dbus::Property<std::string> name;
-// dbus::Property<uint16> version;
+// dbus::Property<uint16_t> version;
// dbus::Property<dbus::ObjectPath> parent;
// dbus::Property<std::vector<std::string> > children;
//
diff --git a/dbus/object_manager_unittest.cc b/dbus/object_manager_unittest.cc
index 34f7ac4..fa83034 100644
--- a/dbus/object_manager_unittest.cc
+++ b/dbus/object_manager_unittest.cc
@@ -4,10 +4,12 @@
#include "dbus/object_manager.h"
+#include <stddef.h>
+#include <stdint.h>
+
#include <string>
#include <vector>
-#include "base/basictypes.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
@@ -33,7 +35,7 @@ class ObjectManagerTest
struct Properties : public PropertySet {
Property<std::string> name;
- Property<int16> version;
+ Property<int16_t> version;
Property<std::vector<std::string> > methods;
Property<std::vector<ObjectPath> > objects;
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc
index 441dc75..fc7d199 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -4,6 +4,8 @@
#include "dbus/bus.h"
+#include <stddef.h>
+
#include "base/bind.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
diff --git a/dbus/object_proxy.h b/dbus/object_proxy.h
index 9f32821..edb97a5 100644
--- a/dbus/object_proxy.h
+++ b/dbus/object_proxy.h
@@ -13,6 +13,7 @@
#include <vector>
#include "base/callback.h"
+#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_piece.h"
#include "base/time/time.h"
diff --git a/dbus/property.cc b/dbus/property.cc
index 234036c..66af866 100644
--- a/dbus/property.cc
+++ b/dbus/property.cc
@@ -4,7 +4,8 @@
#include "dbus/property.h"
-#include "base/basictypes.h"
+#include <stddef.h>
+
#include "base/bind.h"
#include "base/logging.h"
@@ -302,16 +303,16 @@ void PropertySet::NotifyPropertyChanged(const std::string& name) {
//
template <>
-Property<uint8>::Property() : value_(0) {
-}
+Property<uint8_t>::Property()
+ : value_(0) {}
template <>
-bool Property<uint8>::PopValueFromReader(MessageReader* reader) {
+bool Property<uint8_t>::PopValueFromReader(MessageReader* reader) {
return reader->PopVariantOfByte(&value_);
}
template <>
-void Property<uint8>::AppendSetValueToWriter(MessageWriter* writer) {
+void Property<uint8_t>::AppendSetValueToWriter(MessageWriter* writer) {
writer->AppendVariantOfByte(set_value_);
}
@@ -334,110 +335,110 @@ void Property<bool>::AppendSetValueToWriter(MessageWriter* writer) {
}
//
-// Property<int16> specialization.
+// Property<int16_t> specialization.
//
template <>
-Property<int16>::Property() : value_(0) {
-}
+Property<int16_t>::Property()
+ : value_(0) {}
template <>
-bool Property<int16>::PopValueFromReader(MessageReader* reader) {
+bool Property<int16_t>::PopValueFromReader(MessageReader* reader) {
return reader->PopVariantOfInt16(&value_);
}
template <>
-void Property<int16>::AppendSetValueToWriter(MessageWriter* writer) {
+void Property<int16_t>::AppendSetValueToWriter(MessageWriter* writer) {
writer->AppendVariantOfInt16(set_value_);
}
//
-// Property<uint16> specialization.
+// Property<uint16_t> specialization.
//
template <>
-Property<uint16>::Property() : value_(0) {
-}
+Property<uint16_t>::Property()
+ : value_(0) {}
template <>
-bool Property<uint16>::PopValueFromReader(MessageReader* reader) {
+bool Property<uint16_t>::PopValueFromReader(MessageReader* reader) {
return reader->PopVariantOfUint16(&value_);
}
template <>
-void Property<uint16>::AppendSetValueToWriter(MessageWriter* writer) {
+void Property<uint16_t>::AppendSetValueToWriter(MessageWriter* writer) {
writer->AppendVariantOfUint16(set_value_);
}
//
-// Property<int32> specialization.
+// Property<int32_t> specialization.
//
template <>
-Property<int32>::Property() : value_(0) {
-}
+Property<int32_t>::Property()
+ : value_(0) {}
template <>
-bool Property<int32>::PopValueFromReader(MessageReader* reader) {
+bool Property<int32_t>::PopValueFromReader(MessageReader* reader) {
return reader->PopVariantOfInt32(&value_);
}
template <>
-void Property<int32>::AppendSetValueToWriter(MessageWriter* writer) {
+void Property<int32_t>::AppendSetValueToWriter(MessageWriter* writer) {
writer->AppendVariantOfInt32(set_value_);
}
//
-// Property<uint32> specialization.
+// Property<uint32_t> specialization.
//
template <>
-Property<uint32>::Property() : value_(0) {
-}
+Property<uint32_t>::Property()
+ : value_(0) {}
template <>
-bool Property<uint32>::PopValueFromReader(MessageReader* reader) {
+bool Property<uint32_t>::PopValueFromReader(MessageReader* reader) {
return reader->PopVariantOfUint32(&value_);
}
template <>
-void Property<uint32>::AppendSetValueToWriter(MessageWriter* writer) {
+void Property<uint32_t>::AppendSetValueToWriter(MessageWriter* writer) {
writer->AppendVariantOfUint32(set_value_);
}
//
-// Property<int64> specialization.
+// Property<int64_t> specialization.
//
template <>
-Property<int64>::Property() : value_(0), set_value_(0) {
-}
+Property<int64_t>::Property()
+ : value_(0), set_value_(0) {}
template <>
-bool Property<int64>::PopValueFromReader(MessageReader* reader) {
+bool Property<int64_t>::PopValueFromReader(MessageReader* reader) {
return reader->PopVariantOfInt64(&value_);
}
template <>
-void Property<int64>::AppendSetValueToWriter(MessageWriter* writer) {
+void Property<int64_t>::AppendSetValueToWriter(MessageWriter* writer) {
writer->AppendVariantOfInt64(set_value_);
}
//
-// Property<uint64> specialization.
+// Property<uint64_t> specialization.
//
template <>
-Property<uint64>::Property() : value_(0) {
-}
+Property<uint64_t>::Property()
+ : value_(0) {}
template <>
-bool Property<uint64>::PopValueFromReader(MessageReader* reader) {
+bool Property<uint64_t>::PopValueFromReader(MessageReader* reader) {
return reader->PopVariantOfUint64(&value_);
}
template <>
-void Property<uint64>::AppendSetValueToWriter(MessageWriter* writer) {
+void Property<uint64_t>::AppendSetValueToWriter(MessageWriter* writer) {
writer->AppendVariantOfUint64(set_value_);
}
@@ -536,17 +537,17 @@ void Property<std::vector<ObjectPath> >::AppendSetValueToWriter(
}
//
-// Property<std::vector<uint8> > specialization.
+// Property<std::vector<uint8_t> > specialization.
//
template <>
-bool Property<std::vector<uint8> >::PopValueFromReader(MessageReader* reader) {
+bool Property<std::vector<uint8_t>>::PopValueFromReader(MessageReader* reader) {
MessageReader variant_reader(NULL);
if (!reader->PopVariant(&variant_reader))
return false;
value_.clear();
- const uint8* bytes = NULL;
+ const uint8_t* bytes = NULL;
size_t length = 0;
if (!variant_reader.PopArrayOfBytes(&bytes, &length))
return false;
@@ -555,7 +556,7 @@ bool Property<std::vector<uint8> >::PopValueFromReader(MessageReader* reader) {
}
template <>
-void Property<std::vector<uint8> >::AppendSetValueToWriter(
+void Property<std::vector<uint8_t>>::AppendSetValueToWriter(
MessageWriter* writer) {
MessageWriter variant_writer(NULL);
writer->OpenVariant("ay", &variant_writer);
@@ -629,7 +630,7 @@ bool Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>::
return false;
std::pair<std::vector<uint8_t>, uint16_t> entry;
- const uint8* bytes = NULL;
+ const uint8_t* bytes = NULL;
size_t length = 0;
if (!struct_reader.PopArrayOfBytes(&bytes, &length))
return false;
@@ -660,20 +661,20 @@ void Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>::
writer->CloseContainer(&variant_writer);
}
-template class Property<uint8>;
+template class Property<uint8_t>;
template class Property<bool>;
-template class Property<int16>;
-template class Property<uint16>;
-template class Property<int32>;
-template class Property<uint32>;
-template class Property<int64>;
-template class Property<uint64>;
+template class Property<int16_t>;
+template class Property<uint16_t>;
+template class Property<int32_t>;
+template class Property<uint32_t>;
+template class Property<int64_t>;
+template class Property<uint64_t>;
template class Property<double>;
template class Property<std::string>;
template class Property<ObjectPath>;
template class Property<std::vector<std::string> >;
template class Property<std::vector<ObjectPath> >;
-template class Property<std::vector<uint8> >;
+template class Property<std::vector<uint8_t>>;
template class Property<std::map<std::string, std::string>>;
template class Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>;
diff --git a/dbus/property.h b/dbus/property.h
index e379f8a..efbad22 100644
--- a/dbus/property.h
+++ b/dbus/property.h
@@ -5,14 +5,16 @@
#ifndef DBUS_PROPERTY_H_
#define DBUS_PROPERTY_H_
+#include <stdint.h>
+
#include <map>
#include <string>
#include <utility>
#include <vector>
-#include "base/basictypes.h"
#include "base/bind.h"
#include "base/callback.h"
+#include "base/macros.h"
#include "dbus/dbus_export.h"
#include "dbus/message.h"
#include "dbus/object_proxy.h"
@@ -36,7 +38,7 @@
// public:
// struct Properties : public dbus::PropertySet {
// dbus::Property<std::string> name;
-// dbus::Property<uint16> version;
+// dbus::Property<uint16_t> version;
// dbus::Property<dbus::ObjectPath> parent;
// dbus::Property<std::vector<std::string> > children;
//
@@ -457,14 +459,14 @@ class CHROME_DBUS_EXPORT Property : public PropertyBase {
#pragma GCC diagnostic ignored "-Wattributes"
template <>
-CHROME_DBUS_EXPORT Property<uint8>::Property();
+CHROME_DBUS_EXPORT Property<uint8_t>::Property();
template <>
-CHROME_DBUS_EXPORT bool Property<uint8>::PopValueFromReader(
+CHROME_DBUS_EXPORT bool Property<uint8_t>::PopValueFromReader(
MessageReader* reader);
template <>
-CHROME_DBUS_EXPORT void Property<uint8>::AppendSetValueToWriter(
+CHROME_DBUS_EXPORT void Property<uint8_t>::AppendSetValueToWriter(
MessageWriter* writer);
-extern template class CHROME_DBUS_EXPORT Property<uint8>;
+extern template class CHROME_DBUS_EXPORT Property<uint8_t>;
template <>
CHROME_DBUS_EXPORT Property<bool>::Property();
@@ -477,64 +479,64 @@ CHROME_DBUS_EXPORT void Property<bool>::AppendSetValueToWriter(
extern template class CHROME_DBUS_EXPORT Property<bool>;
template <>
-CHROME_DBUS_EXPORT Property<int16>::Property();
+CHROME_DBUS_EXPORT Property<int16_t>::Property();
template <>
-CHROME_DBUS_EXPORT bool Property<int16>::PopValueFromReader(
+CHROME_DBUS_EXPORT bool Property<int16_t>::PopValueFromReader(
MessageReader* reader);
template <>
-CHROME_DBUS_EXPORT void Property<int16>::AppendSetValueToWriter(
+CHROME_DBUS_EXPORT void Property<int16_t>::AppendSetValueToWriter(
MessageWriter* writer);
-extern template class CHROME_DBUS_EXPORT Property<int16>;
+extern template class CHROME_DBUS_EXPORT Property<int16_t>;
template <>
-CHROME_DBUS_EXPORT Property<uint16>::Property();
+CHROME_DBUS_EXPORT Property<uint16_t>::Property();
template <>
-CHROME_DBUS_EXPORT bool Property<uint16>::PopValueFromReader(
+CHROME_DBUS_EXPORT bool Property<uint16_t>::PopValueFromReader(
MessageReader* reader);
template <>
-CHROME_DBUS_EXPORT void Property<uint16>::AppendSetValueToWriter(
+CHROME_DBUS_EXPORT void Property<uint16_t>::AppendSetValueToWriter(
MessageWriter* writer);
-extern template class CHROME_DBUS_EXPORT Property<uint16>;
+extern template class CHROME_DBUS_EXPORT Property<uint16_t>;
template <>
-CHROME_DBUS_EXPORT Property<int32>::Property();
+CHROME_DBUS_EXPORT Property<int32_t>::Property();
template <>
-CHROME_DBUS_EXPORT bool Property<int32>::PopValueFromReader(
+CHROME_DBUS_EXPORT bool Property<int32_t>::PopValueFromReader(
MessageReader* reader);
template <>
-CHROME_DBUS_EXPORT void Property<int32>::AppendSetValueToWriter(
+CHROME_DBUS_EXPORT void Property<int32_t>::AppendSetValueToWriter(
MessageWriter* writer);
-extern template class CHROME_DBUS_EXPORT Property<int32>;
+extern template class CHROME_DBUS_EXPORT Property<int32_t>;
template <>
-CHROME_DBUS_EXPORT Property<uint32>::Property();
+CHROME_DBUS_EXPORT Property<uint32_t>::Property();
template <>
-CHROME_DBUS_EXPORT bool Property<uint32>::PopValueFromReader(
+CHROME_DBUS_EXPORT bool Property<uint32_t>::PopValueFromReader(
MessageReader* reader);
template <>
-CHROME_DBUS_EXPORT void Property<uint32>::AppendSetValueToWriter(
+CHROME_DBUS_EXPORT void Property<uint32_t>::AppendSetValueToWriter(
MessageWriter* writer);
-extern template class CHROME_DBUS_EXPORT Property<uint32>;
+extern template class CHROME_DBUS_EXPORT Property<uint32_t>;
template <>
-CHROME_DBUS_EXPORT Property<int64>::Property();
+CHROME_DBUS_EXPORT Property<int64_t>::Property();
template <>
-CHROME_DBUS_EXPORT bool Property<int64>::PopValueFromReader(
+CHROME_DBUS_EXPORT bool Property<int64_t>::PopValueFromReader(
MessageReader* reader);
template <>
-CHROME_DBUS_EXPORT void Property<int64>::AppendSetValueToWriter(
+CHROME_DBUS_EXPORT void Property<int64_t>::AppendSetValueToWriter(
MessageWriter* writer);
-extern template class CHROME_DBUS_EXPORT Property<int64>;
+extern template class CHROME_DBUS_EXPORT Property<int64_t>;
template <>
-CHROME_DBUS_EXPORT Property<uint64>::Property();
+CHROME_DBUS_EXPORT Property<uint64_t>::Property();
template <>
-CHROME_DBUS_EXPORT bool Property<uint64>::PopValueFromReader(
+CHROME_DBUS_EXPORT bool Property<uint64_t>::PopValueFromReader(
MessageReader* reader);
template <>
-CHROME_DBUS_EXPORT void Property<uint64>::AppendSetValueToWriter(
+CHROME_DBUS_EXPORT void Property<uint64_t>::AppendSetValueToWriter(
MessageWriter* writer);
-extern template class CHROME_DBUS_EXPORT Property<uint64>;
+extern template class CHROME_DBUS_EXPORT Property<uint64_t>;
template <>
CHROME_DBUS_EXPORT Property<double>::Property();
@@ -579,12 +581,12 @@ CHROME_DBUS_EXPORT void Property<
extern template class CHROME_DBUS_EXPORT Property<std::vector<ObjectPath>>;
template <>
-CHROME_DBUS_EXPORT bool Property<std::vector<uint8>>::PopValueFromReader(
+CHROME_DBUS_EXPORT bool Property<std::vector<uint8_t>>::PopValueFromReader(
MessageReader* reader);
template <>
-CHROME_DBUS_EXPORT void Property<std::vector<uint8>>::AppendSetValueToWriter(
+CHROME_DBUS_EXPORT void Property<std::vector<uint8_t>>::AppendSetValueToWriter(
MessageWriter* writer);
-extern template class CHROME_DBUS_EXPORT Property<std::vector<uint8>>;
+extern template class CHROME_DBUS_EXPORT Property<std::vector<uint8_t>>;
template <>
CHROME_DBUS_EXPORT bool
diff --git a/dbus/property_unittest.cc b/dbus/property_unittest.cc
index 59faa22..b6bbb18 100644
--- a/dbus/property_unittest.cc
+++ b/dbus/property_unittest.cc
@@ -4,12 +4,15 @@
#include "dbus/property.h"
+#include <stddef.h>
+#include <stdint.h>
+
#include <string>
#include <vector>
-#include "base/basictypes.h"
#include "base/bind.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
@@ -31,10 +34,10 @@ class PropertyTest : public testing::Test {
struct Properties : public PropertySet {
Property<std::string> name;
- Property<int16> version;
+ Property<int16_t> version;
Property<std::vector<std::string> > methods;
Property<std::vector<ObjectPath> > objects;
- Property<std::vector<uint8> > bytes;
+ Property<std::vector<uint8_t>> bytes;
Properties(ObjectProxy* object_proxy,
PropertyChangedCallback property_changed_callback)
@@ -189,7 +192,7 @@ TEST_F(PropertyTest, InitialValues) {
ASSERT_EQ(1U, objects.size());
EXPECT_EQ(ObjectPath("/TestObjectPath"), objects[0]);
- std::vector<uint8> bytes = properties_->bytes.value();
+ std::vector<uint8_t> bytes = properties_->bytes.value();
ASSERT_EQ(4U, bytes.size());
EXPECT_EQ('T', bytes[0]);
EXPECT_EQ('e', bytes[1]);
@@ -253,7 +256,7 @@ TEST_F(PropertyTest, UpdatedValues) {
WaitForCallback("Bytes");
WaitForUpdates(1);
- std::vector<uint8> bytes = properties_->bytes.value();
+ std::vector<uint8_t> bytes = properties_->bytes.value();
ASSERT_EQ(4U, bytes.size());
EXPECT_EQ('T', bytes[0]);
EXPECT_EQ('e', bytes[1]);
@@ -380,8 +383,8 @@ TEST(PropertyTestStatic, ReadWriteNetAddressArray) {
writer.OpenVariant("a(ayq)", &variant_writer);
variant_writer.OpenArray("(ayq)", &variant_array_writer);
- uint8 ip_bytes[] = {0x54, 0x65, 0x73, 0x74, 0x30};
- for (uint16 i = 0; i < 5; ++i) {
+ uint8_t ip_bytes[] = {0x54, 0x65, 0x73, 0x74, 0x30};
+ for (uint16_t i = 0; i < 5; ++i) {
variant_array_writer.OpenStruct(&struct_entry_writer);
ip_bytes[4] = 0x30 + i;
struct_entry_writer.AppendArrayOfBytes(ip_bytes, arraysize(ip_bytes));
@@ -392,7 +395,7 @@ TEST(PropertyTestStatic, ReadWriteNetAddressArray) {
writer.CloseContainer(&variant_writer);
MessageReader reader(message.get());
- Property<std::vector<std::pair<std::vector<uint8>, uint16>>> ip_list;
+ Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>> ip_list;
EXPECT_TRUE(ip_list.PopValueFromReader(&reader));
ASSERT_EQ(5U, ip_list.value().size());
@@ -407,19 +410,19 @@ TEST(PropertyTestStatic, ReadWriteNetAddressArray) {
}
TEST(PropertyTestStatic, SerializeNetAddressArray) {
- std::vector<std::pair<std::vector<uint8>, uint16>> test_list;
+ std::vector<std::pair<std::vector<uint8_t>, uint16_t>> test_list;
- uint8 ip_bytes[] = {0x54, 0x65, 0x73, 0x74, 0x30};
- for (uint16 i = 0; i < 5; ++i) {
+ uint8_t ip_bytes[] = {0x54, 0x65, 0x73, 0x74, 0x30};
+ for (uint16_t i = 0; i < 5; ++i) {
ip_bytes[4] = 0x30 + i;
- std::vector<uint8> bytes(ip_bytes, ip_bytes + arraysize(ip_bytes));
+ std::vector<uint8_t> bytes(ip_bytes, ip_bytes + arraysize(ip_bytes));
test_list.push_back(make_pair(bytes, 16));
}
scoped_ptr<Response> message(Response::CreateEmpty());
MessageWriter writer(message.get());
- Property<std::vector<std::pair<std::vector<uint8>, uint16>>> ip_list;
+ Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>> ip_list;
ip_list.ReplaceSetValueForTesting(test_list);
ip_list.AppendSetValueToWriter(&writer);
diff --git a/dbus/string_util.cc b/dbus/string_util.cc
index 16e483a..7f71015 100644
--- a/dbus/string_util.cc
+++ b/dbus/string_util.cc
@@ -4,6 +4,8 @@
#include "dbus/string_util.h"
+#include <stddef.h>
+
#include "base/strings/string_util.h"
namespace dbus {
diff --git a/dbus/test_service.cc b/dbus/test_service.cc
index 2c14869..804bb2a 100644
--- a/dbus/test_service.cc
+++ b/dbus/test_service.cc
@@ -4,6 +4,8 @@
#include "dbus/test_service.h"
+#include <stdint.h>
+
#include <string>
#include <vector>
@@ -428,7 +430,7 @@ void TestService::GetProperty(MethodCall* method_call,
MessageWriter variant_array_writer(NULL);
writer.OpenVariant("ay", &variant_writer);
- const uint8 bytes[] = { 0x54, 0x65, 0x73, 0x74 };
+ const uint8_t bytes[] = {0x54, 0x65, 0x73, 0x74};
variant_writer.AppendArrayOfBytes(bytes, sizeof(bytes));
writer.CloseContainer(&variant_writer);
@@ -630,7 +632,7 @@ void TestService::AddPropertiesToWriter(MessageWriter* writer) {
array_writer.OpenDictEntry(&dict_entry_writer);
dict_entry_writer.AppendString("Bytes");
dict_entry_writer.OpenVariant("ay", &variant_writer);
- const uint8 bytes[] = { 0x54, 0x65, 0x73, 0x74 };
+ const uint8_t bytes[] = {0x54, 0x65, 0x73, 0x74};
variant_writer.AppendArrayOfBytes(bytes, sizeof(bytes));
dict_entry_writer.CloseContainer(&variant_writer);
array_writer.CloseContainer(&dict_entry_writer);
diff --git a/dbus/values_util.cc b/dbus/values_util.cc
index c162878..e932312 100644
--- a/dbus/values_util.cc
+++ b/dbus/values_util.cc
@@ -94,7 +94,7 @@ base::Value* PopDataAsValue(MessageReader* reader) {
// Do nothing.
break;
case Message::BYTE: {
- uint8 value = 0;
+ uint8_t value = 0;
if (reader->PopByte(&value))
result = new base::FundamentalValue(value);
break;
@@ -106,31 +106,31 @@ base::Value* PopDataAsValue(MessageReader* reader) {
break;
}
case Message::INT16: {
- int16 value = 0;
+ int16_t value = 0;
if (reader->PopInt16(&value))
result = new base::FundamentalValue(value);
break;
}
case Message::UINT16: {
- uint16 value = 0;
+ uint16_t value = 0;
if (reader->PopUint16(&value))
result = new base::FundamentalValue(value);
break;
}
case Message::INT32: {
- int32 value = 0;
+ int32_t value = 0;
if (reader->PopInt32(&value))
result = new base::FundamentalValue(value);
break;
}
case Message::UINT32: {
- uint32 value = 0;
+ uint32_t value = 0;
if (reader->PopUint32(&value))
result = new base::FundamentalValue(static_cast<double>(value));
break;
}
case Message::INT64: {
- int64 value = 0;
+ int64_t value = 0;
if (reader->PopInt64(&value)) {
DLOG_IF(WARNING, !IsExactlyRepresentableByDouble(value)) <<
value << " is not exactly representable by double";
@@ -139,7 +139,7 @@ base::Value* PopDataAsValue(MessageReader* reader) {
break;
}
case Message::UINT64: {
- uint64 value = 0;
+ uint64_t value = 0;
if (reader->PopUint64(&value)) {
DLOG_IF(WARNING, !IsExactlyRepresentableByDouble(value)) <<
value << " is not exactly representable by double";
diff --git a/dbus/values_util.h b/dbus/values_util.h
index 9ece9b9..b6f4ff3 100644
--- a/dbus/values_util.h
+++ b/dbus/values_util.h
@@ -5,6 +5,8 @@
#ifndef DBUS_VALUES_UTIL_H_
#define DBUS_VALUES_UTIL_H_
+#include <stdint.h>
+
#include "dbus/dbus_export.h"
namespace base {
@@ -18,8 +20,8 @@ class MessageWriter;
// Pops a value from |reader| as a base::Value.
// Returns NULL if an error occurs.
-// Note: Integer values larger than int32 (including uint32) are converted to
-// double. Non-string diciontary keys are converted to strings.
+// Note: Integer values larger than int32_t (including uint32_t) are converted
+// to double. Non-string dictionary keys are converted to strings.
CHROME_DBUS_EXPORT base::Value* PopDataAsValue(MessageReader* reader);
// Appends a basic type value to |writer|. Basic types are BOOLEAN, INTEGER,
diff --git a/dbus/values_util_unittest.cc b/dbus/values_util_unittest.cc
index 6abc56a..b2f1404 100644
--- a/dbus/values_util_unittest.cc
+++ b/dbus/values_util_unittest.cc
@@ -4,10 +4,14 @@
#include "dbus/values_util.h"
+#include <stddef.h>
+#include <stdint.h>
+
#include <cmath>
#include <vector>
#include "base/json/json_writer.h"
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "dbus/message.h"
@@ -19,21 +23,21 @@ TEST(ValuesUtilTest, PopBasicTypes) {
scoped_ptr<Response> response(Response::CreateEmpty());
// Append basic type values.
MessageWriter writer(response.get());
- const uint8 kByteValue = 42;
+ const uint8_t kByteValue = 42;
writer.AppendByte(kByteValue);
const bool kBoolValue = true;
writer.AppendBool(kBoolValue);
- const int16 kInt16Value = -43;
+ const int16_t kInt16Value = -43;
writer.AppendInt16(kInt16Value);
- const uint16 kUint16Value = 44;
+ const uint16_t kUint16Value = 44;
writer.AppendUint16(kUint16Value);
- const int32 kInt32Value = -45;
+ const int32_t kInt32Value = -45;
writer.AppendInt32(kInt32Value);
- const uint32 kUint32Value = 46;
+ const uint32_t kUint32Value = 46;
writer.AppendUint32(kUint32Value);
- const int64 kInt64Value = -47;
+ const int64_t kInt64Value = -47;
writer.AppendInt64(kInt64Value);
- const uint64 kUint64Value = 48;
+ const uint64_t kUint64Value = 48;
writer.AppendUint64(kUint64Value);
const double kDoubleValue = 4.9;
writer.AppendDouble(kDoubleValue);
@@ -57,34 +61,34 @@ TEST(ValuesUtilTest, PopBasicTypes) {
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(new base::FundamentalValue(kBoolValue));
EXPECT_TRUE(value->Equals(expected_value.get()));
- // Pop an int16.
+ // Pop an int16_t.
value.reset(PopDataAsValue(&reader));
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(new base::FundamentalValue(kInt16Value));
EXPECT_TRUE(value->Equals(expected_value.get()));
- // Pop a uint16.
+ // Pop a uint16_t.
value.reset(PopDataAsValue(&reader));
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(new base::FundamentalValue(kUint16Value));
EXPECT_TRUE(value->Equals(expected_value.get()));
- // Pop an int32.
+ // Pop an int32_t.
value.reset(PopDataAsValue(&reader));
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(new base::FundamentalValue(kInt32Value));
EXPECT_TRUE(value->Equals(expected_value.get()));
- // Pop a uint32.
+ // Pop a uint32_t.
value.reset(PopDataAsValue(&reader));
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(
new base::FundamentalValue(static_cast<double>(kUint32Value)));
EXPECT_TRUE(value->Equals(expected_value.get()));
- // Pop an int64.
+ // Pop an int64_t.
value.reset(PopDataAsValue(&reader));
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(
new base::FundamentalValue(static_cast<double>(kInt64Value)));
EXPECT_TRUE(value->Equals(expected_value.get()));
- // Pop a uint64.
+ // Pop a uint64_t.
value.reset(PopDataAsValue(&reader));
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(
@@ -118,7 +122,7 @@ TEST(ValuesUtilTest, PopVariant) {
MessageWriter writer(response.get());
const bool kBoolValue = true;
writer.AppendVariantOfBool(kBoolValue);
- const int32 kInt32Value = -45;
+ const int32_t kInt32Value = -45;
writer.AppendVariantOfInt32(kInt32Value);
const double kDoubleValue = 4.9;
writer.AppendVariantOfDouble(kDoubleValue);
@@ -133,7 +137,7 @@ TEST(ValuesUtilTest, PopVariant) {
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(new base::FundamentalValue(kBoolValue));
EXPECT_TRUE(value->Equals(expected_value.get()));
- // Pop an int32.
+ // Pop an int32_t.
value.reset(PopDataAsValue(&reader));
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(new base::FundamentalValue(kInt32Value));
@@ -156,39 +160,39 @@ TEST(ValuesUtilTest, PopExtremelyLargeIntegers) {
scoped_ptr<Response> response(Response::CreateEmpty());
// Append large integers.
MessageWriter writer(response.get());
- const int64 kInt64Value = -123456789012345689LL;
+ const int64_t kInt64Value = -123456789012345689LL;
writer.AppendInt64(kInt64Value);
- const uint64 kUint64Value = 9876543210987654321ULL;
+ const uint64_t kUint64Value = 9876543210987654321ULL;
writer.AppendUint64(kUint64Value);
MessageReader reader(response.get());
scoped_ptr<base::Value> value;
scoped_ptr<base::Value> expected_value;
double double_value = 0;
- // Pop an int64.
+ // Pop an int64_t.
value.reset(PopDataAsValue(&reader));
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(
new base::FundamentalValue(static_cast<double>(kInt64Value)));
EXPECT_TRUE(value->Equals(expected_value.get()));
ASSERT_TRUE(value->GetAsDouble(&double_value));
- EXPECT_NE(kInt64Value, static_cast<int64>(double_value));
- // Pop a uint64.
+ EXPECT_NE(kInt64Value, static_cast<int64_t>(double_value));
+ // Pop a uint64_t.
value.reset(PopDataAsValue(&reader));
ASSERT_TRUE(value.get() != NULL);
expected_value.reset(
new base::FundamentalValue(static_cast<double>(kUint64Value)));
EXPECT_TRUE(value->Equals(expected_value.get()));
ASSERT_TRUE(value->GetAsDouble(&double_value));
- EXPECT_NE(kUint64Value, static_cast<uint64>(double_value));
+ EXPECT_NE(kUint64Value, static_cast<uint64_t>(double_value));
}
TEST(ValuesUtilTest, PopIntArray) {
scoped_ptr<Response> response(Response::CreateEmpty());
- // Append an int32 array.
+ // Append an int32_t array.
MessageWriter writer(response.get());
MessageWriter sub_writer(NULL);
- std::vector<int32> data;
+ std::vector<int32_t> data;
data.push_back(0);
data.push_back(1);
data.push_back(2);
@@ -202,7 +206,7 @@ TEST(ValuesUtilTest, PopIntArray) {
for (size_t i = 0; i != data.size(); ++i)
list_value->Append(new base::FundamentalValue(data[i]));
- // Pop an int32 array.
+ // Pop an int32_t array.
MessageReader reader(response.get());
scoped_ptr<base::Value> value(PopDataAsValue(&reader));
ASSERT_TRUE(value.get() != NULL);
@@ -240,7 +244,7 @@ TEST(ValuesUtilTest, PopStruct) {
writer.OpenStruct(&sub_writer);
const bool kBoolValue = true;
sub_writer.AppendBool(kBoolValue);
- const int32 kInt32Value = -123;
+ const int32_t kInt32Value = -123;
sub_writer.AppendInt32(kInt32Value);
const double kDoubleValue = 1.23;
sub_writer.AppendDouble(kDoubleValue);
@@ -278,7 +282,7 @@ TEST(ValuesUtilTest, PopStringToVariantDictionary) {
sub_writer.OpenDictEntry(&entry_writer);
const std::string kKey2 = "two";
entry_writer.AppendString(kKey2);
- const int32 kInt32Value = -45;
+ const int32_t kInt32Value = -45;
entry_writer.AppendVariantOfInt32(kInt32Value);
sub_writer.CloseContainer(&entry_writer);
sub_writer.OpenDictEntry(&entry_writer);
@@ -325,7 +329,7 @@ TEST(ValuesUtilTest, PopDictionaryWithDottedStringKey) {
sub_writer.OpenDictEntry(&entry_writer);
const std::string kKey2 = ".example"; // String starting with a dot.
entry_writer.AppendString(kKey2);
- const int32 kInt32Value = -45;
+ const int32_t kInt32Value = -45;
entry_writer.AppendVariantOfInt32(kInt32Value);
sub_writer.CloseContainer(&entry_writer);
sub_writer.OpenDictEntry(&entry_writer);
@@ -354,8 +358,8 @@ TEST(ValuesUtilTest, PopDictionaryWithDottedStringKey) {
TEST(ValuesUtilTest, PopDoubleToIntDictionary) {
// Create test data.
- const int32 kValues[] = {0, 1, 1, 2, 3, 5, 8, 13, 21};
- const std::vector<int32> values(kValues, kValues + arraysize(kValues));
+ const int32_t kValues[] = {0, 1, 1, 2, 3, 5, 8, 13, 21};
+ const std::vector<int32_t> values(kValues, kValues + arraysize(kValues));
std::vector<double> keys(values.size());
for (size_t i = 0; i != values.size(); ++i)
keys[i] = std::sqrt(values[i]);
@@ -515,7 +519,7 @@ TEST(ValuesUtilTest, AppendDictionary) {
const std::string kKey6 = "six";
const bool kBoolValue = true;
- const int32 kInt32Value = -45;
+ const int32_t kInt32Value = -45;
const double kDoubleValue = 4.9;
const std::string kStringValue = "fifty";
@@ -562,7 +566,7 @@ TEST(ValuesUtilTest, AppendDictionaryAsVariant) {
const std::string kKey6 = "six";
const bool kBoolValue = true;
- const int32 kInt32Value = -45;
+ const int32_t kInt32Value = -45;
const double kDoubleValue = 4.9;
const std::string kStringValue = "fifty";
@@ -605,7 +609,7 @@ TEST(ValuesUtilTest, AppendList) {
const std::string kKey2 = "two";
const bool kBoolValue = true;
- const int32 kInt32Value = -45;
+ const int32_t kInt32Value = -45;
const double kDoubleValue = 4.9;
const std::string kStringValue = "fifty";
@@ -648,7 +652,7 @@ TEST(ValuesUtilTest, AppendListAsVariant) {
const std::string kKey2 = "two";
const bool kBoolValue = true;
- const int32 kInt32Value = -45;
+ const int32_t kInt32Value = -45;
const double kDoubleValue = 4.9;
const std::string kStringValue = "fifty";