You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/03/11 18:05:38 UTC

svn commit: r921939 - in /subversion/trunk/subversion: libsvn_fs_base/util/fs_skels.c libsvn_fs_fs/fs_fs.c libsvn_fs_fs/tree.c libsvn_ra_serf/update.c libsvn_repos/load.c

Author: julianfoad
Date: Thu Mar 11 17:05:38 2010
New Revision: 921939

URL: http://svn.apache.org/viewvc?rev=921939&view=rev
Log:
Always use SVN_STR_TO_REV for reading a revision number from a string,
rather than (variants of) atoi() or atol().

* subversion/libsvn_fs_base/util/fs_skels.c
  (svn_fs_base__parse_transaction_skel): Replace atoi().

* subversion/libsvn_fs_fs/fs_fs.c
  (svn_fs_fs__read_noderev): Replace atoi().
  (read_rep_line, read_change): Replace atol().

* subversion/libsvn_fs_fs/tree.c
  (fs_copied_from): Replace atol().

* subversion/libsvn_ra_serf/update.c
  (start_report): Replace apr_atoi64().

* subversion/libsvn_repos/load.c
  (make_node_baton): Replace atoi().

Modified:
    subversion/trunk/subversion/libsvn_fs_base/util/fs_skels.c
    subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
    subversion/trunk/subversion/libsvn_fs_fs/tree.c
    subversion/trunk/subversion/libsvn_ra_serf/update.c
    subversion/trunk/subversion/libsvn_repos/load.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=921939&r1=921938&r2=921939&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_base/util/fs_skels.c (original)
+++ subversion/trunk/subversion/libsvn_fs_base/util/fs_skels.c Thu Mar 11 17:05:38 2010
@@ -433,8 +433,9 @@ svn_fs_base__parse_transaction_skel(tran
     {
       /* Committed transactions have a revision number... */
       transaction->base_id = NULL;
-      transaction->revision = atoi(apr_pstrmemdup(pool, base_id_or_rev->data,
-                                                  base_id_or_rev->len));
+      transaction->revision =
+        SVN_STR_TO_REV(apr_pstrmemdup(pool, base_id_or_rev->data,
+                                      base_id_or_rev->len));
       if (! SVN_IS_VALID_REVNUM(transaction->revision))
         return skel_err("transaction");
 

Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=921939&r1=921938&r2=921939&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Thu Mar 11 17:05:38 2010
@@ -2163,7 +2163,7 @@ svn_fs_fs__read_noderev(node_revision_t 
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                                 _("Malformed copyroot line in node-rev"));
 
-      noderev->copyroot_rev = atoi(str);
+      noderev->copyroot_rev = SVN_STR_TO_REV(str);
 
       if (last_str == NULL)
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
@@ -2187,7 +2187,7 @@ svn_fs_fs__read_noderev(node_revision_t 
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                                 _("Malformed copyfrom line in node-rev"));
 
-      noderev->copyfrom_rev = atoi(str);
+      noderev->copyfrom_rev = SVN_STR_TO_REV(str);
 
       if (last_str == NULL)
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
@@ -2419,7 +2419,7 @@ read_rep_line(struct rep_args **rep_args
 
   str = apr_strtok(NULL, " ", &last_str);
   if (! str) goto err;
-  rep_args->base_revision = atol(str);
+  rep_args->base_revision = SVN_STR_TO_REV(str);
 
   str = apr_strtok(NULL, " ", &last_str);
   if (! str) goto err;
@@ -4138,7 +4138,7 @@ read_change(change_t **change_p,
       if (! str)
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                                 _("Invalid changes line in rev-file"));
-      change->copyfrom_rev = atol(str);
+      change->copyfrom_rev = SVN_STR_TO_REV(str);
 
       if (! last_str)
         return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,

Modified: subversion/trunk/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/tree.c?rev=921939&r1=921938&r2=921939&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/tree.c Thu Mar 11 17:05:38 2010
@@ -2188,7 +2188,7 @@ fs_copied_from(svn_revnum_t *rev_p,
           /* Parse the copyfrom string for our cached entry. */
           buf = apr_pstrdup(pool, copyfrom_str);
           str = apr_strtok(buf, " ", &last_str);
-          copyfrom_rev = atol(str);
+          copyfrom_rev = SVN_STR_TO_REV(str);
           copyfrom_path = last_str;
         }
     }

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=921939&r1=921938&r2=921939&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Thu Mar 11 17:05:38 2010
@@ -1261,7 +1261,7 @@ start_report(svn_ra_serf__xml_parser_t *
 
       info = push_state(parser, ctx, OPEN_DIR);
 
-      info->base_rev = apr_atoi64(rev);
+      info->base_rev = SVN_STR_TO_REV(rev);
       info->dir->base_rev = info->base_rev;
       info->dir->target_rev = ctx->target_rev;
       info->fetch_props = TRUE;
@@ -1308,7 +1308,7 @@ start_report(svn_ra_serf__xml_parser_t *
 
       dir = info->dir;
 
-      info->base_rev = apr_atoi64(rev);
+      info->base_rev = SVN_STR_TO_REV(rev);
       dir->base_rev = info->base_rev;
       dir->target_rev = ctx->target_rev;
 
@@ -1356,7 +1356,7 @@ start_report(svn_ra_serf__xml_parser_t *
       info->name = dir->name;
 
       info->copyfrom_path = cf ? apr_pstrdup(info->pool, cf) : NULL;
-      info->copyfrom_rev = cr ? apr_atoi64(cr) : SVN_INVALID_REVNUM;
+      info->copyfrom_rev = cr ? SVN_STR_TO_REV(cr) : SVN_INVALID_REVNUM;
 
       /* Mark that we don't have a base. */
       info->base_rev = SVN_INVALID_REVNUM;
@@ -1390,7 +1390,7 @@ start_report(svn_ra_serf__xml_parser_t *
 
       info = push_state(parser, ctx, OPEN_FILE);
 
-      info->base_rev = apr_atoi64(rev);
+      info->base_rev = SVN_STR_TO_REV(rev);
       info->target_rev = ctx->target_rev;
       info->fetch_props = FALSE;
 
@@ -1425,7 +1425,7 @@ start_report(svn_ra_serf__xml_parser_t *
       info->name = NULL;
 
       info->copyfrom_path = cf ? apr_pstrdup(info->pool, cf) : NULL;
-      info->copyfrom_rev = cr ? apr_atoi64(cr) : SVN_INVALID_REVNUM;
+      info->copyfrom_rev = cr ? SVN_STR_TO_REV(cr) : SVN_INVALID_REVNUM;
     }
   else if ((state == OPEN_DIR || state == ADD_DIR) &&
            strcmp(name.name, "delete-entry") == 0)

Modified: subversion/trunk/subversion/libsvn_repos/load.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/load.c?rev=921939&r1=921938&r2=921939&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/load.c (original)
+++ subversion/trunk/subversion/libsvn_repos/load.c Thu Mar 11 17:05:38 2010
@@ -912,7 +912,7 @@ make_node_baton(apr_hash_t *headers,
   if ((val = apr_hash_get(headers, SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV,
                           APR_HASH_KEY_STRING)))
     {
-      nb->copyfrom_rev = (svn_revnum_t) atoi(val);
+      nb->copyfrom_rev = SVN_STR_TO_REV(val);
     }
   if ((val = apr_hash_get(headers, SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH,
                           APR_HASH_KEY_STRING)))