subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1516315 - in /subversion/branches/log-addressing/subversion: include/private/svn_subr_private.h include/svn_checksum.h libsvn_subr/checksum.c libsvn_subr/fnv1a.c
Date Wed, 21 Aug 2013 22:26:07 GMT
Author: stefan2
Date: Wed Aug 21 22:26:06 2013
New Revision: 1516315

URL: http://svn.apache.org/r1516315
Log:
On the log-addressing branch:  Normalize all FNV-1* checksum
representations to big endian that we already use in 
svn_checksum_t digests.

* subversion/include/svn_checksum.h
  (svn_checksum_kind_t): extend docstrings to describe what
                         we already do in svn_checksum_t

* subversion/include/private/svn_subr_private.h
  (svn__fnv1a_32,
   svn__fnv1a_32x4): update docstring, code needs to change

* subversion/libsvn_subr/fnv1a.c
  (finalize_fnv1a_32x4,
   svn__fnv1a_32,
   svn_fnv1a_32__finalize): return checksums in big endian

* subversion/libsvn_subr/checksum.c
  (svn_checksum,
   svn_checksum_final): simplify

Modified:
    subversion/branches/log-addressing/subversion/include/private/svn_subr_private.h
    subversion/branches/log-addressing/subversion/include/svn_checksum.h
    subversion/branches/log-addressing/subversion/libsvn_subr/checksum.c
    subversion/branches/log-addressing/subversion/libsvn_subr/fnv1a.c

Modified: subversion/branches/log-addressing/subversion/include/private/svn_subr_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/include/private/svn_subr_private.h?rev=1516315&r1=1516314&r2=1516315&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/include/private/svn_subr_private.h (original)
+++ subversion/branches/log-addressing/subversion/include/private/svn_subr_private.h Wed Aug
21 22:26:06 2013
@@ -269,6 +269,7 @@ svn_checksum__from_digest_fnv1a_32x4(con
 
 /**
  * Return a 32 bit FNV-1a checksum for the first @a len bytes in @a input.
+ * The representation is in Big Endian.
  *
  * @since New in 1.9
  */
@@ -277,7 +278,7 @@ svn__fnv1a_32(const void *input, apr_siz
 
 /**
  * Return a 32 bit modified FNV-1a checksum for the first @a len bytes in
- * @a input.
+ * @a input.  The representation is in Big Endian.
  * 
  * @note This is a proprietary checksumming algorithm based FNV-1a with
  *       approximately the same strength.  It is up to 4 times faster

Modified: subversion/branches/log-addressing/subversion/include/svn_checksum.h
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/include/svn_checksum.h?rev=1516315&r1=1516314&r2=1516315&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/include/svn_checksum.h (original)
+++ subversion/branches/log-addressing/subversion/include/svn_checksum.h Wed Aug 21 22:26:06
2013
@@ -50,11 +50,13 @@ typedef enum svn_checksum_kind_t
   /** The checksum is (or should be set to) a SHA1 checksum. */
   svn_checksum_sha1,
 
-  /** The checksum is (or should be set to) a FNV-1a 32 bit checksum.
+  /** The checksum is (or should be set to) a FNV-1a 32 bit checksum,
+   * in big endian byte order.
    * @since New in 1.9. */
   svn_checksum_fnv1a_32,
 
-  /** The checksum is (or should be set to) a modified FNV-1a 32 bit
+  /** The checksum is (or should be set to) a modified FNV-1a 32 bit,
+   * in big endian byte order.
    * @since New in 1.9. */
   svn_checksum_fnv1a_32x4
 } svn_checksum_kind_t;

Modified: subversion/branches/log-addressing/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_subr/checksum.c?rev=1516315&r1=1516314&r2=1516315&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_subr/checksum.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_subr/checksum.c Wed Aug 21 22:26:06
2013
@@ -21,8 +21,6 @@
  * ====================================================================
  */
 
-#define APR_WANT_BYTEFUNC
-
 #include <ctype.h>
 
 #include <apr_md5.h>
@@ -464,13 +462,11 @@ svn_checksum(svn_checksum_t **checksum,
         break;
 
       case svn_checksum_fnv1a_32:
-        *(apr_uint32_t *)(*checksum)->digest
-          = htonl(svn__fnv1a_32(data, len));
+        *(apr_uint32_t *)(*checksum)->digest = svn__fnv1a_32(data, len);
         break;
 
       case svn_checksum_fnv1a_32x4:
-        *(apr_uint32_t *)(*checksum)->digest
-          = htonl(svn__fnv1a_32x4(data, len));
+        *(apr_uint32_t *)(*checksum)->digest = svn__fnv1a_32x4(data, len);
         break;
 
       default:
@@ -593,12 +589,12 @@ svn_checksum_final(svn_checksum_t **chec
 
       case svn_checksum_fnv1a_32:
         *(apr_uint32_t *)(*checksum)->digest
-          = htonl(svn_fnv1a_32__finalize(ctx->apr_ctx));
+          = svn_fnv1a_32__finalize(ctx->apr_ctx);
         break;
 
       case svn_checksum_fnv1a_32x4:
         *(apr_uint32_t *)(*checksum)->digest
-          = htonl(svn_fnv1a_32x4__finalize(ctx->apr_ctx));
+          = svn_fnv1a_32x4__finalize(ctx->apr_ctx);
         break;
 
       default:

Modified: subversion/branches/log-addressing/subversion/libsvn_subr/fnv1a.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_subr/fnv1a.c?rev=1516315&r1=1516314&r2=1516315&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_subr/fnv1a.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_subr/fnv1a.c Wed Aug 21 22:26:06
2013
@@ -21,6 +21,7 @@
  * ====================================================================
  */
 
+#define APR_WANT_BYTEFUNC
 
 #include <assert.h>
 #include <apr.h>
@@ -104,15 +105,15 @@ finalize_fnv1a_32x4(apr_uint32_t hashes[
   if (len)
     memcpy(final_data + sizeof(apr_uint32_t) * SCALING, input, len);
 
-  return fnv1a_32(FNV1_BASE_32,
-                  final_data,
-                  sizeof(apr_uint32_t) * SCALING + len);
+  return htonl(fnv1a_32(FNV1_BASE_32,
+                        final_data,
+                        sizeof(apr_uint32_t) * SCALING + len));
 }
 
 apr_uint32_t
 svn__fnv1a_32(const void *input, apr_size_t len)
 {
-  return fnv1a_32(FNV1_BASE_32, input, len);
+  return htonl(fnv1a_32(FNV1_BASE_32, input, len));
 }
 
 apr_uint32_t
@@ -152,7 +153,7 @@ svn_fnv1a_32__update(svn_fnv1a_32__conte
 apr_uint32_t
 svn_fnv1a_32__finalize(svn_fnv1a_32__context_t *context)
 {
-  return context->hash;
+  return htonl(context->hash);
 }
 
 



Mime
View raw message