Author: stefan2
Date: Mon Aug 24 13:17:39 2015
New Revision: 1697384
URL: http://svn.apache.org/r1697384
Log:
Fix an inconsistency between 'svnfsfs dump-index' and 'svnfsfs load-index'.
While the first writes decimal item numbers, the load would interpret them
as hex. Read them as decimal now.
* subversion/svnfsfs/load-index-cmd.c
(token_to_i64): Make the RADIX selectable.
(parse_index_line): Parse each column with the appropriate radix.
Modified:
subversion/trunk/subversion/svnfsfs/load-index-cmd.c
Modified: subversion/trunk/subversion/svnfsfs/load-index-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnfsfs/load-index-cmd.c?rev=1697384&r1=1697383&r2=1697384&view=diff
==============================================================================
--- subversion/trunk/subversion/svnfsfs/load-index-cmd.c (original)
+++ subversion/trunk/subversion/svnfsfs/load-index-cmd.c Mon Aug 24 13:17:39
2015
@@ -54,13 +54,15 @@ str_to_item_type(unsigned *type,
_("Unknown item type '%s'"), str);
}
-/* Parse the hex string given as const char * at IDX in TOKENS and return
- * its value in *VALUE_P. Check for index overflows and non-hex chars.
+/* Parse the string given as const char * at IDX in TOKENS and return its
+ * value in *VALUE_P. Assume that the string an integer with base RADIX.
+ * Check for index overflows and non-hex chars.
*/
static svn_error_t *
token_to_i64(apr_int64_t *value_p,
apr_array_header_t *tokens,
- int idx)
+ int idx,
+ int radix)
{
const char *hex;
char *end;
@@ -75,7 +77,7 @@ token_to_i64(apr_int64_t *value_p,
/* hex -> int conversion */
hex = APR_ARRAY_IDX(tokens, idx, const char *);
- value = apr_strtoi64(hex, &end, 16);
+ value = apr_strtoi64(hex, &end, radix);
/* Has the whole token be parsed without error? */
if (errno || *end != '\0')
@@ -102,11 +104,13 @@ parse_index_line(svn_fs_fs__p2l_entry_t
apr_int64_t value;
/* Parse the hex columns. */
- SVN_ERR(token_to_i64(&value, tokens, 0));
+ SVN_ERR(token_to_i64(&value, tokens, 0, 16));
result->offset = (apr_off_t)value;
- SVN_ERR(token_to_i64(&value, tokens, 1));
+ SVN_ERR(token_to_i64(&value, tokens, 1, 16));
result->size = (apr_off_t)value;
- SVN_ERR(token_to_i64(&value, tokens, 4));
+
+ /* Parse the rightmost colum that we care of. */
+ SVN_ERR(token_to_i64(&value, tokens, 4, 10));
result->item.number = (apr_uint64_t)value;
/* We now know that there were at least 5 columns.