aboutsummaryrefslogtreecommitdiffstats
path: root/src/entropy/dev_random
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 20:23:47 +0000
committerlloyd <[email protected]>2010-10-12 20:23:47 +0000
commit6385602fcccfd9c561b1c097095ddd2edf1a2357 (patch)
tree63374ebafd20b09ff4ad77d624a4b27c87b1062c /src/entropy/dev_random
parentab1f661083053df745daf1e1b8f4859f5a92065d (diff)
Use size_t instead of u32bit in entropy and rng
Diffstat (limited to 'src/entropy/dev_random')
-rw-r--r--src/entropy/dev_random/dev_random.cpp14
-rw-r--r--src/entropy/dev_random/dev_random.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/src/entropy/dev_random/dev_random.cpp b/src/entropy/dev_random/dev_random.cpp
index a942806d0..b15240aba 100644
--- a/src/entropy/dev_random/dev_random.cpp
+++ b/src/entropy/dev_random/dev_random.cpp
@@ -26,8 +26,8 @@ void Device_EntropySource::Device_Reader::close()
/**
Read bytes from a device file
*/
-u32bit Device_EntropySource::Device_Reader::get(byte out[], u32bit length,
- u32bit ms_wait_time)
+size_t Device_EntropySource::Device_Reader::get(byte out[], size_t length,
+ size_t ms_wait_time)
{
if(fd < 0)
return 0;
@@ -54,7 +54,7 @@ u32bit Device_EntropySource::Device_Reader::get(byte out[], u32bit length,
if(got <= 0)
return 0;
- return static_cast<u32bit>(got);
+ return static_cast<size_t>(got);
}
/**
@@ -82,7 +82,7 @@ Open a file descriptor to each (available) device in fsnames
Device_EntropySource::Device_EntropySource(
const std::vector<std::string>& fsnames)
{
- for(u32bit i = 0; i != fsnames.size(); ++i)
+ for(size_t i = 0; i != fsnames.size(); ++i)
{
Device_Reader::fd_type fd = Device_Reader::open(fsnames[i]);
if(fd > 0)
@@ -104,14 +104,14 @@ Device_EntropySource::~Device_EntropySource()
*/
void Device_EntropySource::poll(Entropy_Accumulator& accum)
{
- u32bit go_get = std::min<u32bit>(accum.desired_remaining_bits() / 8, 48);
+ size_t go_get = std::min<size_t>(accum.desired_remaining_bits() / 8, 48);
- u32bit read_wait_ms = std::max<u32bit>(go_get, 1000);
+ size_t read_wait_ms = std::max<size_t>(go_get, 1000);
MemoryRegion<byte>& io_buffer = accum.get_io_buffer(go_get);
for(size_t i = 0; i != devices.size(); ++i)
{
- u32bit got = devices[i].get(&io_buffer[0], io_buffer.size(),
+ size_t got = devices[i].get(&io_buffer[0], io_buffer.size(),
read_wait_ms);
if(got)
diff --git a/src/entropy/dev_random/dev_random.h b/src/entropy/dev_random/dev_random.h
index e20e74300..171adcc76 100644
--- a/src/entropy/dev_random/dev_random.h
+++ b/src/entropy/dev_random/dev_random.h
@@ -41,7 +41,7 @@ class Device_EntropySource : public EntropySource
void close();
- u32bit get(byte out[], u32bit length, u32bit ms_wait_time);
+ size_t get(byte out[], size_t length, size_t ms_wait_time);
static fd_type open(const std::string& pathname);
private: