summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-14 19:36:28 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-14 19:40:39 +0000
commite2b143d4f0cff16fa5c95009b9cace7b627574b1 (patch)
tree87cba16f6ebe69b05d90258eb735ac115cca3df9
parenta124f7f2fbb78f594f77e84778da371cdb46dafb (diff)
downloadchromium_src-e2b143d4f0cff16fa5c95009b9cace7b627574b1.zip
chromium_src-e2b143d4f0cff16fa5c95009b9cace7b627574b1.tar.gz
chromium_src-e2b143d4f0cff16fa5c95009b9cace7b627574b1.tar.bz2
Mojo: clang-format mojo/public/c/... and add a presubmit check.
Note: clang-format misformats some C-style casts (in the C-compilable parts of header files; e.g., it formats |(Foo)-5| as |(Foo) - 5|), but I can live with that. R=jamesr@chromium.org Review URL: https://codereview.chromium.org/469393002 Cr-Commit-Position: refs/heads/master@{#289669} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289669 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--mojo/public/c/PRESUBMIT.py16
-rw-r--r--mojo/public/c/environment/logger.h10
-rw-r--r--mojo/public/c/system/buffer.h12
-rw-r--r--mojo/public/c/system/data_pipe.h75
-rw-r--r--mojo/public/c/system/macros.h9
-rw-r--r--mojo/public/c/system/message_pipe.h40
-rw-r--r--mojo/public/c/system/tests/core_perftest.cc82
-rw-r--r--mojo/public/c/system/tests/core_unittest.cc74
-rw-r--r--mojo/public/c/system/tests/core_unittest_pure_c.c48
-rw-r--r--mojo/public/c/system/tests/macros_unittest.cc14
-rw-r--r--mojo/public/c/system/types.h46
-rw-r--r--mojo/system/PRESUBMIT.py2
12 files changed, 233 insertions, 195 deletions
diff --git a/mojo/public/c/PRESUBMIT.py b/mojo/public/c/PRESUBMIT.py
new file mode 100644
index 0000000..4cba433
--- /dev/null
+++ b/mojo/public/c/PRESUBMIT.py
@@ -0,0 +1,16 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Presubmit script for mojo/public/c.
+
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more details about the presubmit API built into depot_tools.
+"""
+
+def CheckChangeOnUpload(input_api, output_api):
+ results = []
+ results += input_api.canned_checks.CheckChangeHasOnlyOneEol(input_api,
+ output_api)
+ results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
+ return results
diff --git a/mojo/public/c/environment/logger.h b/mojo/public/c/environment/logger.h
index 5e9067f..c492a66 100644
--- a/mojo/public/c/environment/logger.h
+++ b/mojo/public/c/environment/logger.h
@@ -19,11 +19,11 @@ const MojoLogLevel MOJO_LOG_LEVEL_WARNING = 1;
const MojoLogLevel MOJO_LOG_LEVEL_ERROR = 2;
const MojoLogLevel MOJO_LOG_LEVEL_FATAL = 3;
#else
-#define MOJO_LOG_LEVEL_VERBOSE ((MojoLogLevel) -1)
-#define MOJO_LOG_LEVEL_INFO ((MojoLogLevel) 0)
-#define MOJO_LOG_LEVEL_WARNING ((MojoLogLevel) 1)
-#define MOJO_LOG_LEVEL_ERROR ((MojoLogLevel) 2)
-#define MOJO_LOG_LEVEL_FATAL ((MojoLogLevel) 3)
+#define MOJO_LOG_LEVEL_VERBOSE ((MojoLogLevel) - 1)
+#define MOJO_LOG_LEVEL_INFO ((MojoLogLevel)0)
+#define MOJO_LOG_LEVEL_WARNING ((MojoLogLevel)1)
+#define MOJO_LOG_LEVEL_ERROR ((MojoLogLevel)2)
+#define MOJO_LOG_LEVEL_FATAL ((MojoLogLevel)3)
#endif
// Structure with basic logging functions (on top of which more friendly logging
diff --git a/mojo/public/c/system/buffer.h b/mojo/public/c/system/buffer.h
index e3b1bfe..19e3c52 100644
--- a/mojo/public/c/system/buffer.h
+++ b/mojo/public/c/system/buffer.h
@@ -35,7 +35,7 @@ const MojoCreateSharedBufferOptionsFlags
MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE = 0;
#else
#define MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE \
- ((MojoCreateSharedBufferOptionsFlags) 0)
+ ((MojoCreateSharedBufferOptionsFlags)0)
#endif
MOJO_COMPILE_ASSERT(MOJO_ALIGNOF(int64_t) == 8, int64_t_has_weird_alignment);
@@ -64,7 +64,7 @@ const MojoDuplicateBufferHandleOptionsFlags
MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE = 0;
#else
#define MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE \
- ((MojoDuplicateBufferHandleOptionsFlags) 0)
+ ((MojoDuplicateBufferHandleOptionsFlags)0)
#endif
struct MojoDuplicateBufferHandleOptions {
@@ -82,7 +82,7 @@ typedef uint32_t MojoMapBufferFlags;
#ifdef __cplusplus
const MojoMapBufferFlags MOJO_MAP_BUFFER_FLAG_NONE = 0;
#else
-#define MOJO_MAP_BUFFER_FLAG_NONE ((MojoMapBufferFlags) 0)
+#define MOJO_MAP_BUFFER_FLAG_NONE ((MojoMapBufferFlags)0)
#endif
#ifdef __cplusplus
@@ -116,8 +116,8 @@ extern "C" {
// |MOJO_RESULT_UNIMPLEMENTED| if an unsupported flag was set in |*options|.
MOJO_SYSTEM_EXPORT MojoResult MojoCreateSharedBuffer(
const struct MojoCreateSharedBufferOptions* options, // Optional.
- uint64_t num_bytes, // In.
- MojoHandle* shared_buffer_handle); // Out.
+ uint64_t num_bytes, // In.
+ MojoHandle* shared_buffer_handle); // Out.
// Duplicates the handle |buffer_handle| to a buffer. This creates another
// handle (returned in |*new_buffer_handle| on success), which can then be sent
@@ -138,7 +138,7 @@ MOJO_SYSTEM_EXPORT MojoResult MojoCreateSharedBuffer(
MOJO_SYSTEM_EXPORT MojoResult MojoDuplicateBufferHandle(
MojoHandle buffer_handle,
const struct MojoDuplicateBufferHandleOptions* options, // Optional.
- MojoHandle* new_buffer_handle); // Out.
+ MojoHandle* new_buffer_handle); // Out.
// Maps the part (at offset |offset| of length |num_bytes|) of the buffer given
// by |buffer_handle| into memory, with options specified by |flags|. |offset +
diff --git a/mojo/public/c/system/data_pipe.h b/mojo/public/c/system/data_pipe.h
index 2b30504..c8087ea 100644
--- a/mojo/public/c/system/data_pipe.h
+++ b/mojo/public/c/system/data_pipe.h
@@ -35,15 +35,15 @@
typedef uint32_t MojoCreateDataPipeOptionsFlags;
#ifdef __cplusplus
-const MojoCreateDataPipeOptionsFlags
- MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE = 0;
+const MojoCreateDataPipeOptionsFlags MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE =
+ 0;
const MojoCreateDataPipeOptionsFlags
MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD = 1 << 0;
#else
#define MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE \
- ((MojoCreateDataPipeOptionsFlags) 0)
+ ((MojoCreateDataPipeOptionsFlags)0)
#define MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_MAY_DISCARD \
- ((MojoCreateDataPipeOptionsFlags) 1 << 0)
+ ((MojoCreateDataPipeOptionsFlags)1 << 0)
#endif
MOJO_COMPILE_ASSERT(MOJO_ALIGNOF(int64_t) == 8, int64_t_has_weird_alignment);
@@ -68,8 +68,8 @@ typedef uint32_t MojoWriteDataFlags;
const MojoWriteDataFlags MOJO_WRITE_DATA_FLAG_NONE = 0;
const MojoWriteDataFlags MOJO_WRITE_DATA_FLAG_ALL_OR_NONE = 1 << 0;
#else
-#define MOJO_WRITE_DATA_FLAG_NONE ((MojoWriteDataFlags) 0)
-#define MOJO_WRITE_DATA_FLAG_ALL_OR_NONE ((MojoWriteDataFlags) 1 << 0)
+#define MOJO_WRITE_DATA_FLAG_NONE ((MojoWriteDataFlags)0)
+#define MOJO_WRITE_DATA_FLAG_ALL_OR_NONE ((MojoWriteDataFlags)1 << 0)
#endif
// |MojoReadDataFlags|: Used to specify different modes to |MojoReadData()| and
@@ -92,10 +92,10 @@ const MojoReadDataFlags MOJO_READ_DATA_FLAG_ALL_OR_NONE = 1 << 0;
const MojoReadDataFlags MOJO_READ_DATA_FLAG_DISCARD = 1 << 1;
const MojoReadDataFlags MOJO_READ_DATA_FLAG_QUERY = 1 << 2;
#else
-#define MOJO_READ_DATA_FLAG_NONE ((MojoReadDataFlags) 0)
-#define MOJO_READ_DATA_FLAG_ALL_OR_NONE ((MojoReadDataFlags) 1 << 0)
-#define MOJO_READ_DATA_FLAG_DISCARD ((MojoReadDataFlags) 1 << 1)
-#define MOJO_READ_DATA_FLAG_QUERY ((MojoReadDataFlags) 1 << 2)
+#define MOJO_READ_DATA_FLAG_NONE ((MojoReadDataFlags)0)
+#define MOJO_READ_DATA_FLAG_ALL_OR_NONE ((MojoReadDataFlags)1 << 0)
+#define MOJO_READ_DATA_FLAG_DISCARD ((MojoReadDataFlags)1 << 1)
+#define MOJO_READ_DATA_FLAG_QUERY ((MojoReadDataFlags)1 << 2)
#endif
#ifdef __cplusplus
@@ -129,8 +129,8 @@ extern "C" {
// |MOJO_RESULT_UNIMPLEMENTED| if an unsupported flag was set in |*options|.
MOJO_SYSTEM_EXPORT MojoResult MojoCreateDataPipe(
const struct MojoCreateDataPipeOptions* options, // Optional.
- MojoHandle* data_pipe_producer_handle, // Out.
- MojoHandle* data_pipe_consumer_handle); // Out.
+ MojoHandle* data_pipe_producer_handle, // Out.
+ MojoHandle* data_pipe_consumer_handle); // Out.
// Writes the given data to the data pipe producer given by
// |data_pipe_producer_handle|. |elements| points to data of size |*num_bytes|;
@@ -168,11 +168,11 @@ MOJO_SYSTEM_EXPORT MojoResult MojoCreateDataPipe(
// |MOJO_WRITE_DATA_FLAG_ALL_OR_NONE| set.
//
// TODO(vtl): Should there be a way of querying how much data can be written?
-MOJO_SYSTEM_EXPORT MojoResult MojoWriteData(
- MojoHandle data_pipe_producer_handle,
- const void* elements,
- uint32_t* num_bytes, // In/out.
- MojoWriteDataFlags flags);
+MOJO_SYSTEM_EXPORT MojoResult
+ MojoWriteData(MojoHandle data_pipe_producer_handle,
+ const void* elements,
+ uint32_t* num_bytes, // In/out.
+ MojoWriteDataFlags flags);
// Begins a two-phase write to the data pipe producer given by
// |data_pipe_producer_handle|. On success, |*buffer| will be a pointer to which
@@ -213,11 +213,11 @@ MOJO_SYSTEM_EXPORT MojoResult MojoWriteData(
// called, but not yet the matching |MojoEndWriteData()|).
// |MOJO_RESULT_SHOULD_WAIT| if no data can currently be written (and the
// consumer is still open).
-MOJO_SYSTEM_EXPORT MojoResult MojoBeginWriteData(
- MojoHandle data_pipe_producer_handle,
- void** buffer, // Out.
- uint32_t* buffer_num_bytes, // In/out.
- MojoWriteDataFlags flags);
+MOJO_SYSTEM_EXPORT MojoResult
+ MojoBeginWriteData(MojoHandle data_pipe_producer_handle,
+ void** buffer, // Out.
+ uint32_t* buffer_num_bytes, // In/out.
+ MojoWriteDataFlags flags);
// Ends a two-phase write to the data pipe producer given by
// |data_pipe_producer_handle| that was begun by a call to
@@ -241,9 +241,9 @@ MOJO_SYSTEM_EXPORT MojoResult MojoBeginWriteData(
// |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe producer is not in a
// two-phase write (e.g., |MojoBeginWriteData()| was not called or
// |MojoEndWriteData()| has already been called).
-MOJO_SYSTEM_EXPORT MojoResult MojoEndWriteData(
- MojoHandle data_pipe_producer_handle,
- uint32_t num_bytes_written);
+MOJO_SYSTEM_EXPORT MojoResult
+ MojoEndWriteData(MojoHandle data_pipe_producer_handle,
+ uint32_t num_bytes_written);
// Reads data from the data pipe consumer given by |data_pipe_consumer_handle|.
// May also be used to discard data or query the amount of data available.
@@ -287,11 +287,10 @@ MOJO_SYSTEM_EXPORT MojoResult MojoEndWriteData(
// |MOJO_RESULT_SHOULD_WAIT| if there is no data to be read or discarded (and
// the producer is still open) and |flags| does *not* have
// |MOJO_READ_DATA_FLAG_ALL_OR_NONE| set.
-MOJO_SYSTEM_EXPORT MojoResult MojoReadData(
- MojoHandle data_pipe_consumer_handle,
- void* elements, // Out.
- uint32_t* num_bytes, // In/out.
- MojoReadDataFlags flags);
+MOJO_SYSTEM_EXPORT MojoResult MojoReadData(MojoHandle data_pipe_consumer_handle,
+ void* elements, // Out.
+ uint32_t* num_bytes, // In/out.
+ MojoReadDataFlags flags);
// Begins a two-phase read from the data pipe consumer given by
// |data_pipe_consumer_handle|. On success, |*buffer| will be a pointer from
@@ -329,11 +328,11 @@ MOJO_SYSTEM_EXPORT MojoResult MojoReadData(
// called, but not yet the matching |MojoEndReadData()|).
// |MOJO_RESULT_SHOULD_WAIT| if no data can currently be read (and the
// producer is still open).
-MOJO_SYSTEM_EXPORT MojoResult MojoBeginReadData(
- MojoHandle data_pipe_consumer_handle,
- const void** buffer, // Out.
- uint32_t* buffer_num_bytes, // In/out.
- MojoReadDataFlags flags);
+MOJO_SYSTEM_EXPORT MojoResult
+ MojoBeginReadData(MojoHandle data_pipe_consumer_handle,
+ const void** buffer, // Out.
+ uint32_t* buffer_num_bytes, // In/out.
+ MojoReadDataFlags flags);
// Ends a two-phase read from the data pipe consumer given by
// |data_pipe_consumer_handle| that was begun by a call to |MojoBeginReadData()|
@@ -354,9 +353,9 @@ MOJO_SYSTEM_EXPORT MojoResult MojoBeginReadData(
// |MOJO_RESULT_FAILED_PRECONDITION| if the data pipe consumer is not in a
// two-phase read (e.g., |MojoBeginReadData()| was not called or
// |MojoEndReadData()| has already been called).
-MOJO_SYSTEM_EXPORT MojoResult MojoEndReadData(
- MojoHandle data_pipe_consumer_handle,
- uint32_t num_bytes_read);
+MOJO_SYSTEM_EXPORT MojoResult
+ MojoEndReadData(MojoHandle data_pipe_consumer_handle,
+ uint32_t num_bytes_read);
#ifdef __cplusplus
} // extern "C"
diff --git a/mojo/public/c/system/macros.h b/mojo/public/c/system/macros.h
index ae88249..564ee60 100644
--- a/mojo/public/c/system/macros.h
+++ b/mojo/public/c/system/macros.h
@@ -35,7 +35,7 @@
// if (TakeOwnership(my_var.get()) == SUCCESS)
// mojo_ignore_result(my_var.release());
//
-template<typename T>
+template <typename T>
inline void mojo_ignore_result(const T&) {
}
#endif
@@ -47,9 +47,12 @@ inline void mojo_ignore_result(const T&) {
#if __cplusplus >= 201103L
#define MOJO_COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
#elif defined(__cplusplus)
-namespace mojo { template <bool> struct CompileAssert {}; }
+namespace mojo {
+template <bool>
+struct CompileAssert {};
+}
#define MOJO_COMPILE_ASSERT(expr, msg) \
- typedef ::mojo::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
+ typedef ::mojo::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
#else
#define MOJO_COMPILE_ASSERT(expr, msg)
#endif
diff --git a/mojo/public/c/system/message_pipe.h b/mojo/public/c/system/message_pipe.h
index 39b7859..b08ba75 100644
--- a/mojo/public/c/system/message_pipe.h
+++ b/mojo/public/c/system/message_pipe.h
@@ -28,7 +28,7 @@ const MojoCreateMessagePipeOptionsFlags
MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE = 0;
#else
#define MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE \
- ((MojoCreateMessagePipeOptionsFlags) 0)
+ ((MojoCreateMessagePipeOptionsFlags)0)
#endif
MOJO_COMPILE_ASSERT(MOJO_ALIGNOF(int64_t) == 8, int64_t_has_weird_alignment);
@@ -48,7 +48,7 @@ typedef uint32_t MojoWriteMessageFlags;
#ifdef __cplusplus
const MojoWriteMessageFlags MOJO_WRITE_MESSAGE_FLAG_NONE = 0;
#else
-#define MOJO_WRITE_MESSAGE_FLAG_NONE ((MojoWriteMessageFlags) 0)
+#define MOJO_WRITE_MESSAGE_FLAG_NONE ((MojoWriteMessageFlags)0)
#endif
// |MojoReadMessageFlags|: Used to specify different modes to
@@ -64,8 +64,8 @@ typedef uint32_t MojoReadMessageFlags;
const MojoReadMessageFlags MOJO_READ_MESSAGE_FLAG_NONE = 0;
const MojoReadMessageFlags MOJO_READ_MESSAGE_FLAG_MAY_DISCARD = 1 << 0;
#else
-#define MOJO_READ_MESSAGE_FLAG_NONE ((MojoReadMessageFlags) 0)
-#define MOJO_READ_MESSAGE_FLAG_MAY_DISCARD ((MojoReadMessageFlags) 1 << 0)
+#define MOJO_READ_MESSAGE_FLAG_NONE ((MojoReadMessageFlags)0)
+#define MOJO_READ_MESSAGE_FLAG_MAY_DISCARD ((MojoReadMessageFlags)1 << 0)
#endif
#ifdef __cplusplus
@@ -94,8 +94,8 @@ extern "C" {
// TODO(vtl): Add an options struct pointer argument.
MOJO_SYSTEM_EXPORT MojoResult MojoCreateMessagePipe(
const struct MojoCreateMessagePipeOptions* options, // Optional.
- MojoHandle* message_pipe_handle0, // Out.
- MojoHandle* message_pipe_handle1); // Out.
+ MojoHandle* message_pipe_handle0, // Out.
+ MojoHandle* message_pipe_handle1); // Out.
// Writes a message to the message pipe endpoint given by |message_pipe_handle|,
// with message data specified by |bytes| of size |num_bytes| and attached
@@ -125,13 +125,13 @@ MOJO_SYSTEM_EXPORT MojoResult MojoCreateMessagePipe(
//
// TODO(vtl): Add a notion of capacity for message pipes, and return
// |MOJO_RESULT_SHOULD_WAIT| if the message pipe is full.
-MOJO_SYSTEM_EXPORT MojoResult MojoWriteMessage(
- MojoHandle message_pipe_handle,
- const void* bytes, // Optional.
- uint32_t num_bytes,
- const MojoHandle* handles, // Optional.
- uint32_t num_handles,
- MojoWriteMessageFlags flags);
+MOJO_SYSTEM_EXPORT MojoResult
+ MojoWriteMessage(MojoHandle message_pipe_handle,
+ const void* bytes, // Optional.
+ uint32_t num_bytes,
+ const MojoHandle* handles, // Optional.
+ uint32_t num_handles,
+ MojoWriteMessageFlags flags);
// Reads a message from the message pipe endpoint given by
// |message_pipe_handle|; also usable to query the size of the next message or
@@ -164,13 +164,13 @@ MOJO_SYSTEM_EXPORT MojoResult MojoWriteMessage(
// error code; should distinguish this from the hitting-system-limits
// case.)
// |MOJO_RESULT_SHOULD_WAIT| if no message was available to be read.
-MOJO_SYSTEM_EXPORT MojoResult MojoReadMessage(
- MojoHandle message_pipe_handle,
- void* bytes, // Optional out.
- uint32_t* num_bytes, // Optional in/out.
- MojoHandle* handles, // Optional out.
- uint32_t* num_handles, // Optional in/out.
- MojoReadMessageFlags flags);
+MOJO_SYSTEM_EXPORT MojoResult
+ MojoReadMessage(MojoHandle message_pipe_handle,
+ void* bytes, // Optional out.
+ uint32_t* num_bytes, // Optional in/out.
+ MojoHandle* handles, // Optional out.
+ uint32_t* num_handles, // Optional in/out.
+ MojoReadMessageFlags flags);
#ifdef __cplusplus
} // extern "C"
diff --git a/mojo/public/c/system/tests/core_perftest.cc b/mojo/public/c/system/tests/core_perftest.cc
index c81f51a..868457b 100644
--- a/mojo/public/c/system/tests/core_perftest.cc
+++ b/mojo/public/c/system/tests/core_perftest.cc
@@ -28,9 +28,7 @@ namespace {
class MessagePipeWriterThread : public mojo::Thread {
public:
MessagePipeWriterThread(MojoHandle handle, uint32_t num_bytes)
- : handle_(handle),
- num_bytes_(num_bytes),
- num_writes_(0) {}
+ : handle_(handle), num_bytes_(num_bytes), num_writes_(0) {}
virtual ~MessagePipeWriterThread() {}
virtual void Run() MOJO_OVERRIDE {
@@ -39,8 +37,8 @@ class MessagePipeWriterThread : public mojo::Thread {
// TODO(vtl): Should I throttle somehow?
for (;;) {
- MojoResult result = MojoWriteMessage(handle_, buffer, num_bytes_, NULL, 0,
- MOJO_WRITE_MESSAGE_FLAG_NONE);
+ MojoResult result = MojoWriteMessage(
+ handle_, buffer, num_bytes_, NULL, 0, MOJO_WRITE_MESSAGE_FLAG_NONE);
if (result == MOJO_RESULT_OK) {
num_writes_++;
continue;
@@ -68,9 +66,7 @@ class MessagePipeWriterThread : public mojo::Thread {
class MessagePipeReaderThread : public mojo::Thread {
public:
explicit MessagePipeReaderThread(MojoHandle handle)
- : handle_(handle),
- num_reads_(0) {
- }
+ : handle_(handle), num_reads_(0) {}
virtual ~MessagePipeReaderThread() {}
virtual void Run() MOJO_OVERRIDE {
@@ -78,16 +74,16 @@ class MessagePipeReaderThread : public mojo::Thread {
for (;;) {
uint32_t num_bytes = static_cast<uint32_t>(sizeof(buffer));
- MojoResult result = MojoReadMessage(handle_, buffer, &num_bytes, NULL,
- NULL, MOJO_READ_MESSAGE_FLAG_NONE);
+ MojoResult result = MojoReadMessage(
+ handle_, buffer, &num_bytes, NULL, NULL, MOJO_READ_MESSAGE_FLAG_NONE);
if (result == MOJO_RESULT_OK) {
num_reads_++;
continue;
}
if (result == MOJO_RESULT_SHOULD_WAIT) {
- result = MojoWait(handle_, MOJO_HANDLE_SIGNAL_READABLE,
- MOJO_DEADLINE_INDEFINITE);
+ result = MojoWait(
+ handle_, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE);
if (result == MOJO_RESULT_OK) {
// Go to the top of the loop to read again.
continue;
@@ -118,8 +114,7 @@ class CorePerftest : public testing::Test {
CorePerftest() : buffer_(NULL), num_bytes_(0) {}
virtual ~CorePerftest() {}
- static void NoOp(void* /*closure*/) {
- }
+ static void NoOp(void* /*closure*/) {}
static void MessagePipe_CreateAndClose(void* closure) {
CorePerftest* self = static_cast<CorePerftest*>(closure);
@@ -136,14 +131,18 @@ class CorePerftest : public testing::Test {
CorePerftest* self = static_cast<CorePerftest*>(closure);
MojoResult result MOJO_ALLOW_UNUSED;
result = MojoWriteMessage(self->h0_,
- self->buffer_, self->num_bytes_,
- NULL, 0,
+ self->buffer_,
+ self->num_bytes_,
+ NULL,
+ 0,
MOJO_WRITE_MESSAGE_FLAG_NONE);
assert(result == MOJO_RESULT_OK);
uint32_t read_bytes = self->num_bytes_;
result = MojoReadMessage(self->h1_,
- self->buffer_, &read_bytes,
- NULL, NULL,
+ self->buffer_,
+ &read_bytes,
+ NULL,
+ NULL,
MOJO_READ_MESSAGE_FLAG_NONE);
assert(result == MOJO_RESULT_OK);
}
@@ -151,10 +150,8 @@ class CorePerftest : public testing::Test {
static void MessagePipe_EmptyRead(void* closure) {
CorePerftest* self = static_cast<CorePerftest*>(closure);
MojoResult result MOJO_ALLOW_UNUSED;
- result = MojoReadMessage(self->h0_,
- NULL, NULL,
- NULL, NULL,
- MOJO_READ_MESSAGE_FLAG_MAY_DISCARD);
+ result = MojoReadMessage(
+ self->h0_, NULL, NULL, NULL, NULL, MOJO_READ_MESSAGE_FLAG_MAY_DISCARD);
assert(result == MOJO_RESULT_SHOULD_WAIT);
}
@@ -223,18 +220,24 @@ class CorePerftest : public testing::Test {
readers.clear();
char test_name[200];
- sprintf(test_name, "MessagePipe_Threaded_Writes_%uw_%ur_%ubytes",
- num_writers, num_readers, static_cast<unsigned>(num_bytes));
- mojo::test::LogPerfResult(test_name,
- 1000000.0 * static_cast<double>(num_writes) /
- (end_time - start_time),
- "writes/second");
- sprintf(test_name, "MessagePipe_Threaded_Reads_%uw_%ur_%ubytes",
- num_writers, num_readers, static_cast<unsigned>(num_bytes));
- mojo::test::LogPerfResult(test_name,
- 1000000.0 * static_cast<double>(num_reads) /
- (end_time - start_time),
- "reads/second");
+ sprintf(test_name,
+ "MessagePipe_Threaded_Writes_%uw_%ur_%ubytes",
+ num_writers,
+ num_readers,
+ static_cast<unsigned>(num_bytes));
+ mojo::test::LogPerfResult(
+ test_name,
+ 1000000.0 * static_cast<double>(num_writes) / (end_time - start_time),
+ "writes/second");
+ sprintf(test_name,
+ "MessagePipe_Threaded_Reads_%uw_%ur_%ubytes",
+ num_writers,
+ num_readers,
+ static_cast<unsigned>(num_bytes));
+ mojo::test::LogPerfResult(
+ test_name,
+ 1000000.0 * static_cast<double>(num_reads) / (end_time - start_time),
+ "reads/second");
}
#endif // !defined(WIN32)
@@ -248,8 +251,8 @@ class CorePerftest : public testing::Test {
#if !defined(WIN32)
void Sleep(int64_t microseconds) {
struct timespec req = {
- static_cast<time_t>(microseconds / 1000000), // Seconds.
- static_cast<long>(microseconds % 1000000) * 1000L // Nanoseconds.
+ static_cast<time_t>(microseconds / 1000000), // Seconds.
+ static_cast<long>(microseconds % 1000000) * 1000L // Nanoseconds.
};
int rv MOJO_ALLOW_UNUSED;
rv = nanosleep(&req, NULL);
@@ -275,7 +278,7 @@ TEST_F(CorePerftest, MessagePipe_WriteAndRead) {
MojoResult result MOJO_ALLOW_UNUSED;
result = MojoCreateMessagePipe(NULL, &h0_, &h1_);
assert(result == MOJO_RESULT_OK);
- char buffer[10000] = { 0 };
+ char buffer[10000] = {0};
buffer_ = buffer;
num_bytes_ = 10u;
mojo::test::IterateAndReportPerf("MessagePipe_WriteAndRead_10bytes",
@@ -303,9 +306,8 @@ TEST_F(CorePerftest, MessagePipe_EmptyRead) {
MojoResult result MOJO_ALLOW_UNUSED;
result = MojoCreateMessagePipe(NULL, &h0_, &h1_);
assert(result == MOJO_RESULT_OK);
- mojo::test::IterateAndReportPerf("MessagePipe_EmptyRead",
- &CorePerftest::MessagePipe_EmptyRead,
- this);
+ mojo::test::IterateAndReportPerf(
+ "MessagePipe_EmptyRead", &CorePerftest::MessagePipe_EmptyRead, this);
result = MojoClose(h0_);
assert(result == MOJO_RESULT_OK);
result = MojoClose(h1_);
diff --git a/mojo/public/c/system/tests/core_unittest.cc b/mojo/public/c/system/tests/core_unittest.cc
index 9c29aea..a2f6785 100644
--- a/mojo/public/c/system/tests/core_unittest.cc
+++ b/mojo/public/c/system/tests/core_unittest.cc
@@ -24,7 +24,7 @@ TEST(CoreTest, GetTimeTicksNow) {
TEST(CoreTest, InvalidHandle) {
MojoHandle h0, h1;
MojoHandleSignals sig;
- char buffer[10] = { 0 };
+ char buffer[10] = {0};
uint32_t buffer_size;
void* write_pointer;
const void* read_pointer;
@@ -41,13 +41,14 @@ TEST(CoreTest, InvalidHandle) {
MojoWaitMany(&h0, &sig, 1, MOJO_DEADLINE_INDEFINITE));
// Message pipe:
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- MojoWriteMessage(h0, buffer, 3, NULL, 0,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ MojoWriteMessage(h0, buffer, 3, NULL, 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
buffer_size = static_cast<uint32_t>(sizeof(buffer));
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- MojoReadMessage(h0, buffer, &buffer_size, NULL, NULL,
- MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ MojoReadMessage(
+ h0, buffer, &buffer_size, NULL, NULL, MOJO_READ_MESSAGE_FLAG_NONE));
// Data pipe:
buffer_size = static_cast<uint32_t>(sizeof(buffer));
@@ -55,16 +56,16 @@ TEST(CoreTest, InvalidHandle) {
MojoWriteData(h0, buffer, &buffer_size, MOJO_WRITE_DATA_FLAG_NONE));
write_pointer = NULL;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- MojoBeginWriteData(h0, &write_pointer, &buffer_size,
- MOJO_WRITE_DATA_FLAG_NONE));
+ MojoBeginWriteData(
+ h0, &write_pointer, &buffer_size, MOJO_WRITE_DATA_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoEndWriteData(h0, 1));
buffer_size = static_cast<uint32_t>(sizeof(buffer));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
MojoReadData(h0, buffer, &buffer_size, MOJO_READ_DATA_FLAG_NONE));
read_pointer = NULL;
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- MojoBeginReadData(h0, &read_pointer, &buffer_size,
- MOJO_READ_DATA_FLAG_NONE));
+ MojoBeginReadData(
+ h0, &read_pointer, &buffer_size, MOJO_READ_DATA_FLAG_NONE));
EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, MojoEndReadData(h0, 1));
// Shared buffer:
@@ -78,7 +79,7 @@ TEST(CoreTest, InvalidHandle) {
TEST(CoreTest, BasicMessagePipe) {
MojoHandle h0, h1;
MojoHandleSignals sig;
- char buffer[10] = { 0 };
+ char buffer[10] = {0};
uint32_t buffer_size;
h0 = MOJO_HANDLE_INVALID;
@@ -96,16 +97,18 @@ TEST(CoreTest, BasicMessagePipe) {
// Try to read.
buffer_size = static_cast<uint32_t>(sizeof(buffer));
- EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
- MojoReadMessage(h0, buffer, &buffer_size, NULL, NULL,
- MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_SHOULD_WAIT,
+ MojoReadMessage(
+ h0, buffer, &buffer_size, NULL, NULL, MOJO_READ_MESSAGE_FLAG_NONE));
// Write to |h1|.
static const char kHello[] = "hello";
buffer_size = static_cast<uint32_t>(sizeof(kHello));
- EXPECT_EQ(MOJO_RESULT_OK,
- MojoWriteMessage(h1, kHello, buffer_size, NULL, 0,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_OK,
+ MojoWriteMessage(
+ h1, kHello, buffer_size, NULL, 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
// |h0| should be readable.
sig = MOJO_HANDLE_SIGNAL_READABLE;
@@ -114,9 +117,10 @@ TEST(CoreTest, BasicMessagePipe) {
// Read from |h0|.
buffer_size = static_cast<uint32_t>(sizeof(buffer));
- EXPECT_EQ(MOJO_RESULT_OK,
- MojoReadMessage(h0, buffer, &buffer_size, NULL, NULL,
- MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_OK,
+ MojoReadMessage(
+ h0, buffer, &buffer_size, NULL, NULL, MOJO_READ_MESSAGE_FLAG_NONE));
EXPECT_EQ(static_cast<uint32_t>(sizeof(kHello)), buffer_size);
EXPECT_STREQ(kHello, buffer);
@@ -128,10 +132,10 @@ TEST(CoreTest, BasicMessagePipe) {
EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h0));
// |h1| should no longer be readable or writable.
- EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
- MojoWait(h1,
- MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
- 1000));
+ EXPECT_EQ(
+ MOJO_RESULT_FAILED_PRECONDITION,
+ MojoWait(
+ h1, MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE, 1000));
EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1));
}
@@ -139,7 +143,7 @@ TEST(CoreTest, BasicMessagePipe) {
TEST(CoreTest, BasicDataPipe) {
MojoHandle hp, hc;
MojoHandleSignals sig;
- char buffer[20] = { 0 };
+ char buffer[20] = {0};
uint32_t buffer_size;
void* write_pointer;
const void* read_pointer;
@@ -165,16 +169,16 @@ TEST(CoreTest, BasicDataPipe) {
// Try to begin a two-phase read from |hc|.
read_pointer = NULL;
EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
- MojoBeginReadData(hc, &read_pointer, &buffer_size,
- MOJO_READ_DATA_FLAG_NONE));
+ MojoBeginReadData(
+ hc, &read_pointer, &buffer_size, MOJO_READ_DATA_FLAG_NONE));
// Write to |hp|.
static const char kHello[] = "hello ";
// Don't include terminating null.
buffer_size = static_cast<uint32_t>(strlen(kHello));
- EXPECT_EQ(MOJO_RESULT_OK,
- MojoWriteData(hp, kHello, &buffer_size,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(
+ MOJO_RESULT_OK,
+ MojoWriteData(hp, kHello, &buffer_size, MOJO_WRITE_MESSAGE_FLAG_NONE));
// |hc| should be(come) readable.
sig = MOJO_HANDLE_SIGNAL_READABLE;
@@ -183,8 +187,8 @@ TEST(CoreTest, BasicDataPipe) {
// Do a two-phase write to |hp|.
EXPECT_EQ(MOJO_RESULT_OK,
- MojoBeginWriteData(hp, &write_pointer, &buffer_size,
- MOJO_WRITE_DATA_FLAG_NONE));
+ MojoBeginWriteData(
+ hp, &write_pointer, &buffer_size, MOJO_WRITE_DATA_FLAG_NONE));
static const char kWorld[] = "world";
ASSERT_GE(buffer_size, sizeof(kWorld));
// Include the terminating null.
@@ -207,8 +211,8 @@ TEST(CoreTest, BasicDataPipe) {
// Do a two-phase read from |hc|.
read_pointer = NULL;
EXPECT_EQ(MOJO_RESULT_OK,
- MojoBeginReadData(hc, &read_pointer, &buffer_size,
- MOJO_READ_DATA_FLAG_NONE));
+ MojoBeginReadData(
+ hc, &read_pointer, &buffer_size, MOJO_READ_DATA_FLAG_NONE));
ASSERT_LE(buffer_size, sizeof(buffer) - 1);
memcpy(&buffer[1], read_pointer, buffer_size);
EXPECT_EQ(MOJO_RESULT_OK, MojoEndReadData(hc, buffer_size));
diff --git a/mojo/public/c/system/tests/core_unittest_pure_c.c b/mojo/public/c/system/tests/core_unittest_pure_c.c
index 6464d8e..33de688 100644
--- a/mojo/public/c/system/tests/core_unittest_pure_c.c
+++ b/mojo/public/c/system/tests/core_unittest_pure_c.c
@@ -22,14 +22,14 @@
__FILE__ "(" STRINGIFY2(__LINE__) "): Failure: " message
// Poor man's gtest.
-#define EXPECT_EQ(a, b) \
- do { \
- if ((a) != (b)) \
+#define EXPECT_EQ(a, b) \
+ do { \
+ if ((a) != (b)) \
return FAILURE(STRINGIFY(a) " != " STRINGIFY(b) " (expected ==)"); \
} while (0)
-#define EXPECT_NE(a, b) \
- do { \
- if ((a) == (b)) \
+#define EXPECT_NE(a, b) \
+ do { \
+ if ((a) == (b)) \
return FAILURE(STRINGIFY(a) " == " STRINGIFY(b) " (expected !=)"); \
} while (0)
@@ -44,7 +44,7 @@ const char* MinimalCTest(void) {
MojoHandle handle0, handle1;
MojoHandleSignals signals;
const char kHello[] = "hello";
- char buffer[200] = { 0 };
+ char buffer[200] = {0};
uint32_t num_bytes;
ticks = MojoGetTimeTicksNow();
@@ -53,9 +53,9 @@ const char* MinimalCTest(void) {
handle0 = MOJO_HANDLE_INVALID;
EXPECT_NE(MOJO_RESULT_OK, MojoClose(handle0));
- EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
- MojoWait(handle0, ~MOJO_HANDLE_SIGNAL_NONE,
- MOJO_DEADLINE_INDEFINITE));
+ EXPECT_EQ(
+ MOJO_RESULT_INVALID_ARGUMENT,
+ MojoWait(handle0, ~MOJO_HANDLE_SIGNAL_NONE, MOJO_DEADLINE_INDEFINITE));
handle1 = MOJO_HANDLE_INVALID;
EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(NULL, &handle0, &handle1));
@@ -65,18 +65,26 @@ const char* MinimalCTest(void) {
MojoWaitMany(&handle0, &signals, 1, 1));
EXPECT_EQ(MOJO_RESULT_OK,
- MojoWriteMessage(handle0, kHello, (uint32_t) sizeof(kHello), NULL,
- 0u, MOJO_WRITE_DATA_FLAG_NONE));
-
- EXPECT_EQ(MOJO_RESULT_OK,
- MojoWait(handle1, MOJO_HANDLE_SIGNAL_READABLE,
- MOJO_DEADLINE_INDEFINITE));
-
- num_bytes = (uint32_t) sizeof(buffer);
+ MojoWriteMessage(handle0,
+ kHello,
+ (uint32_t)sizeof(kHello),
+ NULL,
+ 0u,
+ MOJO_WRITE_DATA_FLAG_NONE));
+
+ EXPECT_EQ(
+ MOJO_RESULT_OK,
+ MojoWait(handle1, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE));
+
+ num_bytes = (uint32_t)sizeof(buffer);
EXPECT_EQ(MOJO_RESULT_OK,
- MojoReadMessage(handle1, buffer, &num_bytes, NULL, NULL,
+ MojoReadMessage(handle1,
+ buffer,
+ &num_bytes,
+ NULL,
+ NULL,
MOJO_READ_MESSAGE_FLAG_NONE));
- EXPECT_EQ((uint32_t) sizeof(kHello), num_bytes);
+ EXPECT_EQ((uint32_t)sizeof(kHello), num_bytes);
EXPECT_EQ(0, memcmp(buffer, kHello, sizeof(kHello)));
EXPECT_EQ(MOJO_RESULT_OK, MojoClose(handle0));
diff --git a/mojo/public/c/system/tests/macros_unittest.cc b/mojo/public/c/system/tests/macros_unittest.cc
index fdc0c87..6a694b8 100644
--- a/mojo/public/c/system/tests/macros_unittest.cc
+++ b/mojo/public/c/system/tests/macros_unittest.cc
@@ -58,11 +58,17 @@ TEST(MacrosTest, Alignof) {
#if defined(_MSC_VER)
#pragma warning(push)
// Disable the warning "structure was padded due to __declspec(align())".
-#pragma warning(disable:4324)
+#pragma warning(disable : 4324)
#endif
-struct MOJO_ALIGNAS(1) StructAlignas1 { char x; };
-struct MOJO_ALIGNAS(4) StructAlignas4 { char x; };
-struct MOJO_ALIGNAS(8) StructAlignas8 { char x; };
+struct MOJO_ALIGNAS(1) StructAlignas1 {
+ char x;
+};
+struct MOJO_ALIGNAS(4) StructAlignas4 {
+ char x;
+};
+struct MOJO_ALIGNAS(8) StructAlignas8 {
+ char x;
+};
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
diff --git a/mojo/public/c/system/types.h b/mojo/public/c/system/types.h
index e992d11..5a72d2f 100644
--- a/mojo/public/c/system/types.h
+++ b/mojo/public/c/system/types.h
@@ -29,7 +29,7 @@ typedef uint32_t MojoHandle;
#ifdef __cplusplus
const MojoHandle MOJO_HANDLE_INVALID = 0;
#else
-#define MOJO_HANDLE_INVALID ((MojoHandle) 0)
+#define MOJO_HANDLE_INVALID ((MojoHandle)0)
#endif
// |MojoResult|: Result codes for Mojo operations. Non-negative values are
@@ -110,24 +110,24 @@ const MojoResult MOJO_RESULT_DATA_LOSS = -15;
const MojoResult MOJO_RESULT_BUSY = -16;
const MojoResult MOJO_RESULT_SHOULD_WAIT = -17;
#else
-#define MOJO_RESULT_OK ((MojoResult) 0)
-#define MOJO_RESULT_CANCELLED ((MojoResult) -1)
-#define MOJO_RESULT_UNKNOWN ((MojoResult) -2)
-#define MOJO_RESULT_INVALID_ARGUMENT ((MojoResult) -3)
-#define MOJO_RESULT_DEADLINE_EXCEEDED ((MojoResult) -4)
-#define MOJO_RESULT_NOT_FOUND ((MojoResult) -5)
-#define MOJO_RESULT_ALREADY_EXISTS ((MojoResult) -6)
-#define MOJO_RESULT_PERMISSION_DENIED ((MojoResult) -7)
-#define MOJO_RESULT_RESOURCE_EXHAUSTED ((MojoResult) -8)
-#define MOJO_RESULT_FAILED_PRECONDITION ((MojoResult) -9)
-#define MOJO_RESULT_ABORTED ((MojoResult) -10)
-#define MOJO_RESULT_OUT_OF_RANGE ((MojoResult) -11)
-#define MOJO_RESULT_UNIMPLEMENTED ((MojoResult) -12)
-#define MOJO_RESULT_INTERNAL ((MojoResult) -13)
-#define MOJO_RESULT_UNAVAILABLE ((MojoResult) -14)
-#define MOJO_RESULT_DATA_LOSS ((MojoResult) -15)
-#define MOJO_RESULT_BUSY ((MojoResult) -16)
-#define MOJO_RESULT_SHOULD_WAIT ((MojoResult) -17)
+#define MOJO_RESULT_OK ((MojoResult)0)
+#define MOJO_RESULT_CANCELLED ((MojoResult) - 1)
+#define MOJO_RESULT_UNKNOWN ((MojoResult) - 2)
+#define MOJO_RESULT_INVALID_ARGUMENT ((MojoResult) - 3)
+#define MOJO_RESULT_DEADLINE_EXCEEDED ((MojoResult) - 4)
+#define MOJO_RESULT_NOT_FOUND ((MojoResult) - 5)
+#define MOJO_RESULT_ALREADY_EXISTS ((MojoResult) - 6)
+#define MOJO_RESULT_PERMISSION_DENIED ((MojoResult) - 7)
+#define MOJO_RESULT_RESOURCE_EXHAUSTED ((MojoResult) - 8)
+#define MOJO_RESULT_FAILED_PRECONDITION ((MojoResult) - 9)
+#define MOJO_RESULT_ABORTED ((MojoResult) - 10)
+#define MOJO_RESULT_OUT_OF_RANGE ((MojoResult) - 11)
+#define MOJO_RESULT_UNIMPLEMENTED ((MojoResult) - 12)
+#define MOJO_RESULT_INTERNAL ((MojoResult) - 13)
+#define MOJO_RESULT_UNAVAILABLE ((MojoResult) - 14)
+#define MOJO_RESULT_DATA_LOSS ((MojoResult) - 15)
+#define MOJO_RESULT_BUSY ((MojoResult) - 16)
+#define MOJO_RESULT_SHOULD_WAIT ((MojoResult) - 17)
#endif
// |MojoDeadline|: Used to specify deadlines (timeouts), in microseconds (except
@@ -139,7 +139,7 @@ typedef uint64_t MojoDeadline;
#ifdef __cplusplus
const MojoDeadline MOJO_DEADLINE_INDEFINITE = static_cast<MojoDeadline>(-1);
#else
-#define MOJO_DEADLINE_INDEFINITE ((MojoDeadline) -1)
+#define MOJO_DEADLINE_INDEFINITE ((MojoDeadline) - 1)
#endif
// |MojoHandleSignals|: Used to specify signals that can be waited on for a
@@ -157,9 +157,9 @@ const MojoHandleSignals MOJO_HANDLE_SIGNAL_NONE = 0;
const MojoHandleSignals MOJO_HANDLE_SIGNAL_READABLE = 1 << 0;
const MojoHandleSignals MOJO_HANDLE_SIGNAL_WRITABLE = 1 << 1;
#else
-#define MOJO_HANDLE_SIGNAL_NONE ((MojoHandleSignals) 0)
-#define MOJO_HANDLE_SIGNAL_READABLE ((MojoHandleSignals) 1 << 0)
-#define MOJO_HANDLE_SIGNAL_WRITABLE ((MojoHandleSignals) 1 << 1)
+#define MOJO_HANDLE_SIGNAL_NONE ((MojoHandleSignals)0)
+#define MOJO_HANDLE_SIGNAL_READABLE ((MojoHandleSignals)1 << 0)
+#define MOJO_HANDLE_SIGNAL_WRITABLE ((MojoHandleSignals)1 << 1)
#endif
// TODO(vtl): Add out parameters with this to MojoWait/MojoWaitMany.
diff --git a/mojo/system/PRESUBMIT.py b/mojo/system/PRESUBMIT.py
index 97f67c0..36cc56a 100644
--- a/mojo/system/PRESUBMIT.py
+++ b/mojo/system/PRESUBMIT.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Presubmit script for mojo/embedder.
+"""Presubmit script for mojo/system.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_tools.