Commit 94f59e26 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

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
parent 4b5711db
...@@ -58,7 +58,8 @@ ...@@ -58,7 +58,8 @@
#include <algorithm> #include <algorithm>
#include <unordered_set> #include <unordered_set>
namespace folly { namespace io { namespace folly {
namespace io {
Codec::Codec(CodecType type) : type_(type) { } Codec::Codec(CodecType type) : type_(type) { }
...@@ -512,7 +513,7 @@ inline uint64_t decodeVarintFromCursor(folly::io::Cursor& cursor) { ...@@ -512,7 +513,7 @@ inline uint64_t decodeVarintFromCursor(folly::io::Cursor& cursor) {
return val; return val;
} }
} // namespace } // namespace
#endif // FOLLY_HAVE_LIBLZ4 || FOLLY_HAVE_LIBLZMA #endif // FOLLY_HAVE_LIBLZ4 || FOLLY_HAVE_LIBLZMA
...@@ -2323,4 +2324,5 @@ std::unique_ptr<Codec> getAutoUncompressionCodec( ...@@ -2323,4 +2324,5 @@ std::unique_ptr<Codec> getAutoUncompressionCodec(
std::vector<std::unique_ptr<Codec>> customCodecs) { std::vector<std::unique_ptr<Codec>> customCodecs) {
return AutomaticCodec::create(std::move(customCodecs)); return AutomaticCodec::create(std::move(customCodecs));
} }
}} // namespaces } // namespace io
} // namespace folly
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
* Compression / decompression over IOBufs * Compression / decompression over IOBufs
*/ */
namespace folly { namespace io { namespace folly {
namespace io {
enum class CodecType { enum class CodecType {
/** /**
...@@ -466,4 +467,5 @@ bool hasCodec(CodecType type); ...@@ -466,4 +467,5 @@ bool hasCodec(CodecType type);
* Check if a specified codec is supported and supports streaming. * Check if a specified codec is supported and supports streaming.
*/ */
bool hasStreamCodec(CodecType type); bool hasStreamCodec(CodecType type);
}} // namespaces } // namespace io
} // namespace folly
...@@ -105,6 +105,6 @@ void CursorBase<Derived, BufType>::skipWhile(const Predicate& predicate) { ...@@ -105,6 +105,6 @@ void CursorBase<Derived, BufType>::skipWhile(const Predicate& predicate) {
CursorNoopAppender appender; CursorNoopAppender appender;
readWhile(predicate, appender); readWhile(predicate, appender);
} }
} } // namespace detail
} } // namespace io
} // folly::io::detail } // namespace folly
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
#include <cstdio> #include <cstdio>
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
namespace folly { namespace io { namespace folly {
namespace io {
void Appender::printf(const char* fmt, ...) { void Appender::printf(const char* fmt, ...) {
va_list ap; va_list ap;
...@@ -68,5 +69,5 @@ void Appender::vprintf(const char* fmt, va_list ap) { ...@@ -68,5 +69,5 @@ void Appender::vprintf(const char* fmt, va_list ap) {
} }
append(len); append(len);
} }
} // namespace io
}} // folly::io } // namespace folly
...@@ -48,7 +48,8 @@ ...@@ -48,7 +48,8 @@
* Appender with a buffer chain; for this reason, Appenders assume private * Appender with a buffer chain; for this reason, Appenders assume private
* access to the buffer (you need to call unshare() yourself if necessary). * access to the buffer (you need to call unshare() yourself if necessary).
**/ **/
namespace folly { namespace io { namespace folly {
namespace io {
namespace detail { namespace detail {
...@@ -618,7 +619,7 @@ class CursorBase { ...@@ -618,7 +619,7 @@ class CursorBase {
BufType* buffer_; BufType* buffer_;
}; };
} // namespace detail } // namespace detail
class Cursor : public detail::CursorBase<Cursor, const IOBuf> { class Cursor : public detail::CursorBase<Cursor, const IOBuf> {
public: public:
...@@ -1049,7 +1050,7 @@ class QueueAppender : public detail::Writable<QueueAppender> { ...@@ -1049,7 +1050,7 @@ class QueueAppender : public detail::Writable<QueueAppender> {
folly::IOBufQueue* queue_; folly::IOBufQueue* queue_;
size_t growth_; size_t growth_;
}; };
} // namespace io
}} // folly::io } // namespace folly
#include <folly/io/Cursor-inl.h> #include <folly/io/Cursor-inl.h>
...@@ -82,7 +82,7 @@ FOLLY_PACK_POP ...@@ -82,7 +82,7 @@ FOLLY_PACK_POP
static_assert(offsetof(Header, headerHash) + sizeof(Header::headerHash) == static_assert(offsetof(Header, headerHash) + sizeof(Header::headerHash) ==
sizeof(Header), "invalid header layout"); sizeof(Header), "invalid header layout");
} // namespace detail } // namespace detail
constexpr size_t headerSize() { return sizeof(detail::Header); } constexpr size_t headerSize() { return sizeof(detail::Header); }
...@@ -90,6 +90,6 @@ inline RecordInfo findRecord(ByteRange range, uint32_t fileId) { ...@@ -90,6 +90,6 @@ inline RecordInfo findRecord(ByteRange range, uint32_t fileId) {
return findRecord(range, range, fileId); return findRecord(range, range, fileId);
} }
} // namespace recordio_helpers } // namespace recordio_helpers
} // namespaces } // namespace folly
...@@ -138,7 +138,7 @@ uint64_t dataHash(ByteRange range) { ...@@ -138,7 +138,7 @@ uint64_t dataHash(ByteRange range) {
return hash::SpookyHashV2::Hash64(range.data(), range.size(), kHashSeed); return hash::SpookyHashV2::Hash64(range.data(), range.size(), kHashSeed);
} }
} // namespace } // namespace
size_t prependHeader(std::unique_ptr<IOBuf>& buf, uint32_t fileId) { size_t prependHeader(std::unique_ptr<IOBuf>& buf, uint32_t fileId) {
if (fileId == 0) { if (fileId == 0) {
...@@ -229,6 +229,6 @@ RecordInfo findRecord(ByteRange searchRange, ...@@ -229,6 +229,6 @@ RecordInfo findRecord(ByteRange searchRange,
return {0, {}}; return {0, {}};
} }
} // namespace } // namespace recordio_helpers
} // namespaces } // namespace folly
...@@ -172,8 +172,8 @@ RecordInfo findRecord(ByteRange range, uint32_t fileId); ...@@ -172,8 +172,8 @@ RecordInfo findRecord(ByteRange range, uint32_t fileId);
*/ */
RecordInfo validateRecord(ByteRange range, uint32_t fileId); RecordInfo validateRecord(ByteRange range, uint32_t fileId);
} // namespace recordio_helpers } // namespace recordio_helpers
} // namespaces } // namespace folly
#include <folly/io/RecordIO-inl.h> #include <folly/io/RecordIO-inl.h>
...@@ -176,4 +176,4 @@ void ShutdownSocketSet::doShutdown(int fd, bool abortive) { ...@@ -176,4 +176,4 @@ void ShutdownSocketSet::doShutdown(int fd, bool abortive) {
folly::dup2NoInt(nullFile_.fd(), fd); folly::dup2NoInt(nullFile_.fd(), fd);
} }
} // namespaces } // namespace folly
...@@ -117,4 +117,4 @@ class ShutdownSocketSet : private boost::noncopyable { ...@@ -117,4 +117,4 @@ class ShutdownSocketSet : private boost::noncopyable {
folly::File nullFile_; folly::File nullFile_;
}; };
} // namespaces } // namespace folly
...@@ -212,4 +212,4 @@ class TypedIOBuf { ...@@ -212,4 +212,4 @@ class TypedIOBuf {
IOBuf* buf_; IOBuf* buf_;
}; };
} // namespace folly } // namespace folly
...@@ -38,7 +38,9 @@ ...@@ -38,7 +38,9 @@
#include <zstd.h> #include <zstd.h>
#endif #endif
namespace folly { namespace io { namespace test { namespace folly {
namespace io {
namespace test {
class DataHolder : private boost::noncopyable { class DataHolder : private boost::noncopyable {
public: public:
...@@ -1127,7 +1129,9 @@ TEST(ZstdTest, BackwardCompatible) { ...@@ -1127,7 +1129,9 @@ TEST(ZstdTest, BackwardCompatible) {
} }
#endif #endif
}}} // namespaces } // namespace test
} // namespace io
} // namespace folly
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
......
...@@ -190,7 +190,7 @@ std::string toString(const IOBuf& buf) { ...@@ -190,7 +190,7 @@ std::string toString(const IOBuf& buf) {
return str; return str;
} }
} // namespace } // namespace
TEST(IOBuf, PullAndPeek) { TEST(IOBuf, PullAndPeek) {
std::unique_ptr<IOBuf> iobuf1(IOBuf::create(10)); std::unique_ptr<IOBuf> iobuf1(IOBuf::create(10));
......
...@@ -755,7 +755,7 @@ void customDeleteArray(OwnershipTestClass* p) { ...@@ -755,7 +755,7 @@ void customDeleteArray(OwnershipTestClass* p) {
delete[] p; delete[] p;
} }
} // namespace } // namespace
TEST(IOBuf, takeOwnershipUniquePtr) { TEST(IOBuf, takeOwnershipUniquePtr) {
destructorCount = 0; destructorCount = 0;
...@@ -1041,7 +1041,7 @@ namespace { ...@@ -1041,7 +1041,7 @@ namespace {
std::unique_ptr<IOBuf> fromStr(StringPiece sp) { std::unique_ptr<IOBuf> fromStr(StringPiece sp) {
return IOBuf::copyBuffer(ByteRange(sp)); return IOBuf::copyBuffer(ByteRange(sp));
} }
} // namespace } // namespace
TEST(IOBuf, HashAndEqual) { TEST(IOBuf, HashAndEqual) {
folly::IOBufEqual eq; folly::IOBufEqual eq;
...@@ -1240,7 +1240,7 @@ char* writableStr(folly::IOBuf& buf) { ...@@ -1240,7 +1240,7 @@ char* writableStr(folly::IOBuf& buf) {
return reinterpret_cast<char*>(buf.writableData()); return reinterpret_cast<char*>(buf.writableData());
} }
} // namespace } // namespace
TEST(IOBuf, ExternallyShared) { TEST(IOBuf, ExternallyShared) {
struct Item { struct Item {
......
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
DEFINE_int32(random_seed, folly::randomNumberSeed(), "random seed"); DEFINE_int32(random_seed, folly::randomNumberSeed(), "random seed");
namespace folly { namespace test { namespace folly {
namespace test {
namespace { namespace {
// shortcut // shortcut
...@@ -49,7 +50,7 @@ std::unique_ptr<IOBuf> iobufs(std::initializer_list<T> ranges) { ...@@ -49,7 +50,7 @@ std::unique_ptr<IOBuf> iobufs(std::initializer_list<T> ranges) {
return queue.move(); return queue.move();
} }
} // namespace } // namespace
TEST(RecordIOTest, Simple) { TEST(RecordIOTest, Simple) {
TemporaryFile file; TemporaryFile file;
...@@ -189,7 +190,7 @@ void corrupt(int fd, off_t pos) { ...@@ -189,7 +190,7 @@ void corrupt(int fd, off_t pos) {
++val; ++val;
EXPECT_EQ(1, pwrite(fd, &val, 1, pos)); EXPECT_EQ(1, pwrite(fd, &val, 1, pos));
} }
} // namespace } // namespace
TEST(RecordIOTest, Randomized) { TEST(RecordIOTest, Randomized) {
SCOPED_TRACE(to<std::string>("Random seed is ", FLAGS_random_seed)); SCOPED_TRACE(to<std::string>("Random seed is ", FLAGS_random_seed));
...@@ -262,8 +263,9 @@ TEST(RecordIOTest, Randomized) { ...@@ -262,8 +263,9 @@ TEST(RecordIOTest, Randomized) {
EXPECT_EQ(records.size(), i); EXPECT_EQ(records.size(), i);
} }
} }
} // namespace test
} // namespace folly
}} // namespaces
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
......
...@@ -28,7 +28,8 @@ using folly::ShutdownSocketSet; ...@@ -28,7 +28,8 @@ using folly::ShutdownSocketSet;
namespace fsp = folly::portability::sockets; namespace fsp = folly::portability::sockets;
namespace folly { namespace test { namespace folly {
namespace test {
ShutdownSocketSet shutdownSocketSet; ShutdownSocketSet shutdownSocketSet;
...@@ -221,5 +222,5 @@ TEST(ShutdownSocketSetTest, OrderlyKill) { ...@@ -221,5 +222,5 @@ TEST(ShutdownSocketSetTest, OrderlyKill) {
TEST(ShutdownSocketSetTest, AbortiveKill) { TEST(ShutdownSocketSetTest, AbortiveKill) {
runKillTest(true); runKillTest(true);
} }
} // namespace test
}} // namespaces } // namespace folly
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment