From 94f59e2636b7a3b910cbe3a8ec8f541c1e9b1719 Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Mon, 3 Jul 2017 17:52:24 -0700 Subject: [PATCH] Apply clang-format to folly/io/ (namespace) Summary: [Folly] Apply `clang-format` to `folly/io/` (namespace). Reviewed By: Orvid, terrelln Differential Revision: D5366477 fbshipit-source-id: b4efcdc66c62885f5574b2940e5138590710deae --- folly/io/Compression.cpp | 8 +++++--- folly/io/Compression.h | 6 ++++-- folly/io/Cursor-inl.h | 6 +++--- folly/io/Cursor.cpp | 7 ++++--- folly/io/Cursor.h | 9 +++++---- folly/io/RecordIO-inl.h | 6 +++--- folly/io/RecordIO.cpp | 6 +++--- folly/io/RecordIO.h | 4 ++-- folly/io/ShutdownSocketSet.cpp | 2 +- folly/io/ShutdownSocketSet.h | 2 +- folly/io/TypedIOBuf.h | 2 +- folly/io/test/CompressionTest.cpp | 8 ++++++-- folly/io/test/IOBufCursorTest.cpp | 2 +- folly/io/test/IOBufTest.cpp | 6 +++--- folly/io/test/RecordIOTest.cpp | 10 ++++++---- folly/io/test/ShutdownSocketSetTest.cpp | 7 ++++--- 16 files changed, 52 insertions(+), 39 deletions(-) diff --git a/folly/io/Compression.cpp b/folly/io/Compression.cpp index 3e027d19..98f332b8 100644 --- a/folly/io/Compression.cpp +++ b/folly/io/Compression.cpp @@ -58,7 +58,8 @@ #include #include -namespace folly { namespace io { +namespace folly { +namespace io { Codec::Codec(CodecType type) : type_(type) { } @@ -512,7 +513,7 @@ inline uint64_t decodeVarintFromCursor(folly::io::Cursor& cursor) { return val; } -} // namespace +} // namespace #endif // FOLLY_HAVE_LIBLZ4 || FOLLY_HAVE_LIBLZMA @@ -2323,4 +2324,5 @@ std::unique_ptr getAutoUncompressionCodec( std::vector> customCodecs) { return AutomaticCodec::create(std::move(customCodecs)); } -}} // namespaces +} // namespace io +} // namespace folly diff --git a/folly/io/Compression.h b/folly/io/Compression.h index 0a2423bf..b8ff6455 100644 --- a/folly/io/Compression.h +++ b/folly/io/Compression.h @@ -30,7 +30,8 @@ * Compression / decompression over IOBufs */ -namespace folly { namespace io { +namespace folly { +namespace io { enum class CodecType { /** @@ -466,4 +467,5 @@ bool hasCodec(CodecType type); * Check if a specified codec is supported and supports streaming. */ bool hasStreamCodec(CodecType type); -}} // namespaces +} // namespace io +} // namespace folly diff --git a/folly/io/Cursor-inl.h b/folly/io/Cursor-inl.h index 48a0ebd8..e9dd4548 100644 --- a/folly/io/Cursor-inl.h +++ b/folly/io/Cursor-inl.h @@ -105,6 +105,6 @@ void CursorBase::skipWhile(const Predicate& predicate) { CursorNoopAppender appender; readWhile(predicate, appender); } -} -} -} // folly::io::detail +} // namespace detail +} // namespace io +} // namespace folly diff --git a/folly/io/Cursor.cpp b/folly/io/Cursor.cpp index 9d51092e..c51ce6cc 100644 --- a/folly/io/Cursor.cpp +++ b/folly/io/Cursor.cpp @@ -18,7 +18,8 @@ #include #include -namespace folly { namespace io { +namespace folly { +namespace io { void Appender::printf(const char* fmt, ...) { va_list ap; @@ -68,5 +69,5 @@ void Appender::vprintf(const char* fmt, va_list ap) { } append(len); } - -}} // folly::io +} // namespace io +} // namespace folly diff --git a/folly/io/Cursor.h b/folly/io/Cursor.h index 23186764..4d61b4f5 100644 --- a/folly/io/Cursor.h +++ b/folly/io/Cursor.h @@ -48,7 +48,8 @@ * Appender with a buffer chain; for this reason, Appenders assume private * access to the buffer (you need to call unshare() yourself if necessary). **/ -namespace folly { namespace io { +namespace folly { +namespace io { namespace detail { @@ -618,7 +619,7 @@ class CursorBase { BufType* buffer_; }; -} // namespace detail +} // namespace detail class Cursor : public detail::CursorBase { public: @@ -1049,7 +1050,7 @@ class QueueAppender : public detail::Writable { folly::IOBufQueue* queue_; size_t growth_; }; - -}} // folly::io +} // namespace io +} // namespace folly #include diff --git a/folly/io/RecordIO-inl.h b/folly/io/RecordIO-inl.h index 441a88b8..203fae9f 100644 --- a/folly/io/RecordIO-inl.h +++ b/folly/io/RecordIO-inl.h @@ -82,7 +82,7 @@ FOLLY_PACK_POP static_assert(offsetof(Header, headerHash) + sizeof(Header::headerHash) == sizeof(Header), "invalid header layout"); -} // namespace detail +} // namespace detail constexpr size_t headerSize() { return sizeof(detail::Header); } @@ -90,6 +90,6 @@ inline RecordInfo findRecord(ByteRange range, uint32_t fileId) { return findRecord(range, range, fileId); } -} // namespace recordio_helpers +} // namespace recordio_helpers -} // namespaces +} // namespace folly diff --git a/folly/io/RecordIO.cpp b/folly/io/RecordIO.cpp index 50c854ec..f6fe3b6d 100644 --- a/folly/io/RecordIO.cpp +++ b/folly/io/RecordIO.cpp @@ -138,7 +138,7 @@ uint64_t dataHash(ByteRange range) { return hash::SpookyHashV2::Hash64(range.data(), range.size(), kHashSeed); } -} // namespace +} // namespace size_t prependHeader(std::unique_ptr& buf, uint32_t fileId) { if (fileId == 0) { @@ -229,6 +229,6 @@ RecordInfo findRecord(ByteRange searchRange, return {0, {}}; } -} // namespace +} // namespace recordio_helpers -} // namespaces +} // namespace folly diff --git a/folly/io/RecordIO.h b/folly/io/RecordIO.h index a350fc10..0acb4a20 100644 --- a/folly/io/RecordIO.h +++ b/folly/io/RecordIO.h @@ -172,8 +172,8 @@ RecordInfo findRecord(ByteRange range, uint32_t fileId); */ RecordInfo validateRecord(ByteRange range, uint32_t fileId); -} // namespace recordio_helpers +} // namespace recordio_helpers -} // namespaces +} // namespace folly #include diff --git a/folly/io/ShutdownSocketSet.cpp b/folly/io/ShutdownSocketSet.cpp index 839fd386..09988e7a 100644 --- a/folly/io/ShutdownSocketSet.cpp +++ b/folly/io/ShutdownSocketSet.cpp @@ -176,4 +176,4 @@ void ShutdownSocketSet::doShutdown(int fd, bool abortive) { folly::dup2NoInt(nullFile_.fd(), fd); } -} // namespaces +} // namespace folly diff --git a/folly/io/ShutdownSocketSet.h b/folly/io/ShutdownSocketSet.h index f74bf48a..7d0853c2 100644 --- a/folly/io/ShutdownSocketSet.h +++ b/folly/io/ShutdownSocketSet.h @@ -117,4 +117,4 @@ class ShutdownSocketSet : private boost::noncopyable { folly::File nullFile_; }; -} // namespaces +} // namespace folly diff --git a/folly/io/TypedIOBuf.h b/folly/io/TypedIOBuf.h index 9358cd4d..86df07c4 100644 --- a/folly/io/TypedIOBuf.h +++ b/folly/io/TypedIOBuf.h @@ -212,4 +212,4 @@ class TypedIOBuf { IOBuf* buf_; }; -} // namespace folly +} // namespace folly diff --git a/folly/io/test/CompressionTest.cpp b/folly/io/test/CompressionTest.cpp index e15a18da..55514e86 100644 --- a/folly/io/test/CompressionTest.cpp +++ b/folly/io/test/CompressionTest.cpp @@ -38,7 +38,9 @@ #include #endif -namespace folly { namespace io { namespace test { +namespace folly { +namespace io { +namespace test { class DataHolder : private boost::noncopyable { public: @@ -1127,7 +1129,9 @@ TEST(ZstdTest, BackwardCompatible) { } #endif -}}} // namespaces +} // namespace test +} // namespace io +} // namespace folly int main(int argc, char *argv[]) { testing::InitGoogleTest(&argc, argv); diff --git a/folly/io/test/IOBufCursorTest.cpp b/folly/io/test/IOBufCursorTest.cpp index 68aa7784..22c2a76d 100644 --- a/folly/io/test/IOBufCursorTest.cpp +++ b/folly/io/test/IOBufCursorTest.cpp @@ -190,7 +190,7 @@ std::string toString(const IOBuf& buf) { return str; } -} // namespace +} // namespace TEST(IOBuf, PullAndPeek) { std::unique_ptr iobuf1(IOBuf::create(10)); diff --git a/folly/io/test/IOBufTest.cpp b/folly/io/test/IOBufTest.cpp index e33287bb..9fd353f4 100644 --- a/folly/io/test/IOBufTest.cpp +++ b/folly/io/test/IOBufTest.cpp @@ -755,7 +755,7 @@ void customDeleteArray(OwnershipTestClass* p) { delete[] p; } -} // namespace +} // namespace TEST(IOBuf, takeOwnershipUniquePtr) { destructorCount = 0; @@ -1041,7 +1041,7 @@ namespace { std::unique_ptr fromStr(StringPiece sp) { return IOBuf::copyBuffer(ByteRange(sp)); } -} // namespace +} // namespace TEST(IOBuf, HashAndEqual) { folly::IOBufEqual eq; @@ -1240,7 +1240,7 @@ char* writableStr(folly::IOBuf& buf) { return reinterpret_cast(buf.writableData()); } -} // namespace +} // namespace TEST(IOBuf, ExternallyShared) { struct Item { diff --git a/folly/io/test/RecordIOTest.cpp b/folly/io/test/RecordIOTest.cpp index d8a8d5aa..4702911c 100644 --- a/folly/io/test/RecordIOTest.cpp +++ b/folly/io/test/RecordIOTest.cpp @@ -33,7 +33,8 @@ DEFINE_int32(random_seed, folly::randomNumberSeed(), "random seed"); -namespace folly { namespace test { +namespace folly { +namespace test { namespace { // shortcut @@ -49,7 +50,7 @@ std::unique_ptr iobufs(std::initializer_list ranges) { return queue.move(); } -} // namespace +} // namespace TEST(RecordIOTest, Simple) { TemporaryFile file; @@ -189,7 +190,7 @@ void corrupt(int fd, off_t pos) { ++val; EXPECT_EQ(1, pwrite(fd, &val, 1, pos)); } -} // namespace +} // namespace TEST(RecordIOTest, Randomized) { SCOPED_TRACE(to("Random seed is ", FLAGS_random_seed)); @@ -262,8 +263,9 @@ TEST(RecordIOTest, Randomized) { EXPECT_EQ(records.size(), i); } } +} // namespace test +} // namespace folly -}} // namespaces int main(int argc, char *argv[]) { testing::InitGoogleTest(&argc, argv); diff --git a/folly/io/test/ShutdownSocketSetTest.cpp b/folly/io/test/ShutdownSocketSetTest.cpp index ae28203b..ed478b3a 100644 --- a/folly/io/test/ShutdownSocketSetTest.cpp +++ b/folly/io/test/ShutdownSocketSetTest.cpp @@ -28,7 +28,8 @@ using folly::ShutdownSocketSet; namespace fsp = folly::portability::sockets; -namespace folly { namespace test { +namespace folly { +namespace test { ShutdownSocketSet shutdownSocketSet; @@ -221,5 +222,5 @@ TEST(ShutdownSocketSetTest, OrderlyKill) { TEST(ShutdownSocketSetTest, AbortiveKill) { runKillTest(true); } - -}} // namespaces +} // namespace test +} // namespace folly -- 2.34.1