subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bl...@apache.org
Subject svn commit: r1327716 - /subversion/trunk/subversion/libsvn_subr/checksum.c
Date Wed, 18 Apr 2012 22:55:01 GMT
Author: blair
Date: Wed Apr 18 22:55:01 2012
New Revision: 1327716

URL: http://svn.apache.org/viewvc?rev=1327716&view=rev
Log:
Reimplement svn_checksum_empty_checksum().

* subversion/libsvn_subr/checksum.c
  (svn_checksum_empty_checksum):
    Do not use svn_checksum__from_digest() which would results in two
    checks of the checksum's kind.

Modified:
    subversion/trunk/subversion/libsvn_subr/checksum.c

Modified: subversion/trunk/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/checksum.c?rev=1327716&r1=1327715&r2=1327716&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/checksum.c (original)
+++ subversion/trunk/subversion/libsvn_subr/checksum.c Wed Apr 18 22:55:01 2012
@@ -358,15 +358,19 @@ svn_checksum_t *
 svn_checksum_empty_checksum(svn_checksum_kind_t kind,
                             apr_pool_t *pool)
 {
+  svn_checksum_t *checksum;
+  apr_size_t digest_size;
   const unsigned char *digest;
 
   switch (kind)
     {
       case svn_checksum_md5:
+        digest_size = APR_MD5_DIGESTSIZE;
         digest = svn_md5__empty_string_digest();
         break;
 
       case svn_checksum_sha1:
+        digest_size = APR_SHA1_DIGESTSIZE;
         digest = svn_sha1__empty_string_digest();
         break;
 
@@ -375,7 +379,9 @@ svn_checksum_empty_checksum(svn_checksum
         return NULL;
     }
 
-  return svn_checksum__from_digest(digest, kind, pool);
+  checksum = checksum_create(kind, digest_size, pool);
+  memcpy((unsigned char *)checksum->digest, digest, digest_size);
+  return checksum;
 }
 
 struct svn_checksum_ctx_t



Mime
View raw message