Repository: trafficserver
Updated Branches:
  refs/heads/master 651ccded8 -> 465b2cb2f


Fix indentation


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/465b2cb2
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/465b2cb2
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/465b2cb2

Branch: refs/heads/master
Commit: 465b2cb2fc058418524187c856b4712de6b0860b
Parents: 651ccde
Author: Phil Sorber <[email protected]>
Authored: Sat Aug 9 19:39:54 2014 -0600
Committer: Phil Sorber <[email protected]>
Committed: Sat Aug 9 19:39:54 2014 -0600

----------------------------------------------------------------------
 lib/ts/ConsistentHash.cc | 268 +++++++++++++++++++++---------------------
 lib/ts/ConsistentHash.h  |  22 ++--
 lib/ts/Hash.cc           |  33 +++---
 lib/ts/Hash.h            |  34 +++---
 lib/ts/HashFNV.cc        |  70 ++++++-----
 lib/ts/HashFNV.h         |  26 ++--
 lib/ts/HashSip.cc        | 171 ++++++++++++++-------------
 lib/ts/HashSip.h         |  23 ++--
 8 files changed, 341 insertions(+), 306 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/465b2cb2/lib/ts/ConsistentHash.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ConsistentHash.cc b/lib/ts/ConsistentHash.cc
index 69b414b..e39edbd 100644
--- a/lib/ts/ConsistentHash.cc
+++ b/lib/ts/ConsistentHash.cc
@@ -28,155 +28,161 @@
 #include <cstdio>
 
 std::ostream &
-operator << (std::ostream & os, ATSConsistentHashNode & thing) {
-    return os << thing.name;
+operator << (std::ostream & os, ATSConsistentHashNode & thing)
+{
+  return os << thing.name;
 }
 
-ATSConsistentHash::ATSConsistentHash(int r, ATSHash64 *h) : replicas(r), 
hash(h) {
+ATSConsistentHash::ATSConsistentHash(int r, ATSHash64 *h) : replicas(r), 
hash(h)
+{
 }
 
 void
-ATSConsistentHash::insert(ATSConsistentHashNode *node, float weight, ATSHash64 
*h) {
-    int i;
-    char numstr[256];
-    ATSHash64 *thash;
-    std::ostringstream string_stream;
-    std::string std_string;
-
-    if (h) {
-        thash = h;
-    } else if (hash) {
-        thash = hash;
-    } else {
-        return;
-    }
-
-    string_stream << *node;
-    std_string = string_stream.str();
-
-    for (i = 0; i < (int) roundf(replicas * weight); i++) {
-        snprintf(numstr, 256, "%d-", i);
-        thash->update(numstr, strlen(numstr));
-        thash->update(std_string.c_str(), strlen(std_string.c_str()));
-        thash->final();
-        
NodeMap.insert(std::pair<uint64_t,ATSConsistentHashNode*>(thash->get(), node));
-        thash->clear();
-    }
+ATSConsistentHash::insert(ATSConsistentHashNode * node, float weight, 
ATSHash64 *h)
+{
+  int i;
+  char numstr[256];
+  ATSHash64 *thash;
+  std::ostringstream string_stream;
+  std::string std_string;
+
+  if (h) {
+    thash = h;
+  } else if (hash) {
+    thash = hash;
+  } else {
+    return;
+  }
+
+  string_stream << *node;
+  std_string = string_stream.str();
+
+  for (i = 0; i < (int) roundf(replicas * weight); i++) {
+    snprintf(numstr, 256, "%d-", i);
+    thash->update(numstr, strlen(numstr));
+    thash->update(std_string.c_str(), strlen(std_string.c_str()));
+    thash->final();
+    NodeMap.insert(std::pair<uint64_t, ATSConsistentHashNode *>(thash->get(), 
node));
+    thash->clear();
+  }
 }
 
-ATSConsistentHashNode*
-ATSConsistentHash::lookup(const char *url, ATSConsistentHashIter *i, bool *w, 
ATSHash64 *h) {
-    uint64_t url_hash;
-    ATSConsistentHashIter NodeMapIterUp, *iter;
-    ATSHash64 *thash;
-    bool *wptr, wrapped = false;
-
-    if (h) {
-        thash = h;
-    } else if (hash) {
-        thash = hash;
-    } else {
-        return NULL;
-    }
-
-    if (w) {
-        wptr = w;
-    } else {
-        wptr = &wrapped;
-    }
+ATSConsistentHashNode *
+ATSConsistentHash::lookup(const char *url, ATSConsistentHashIter *i, bool *w, 
ATSHash64 *h)
+{
+  uint64_t url_hash;
+  ATSConsistentHashIter NodeMapIterUp, *iter;
+  ATSHash64 *thash;
+  bool *wptr, wrapped = false;
+
+  if (h) {
+    thash = h;
+  } else if (hash) {
+    thash = hash;
+  } else {
+    return NULL;
+  }
+
+  if (w) {
+    wptr = w;
+  } else {
+    wptr = &wrapped;
+  }
+
+  if (i) {
+    iter = i;
+  } else {
+    iter = &NodeMapIterUp;
+  }
+
+  if (url) {
+    thash->update(url, strlen(url));
+    thash->final();
+    url_hash = thash->get();
+    thash->clear();
+
+    *iter = NodeMap.lower_bound(url_hash);
 
-    if (i) {
-        iter = i;
-    } else {
-        iter = &NodeMapIterUp;
+    if (*iter == NodeMap.end()) {
+      *wptr = true;
+      *iter = NodeMap.begin();
     }
 
-    if (url) {
-        thash->update(url, strlen(url));
-        thash->final();
-        url_hash = thash->get();
-        thash->clear();
+  } else {
+    (*iter)++;
+  }
 
-        *iter = NodeMap.lower_bound(url_hash);
+  if (!(*wptr) && *iter == NodeMap.end()) {
+    *wptr = true;
+    *iter = NodeMap.begin();
+  }
 
-        if (*iter == NodeMap.end()) {
-            *wptr = true;
-            *iter = NodeMap.begin();
-        }
-
-    } else {
-        (*iter)++;
-    }
-
-    if (!(*wptr) && *iter == NodeMap.end()) {
-        *wptr = true;
-        *iter = NodeMap.begin();
-    }
-
-    if (*wptr && *iter == NodeMap.end()) {
-        return NULL;
-    }
+  if (*wptr && *iter == NodeMap.end()) {
+    return NULL;
+  }
 
-    return (*iter)->second;
+  return (*iter)->second;
 }
 
-ATSConsistentHashNode*
-ATSConsistentHash::lookup_available(const char *url, ATSConsistentHashIter *i, 
bool *w, ATSHash64 *h) {
-    uint64_t url_hash;
-    ATSConsistentHashIter NodeMapIterUp, *iter;
-    ATSHash64 *thash;
-    bool *wptr, wrapped = false;
-
-    if (h) {
-        thash = h;
-    } else if (hash) {
-        thash = hash;
-    } else {
-        return NULL;
-    }
-
-    if (w) {
-        wptr = w;
-    } else {
-        wptr = &wrapped;
-    }
-
-    if (i) {
-        iter = i;
-    } else {
-        iter = &NodeMapIterUp;
-    }
-
-    if (url) {
-        thash->update(url, strlen(url));
-        thash->final();
-        url_hash = thash->get();
-        thash->clear();
-
-        *iter = NodeMap.lower_bound(url_hash);
-    }
-
-    if (*iter == NodeMap.end()) {
-        *wptr = true;
-        *iter = NodeMap.begin();
-    }
+ATSConsistentHashNode *
+ATSConsistentHash::lookup_available(const char *url, ATSConsistentHashIter *i, 
bool *w, ATSHash64 *h)
+{
+  uint64_t url_hash;
+  ATSConsistentHashIter NodeMapIterUp, *iter;
+  ATSHash64 *thash;
+  bool *wptr, wrapped = false;
+
+  if (h) {
+    thash = h;
+  } else if (hash) {
+    thash = hash;
+  } else {
+    return NULL;
+  }
+
+  if (w) {
+    wptr = w;
+  } else {
+    wptr = &wrapped;
+  }
+
+  if (i) {
+    iter = i;
+  } else {
+    iter = &NodeMapIterUp;
+  }
+
+  if (url) {
+    thash->update(url, strlen(url));
+    thash->final();
+    url_hash = thash->get();
+    thash->clear();
+
+    *iter = NodeMap.lower_bound(url_hash);
+  }
+
+  if (*iter == NodeMap.end()) {
+    *wptr = true;
+    *iter = NodeMap.begin();
+  }
+
+  while (!(*iter)->second->available) {
+    (*iter)++;
 
-    while (!(*iter)->second->available) {
-        (*iter)++;
-
-        if (!(*wptr) && *iter == NodeMap.end()) {
-            *wptr = true;
-            *iter = NodeMap.begin();
-        } else if (*wptr && *iter == NodeMap.end()) {
-            return NULL;
-        }
+    if (!(*wptr) && *iter == NodeMap.end()) {
+      *wptr = true;
+      *iter = NodeMap.begin();
+    } else if (*wptr && *iter == NodeMap.end()) {
+      return NULL;
     }
+  }
 
-    return (*iter)->second;
+  return (*iter)->second;
 }
 
-ATSConsistentHash::~ATSConsistentHash() {
-    if (hash) {
-        delete hash;
-    }
+ATSConsistentHash::~ATSConsistentHash()
+{
+  if (hash) {
+    delete hash;
+  }
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/465b2cb2/lib/ts/ConsistentHash.h
----------------------------------------------------------------------
diff --git a/lib/ts/ConsistentHash.h b/lib/ts/ConsistentHash.h
index b6efd85..7704c7a 100644
--- a/lib/ts/ConsistentHash.h
+++ b/lib/ts/ConsistentHash.h
@@ -33,14 +33,14 @@
 
 struct ATSConsistentHashNode
 {
-    bool available;
-    char *name;
+  bool available;
+  char *name;
 };
 
 std::ostream &
 operator<< (std::ostream & os, ATSConsistentHashNode & thing);
 
-typedef std::map<uint64_t,ATSConsistentHashNode*>::iterator 
ATSConsistentHashIter;
+typedef std::map<uint64_t, ATSConsistentHashNode *>::iterator 
ATSConsistentHashIter;
 
 /*
   TSConsistentHash requires a TSHash64 object
@@ -50,16 +50,16 @@ typedef std::map<uint64_t,ATSConsistentHashNode*>::iterator 
ATSConsistentHashIte
 
 struct ATSConsistentHash
 {
-    ATSConsistentHash(int r = 1024, ATSHash64 *h = NULL);
-    void insert(ATSConsistentHashNode *node, float weight = 1.0, ATSHash64 *h 
= NULL);
-    ATSConsistentHashNode *lookup(const char *url = NULL, 
ATSConsistentHashIter *i = NULL, bool *w = NULL, ATSHash64 *h = NULL);
-    ATSConsistentHashNode *lookup_available(const char *url = NULL, 
ATSConsistentHashIter *i = NULL, bool *w = NULL, ATSHash64 *h = NULL);
-    ~ATSConsistentHash();
+  ATSConsistentHash(int r = 1024, ATSHash64 *h = NULL);
+  void insert(ATSConsistentHashNode *node, float weight = 1.0, ATSHash64 *h = 
NULL);
+  ATSConsistentHashNode *lookup(const char *url = NULL, ATSConsistentHashIter 
*i = NULL, bool *w = NULL, ATSHash64 *h = NULL);
+  ATSConsistentHashNode *lookup_available(const char *url = NULL, 
ATSConsistentHashIter *i = NULL, bool *w = NULL, ATSHash64 *h = NULL);
+  ~ATSConsistentHash();
 
 private:
-    int replicas;
-    ATSHash64 *hash;
-    std::map<uint64_t, ATSConsistentHashNode*> NodeMap;
+  int replicas;
+  ATSHash64 *hash;
+  std::map<uint64_t, ATSConsistentHashNode *> NodeMap;
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/465b2cb2/lib/ts/Hash.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Hash.cc b/lib/ts/Hash.cc
index a0931ef..d36c96a 100644
--- a/lib/ts/Hash.cc
+++ b/lib/ts/Hash.cc
@@ -22,27 +22,32 @@
 #include "Hash.h"
 #include <cstring>
 
-ATSHashBase::~ATSHashBase() {
+ATSHashBase::~ATSHashBase()
+{
 }
 
 bool
-ATSHash::operator==(const ATSHash & other) const {
-    if (this->size() != other.size()) {
-        return false;
-    }
-    if (memcmp(this->get(), other.get(), this->size()) == 0) {
-        return true;
-    } else {
-        return false;
-    }
+ATSHash::operator==(const ATSHash & other) const
+{
+  if (this->size() != other.size())
+  {
+    return false;
+  }
+  if (memcmp(this->get(), other.get(), this->size()) == 0) {
+    return true;
+  } else {
+    return false;
+  }
 }
 
 bool
-ATSHash32::operator==(const ATSHash32 & other) const {
-    return this->get() == other.get();
+ATSHash32::operator==(const ATSHash32 & other) const
+{
+  return this->get() == other.get();
 }
 
 bool
-ATSHash64::operator==(const ATSHash64 & other) const {
-    return this->get() == other.get();
+ATSHash64::operator==(const ATSHash64 & other) const
+{
+  return this->get() == other.get();
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/465b2cb2/lib/ts/Hash.h
----------------------------------------------------------------------
diff --git a/lib/ts/Hash.h b/lib/ts/Hash.h
index c0e621c..bd67e2c 100644
--- a/lib/ts/Hash.h
+++ b/lib/ts/Hash.h
@@ -25,27 +25,31 @@
 #include <cstddef>
 #include <stdint.h>
 
-struct ATSHashBase {
-    virtual void update(const void *, size_t) = 0;
-    virtual void final(void) = 0;
-    virtual void clear(void) = 0;
-    virtual ~ATSHashBase();
+struct ATSHashBase
+{
+  virtual void update(const void *, size_t) = 0;
+  virtual void final(void) = 0;
+  virtual void clear(void) = 0;
+  virtual ~ATSHashBase();
 };
 
-struct ATSHash : ATSHashBase {
-    virtual const void *get(void) const = 0;
-    virtual size_t size(void) const = 0;
-    virtual bool operator==(const ATSHash &) const;
+struct ATSHash:ATSHashBase
+{
+  virtual const void *get(void) const = 0;
+  virtual size_t size(void) const = 0;
+  virtual bool operator==(const ATSHash &) const;
 };
 
-struct ATSHash32 : ATSHashBase {
-    virtual uint32_t get(void) const = 0;
-    virtual bool operator==(const ATSHash32 &) const;
+struct ATSHash32:ATSHashBase
+{
+  virtual uint32_t get(void) const = 0;
+  virtual bool operator==(const ATSHash32 &) const;
 };
 
-struct ATSHash64 : ATSHashBase {
-    virtual uint64_t get(void) const = 0;
-    virtual bool operator==(const ATSHash64 &) const;
+struct ATSHash64:ATSHashBase
+{
+  virtual uint64_t get(void) const = 0;
+  virtual bool operator==(const ATSHash64 &) const;
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/465b2cb2/lib/ts/HashFNV.cc
----------------------------------------------------------------------
diff --git a/lib/ts/HashFNV.cc b/lib/ts/HashFNV.cc
index 4931cd5..36042a9 100644
--- a/lib/ts/HashFNV.cc
+++ b/lib/ts/HashFNV.cc
@@ -13,61 +13,71 @@
 #define FNV_INIT_64 ((uint64_t)0xcbf29ce484222325ULL)
 
 // FNV-1a 64bit
-ATSHash32FNV1a::ATSHash32FNV1a(void) {
-    this->clear();
+ATSHash32FNV1a::ATSHash32FNV1a(void)
+{
+  this->clear();
 }
 
 void
-ATSHash32FNV1a::update(const void *data, size_t len) {
-    uint8_t *bp = (uint8_t *) data;
-    uint8_t *be = bp + len;
-
-    while (bp < be) {
-        hval ^= (uint32_t) *bp++;
-        hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval 
<< 24);
-    }
+ATSHash32FNV1a::update(const void *data, size_t len)
+{
+  uint8_t *bp = (uint8_t *) data;
+  uint8_t *be = bp + len;
+
+  while (bp < be) {
+    hval ^= (uint32_t) *bp++;
+    hval += (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) + (hval << 
24);
+  }
 }
 
 void
-ATSHash32FNV1a::final(void) {
+ATSHash32FNV1a::final(void)
+{
 }
 
 uint32_t
-ATSHash32FNV1a::get(void) const {
-    return hval;
+ATSHash32FNV1a::get(void) const
+{
+  return hval;
 }
 
 void
-ATSHash32FNV1a::clear(void) {
-    hval = FNV_INIT_32;
+ATSHash32FNV1a::clear(void)
+{
+  hval = FNV_INIT_32;
 }
 
 // FNV-1a 64bit
-ATSHash64FNV1a::ATSHash64FNV1a(void) {
-    this->clear();
+ATSHash64FNV1a::ATSHash64FNV1a(void)
+{
+  this->clear();
 }
 
 void
-ATSHash64FNV1a::update(const void *data, size_t len) {
-    uint8_t *bp = (uint8_t *) data;
-    uint8_t *be = bp + len;
-
-    while (bp < be) {
-        hval ^= (uint64_t) *bp++;
-        hval += (hval << 1) + (hval << 4) + (hval << 5) + (hval << 7) + (hval 
<< 8) + (hval << 40);
-    }
+ATSHash64FNV1a::update(const void *data, size_t len)
+{
+  uint8_t *bp = (uint8_t *) data;
+  uint8_t *be = bp + len;
+
+  while (bp < be) {
+    hval ^= (uint64_t) *bp++;
+    hval += (hval << 1) + (hval << 4) + (hval << 5) + (hval << 7) + (hval << 
8) + (hval << 40);
+  }
 }
 
 void
-ATSHash64FNV1a::final(void) {
+ATSHash64FNV1a::final(void)
+{
 }
 
 uint64_t
-ATSHash64FNV1a::get(void) const {
-    return hval;
+ATSHash64FNV1a::get(void) const
+{
+  return hval;
 }
 
 void
-ATSHash64FNV1a::clear(void) {
-    hval = FNV_INIT_64;
+ATSHash64FNV1a::clear(void)
+{
+  hval = FNV_INIT_64;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/465b2cb2/lib/ts/HashFNV.h
----------------------------------------------------------------------
diff --git a/lib/ts/HashFNV.h b/lib/ts/HashFNV.h
index 3be6038..9fec580 100644
--- a/lib/ts/HashFNV.h
+++ b/lib/ts/HashFNV.h
@@ -31,23 +31,25 @@
 #include "Hash.h"
 #include <stdint.h>
 
-struct ATSHash32FNV1a : ATSHash32 {
-    ATSHash32FNV1a(void);
-    void update(const void *data, size_t len);
-    void final(void);
-    uint32_t get(void) const;
-    void clear(void);
+struct ATSHash32FNV1a:ATSHash32
+{
+  ATSHash32FNV1a(void);
+  void update(const void *data, size_t len);
+  void final(void);
+  uint32_t get(void) const;
+  void clear(void);
 
 private:
     uint32_t hval;
 };
 
-struct ATSHash64FNV1a : ATSHash64 {
-    ATSHash64FNV1a(void);
-    void update(const void *data, size_t len);
-    void final(void);
-    uint64_t get(void) const;
-    void clear(void);
+struct ATSHash64FNV1a:ATSHash64
+{
+  ATSHash64FNV1a(void);
+  void update(const void *data, size_t len);
+  void final(void);
+  uint64_t get(void) const;
+  void clear(void);
 
 private:
     uint64_t hval;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/465b2cb2/lib/ts/HashSip.cc
----------------------------------------------------------------------
diff --git a/lib/ts/HashSip.cc b/lib/ts/HashSip.cc
index ac1632f..6ccb6d6 100644
--- a/lib/ts/HashSip.cc
+++ b/lib/ts/HashSip.cc
@@ -33,106 +33,113 @@ https://github.com/floodyberry/siphash
     x3 ^= x0; \
     x2 = ROTL64(x2,32);
 
-ATSHash64Sip24::ATSHash64Sip24(void) {
-    k0 = 0;
-    k1 = 0;
-    this->clear();
+ATSHash64Sip24::ATSHash64Sip24(void)
+{
+  k0 = 0;
+  k1 = 0;
+  this->clear();
 }
 
-ATSHash64Sip24::ATSHash64Sip24(const unsigned char key[16]) {
-    k0 = U8TO64_LE(key);
-    k1 = U8TO64_LE(key + sizeof(k0));
-    this->clear();
+ATSHash64Sip24::ATSHash64Sip24(const unsigned char key[16])
+{
+  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();
+ATSHash64Sip24::ATSHash64Sip24(uint64_t key0, uint64_t key1)
+{
+  k0 = key0;
+  k1 = key1;
+  this->clear();
 }
 
 void
-ATSHash64Sip24::update(const void *data, size_t len) {
-    size_t i, blocks;
-    unsigned char *m;
-    uint64_t mi;
-    uint8_t block_off = 0;
-
-    if (!finalized) {
-        m = (unsigned char *) data;
-        total_len += len;
-
-        if (len + block_buffer_len < SIP_BLOCK_SIZE) {
-            memcpy(block_buffer + block_buffer_len, m, len);
-            block_buffer_len += len;
-        } else {
-            if (block_buffer_len > 0) {
-                block_off = SIP_BLOCK_SIZE - block_buffer_len;
-                memcpy(block_buffer + block_buffer_len, m, block_off);
-
-                mi = U8TO64_LE(block_buffer);
-                v3 ^= mi;
-                SIPCOMPRESS(v0, v1, v2, v3);
-                SIPCOMPRESS(v0, v1, v2, v3);
-                v0 ^= mi;
-            }
-
-            for (i = block_off, blocks = ((len - block_off) & ~(SIP_BLOCK_SIZE 
- 1)); i < blocks; i += SIP_BLOCK_SIZE) {
-                mi = U8TO64_LE(m + i);
-                v3 ^= mi;
-                SIPCOMPRESS(v0, v1, v2, v3);
-                SIPCOMPRESS(v0, v1, v2, v3);
-                v0 ^= mi;
-            }
-
-            block_buffer_len = (len - block_off) & (SIP_BLOCK_SIZE - 1);
-            memcpy(block_buffer, m + block_off + blocks, block_buffer_len);
-        }
+ATSHash64Sip24::update(const void *data, size_t len)
+{
+  size_t i, blocks;
+  unsigned char *m;
+  uint64_t mi;
+  uint8_t block_off = 0;
+
+  if (!finalized) {
+    m = (unsigned char *) data;
+    total_len += len;
+
+    if (len + block_buffer_len < SIP_BLOCK_SIZE) {
+      memcpy(block_buffer + block_buffer_len, m, len);
+      block_buffer_len += len;
+    } else {
+      if (block_buffer_len > 0) {
+        block_off = SIP_BLOCK_SIZE - block_buffer_len;
+        memcpy(block_buffer + block_buffer_len, m, block_off);
+
+        mi = U8TO64_LE(block_buffer);
+        v3 ^= mi;
+        SIPCOMPRESS(v0, v1, v2, v3);
+        SIPCOMPRESS(v0, v1, v2, v3);
+        v0 ^= mi;
+      }
+
+      for (i = block_off, blocks = ((len - block_off) & ~(SIP_BLOCK_SIZE - 
1)); i < blocks; i += SIP_BLOCK_SIZE) {
+        mi = U8TO64_LE(m + i);
+        v3 ^= mi;
+        SIPCOMPRESS(v0, v1, v2, v3);
+        SIPCOMPRESS(v0, v1, v2, v3);
+        v0 ^= mi;
+      }
+
+      block_buffer_len = (len - block_off) & (SIP_BLOCK_SIZE - 1);
+      memcpy(block_buffer, m + block_off + blocks, block_buffer_len);
     }
+  }
 }
 
 void
-ATSHash64Sip24::final(void) {
-    uint64_t last7;
-    int i;
-
-    if (!finalized) {
-        last7 = (uint64_t) (total_len & 0xff) << 56;
+ATSHash64Sip24::final(void)
+{
+  uint64_t last7;
+  int i;
 
-        for (i = block_buffer_len - 1; i >= 0; i--) {
-            last7 |= (uint64_t) block_buffer[i] << (i * 8);
-        }
+  if (!finalized) {
+    last7 = (uint64_t) (total_len & 0xff) << 56;
 
-        v3 ^= last7;
-        SIPCOMPRESS(v0, v1, v2, v3);
-        SIPCOMPRESS(v0, v1, v2, v3);
-        v0 ^= last7;
-        v2 ^= 0xff;
-        SIPCOMPRESS(v0, v1, v2, v3);
-        SIPCOMPRESS(v0, v1, v2, v3);
-        SIPCOMPRESS(v0, v1, v2, v3);
-        SIPCOMPRESS(v0, v1, v2, v3);
-        hfinal = v0 ^ v1 ^ v2 ^ v3;
-        finalized = true;
+    for (i = block_buffer_len - 1; i >= 0; i--) {
+      last7 |= (uint64_t) block_buffer[i] << (i * 8);
     }
+
+    v3 ^= last7;
+    SIPCOMPRESS(v0, v1, v2, v3);
+    SIPCOMPRESS(v0, v1, v2, v3);
+    v0 ^= last7;
+    v2 ^= 0xff;
+    SIPCOMPRESS(v0, v1, v2, v3);
+    SIPCOMPRESS(v0, v1, v2, v3);
+    SIPCOMPRESS(v0, v1, v2, v3);
+    SIPCOMPRESS(v0, v1, v2, v3);
+    hfinal = v0 ^ v1 ^ v2 ^ v3;
+    finalized = true;
+  }
 }
 
 uint64_t
-ATSHash64Sip24::get(void) const {
-    if (finalized) {
-        return hfinal;
-    } else {
-        return 0;
-    }
+ATSHash64Sip24::get(void) const
+{
+  if (finalized) {
+    return hfinal;
+  } else {
+    return 0;
+  }
 }
 
 void
-ATSHash64Sip24::clear(void) {
-    v0 = k0 ^ 0x736f6d6570736575ull;
-    v1 = k1 ^ 0x646f72616e646f6dull;
-    v2 = k0 ^ 0x6c7967656e657261ull;
-    v3 = k1 ^ 0x7465646279746573ull;
-    finalized = false;
-    total_len = 0;
-    block_buffer_len = 0;
+ATSHash64Sip24::clear(void)
+{
+  v0 = k0 ^ 0x736f6d6570736575ull;
+  v1 = k1 ^ 0x646f72616e646f6dull;
+  v2 = k0 ^ 0x6c7967656e657261ull;
+  v3 = k1 ^ 0x7465646279746573ull;
+  finalized = false;
+  total_len = 0;
+  block_buffer_len = 0;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/465b2cb2/lib/ts/HashSip.h
----------------------------------------------------------------------
diff --git a/lib/ts/HashSip.h b/lib/ts/HashSip.h
index 80fe733..30b99c7 100644
--- a/lib/ts/HashSip.h
+++ b/lib/ts/HashSip.h
@@ -32,21 +32,22 @@
   a zero key for you.
  */
 
-struct ATSHash64Sip24 : ATSHash64 {
-    ATSHash64Sip24(void);
+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);
-    void final(void);
-    uint64_t get(void) const;
-    void clear(void);
+  void update(const void *data, size_t len);
+  void final(void);
+  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];
+  uint8_t block_buffer_len;
+  uint64_t k0, k1, v0, v1, v2, v3, hfinal;
+  size_t total_len;
+  bool finalized;
 };
 
 #endif

Reply via email to