clang-format Mosh
Run clang-format over the Mosh source tree. This is a large change and
has been factored into its own commit for auditability. Reproduce it
with
find . -name \*.cc -or -name \*.h | while read f; do clang-format -i --style=file $f; done
This commit is contained in:
committed by
Alex Chernyakhovsky
parent
0b15dc94fa
commit
3acaa1c4d3
+15
-10
@@ -47,41 +47,46 @@ static const char rdev[] = "/dev/urandom";
|
||||
|
||||
using namespace Crypto;
|
||||
|
||||
class PRNG {
|
||||
private:
|
||||
class PRNG
|
||||
{
|
||||
private:
|
||||
std::ifstream randfile;
|
||||
|
||||
/* unimplemented to satisfy -Weffc++ */
|
||||
PRNG( const PRNG & );
|
||||
PRNG & operator=( const PRNG & );
|
||||
PRNG( const PRNG& );
|
||||
PRNG& operator=( const PRNG& );
|
||||
|
||||
public:
|
||||
public:
|
||||
PRNG() : randfile( rdev, std::ifstream::in | std::ifstream::binary ) {}
|
||||
|
||||
void fill( void *dest, size_t size ) {
|
||||
void fill( void* dest, size_t size )
|
||||
{
|
||||
if ( 0 == size ) {
|
||||
return;
|
||||
}
|
||||
|
||||
randfile.read( static_cast<char *>( dest ), size );
|
||||
randfile.read( static_cast<char*>( dest ), size );
|
||||
if ( !randfile ) {
|
||||
throw CryptoException( "Could not read from " + std::string( rdev ) );
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t uint8() {
|
||||
uint8_t uint8()
|
||||
{
|
||||
uint8_t x;
|
||||
fill( &x, 1 );
|
||||
return x;
|
||||
}
|
||||
|
||||
uint32_t uint32() {
|
||||
uint32_t uint32()
|
||||
{
|
||||
uint32_t x;
|
||||
fill( &x, 4 );
|
||||
return x;
|
||||
}
|
||||
|
||||
uint64_t uint64() {
|
||||
uint64_t uint64()
|
||||
{
|
||||
uint64_t x;
|
||||
fill( &x, 8 );
|
||||
return x;
|
||||
|
||||
Reference in New Issue
Block a user