whitespace

This commit is contained in:
Danny Robson 2015-04-13 18:06:08 +10:00
parent 2658b41ea1
commit 7ae57730f0
54 changed files with 78 additions and 83 deletions

View File

@ -6,7 +6,7 @@ using namespace std;
debug::backtrace::backtrace (void):
m_frames (DEFAULT_DEPTH)
m_frames (DEFAULT_DEPTH)
{ ; }

View File

@ -66,5 +66,5 @@ reverse (T value) {
return out;
}
#endif
#endif

View File

@ -79,7 +79,7 @@ unreachable (void) {
void
unreachable (const std::string& what) {
panic (" Unreachable code executed: " + what);
panic (" Unreachable code executed: " + what);
}

View File

@ -79,4 +79,4 @@ namespace util {
}
#endif
#endif
#endif

View File

@ -38,7 +38,6 @@ util::image_path (void) {
// We can't use lstat to check the size of the link in proc, as Linux
// will return 0 for most entries under proc. Instead we've got to
// iterate for a correct size.
std::vector<char> resolved (256);
retry:

View File

@ -19,7 +19,7 @@ ieee_float<E, S>::ieee_float (floating_t _floating):
template <unsigned int E, unsigned int S>
ieee_float<E, S>::ieee_float (const ieee_float &rhs):
ieee_float<E, S>::ieee_float (const ieee_float &rhs):
m_bits (rhs.m_bits)
{ ; }
@ -56,7 +56,7 @@ ieee_float<E, S>::is_nan (void) const {
template <unsigned int E, unsigned int S>
bool
ieee_float<E, S>::operator==(floating_t _floating) const {
ieee_float<E, S>::operator==(floating_t _floating) const {
// TODO: This method really shouldn't be generated if there's no
// representative native floating point type. But I'm sick of
// C++'s template bullshit for tonight.
@ -79,7 +79,7 @@ ieee_float<E, S>::operator==(floating_t _floating) const {
//template <unsigned int E, unsigned int S>
//bool
//ieee_float<E, S>::almost_equal (floating_t a,
// floating_t b) {
// floating_t b) {
// // Static cast to avoid integer casting warnings when using uint16_t for half
// static const floating_t epsilon = static_cast<floating_t> (0.001);
// const floating_t diff = static_cast<floating_t> (std::fabs (a - b));

View File

@ -196,7 +196,7 @@ operator>> (std::istream &is, guid &g) {
g.data4[5] = data4 & 0xFF; data4 >>= 8u;
g.data4[6] = data4 & 0xFF; data4 >>= 8u;
g.data4[7] = data4 & 0xFF;
if (braces)
is.get ();

View File

@ -39,13 +39,13 @@ crc32 (const void *restrict, size_t) {
case 2: bits |= static_cast<uint64_t>(data[1]) << 48U;
case 1: bits |= static_cast<uint64_t>(data[0]) << 56U;
}
for (size_t i = 0; i < size; ++i) {
for (unsigned j = 0; j < 32; ++j) {
bool mix = bits 0x7000000000000000ULL;
bits <<= 1;
if (mix)
if (mix)
bits ^= POLYNOMIAL << 32;
}

View File

@ -134,7 +134,7 @@ MD2::transform (void) {
for (size_t i = 0; i < 18; ++i) {
for (size_t j = 0; j < 48; ++j)
t = X[j] = X[j] ^ S[t];
t = (t + i) % 256;
}
}

View File

@ -110,7 +110,7 @@ MD4::digest_t
MD4::digest (void) const {
digest_t d;
memcpy (d.data (), ABCD.data(), sizeof (ABCD));
return d;
return d;
}
@ -130,17 +130,17 @@ MD4::transform (void) {
ROUND1(D,A,B,C, 1, 7);
ROUND1(C,D,A,B, 2, 11);
ROUND1(B,C,D,A, 3, 19);
ROUND1(A,B,C,D, 4, 3);
ROUND1(D,A,B,C, 5, 7);
ROUND1(C,D,A,B, 6, 11);
ROUND1(B,C,D,A, 7, 19);
ROUND1(A,B,C,D, 8, 3);
ROUND1(D,A,B,C, 9, 7);
ROUND1(C,D,A,B, 10, 11);
ROUND1(B,C,D,A, 11, 19);
ROUND1(A,B,C,D, 12, 3);
ROUND1(D,A,B,C, 13, 7);
ROUND1(C,D,A,B, 14, 11);

View File

@ -39,7 +39,7 @@ G (uint32_t x, uint32_t y, uint32_t z)
static inline uint32_t
H (uint32_t x, uint32_t y, uint32_t z)
{ return x ^ y ^ z; }
{ return x ^ y ^ z; }
static inline uint32_t
@ -57,19 +57,19 @@ const std::array<uint32_t, 65> T = { {
0xf57c0fafu, 0x4787c62au, 0xa8304613u, 0xfd469501u,
0x698098d8u, 0x8b44f7afu, 0xffff5bb1u, 0x895cd7beu,
0x6b901122u, 0xfd987193u, 0xa679438eu, 0x49b40821u,
// Round 2
0xf61e2562u, 0xc040b340u, 0x265e5a51u, 0xe9b6c7aau,
0xd62f105du, 0x02441453u, 0xd8a1e681u, 0xe7d3fbc8u,
0x21e1cde6u, 0xc33707d6u, 0xf4d50d87u, 0x455a14edu,
0xa9e3e905u, 0xfcefa3f8u, 0x676f02d9u, 0x8d2a4c8au,
// Round 3
0xfffa3942u, 0x8771f681u, 0x6d9d6122u, 0xfde5380cu,
0xa4beea44u, 0x4bdecfa9u, 0xf6bb4b60u, 0xbebfbc70u,
0x289b7ec6u, 0xeaa127fau, 0xd4ef3085u, 0x04881d05u,
0xd9d4d039u, 0xe6db99e5u, 0x1fa27cf8u, 0xc4ac5665u,
// Round 4
0xf4292244u, 0x432aff97u, 0xab9423a7u, 0xfc93a039u,
0x655b59c3u, 0x8f0ccc92u, 0xffeff47du, 0x85845dd1u,
@ -243,12 +243,12 @@ MD5::transform (void) {
ROUNDx(D,A,B,C, 8, 11, 34, H);
ROUNDx(C,D,A,B, 11, 16, 35, H);
ROUNDx(B,C,D,A, 14, 23, 36, H);
ROUNDx(A,B,C,D, 1, 4, 37, H);
ROUNDx(D,A,B,C, 4, 11, 38, H);
ROUNDx(C,D,A,B, 7, 16, 39, H);
ROUNDx(B,C,D,A, 10, 23, 40, H);
ROUNDx(A,B,C,D, 13, 4, 41, H);
ROUNDx(D,A,B,C, 0, 11, 42, H);
ROUNDx(C,D,A,B, 3, 16, 43, H);

View File

@ -1,4 +1,4 @@
/*
/*
* This file is part of libgim
*
* This Source Code Form is subject to the terms of the Mozilla Public
@ -110,7 +110,7 @@ RIPEMD::transform (void) {
#define R2a(a,b,c,d,e,x,s) ROUND(f2,a,b,c,d,e,0x5A827999u,x,s)
#define R3a(a,b,c,d,e,x,s) ROUND(f3,a,b,c,d,e,0x6ED9EBA1u,x,s)
#define R4a(a,b,c,d,e,x,s) ROUND(f4,a,b,c,d,e,0x8F1BBCDCu,x,s)
#define R5a(a,b,c,d,e,x,s) ROUND(f5,a,b,c,d,e,0xA953FD4Eu,x,s)
#define R5a(a,b,c,d,e,x,s) ROUND(f5,a,b,c,d,e,0xA953FD4Eu,x,s)
#define R1b(a,b,c,d,e,x,s) ROUND(f5,a,b,c,d,e,0x50A28BE6u,x,s)
#define R2b(a,b,c,d,e,x,s) ROUND(f4,a,b,c,d,e,0x5C4DD124u,x,s)
@ -236,7 +236,7 @@ RIPEMD::transform (void) {
R1b(a2, b2, c2, d2, e2, 12, 6);
// Right round 2
R2b(e2, a2, b2, c2, d2, 6, 9);
R2b(e2, a2, b2, c2, d2, 6, 9);
R2b(d2, e2, a2, b2, c2, 11, 13);
R2b(c2, d2, e2, a2, b2, 3, 15);
R2b(b2, c2, d2, e2, a2, 7, 7);
@ -351,7 +351,7 @@ RIPEMD::finish (void) {
memset (d32, 0, sizeof (d32));
d32[14] = length & 0xFFFFFFFF;
d32[15] = length >> 32u;
// Do the final update
size_t offset = sizeof(d08) - remaining;
update (d08 + offset, remaining);

View File

@ -1,4 +1,4 @@
/*
/*
* This file is part of libgim
*
* This Source Code Form is subject to the terms of the Mozilla Public

View File

@ -1,4 +1,4 @@
/*
/*
* This file is part of libgim
*
* This Source Code Form is subject to the terms of the Mozilla Public
@ -267,7 +267,7 @@ SHA256::process (void) {
SHA256::digest_t
SHA256::digest (void) const {
digest_t out;
auto cursor = out.begin ();
for (auto i: H) {
*cursor++ = (i >> 24) & 0xFF;

View File

@ -1,4 +1,4 @@
/*
/*
* This file is part of libgim
*
* This Source Code Form is subject to the terms of the Mozilla Public
@ -39,7 +39,6 @@ namespace util {
std::array<uint32_t, 16> M;
std::array<uint8_t, 64> C;
};
};
}
}

3
io.hpp
View File

@ -38,7 +38,7 @@ namespace util {
ACCESS_WRITE = 1 << 1,
ACCESS_READWRITE = ACCESS_READ | ACCESS_WRITE
};
/// Reads an entire file into memory. Caller frees the result. Guarantees a
/// null trailing byte.
std::unique_ptr<char []>
@ -130,7 +130,6 @@ namespace util {
void set_cwd (const boost::filesystem::path &);
//-------------------------------------------------------------------------
class path_error : public std::runtime_error {
public:

View File

@ -50,7 +50,6 @@ namespace util {
const uint8_t* cbegin (void) const;
const uint8_t* cend (void) const;
};
} }
typedef detail::posix::mapped_file mapped_file;

2
ip.hpp
View File

@ -45,7 +45,7 @@ namespace ipv4 {
static const ip ANY;
};
typedef uint16_t port;
typedef uint32_t mask;

View File

@ -36,7 +36,7 @@ class referencing_iterator {
typedef typename Base::difference_type difference_type ;
typedef value_type& reference ;
typedef value_type* pointer;
typedef typename Base::iterator_category iterator_category;
typedef typename Base::iterator_category iterator_category;
protected:
Base m_base;

View File

@ -13,7 +13,6 @@
*
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
*/
#ifndef __UTIL_JSON_EXCEPT_HPP
#define __UTIL_JSON_EXCEPT_HPP

View File

@ -27,4 +27,4 @@ namespace lerp {
double trunc (double a, double b, double weight);
}
#endif
#endif

View File

@ -116,7 +116,7 @@ util::detail::log (level_t level, boost::format &&format) {
return;
static const boost::format LEVEL_FORMAT ("%s [%s] ");
static const size_t time_len = strlen("YYYY-mm-dd HHMMhSS") + 1;
std::string time_string (time_len - 1, '\0');
time_t unix_time = time (nullptr);

View File

@ -36,7 +36,7 @@ namespace util {
ALERT, /** action must be taken immediately */
CRITICAL, /** critical conditions */
ERROR, /** error conditions */
WARNING,
WARNING,
WARN = WARNING, /** warning conditions */
NOTICE, /** normal but significant condition */
INFORMATIONAL,

View File

@ -52,7 +52,7 @@ namespace maths {
double * operator [] (unsigned int row);
const double * data (void) const;
matrix& operator =(const matrix &rhs);
matrix operator * (double scalar) const;
matrix& operator *=(double scalar);
@ -65,7 +65,7 @@ namespace maths {
bool operator ==(const matrix &rhs) const;
//matrix transpose (void) const { ; }
size_t rows (void) const;
size_t columns (void) const;
size_t size (void) const;
@ -107,7 +107,7 @@ namespace maths {
class not_invertible : public std::runtime_error {
public:
not_invertible ():
not_invertible ():
std::runtime_error ("not_invertible")
{ ; }
};

View File

@ -43,7 +43,7 @@ vector::~vector (void)
/* element accessors */
const double*
vector::data (void) const
vector::data (void) const
{ return &m_data[0]; }
@ -72,7 +72,7 @@ double vector::dot (const double *restrict A,
vector vector::cross (const double *restrict A,
const double *restrict B,
unsigned int size) {
unsigned int size) {
CHECK_EQ (size, 3);
(void)size;
return vector ({ A[1] * B[2] - A[2] * B[1],

View File

@ -53,7 +53,7 @@ const char* inet_ntop(int af, const void* src, char* dst, int size){
//-----------------------------------------------------------------------------
template <domain D>
typename address<D>::port_type
address<D>::port (void) const
address<D>::port (void) const
{ return m_port; }

View File

@ -121,5 +121,5 @@ net::error_code<CODE>::error_code (void):
template <int CODE>
int
net::error_code<CODE>::code (void) const
net::error_code<CODE>::code (void) const
{ return CODE; }

View File

@ -61,7 +61,7 @@ namespace net {
last_code (void);
};
template <int CODE>
class error_code : public error {
public:

View File

@ -168,8 +168,8 @@ net::socket<D, type::STREAM>::send (const uint8_t *restrict data, size_t len) {
for (size_t sent = 0; sent < len; ) {
ssize_t result = ::send (this->m_fd, static_cast<const void *>(data + sent), len - sent, 0);
if (result < 0)
if (result < 0)
net::error::throw_code ();
sent += sign_cast<size_t> (result);

View File

@ -79,7 +79,7 @@ namespace net {
/// Indicates the wire transmission protocol to use.
///
///
/// This DOES NOT mean what you think it does! It is included for completeness sake, and unless
/// you're doing something funky with the C API you really just want DEFAULT.
/// Values retrieved from /etc/protocols

View File

@ -92,7 +92,7 @@ value<L>::bounds (void) const
template <lerp_function L>
double
double
value<L>::eval (double x, double y) const {
intmax_t x_int = static_cast<intmax_t> (x);
intmax_t y_int = static_cast<intmax_t> (y);
@ -146,7 +146,7 @@ gradient<L>::bounds (void) const
template <lerp_function L>
double
double
gradient<L>::eval (double x, double y) const {
intmax_t x_int = static_cast<intmax_t> (x);
intmax_t y_int = static_cast<intmax_t> (y);

View File

@ -129,7 +129,7 @@ util::noise::musgrave<B>::eval (double x, double y) const {
for (size_t i = 1; i < this->octaves; ++i) {
f *= 2.0;
a *= this->lacunarity;
weight = signal * gain;
weight = max (0.0, min (1.0, weight));

View File

@ -155,7 +155,7 @@ namespace util {
m_data (_data)
{ ; }
virtual void execute(void)
virtual void execute(void)
{ option::execute(); }
virtual void execute(const std::string& data) {
get_arg(data, m_data);
@ -253,7 +253,7 @@ namespace util {
*
* parse_args will perform minimal interpretation of the arguments to allow
* dispatch to registered options. No direct actions upon any input is
* performed within this class, merely dispatch and tokenisation.
* performed within this class, merely dispatch and tokenisation.
*/
class processor {
protected:

View File

@ -25,7 +25,7 @@
#error "Unknown platform"
#endif
// Clang needs to be checked before GCC as it pretends to be GCC
// Clang needs to be checked before GCC as it pretends to be GCC
#if defined(__clang__)
#define COMPILER_CLANG
#elif defined(__GNUC__)

View File

@ -36,7 +36,7 @@ namespace util {
T &counter;
};
/// Executes a function upon object destruction
template <typename T>
struct scoped_function {

View File

@ -122,7 +122,7 @@ namespace util {
{
double pos = ::rand () / (double)(RAND_MAX);
return (max - min) * pos + min;
}
}
template <>
float
@ -174,7 +174,7 @@ util::range<T>::operator ==(const util::range<T> &rhs) const
///////////////////////////////////////////////////////////////////////////////
template <typename T>
template <typename T>
const util::range<T>
util::range<T>::UNLIMITED (std::numeric_limits<T>::has_infinity ? -std::numeric_limits<T>::infinity () :
std::numeric_limits<T>::lowest (),

View File

@ -70,7 +70,7 @@ namespace util {
range operator- (T) const;
/// Return a pseudo-random uniformly distributed value within the range.
/// There are no statistical randomness guarantees whatsoever.
/// There are no statistical randomness guarantees whatsoever.
T random (void) const;
bool operator ==(const range<T>& rhs) const;

2
si.hpp
View File

@ -27,4 +27,4 @@ uintmax_t from_KiB (uintmax_t bytes);
uintmax_t from_MiB (uintmax_t bytes);
uintmax_t from_GiB (uintmax_t bytes);
#endif
#endif

View File

@ -131,7 +131,7 @@ namespace util {
/// Disconnect all callbacks
template <typename F, template <typename> class C>
void
signal<F,C>::clear (void)
signal<F,C>::clear (void)
{
m_children.clear ();
}

View File

@ -37,7 +37,7 @@ stringid::add (const std::string key) {
id_t id = m_map.size ();
m_map[key] = id;
return id;
return id;
}

View File

@ -30,7 +30,7 @@ main (int, char**)
};
box.expand (2.f);
tap.expect_eq<util::AABB2f, util::AABB2f> (box, { { 1, 1 }, { 9, 9 }}, "expansion");
}

View File

@ -1,5 +1,5 @@
#include "colour.hpp"
#include "tap.hpp"
int

View File

@ -40,7 +40,7 @@ test_double (void) {
}
void
void
test_single (void) {
struct sized_test {
ieee_single::uint_t bits;
@ -57,7 +57,7 @@ test_single (void) {
{ 0x7f800000, numeric_limits<float>::infinity () },
{ 0xff800000, -numeric_limits<float>::infinity () },
{ 0x3eaaaaab, 1.0f / 3.0f }
};

View File

@ -1,5 +1,5 @@
#include "hash/hotp.hpp"
#include "debug.hpp"
#include "tap.hpp"
#include "types.hpp"

View File

@ -14,7 +14,7 @@
#endif
int
int
main (int, char **) {
uint16_t u16 = 0x1358;

View File

@ -186,7 +186,7 @@ test_bytes_opt(void) {
};
static const char *argv[] = {
static const char *argv[] = {
"./foo",
"-b",
NULL
@ -197,7 +197,7 @@ test_bytes_opt(void) {
p->add_option(make_unique<bytesoption> (
'b', "bytes",
"testing sizeof bytes", &size, commands[i].type,
commands[i].mod
commands[i].mod
));
argv[elems (argv) - 1] = commands[i].param;

View File

@ -29,7 +29,7 @@ check_unique_ptr (void) {
CHECK (success);
}
for (auto i = uintset.begin (); i != uintset.end (); ++i)
for (auto i = uintset.begin (); i != uintset.end (); ++i)
uintpool.release (*i);
uintset.clear ();
@ -39,7 +39,7 @@ check_unique_ptr (void) {
CHECK (success);
}
for (auto i = uintset.begin (); i != uintset.end (); ++i)
for (auto i = uintset.begin (); i != uintset.end (); ++i)
uintpool.release (*i);
}
@ -79,7 +79,7 @@ check_keep_value (void) {
}
int
int
main (int, char **) {
check_single ();
check_unique_ptr ();

View File

@ -15,7 +15,7 @@ void
test_bool (void) {
static const unsigned ITERATIONS = 8192;
static const unsigned THRESHOLD = ITERATIONS / 10;
unsigned counts[2] = { 0, 0 };
for (unsigned i = 0; i < ITERATIONS; ++i)
++counts[util::random<bool> () ? 0 : 1];

View File

@ -37,7 +37,7 @@ test_intersect_aabb (void)
void
test_intersect_sphere (void)
{
;
}

View File

@ -68,7 +68,7 @@ main (int, char**) {
CHECK (obj.digest () == i.output);
}
util::TAP::logger tap;
tap.skip ("convert to TAP");
}

View File

@ -35,7 +35,7 @@ main (void)
CHECK_EQ (i.query, u.get (util::uri::QUERY));
CHECK_EQ (i.fragment, u.get (util::uri::FRAGMENT));
}
static const char* BAD[] = {
"www.google.com.au",
};

View File

@ -36,7 +36,7 @@ uint64_t
util::nanoseconds (void) {
LARGE_INTEGER freq, count;
QueryPerformanceFrequency (&freq);
QueryPerformanceCounter (&count);
QueryPerformanceCounter (&count);
return ((double)count.QuadPart / freq.QuadPart) * SECOND;
}
@ -131,7 +131,7 @@ util::rate_limiter::poll (void) {
util::polled_duration::polled_duration (std::string name, uint64_t interval):
m_name (name),
m_interval (interval),
m_next (nanoseconds () + interval)
m_next (nanoseconds () + interval)
{ ; }

View File

@ -24,7 +24,7 @@
//-----------------------------------------------------------------------------
/// Returns the number of elements of a statically allocated array
template <typename T, size_t N>
template <typename T, size_t N>
constexpr size_t elems(const T (&)[N])
{ return N; }

View File

@ -38,7 +38,7 @@ util::zlib::uncompress (uint8_t *dst, size_t dst_len,
const uint8_t *src, size_t src_len) {
size_t actual_len = dst_len;
uLongf zlib_actual = actual_len;
int err = ::uncompress (dst, &zlib_actual, src, src_len);
error::try_code (err);