You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/02/15 12:29:01 UTC

svn commit: r1070847 - in /subversion/trunk/subversion: include/svn_checksum.h libsvn_client/export.c libsvn_subr/checksum.c

Author: hwright
Date: Tue Feb 15 11:29:00 2011
New Revision: 1070847

URL: http://svn.apache.org/viewvc?rev=1070847&view=rev
Log:
Move the "check for mismatch" bit out of the svn_checkum_mismatch_err()
function, so that we don't have to do path localization unconditionally.

* subversion/libsvn_subr/checksum.c
  (svn_checksum_mismatch_err): Don't check for the mismatch, just create the
    error.

* subversion/include/svn_checksum.h
  (svn_checksum_mismatch_err): Update docs.

* subversion/libsvn_client/export.c
  (close_file): Restore checkum mismatch check here, but use the helper to
    create the error.

Modified:
    subversion/trunk/subversion/include/svn_checksum.h
    subversion/trunk/subversion/libsvn_client/export.c
    subversion/trunk/subversion/libsvn_subr/checksum.c

Modified: subversion/trunk/subversion/include/svn_checksum.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_checksum.h?rev=1070847&r1=1070846&r2=1070847&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_checksum.h (original)
+++ subversion/trunk/subversion/include/svn_checksum.h Tue Feb 15 11:29:00 2011
@@ -241,9 +241,12 @@ svn_checksum_size(const svn_checksum_t *
 
 
 /**
- * Return an error of type #SVN_ERR_CHECKSUM_MISMATCH if @a actual and 
- * @a expected checksums do not match, otherwise, return #SVN_NO_ERROR.
- * Use @a fmt, and the following parameters to populate the error message.
+ * Return an error of type #SVN_ERR_CHECKSUM_MISMATCH for @a actual and 
+ * @a expected checksums which do not match.  Use @a fmt, and the following
+ * parameters to populate the error message.
+ *
+ * @note This function does not actually check for the mismatch, it just
+ * constructs the error.
  *
  * @a scratch_pool is used for temporary allocations; the returned error
  * will be allocated in its own pool (as is typical).

Modified: subversion/trunk/subversion/libsvn_client/export.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/export.c?rev=1070847&r1=1070846&r2=1070847&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/export.c (original)
+++ subversion/trunk/subversion/libsvn_client/export.c Tue Feb 15 11:29:00 2011
@@ -900,9 +900,10 @@ close_file(void *file_baton,
   actual_checksum = svn_checksum__from_digest(fb->text_digest,
                                               svn_checksum_md5, pool);
 
-  SVN_ERR(svn_checksum_mismatch_err(text_checksum, actual_checksum, pool,
-                                    _("Checksum mismatch for '%s'"),
-                                    svn_dirent_local_style(fb->path, pool)));
+  if (!svn_checksum_match(text_checksum, actual_checksum))
+    return svn_checksum_mismatch_err(text_checksum, actual_checksum, pool,
+                                     _("Checksum mismatch for '%s'"),
+                                     svn_dirent_local_style(fb->path, pool));
 
   if ((! fb->eol_style_val) && (! fb->keywords_val) && (! fb->special))
     {

Modified: subversion/trunk/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/checksum.c?rev=1070847&r1=1070846&r2=1070847&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/checksum.c (original)
+++ subversion/trunk/subversion/libsvn_subr/checksum.c Tue Feb 15 11:29:00 2011
@@ -408,23 +408,18 @@ svn_checksum_mismatch_err(const svn_chec
                           const char *fmt,
                           ...)
 {
-  if (!svn_checksum_match(expected, actual))
-    {
-      va_list ap;
-      const char *desc;
+  va_list ap;
+  const char *desc;
 
-      va_start(ap, fmt);
-      desc = apr_pvsprintf(scratch_pool, fmt, ap);
-      va_end(ap);
+  va_start(ap, fmt);
+  desc = apr_pvsprintf(scratch_pool, fmt, ap);
+  va_end(ap);
     
-      return svn_error_createf(SVN_ERR_CHECKSUM_MISMATCH, NULL,
-                               _("%s:\n"
-                                 "   expected:  %s\n"
-                                 "     actual:  %s\n"),
-                    desc,               
-                    svn_checksum_to_cstring_display(expected, scratch_pool),
-                    svn_checksum_to_cstring_display(actual, scratch_pool));
-    }
-  else
-    return SVN_NO_ERROR;
+  return svn_error_createf(SVN_ERR_CHECKSUM_MISMATCH, NULL,
+                           _("%s:\n"
+                             "   expected:  %s\n"
+                             "     actual:  %s\n"),
+                desc,               
+                svn_checksum_to_cstring_display(expected, scratch_pool),
+                svn_checksum_to_cstring_display(actual, scratch_pool));
 }