You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/09/07 18:57:36 UTC
svn commit: r993425 -
/subversion/trunk/subversion/libsvn_fs_base/util/fs_skels.c
Author: stsp
Date: Tue Sep 7 16:57:36 2010
New Revision: 993425
URL: http://svn.apache.org/viewvc?rev=993425&view=rev
Log:
Convert use of atoi() and apr_atoi64() in the BDB skel parsing code over
to the new svn_cstring number parsing API.
* subversion/libsvn_fs_base/util/fs_skels.c
(svn_fs_base__parse_representation_skel): Use svn_cstring_strtoui64()
and svn_cstring_strtoi64() instead of atoi() and svn__atoui64().
(svn_fs_base__parse_node_revision_skel): Use svn_cstring_atoi() instead
of atoi() and apr_atoi64().
Modified:
subversion/trunk/subversion/libsvn_fs_base/util/fs_skels.c
Modified: subversion/trunk/subversion/libsvn_fs_base/util/fs_skels.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_base/util/fs_skels.c?rev=993425&r1=993424&r2=993425&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/util/fs_skels.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/util/fs_skels.c Tue Sep 7 16:57:36 2010
@@ -31,6 +31,7 @@
#include "svn_time.h"
#include "private/svn_skel.h"
+#include "private/svn_dep_compat.h"
#include "svn_checksum.h"
#include "fs_skels.h"
@@ -550,32 +551,38 @@ svn_fs_base__parse_representation_skel(r
{
svn_skel_t *window_skel = chunk_skel->children->next;
svn_skel_t *diff_skel = window_skel->children;
+ apr_int64_t val;
+ apr_uint64_t uval;
+ const char *str;
/* Allocate a chunk and its window */
chunk = apr_palloc(pool, sizeof(*chunk));
/* Populate the window */
- chunk->version
- = (apr_byte_t)atoi(apr_pstrmemdup
- (pool,
- diff_skel->children->next->data,
- diff_skel->children->next->len));
+ str = apr_pstrmemdup(pool, diff_skel->children->next->data,
+ diff_skel->children->next->len);
+ SVN_ERR(svn_cstring_strtoui64(&uval, str, 0, 255, 10));
+ chunk->version = (apr_byte_t)uval;
+
chunk->string_key
= apr_pstrmemdup(pool,
diff_skel->children->next->next->data,
diff_skel->children->next->next->len);
- chunk->size
- = atoi(apr_pstrmemdup(pool,
- window_skel->children->next->data,
- window_skel->children->next->len));
+
+ str = apr_pstrmemdup(pool, window_skel->children->next->data,
+ window_skel->children->next->len);
+ SVN_ERR(svn_cstring_strtoui64(&uval, str, 0, APR_SIZE_MAX, 10));
+ chunk->size = (apr_size_t)uval;
+
chunk->rep_key
= apr_pstrmemdup(pool,
window_skel->children->next->next->data,
window_skel->children->next->next->len);
- chunk->offset =
- svn__atoui64(apr_pstrmemdup(pool,
- chunk_skel->children->data,
- chunk_skel->children->len));
+
+ str = apr_pstrmemdup(pool, chunk_skel->children->data,
+ chunk_skel->children->len);
+ SVN_ERR(svn_cstring_strtoi64(&val, str, 0, APR_INT64_MAX, 10));
+ chunk->offset = (svn_filesize_t)val;
/* Add this chunk to the array. */
APR_ARRAY_PUSH(chunks, rep_delta_chunk_t *) = chunk;
@@ -633,24 +640,28 @@ svn_fs_base__parse_node_revision_skel(no
noderev->predecessor_count = -1;
if (cur_skel->next)
{
+ const char *str;
+
cur_skel = cur_skel->next;
if (cur_skel->len)
- noderev->predecessor_count = atoi(apr_pstrmemdup(pool,
- cur_skel->data,
- cur_skel->len));
+ {
+ str = apr_pstrmemdup(pool, cur_skel->data, cur_skel->len);
+ SVN_ERR(svn_cstring_atoi(&noderev->predecessor_count, str));
+ }
/* HAS-MERGEINFO and MERGEINFO-COUNT */
if (cur_skel->next)
{
+ int val;
+
cur_skel = cur_skel->next;
- noderev->has_mergeinfo = atoi(apr_pstrmemdup(pool,
- cur_skel->data,
- cur_skel->len))
- != 0;
- noderev->mergeinfo_count =
- apr_atoi64(apr_pstrmemdup(pool,
- cur_skel->next->data,
- cur_skel->next->len));
+ str = apr_pstrmemdup(pool, cur_skel->data, cur_skel->len);
+ SVN_ERR(svn_cstring_atoi(&val, str));
+ noderev->has_mergeinfo = (val != 0);
+
+ str = apr_pstrmemdup(pool, cur_skel->next->data,
+ cur_skel->next->len);
+ SVN_ERR(svn_cstring_atoi64(&noderev->mergeinfo_count, str));
}
}
}