Author: stsp
Date: Thu May 7 08:54:59 2015
New Revision: 1678147
URL: http://svn.apache.org/r1678147
Log:
Provide slightly more specific error messages when parsing hashes.
* subversion/libsvn_subr/hash.c
(svn_hash__read_entry): In error messages, hint at which part of the
serialized hash failed to parse, rather than using the same error
message in all failure cases. Fix typo in comment while here.
Modified:
subversion/trunk/subversion/libsvn_subr/hash.c
Modified: subversion/trunk/subversion/libsvn_subr/hash.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/hash.c?rev=1678147&r1=1678146&r2=1678147&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/hash.c (original)
+++ subversion/trunk/subversion/libsvn_subr/hash.c Thu May 7 08:54:59 2015
@@ -135,7 +135,7 @@ svn_hash__read_entry(svn_hash__entry_t *
0, APR_SIZE_MAX, 10);
if (err)
return svn_error_create(SVN_ERR_MALFORMED_FILE, err,
- _("Serialized hash malformed"));
+ _("Serialized hash malformed key length"));
entry->keylen = (apr_size_t)ui64;
/* Now read that much into a buffer. */
@@ -148,19 +148,19 @@ svn_hash__read_entry(svn_hash__entry_t *
SVN_ERR(svn_stream_read_full(stream, &c, &len));
if (c != '\n')
return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
- _("Serialized hash malformed"));
+ _("Serialized hash malformed key data"));
/* Read a val length line */
SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eof, pool));
if ((buf->data[0] == 'V') && (buf->data[1] == ' '))
{
- /* Get the length of the key */
+ /* Get the length of the val */
err = svn_cstring_strtoui64(&ui64, buf->data + 2,
0, APR_SIZE_MAX, 10);
if (err)
return svn_error_create(SVN_ERR_MALFORMED_FILE, err,
- _("Serialized hash malformed"));
+ _("Serialized hash malformed value
length"));
entry->vallen = (apr_size_t)ui64;
entry->val = apr_palloc(pool, entry->vallen + 1);
@@ -172,7 +172,7 @@ svn_hash__read_entry(svn_hash__entry_t *
SVN_ERR(svn_stream_read_full(stream, &c, &len));
if (c != '\n')
return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
- _("Serialized hash malformed"));
+ _("Serialized hash malformed value data"));
}
else
return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
@@ -186,7 +186,7 @@ svn_hash__read_entry(svn_hash__entry_t *
0, APR_SIZE_MAX, 10);
if (err)
return svn_error_create(SVN_ERR_MALFORMED_FILE, err,
- _("Serialized hash malformed"));
+ _("Serialized hash malformed key length"));
entry->keylen = (apr_size_t)ui64;
/* Now read that much into a buffer. */
@@ -199,7 +199,7 @@ svn_hash__read_entry(svn_hash__entry_t *
SVN_ERR(svn_stream_read_full(stream, &c, &len));
if (c != '\n')
return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
- _("Serialized hash malformed"));
+ _("Serialized hash malformed key data"));
/* Remove this hash entry. */
entry->vallen = 0;