mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
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:
commit
9caf6e4884
4 changed files with 13 additions and 5 deletions
5
CHANGES
5
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
|
2.1-377 | 2013-03-17 17:36:09 -0700
|
||||||
|
|
||||||
* Fixing potential leak in DNS error case. (Vlad Grigorescu)
|
* Fixing potential leak in DNS error case. (Vlad Grigorescu)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.1-377
|
2.1-380
|
||||||
|
|
|
@ -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 ); )
|
for ( int i = 0, j = 0; (i < len) && ( j < blen ); )
|
||||||
{
|
{
|
||||||
uint32_t bit32 = ((i < len ? data[i++] : 0) << 16) +
|
uint32_t bit32 = data[i++] << 16;
|
||||||
((i < len ? data[i++] : 0 & i++) << 8) +
|
bit32 += (i++ < len ? data[i-1] : 0) << 8;
|
||||||
( i < len ? data[i++] : 0 & i++);
|
bit32 += i++ < len ? data[i-1] : 0;
|
||||||
|
|
||||||
buf[j++] = alphabet[(bit32 >> 18) & 0x3f];
|
buf[j++] = alphabet[(bit32 >> 18) & 0x3f];
|
||||||
buf[j++] = alphabet[(bit32 >> 12) & 0x3f];
|
buf[j++] = alphabet[(bit32 >> 12) & 0x3f];
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "../../threading/Manager.h"
|
#include "../../threading/Manager.h"
|
||||||
|
|
||||||
|
@ -71,7 +72,9 @@ string Benchmark::RandomString(const int len)
|
||||||
double Benchmark::CurrTime()
|
double Benchmark::CurrTime()
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
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;
|
return double(tv.tv_sec) + double(tv.tv_usec) / 1e6;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue