diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-12-27 18:39:47 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2015-12-27 18:40:08 +0900 |
| commit | b1132d6b10cd3791b9529d7031d723fd0e2d8215 (patch) | |
| tree | 9ce465b42bf09372118335c7c619bb2b41869eaf /src/SimpleRandomizer.cc | |
| parent | 4abad2f64c9ff80144a61c5a9c2bea144852b883 (diff) | |
make clang-format using clang-format-3.6
Diffstat (limited to 'src/SimpleRandomizer.cc')
| -rw-r--r-- | src/SimpleRandomizer.cc | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/SimpleRandomizer.cc b/src/SimpleRandomizer.cc index 6170bee6..11ce13d6 100644 --- a/src/SimpleRandomizer.cc +++ b/src/SimpleRandomizer.cc @@ -46,9 +46,9 @@ #include "fmt.h" #ifdef HAVE_GETRANDOM_INTERFACE -# include <errno.h> -# include <linux/errno.h> -# include "getrandom_linux.h" +#include <errno.h> +#include <linux/errno.h> +#include "getrandom_linux.h" #endif namespace aria2 { @@ -57,7 +57,7 @@ std::unique_ptr<SimpleRandomizer> SimpleRandomizer::randomizer_; const std::unique_ptr<SimpleRandomizer>& SimpleRandomizer::getInstance() { - if(!randomizer_) { + if (!randomizer_) { randomizer_.reset(new SimpleRandomizer()); } return randomizer_; @@ -66,10 +66,8 @@ const std::unique_ptr<SimpleRandomizer>& SimpleRandomizer::getInstance() SimpleRandomizer::SimpleRandomizer() { #ifdef __MINGW32__ - BOOL r = ::CryptAcquireContext( - &provider_, - 0, 0, PROV_RSA_FULL, - CRYPT_VERIFYCONTEXT | CRYPT_SILENT); + BOOL r = ::CryptAcquireContext(&provider_, 0, 0, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT | CRYPT_SILENT); assert(r); #endif } @@ -103,7 +101,8 @@ void SimpleRandomizer::getRandomBytes(unsigned char* buf, size_t len) * check out. If the call failed, we'll not take this branch at all * and disable support below. */ - || errno != ENOSYS + || + errno != ENOSYS #endif ) { if (rv < -1) { @@ -114,15 +113,15 @@ void SimpleRandomizer::getRandomBytes(unsigned char* buf, size_t len) return; } have_random_support = false; - A2_LOG_INFO("Disabled getrandom support, because kernel does not "\ - "implement this feature (ENOSYS)"); + A2_LOG_INFO("Disabled getrandom support, because kernel does not " + "implement this feature (ENOSYS)"); } - // Fall through to generic implementation +// Fall through to generic implementation #endif // defined(HAVE_GETRANDOM_INTERFACE) auto ubuf = reinterpret_cast<result_type*>(buf); size_t q = len / sizeof(result_type); auto gen = std::uniform_int_distribution<result_type>(); - for(; q > 0; --q, ++ubuf) { + for (; q > 0; --q, ++ubuf) { *ubuf = gen(dev_); } const size_t r = len % sizeof(result_type); |
