Author: stefan2
Date: Thu Jun 20 22:11:31 2013
New Revision: 1495209

URL: http://svn.apache.org/r1495209
Log:
Make the hash function used by the FSFS DAG node cache
platform-independent. That should help us reproducing issues
detected on "exotic" platforms.

* subversion/libsvn_fs_fs/tree.c
  (cache_lookup): normalize chunked calculation to big endian

Patch by: stsp

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/tree.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=1495209&r1=1495208&r2=1495209&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Thu Jun 20 22:11:31 2013
@@ -355,14 +355,15 @@ cache_lookup( fs_fs_dag_cache_t *cache
      (HASH_VALUE has been initialized to REVISION). */
   for (i = 0; i + 4 <= path_len; i += 4)
 #if SVN_UNALIGNED_ACCESS_IS_OK
-    hash_value = hash_value * 0xd1f3da69 + *(const apr_uint32_t*)(path + i);
+    hash_value = hash_value * 0xd1f3da69
+               + ntohl(*(const apr_uint32_t*)(path + i));
 #else
     {
       apr_uint32_t val = 0;
       int j;
 
       for (j = 0; j < 4; j++)
-        val |= ((apr_uint32_t)(unsigned char)path[i + j] << (j * 8));
+        val = (val << 8) + (unsigned char)path[i + j];
 
       hash_value = hash_value * 0xd1f3da69 + val;
     }


Reply via email to