Merge remote-tracking branch 'origin/fastpath'

* origin/fastpath:
  fix gcc compile warning in Benchmark reader
  fix gcc compile warning in base64 encoder
This commit is contained in:
Robin Sommer 2013-03-18 12:18:10 -07:00
commit 9caf6e4884
4 changed files with 13 additions and 5 deletions

View file

@ -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)

View file

@ -1 +1 @@
2.1-377
2.1-380

View file

@ -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];

View file

@ -8,6 +8,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#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;
}