You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/05/10 14:23:25 UTC
[trafficserver] branch master updated: coverity 1230692 : fix
constructor
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 355aa69 coverity 1230692 : fix constructor
355aa69 is described below
commit 355aa6957dd6141b6b8e16778f5a8a652cd4fe2f
Author: Jason Kenny <dr...@live.com>
AuthorDate: Tue May 9 15:00:29 2017 -0400
coverity 1230692 : fix constructor
clean up construtor
clean up constructor
---
lib/ts/HashSip.cc | 10 +++-------
lib/ts/HashSip.h | 24 +++++++++++++++---------
2 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/lib/ts/HashSip.cc b/lib/ts/HashSip.cc
index f2d36ec..4543b4a 100644
--- a/lib/ts/HashSip.cc
+++ b/lib/ts/HashSip.cc
@@ -11,6 +11,8 @@ https://github.com/floodyberry/siphash
#include "ts/HashSip.h"
#include <cstring>
+using namespace std;
+
#define SIP_BLOCK_SIZE 8
#define ROTL64(a, b) (((a) << (b)) | ((a) >> (64 - b)))
@@ -35,22 +37,16 @@ https://github.com/floodyberry/siphash
ATSHash64Sip24::ATSHash64Sip24()
{
- k0 = 0;
- k1 = 0;
this->clear();
}
-ATSHash64Sip24::ATSHash64Sip24(const unsigned char key[16])
+ATSHash64Sip24::ATSHash64Sip24(const unsigned char key[16]) : k0(U8TO64_LE(key)), k1(U8TO64_LE(key + sizeof(k0)))
{
- k0 = U8TO64_LE(key);
- k1 = U8TO64_LE(key + sizeof(k0));
this->clear();
}
ATSHash64Sip24::ATSHash64Sip24(uint64_t key0, uint64_t key1)
{
- k0 = key0;
- k1 = key1;
this->clear();
}
diff --git a/lib/ts/HashSip.h b/lib/ts/HashSip.h
index 9bddce5..566f444 100644
--- a/lib/ts/HashSip.h
+++ b/lib/ts/HashSip.h
@@ -23,7 +23,7 @@
#define __HASH_SIP_H__
#include "ts/Hash.h"
-#include <stdint.h>
+#include <cstdint>
/*
Siphash is a Hash Message Authentication Code and can take a key.
@@ -35,18 +35,24 @@
struct ATSHash64Sip24 : ATSHash64 {
ATSHash64Sip24(void);
ATSHash64Sip24(const unsigned char key[16]);
- ATSHash64Sip24(uint64_t key0, uint64_t key1);
- void update(const void *data, size_t len);
+ ATSHash64Sip24(std::uint64_t key0, std::uint64_t key1);
+ void update(const void *data, std::size_t len);
void final(void);
- uint64_t get(void) const;
+ std::uint64_t get(void) const;
void clear(void);
private:
- unsigned char block_buffer[8];
- uint8_t block_buffer_len;
- uint64_t k0, k1, v0, v1, v2, v3, hfinal;
- size_t total_len;
- bool finalized;
+ unsigned char block_buffer[8] = {0};
+ std::uint8_t block_buffer_len = 0;
+ std::uint64_t k0 = 0;
+ std::uint64_t k1 = 0;
+ std::uint64_t v0 = 0;
+ std::uint64_t v1 = 0;
+ std::uint64_t v2 = 0;
+ std::uint64_t v3 = 0;
+ std::uint64_t hfinal = 0;
+ std::size_t total_len = 0;
+ bool finalized = false;
};
#endif
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].