diff --git a/CHANGES b/CHANGES index 024276620f..875765f287 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,9 @@ +2.1-380 | 2013-03-18 12:18:10 -0700 + + * Fix gcc compile warnings in base64 encoder and benchmark reader. + (Bernhard Amann) + 2.1-377 | 2013-03-17 17:36:09 -0700 * Fixing potential leak in DNS error case. (Vlad Grigorescu) diff --git a/VERSION b/VERSION index ccb2f89fe9..8a8d9d8c5b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1-377 +2.1-380 diff --git a/src/Base64.cc b/src/Base64.cc index d953ec3557..d3abd9b563 100644 --- a/src/Base64.cc +++ b/src/Base64.cc @@ -30,9 +30,9 @@ void Base64Converter::Encode(int len, const unsigned char* data, int* pblen, cha for ( int i = 0, j = 0; (i < len) && ( j < blen ); ) { - uint32_t bit32 = ((i < len ? data[i++] : 0) << 16) + - ((i < len ? data[i++] : 0 & i++) << 8) + - ( i < len ? data[i++] : 0 & i++); + uint32_t bit32 = data[i++] << 16; + bit32 += (i++ < len ? data[i-1] : 0) << 8; + bit32 += i++ < len ? data[i-1] : 0; buf[j++] = alphabet[(bit32 >> 18) & 0x3f]; buf[j++] = alphabet[(bit32 >> 12) & 0x3f]; diff --git a/src/input/readers/Benchmark.cc b/src/input/readers/Benchmark.cc index 0c25092e08..0584037e05 100644 --- a/src/input/readers/Benchmark.cc +++ b/src/input/readers/Benchmark.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include "../../threading/Manager.h" @@ -71,7 +72,9 @@ string Benchmark::RandomString(const int len) double Benchmark::CurrTime() { struct timeval tv; - assert ( gettimeofday(&tv, 0) >= 0 ); + if ( gettimeofday(&tv, 0) != 0 ) { + FatalError(Fmt("Could not get time: %d", errno)); + } return double(tv.tv_sec) + double(tv.tv_usec) / 1e6; }