Move threadlocal_detail::Atfork to its own file
[folly.git] / folly / Random.cpp
index d991990e28b60944287529cbd5afa5ca9749b5b5..5f94f00cbd7696db7094978c2e908f1ef6b4d864 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include <folly/Random.h>
 
+#include <array>
 #include <atomic>
 #include <mutex>
 #include <random>
-#include <array>
 
-#include <folly/CallOnce.h>
 #include <folly/File.h>
 #include <folly/FileUtil.h>
 #include <folly/SingletonThreadLocal.h>
 #include <folly/ThreadLocal.h>
 #include <folly/portability/SysTime.h>
 #include <folly/portability/Unistd.h>
+#include <folly/synchronization/CallOnce.h>
 #include <glog/logging.h>
 
 #ifdef _MSC_VER
-# include <wincrypt.h>
+#include <wincrypt.h> // @manual
 #endif
 
 namespace folly {
@@ -89,7 +89,7 @@ class BufferedRandomDevice {
   void getSlow(unsigned char* data, size_t size);
 
   inline size_t remaining() const {
-    return buffer_.get() + bufferSize_ - ptr_;
+    return size_t(buffer_.get() + bufferSize_ - ptr_);
   }
 
   const size_t bufferSize_;
@@ -150,4 +150,4 @@ ThreadLocalPRNG::ThreadLocalPRNG() {
 uint32_t ThreadLocalPRNG::getImpl(LocalInstancePRNG* local) {
   return local->rng();
 }
-}
+} // namespace folly