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 2010/09/15 09:44:05 UTC

svn commit: r997216 [1/6] - in /subversion/branches/javahl-ra: ./ subversion/include/ subversion/include/private/ subversion/libsvn_client/ subversion/libsvn_diff/ subversion/libsvn_fs_base/util/ subversion/libsvn_fs_fs/ subversion/libsvn_ra_neon/ subv...

Author: hwright
Date: Wed Sep 15 07:44:02 2010
New Revision: 997216

URL: http://svn.apache.org/viewvc?rev=997216&view=rev
Log:
On the javahl-ra branch:
Bring up-to-date with trunk.

Added:
    subversion/branches/javahl-ra/tools/dev/wc-format.py
      - copied unchanged from r997214, subversion/trunk/tools/dev/wc-format.py
Modified:
    subversion/branches/javahl-ra/   (props changed)
    subversion/branches/javahl-ra/subversion/include/private/svn_dep_compat.h
    subversion/branches/javahl-ra/subversion/include/private/svn_skel.h
    subversion/branches/javahl-ra/subversion/include/svn_diff.h
    subversion/branches/javahl-ra/subversion/include/svn_string.h
    subversion/branches/javahl-ra/subversion/libsvn_client/add.c
    subversion/branches/javahl-ra/subversion/libsvn_client/commit.c
    subversion/branches/javahl-ra/subversion/libsvn_client/commit_util.c
    subversion/branches/javahl-ra/subversion/libsvn_client/deprecated.c
    subversion/branches/javahl-ra/subversion/libsvn_client/merge.c
    subversion/branches/javahl-ra/subversion/libsvn_client/patch.c
    subversion/branches/javahl-ra/subversion/libsvn_diff/diff_file.c
    subversion/branches/javahl-ra/subversion/libsvn_diff/parse-diff.c
    subversion/branches/javahl-ra/subversion/libsvn_fs_base/util/fs_skels.c
    subversion/branches/javahl-ra/subversion/libsvn_fs_fs/fs_fs.c
    subversion/branches/javahl-ra/subversion/libsvn_fs_fs/id.c
    subversion/branches/javahl-ra/subversion/libsvn_fs_fs/lock.c
    subversion/branches/javahl-ra/subversion/libsvn_ra_neon/lock.c
    subversion/branches/javahl-ra/subversion/libsvn_ra_neon/util.c
    subversion/branches/javahl-ra/subversion/libsvn_ra_serf/property.c
    subversion/branches/javahl-ra/subversion/libsvn_ra_serf/ra_serf.h
    subversion/branches/javahl-ra/subversion/libsvn_ra_serf/util.c
    subversion/branches/javahl-ra/subversion/libsvn_ra_svn/marshal.c
    subversion/branches/javahl-ra/subversion/libsvn_repos/dump.c
    subversion/branches/javahl-ra/subversion/libsvn_repos/load.c
    subversion/branches/javahl-ra/subversion/libsvn_repos/reporter.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/config_file.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/dirent_uri.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/io.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/opt.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/path.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/prompt.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/quoprint.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/skel.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/stream.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/subst.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/svn_string.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/utf.c
    subversion/branches/javahl-ra/subversion/libsvn_subr/validate.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/adm_crawler.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/adm_files.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/adm_ops.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/cleanup.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/copy.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/crop.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/deprecated.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/entries.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/entries.h
    subversion/branches/javahl-ra/subversion/libsvn_wc/lock.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/node.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/old-and-busted.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/props.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/revision_status.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/status.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/update_editor.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/upgrade.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/util.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/wc-metadata.sql
    subversion/branches/javahl-ra/subversion/libsvn_wc/wc-queries.sql
    subversion/branches/javahl-ra/subversion/libsvn_wc/wc.h
    subversion/branches/javahl-ra/subversion/libsvn_wc/wc_db.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/wc_db.h
    subversion/branches/javahl-ra/subversion/libsvn_wc/wc_db_pdh.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/wc_db_private.h
    subversion/branches/javahl-ra/subversion/libsvn_wc/workqueue.c
    subversion/branches/javahl-ra/subversion/libsvn_wc/workqueue.h
    subversion/branches/javahl-ra/subversion/mod_dav_svn/authz.c
    subversion/branches/javahl-ra/subversion/mod_dav_svn/dav_svn.h
    subversion/branches/javahl-ra/subversion/mod_dav_svn/liveprops.c
    subversion/branches/javahl-ra/subversion/mod_dav_svn/lock.c
    subversion/branches/javahl-ra/subversion/mod_dav_svn/repos.c
    subversion/branches/javahl-ra/subversion/svn/conflict-callbacks.c
    subversion/branches/javahl-ra/subversion/svn/main.c
    subversion/branches/javahl-ra/subversion/svn/util.c
    subversion/branches/javahl-ra/subversion/svndumpfilter/main.c
    subversion/branches/javahl-ra/subversion/svnserve/cyrus_auth.c
    subversion/branches/javahl-ra/subversion/svnserve/log-escape.c
    subversion/branches/javahl-ra/subversion/svnserve/main.c
    subversion/branches/javahl-ra/subversion/tests/cmdline/authz_tests.py
    subversion/branches/javahl-ra/subversion/tests/cmdline/copy_tests.py
    subversion/branches/javahl-ra/subversion/tests/cmdline/externals_tests.py
    subversion/branches/javahl-ra/subversion/tests/cmdline/merge_tests.py
    subversion/branches/javahl-ra/subversion/tests/cmdline/patch_tests.py
    subversion/branches/javahl-ra/subversion/tests/cmdline/resolve_tests.py
    subversion/branches/javahl-ra/subversion/tests/cmdline/update_tests.py
    subversion/branches/javahl-ra/subversion/tests/cmdline/upgrade_tests.py
    subversion/branches/javahl-ra/subversion/tests/libsvn_client/   (props changed)
    subversion/branches/javahl-ra/subversion/tests/libsvn_delta/delta-window-test.h
    subversion/branches/javahl-ra/subversion/tests/libsvn_subr/skel-test.c
    subversion/branches/javahl-ra/subversion/tests/libsvn_subr/stream-test.c
    subversion/branches/javahl-ra/subversion/tests/libsvn_wc/db-test.c
    subversion/branches/javahl-ra/subversion/tests/libsvn_wc/entries-compat.c
    subversion/branches/javahl-ra/subversion/tests/svn_test_main.c
    subversion/branches/javahl-ra/tools/dev/unix-build/Makefile.svn
    subversion/branches/javahl-ra/tools/dev/wc-ng/bump-to-19.py

Propchange: subversion/branches/javahl-ra/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Sep 15 07:44:02 2010
@@ -22,7 +22,7 @@
 /subversion/branches/log-g-performance:870941-871032
 /subversion/branches/merge-skips-obstructions:874525-874615
 /subversion/branches/nfc-nfd-aware-client:870276,870376
-/subversion/branches/performance:983764,983766,984927
+/subversion/branches/performance:983764,983766,984927,985014,985037,985046,985669,987893,995507,995603
 /subversion/branches/ra_serf-digest-authn:875693-876404
 /subversion/branches/reintegrate-improvements:873853-874164
 /subversion/branches/subtree-mergeinfo:876734-878766
@@ -37,4 +37,4 @@
 /subversion/branches/tc_url_rev:874351-874483
 /subversion/branches/tree-conflicts:868291-873154
 /subversion/branches/tree-conflicts-notify:873926-874008
-/subversion/trunk:991978-993364
+/subversion/trunk:991978-997214

Modified: subversion/branches/javahl-ra/subversion/include/private/svn_dep_compat.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/private/svn_dep_compat.h?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/private/svn_dep_compat.h (original)
+++ subversion/branches/javahl-ra/subversion/include/private/svn_dep_compat.h Wed Sep 15 07:44:02 2010
@@ -63,12 +63,16 @@ extern "C" {
 #endif
 
 #if !APR_VERSION_AT_LEAST(1,3,0)
+#define APR_UINT16_MAX  0xFFFFU
+#define APR_INT16_MAX   0x7FFF
+#define APR_INT16_MIN   (-APR_INT16_MAX-1)
 #define APR_UINT32_MAX 0xFFFFFFFFU
 #define APR_INT32_MAX  0x7FFFFFFF
 #define APR_INT32_MIN (-APR_INT32_MAX-1)
 #define APR_UINT64_MAX APR_UINT64_C(0xFFFFFFFFFFFFFFFF)
 #define APR_INT64_MAX   APR_INT64_C(0x7FFFFFFFFFFFFFFF)
 #define APR_INT64_MIN (-APR_INT64_MAX-1)
+#define APR_SIZE_MAX (~(apr_size_t)0)
 #endif
 
 /**

Modified: subversion/branches/javahl-ra/subversion/include/private/svn_skel.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/private/svn_skel.h?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/private/svn_skel.h (original)
+++ subversion/branches/javahl-ra/subversion/include/private/svn_skel.h Wed Sep 15 07:44:02 2010
@@ -163,11 +163,11 @@ void svn_skel__prepend_str(const char *v
                            apr_pool_t *result_pool);
 
 
-/* Parse SKEL as an integer. SCRATCH_POOL is used for temporary memory.
-   NOTE: this function assumes the input is valid -- there is no way to
-   return an error.  */
-apr_int64_t svn_skel__parse_int(const svn_skel_t *skel,
-                                apr_pool_t *scratch_pool);
+/* Parse SKEL as an integer and return the result in *N.
+ * SCRATCH_POOL is used for temporary memory.  */
+svn_error_t *
+svn_skel__parse_int(apr_int64_t *n, const svn_skel_t *skel,
+                    apr_pool_t *scratch_pool);
 
 
 /* Return a string whose contents are a concrete representation of

Modified: subversion/branches/javahl-ra/subversion/include/svn_diff.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_diff.h?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_diff.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_diff.h Wed Sep 15 07:44:02 2010
@@ -986,6 +986,10 @@ typedef struct svn_patch_t {
   /**
    * Represents the operation performed on the file. */
   svn_diff_operation_kind_t operation;
+
+  /**
+   * Indicates whether the patch is being interpreted in reverse. */
+  svn_boolean_t reverse;
 } svn_patch_t;
 
 /**

Modified: subversion/branches/javahl-ra/subversion/include/svn_string.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_string.h?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_string.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_string.h Wed Sep 15 07:44:02 2010
@@ -253,6 +253,15 @@ svn_stringbuf_chop(svn_stringbuf_t *str,
 void
 svn_stringbuf_fillchar(svn_stringbuf_t *str, unsigned char c);
 
+/** Append a single character @a byte onto @a targetstr.
+ *
+ * reallocs if necessary. @a targetstr is affected, nothing else is.
+ * @since New in 1.7.
+ */
+void
+svn_stringbuf_appendbyte(svn_stringbuf_t *targetstr,
+                         char byte);
+
 /** Append an array of bytes onto @a targetstr.
  *
  * reallocs if necessary. @a targetstr is affected, nothing else is.

Modified: subversion/branches/javahl-ra/subversion/libsvn_client/add.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/add.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_client/add.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_client/add.c Wed Sep 15 07:44:02 2010
@@ -43,6 +43,7 @@
 #include "svn_hash.h"
 #include "svn_sorts.h"
 #include "client.h"
+#include "svn_ctype.h"
 
 #include "private/svn_wc_private.h"
 
@@ -80,11 +81,11 @@ trim_string(char **pstr)
   char *str = *pstr;
   size_t i;
 
-  while (apr_isspace(*str))
+  while (svn_ctype_isspace(*str))
     str++;
   *pstr = str;
   i = strlen(str);
-  while ((i > 0) && apr_isspace(str[i-1]))
+  while ((i > 0) && svn_ctype_isspace(str[i-1]))
     i--;
   str[i] = '\0';
 }

Modified: subversion/branches/javahl-ra/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/commit.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_client/commit.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_client/commit.c Wed Sep 15 07:44:02 2010
@@ -929,25 +929,6 @@ post_process_commit_item(svn_wc_committe
   svn_boolean_t loop_recurse = FALSE;
   svn_boolean_t remove_lock;
 
-#ifndef SVN_WC__SINGLE_DB
-  /* Is it a missing, deleted directory?
-
-     ### Temporary: once we centralise this sort of node is just a
-     normal delete and will get handled by the post-commit queue. */
-  if (item->kind == svn_node_dir
-      && item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
-    {
-      svn_boolean_t obstructed;
-
-      SVN_ERR(svn_wc__node_is_status_obstructed(&obstructed,
-                                                wc_ctx, item->path,
-                                                scratch_pool));
-      if (obstructed)
-        return svn_wc__temp_mark_missing_not_present(item->path,
-                                                     wc_ctx, scratch_pool);
-    }
-#endif
-
   if ((item->state_flags & SVN_CLIENT_COMMIT_ITEM_ADD)
       && (item->kind == svn_node_dir)
       && (item->copyfrom_url))

Modified: subversion/branches/javahl-ra/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/commit_util.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_client/commit_util.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_client/commit_util.c Wed Sep 15 07:44:02 2010
@@ -859,46 +859,6 @@ harvest_committables(apr_hash_t *committ
                      and depth says not to go there. */
                   continue;
                 }
-#ifndef SVN_WC__SINGLE_DB
-              else
-                {
-                  svn_boolean_t obstructed;
-
-                  SVN_ERR(svn_wc__node_is_status_obstructed(&obstructed,
-                                                            ctx->wc_ctx,
-                                                            this_abspath,
-                                                            iterpool));
-
-                  if (obstructed)
-                    {
-                      /* A missing, schedule-delete child dir is
-                         allowable.  Just don't try to recurse. */
-                      svn_node_kind_t childkind;
-                      SVN_ERR(svn_io_check_path(this_abspath,
-                                                &childkind,
-                                                iterpool));
-                      if (childkind == svn_node_none && this_is_deleted)
-                        {
-                          if (svn_wc__changelist_match(ctx->wc_ctx,
-                                                       this_abspath,
-                                                       changelists,
-                                                       iterpool))
-                            {
-                              SVN_ERR(add_committable(
-                                            committables, this_abspath,
-                                            this_kind, 
-                                            repos_root_url, this_repos_relpath,
-                                            SVN_INVALID_REVNUM,
-                                            NULL,
-                                            SVN_INVALID_REVNUM,
-                                            SVN_CLIENT_COMMIT_ITEM_DELETE,
-                                            result_pool, iterpool));
-                              continue; /* don't recurse! */
-                            }
-                        }
-                    }
-                }
-#endif
             }
 
           {

Modified: subversion/branches/javahl-ra/subversion/libsvn_client/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/deprecated.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_client/deprecated.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_client/deprecated.c Wed Sep 15 07:44:02 2010
@@ -317,7 +317,7 @@ wrapped_receiver(void *baton,
   struct wrapped_receiver_baton_s *b = baton;
   svn_stringbuf_t *expanded_line = svn_stringbuf_create(line, pool);
 
-  svn_stringbuf_appendbytes(expanded_line, "\r", 1);
+  svn_stringbuf_appendbyte(expanded_line, '\r');
 
   return b->orig_receiver(b->orig_baton, line_no, revision, author,
                           date, expanded_line->data, pool);

Modified: subversion/branches/javahl-ra/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/merge.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_client/merge.c Wed Sep 15 07:44:02 2010
@@ -437,29 +437,7 @@ obstructed_or_missing(svn_wc_notify_stat
                                              local_abspath,
                                              pool));
       if (is_deleted)
-        {
-#ifndef SVN_WC__SINGLE_DB
-          /* ### While we are not at single-db: detect missing .svn dirs.
-             ### Once we switch to single db expected kind should be always
-             ### none, just like for files */
-          if (kind_expected == svn_node_dir)
-            {
-              if (kind_on_disk == svn_node_none)
-                {
-                  svn_boolean_t is_obstructed;
-                  
-                  SVN_ERR(svn_wc__node_is_status_obstructed(&is_obstructed,
-                                                            merge_b->ctx->wc_ctx,
-                                                            local_abspath,
-                                                            pool));
-                  if (!is_obstructed)
-                    kind_expected = svn_node_none; 
-                }
-            }
-          else
-#endif
-            kind_expected = svn_node_none;
-        }
+        kind_expected = svn_node_none;
     }
 
   if (kind_expected == kind_on_disk)
@@ -5467,9 +5445,6 @@ get_mergeinfo_walk_cb(const char *local_
   svn_boolean_t is_present;
   svn_boolean_t deleted;
   svn_boolean_t absent;
-#ifndef SVN_WC__SINGLE_DB
-  svn_boolean_t obstructed;
-#endif
   svn_boolean_t immediate_child_dir;
 
   /* TODO(#2843) How to deal with a excluded item on merge? */
@@ -5481,20 +5456,12 @@ get_mergeinfo_walk_cb(const char *local_
   if (!is_present)
     return SVN_NO_ERROR;
 
-#ifndef SVN_WC__SINGLE_DB
-  SVN_ERR(svn_wc__node_is_status_obstructed(&obstructed, wb->ctx->wc_ctx,
-                                            local_abspath, scratch_pool));
-#endif
   SVN_ERR(svn_wc__node_is_status_deleted(&deleted, wb->ctx->wc_ctx,
                                          local_abspath, scratch_pool));
   SVN_ERR(svn_wc__node_is_status_absent(&absent, wb->ctx->wc_ctx,
                                         local_abspath, scratch_pool));
 
-#ifndef SVN_WC__SINGLE_DB
-   if (obstructed || deleted || absent)
-#else
    if (deleted || absent)
-#endif
     {
       propval = NULL;
       switched = FALSE;
@@ -5525,11 +5492,7 @@ get_mergeinfo_walk_cb(const char *local_
                          && (strcmp(abs_parent_path,
                                     wb->merge_target_abspath) == 0));
   /* Make sure what the WC thinks is present on disk really is. */
-#ifndef SVN_WC__SINGLE_DB
-   if (!absent && !deleted && !obstructed)
-#else
    if (!absent && !deleted)
-#endif
     SVN_ERR(record_missing_subtree_roots(local_abspath, kind,
                                          wb->subtree_dirents,
                                          wb->missing_subtrees,

Modified: subversion/branches/javahl-ra/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_client/patch.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_client/patch.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_client/patch.c Wed Sep 15 07:44:02 2010
@@ -811,7 +811,7 @@ match_hunk(svn_boolean_t *matched, targe
   svn_boolean_t hunk_eof;
   svn_boolean_t lines_matched;
   apr_pool_t *iterpool;
-  svn_linenum_t original_length;
+  svn_linenum_t hunk_length;
   svn_linenum_t leading_context;
   svn_linenum_t trailing_context;
 
@@ -823,13 +823,18 @@ match_hunk(svn_boolean_t *matched, targe
   saved_line = content_info->current_line;
   lines_read = 0;
   lines_matched = FALSE;
-  original_length = svn_diff_hunk_get_original_length(hunk);
   leading_context = svn_diff_hunk_get_leading_context(hunk);
   trailing_context = svn_diff_hunk_get_trailing_context(hunk);
   if (match_modified)
-    SVN_ERR(svn_diff_hunk_reset_modified_text(hunk));
+    {
+      SVN_ERR(svn_diff_hunk_reset_modified_text(hunk));
+      hunk_length = svn_diff_hunk_get_modified_length(hunk);
+    }
   else
-    SVN_ERR(svn_diff_hunk_reset_original_text(hunk));
+    {
+      SVN_ERR(svn_diff_hunk_reset_original_text(hunk));
+      hunk_length = svn_diff_hunk_get_original_length(hunk);
+    }
   iterpool = svn_pool_create(pool);
   do
     {
@@ -858,7 +863,7 @@ match_hunk(svn_boolean_t *matched, targe
         {
           if (lines_read <= fuzz && leading_context > fuzz)
             lines_matched = TRUE;
-          else if (lines_read > original_length - fuzz &&
+          else if (lines_read > hunk_length - fuzz &&
                    trailing_context > fuzz)
             lines_matched = TRUE;
           else
@@ -1599,6 +1604,45 @@ send_patch_notification(const patch_targ
   return SVN_NO_ERROR;
 }
 
+/* Close the streams of the TARGET so that their content is flushed
+ * to disk. This will also close underlying streams and files. Use POOL for
+ * temporary allocations. */
+static svn_error_t *
+close_target_streams(const patch_target_t *target,
+                     apr_pool_t *pool)
+{
+  apr_hash_index_t *hi;
+  target_content_info_t *prop_content_info;
+
+   /* First the streams belonging to properties .. */
+      for (hi = apr_hash_first(pool, target->prop_targets);
+           hi;
+           hi = apr_hash_next(hi))
+        {
+          prop_patch_target_t *prop_target;
+          prop_target = svn__apr_hash_index_val(hi);
+          prop_content_info = prop_target->content_info;
+
+          /* ### If the prop did not exist pre-patching we'll not have a
+           * ### stream to read from. Find a better way to store info on
+           * ### the existence of the target prop. */
+          if (prop_content_info->stream)
+            SVN_ERR(svn_stream_close(prop_content_info->stream));
+
+          SVN_ERR(svn_stream_close(prop_content_info->patched));
+        }
+
+
+   /* .. And then streams associted with the file. The reject stream is
+    * shared between all target_content_info structures. */
+  if (target->kind_on_disk == svn_node_file)
+    SVN_ERR(svn_stream_close(target->content_info->stream));
+  SVN_ERR(svn_stream_close(target->content_info->patched));
+  SVN_ERR(svn_stream_close(target->content_info->reject));
+
+  return SVN_NO_ERROR;
+}
+
 /* Apply a PATCH to a working copy at ABS_WC_PATH and put the result
  * into temporary files, to be installed in the working copy later.
  * Return information about the patch target in *PATCH_TARGET, allocated
@@ -1721,16 +1765,13 @@ apply_one_patch(patch_target_t **patch_t
       svn_prop_patch_t *prop_patch;
       const char *prop_name;
       prop_patch_target_t *prop_target;
-      target_content_info_t *prop_content_info;
         
       prop_name = svn__apr_hash_index_key(hash_index);
       prop_patch = svn__apr_hash_index_val(hash_index);
 
-      /* We'll store matched hunks in prop_content_info.
-       * ### Just use prop_target->content_info? */
+      /* We'll store matched hunks in prop_content_info. */
       prop_target = apr_hash_get(target->prop_targets, prop_name, 
                                  APR_HASH_KEY_STRING);
-      prop_content_info = prop_target->content_info;
 
       for (i = 0; i < prop_patch->hunks->nelts; i++)
         {
@@ -1749,7 +1790,8 @@ apply_one_patch(patch_target_t **patch_t
            * If no match is found initially, try with fuzz. */
           do
             {
-              SVN_ERR(get_hunk_info(&hi, target, prop_content_info, hunk, fuzz,
+              SVN_ERR(get_hunk_info(&hi, target, prop_target->content_info, 
+                                    hunk, fuzz,
                                     ignore_whitespace,
                                     TRUE /* is_prop_hunk */,
                                     cancel_func, cancel_baton,
@@ -1758,7 +1800,7 @@ apply_one_patch(patch_target_t **patch_t
             }
           while (hi->rejected && fuzz <= MAX_FUZZ && ! hi->already_applied);
 
-          APR_ARRAY_PUSH(prop_content_info->hunks, hunk_info_t *) = hi;
+          APR_ARRAY_PUSH(prop_target->content_info->hunks, hunk_info_t *) = hi;
         }
     }
 
@@ -1768,52 +1810,40 @@ apply_one_patch(patch_target_t **patch_t
        hash_index = apr_hash_next(hash_index))
     {
       prop_patch_target_t *prop_target;
-      target_content_info_t *prop_content_info;
-      const char *prop_patched_path;
 
       prop_target = svn__apr_hash_index_val(hash_index);
-      /* ### Just use prop_target->content_info? */
-      prop_content_info = prop_target->content_info;
-      /* ### Just use prop_target->patched_path? */
-      prop_patched_path = prop_target->patched_path;
 
-      for (i = 0; i < prop_content_info->hunks->nelts; i++)
+      for (i = 0; i < prop_target->content_info->hunks->nelts; i++)
         {
           hunk_info_t *hi;
 
           svn_pool_clear(iterpool);
 
-          hi = APR_ARRAY_IDX(prop_content_info->hunks, i, hunk_info_t *);
+          hi = APR_ARRAY_IDX(prop_target->content_info->hunks, i, 
+                             hunk_info_t *);
           if (hi->already_applied)
             continue;
           else if (hi->rejected)
-            SVN_ERR(reject_hunk(target, prop_content_info, hi,
+            SVN_ERR(reject_hunk(target, prop_target->content_info, hi,
                                 prop_target->name,
                                 iterpool));
           else
-            SVN_ERR(apply_hunk(target, prop_content_info, hi, 
+            SVN_ERR(apply_hunk(target, prop_target->content_info, hi, 
                                prop_target->name,
                                iterpool));
         }
 
-        if (prop_content_info->stream)
+        if (prop_target->content_info->stream)
           {
             /* Copy any remaining lines to target. */
-            SVN_ERR(copy_lines_to_target(prop_content_info, 0,
-                                         prop_patched_path, scratch_pool));
-            if (! prop_content_info->eof)
+            SVN_ERR(copy_lines_to_target(prop_target->content_info, 0,
+                                         prop_target->patched_path, 
+                                         scratch_pool));
+            if (! prop_target->content_info->eof)
               {
                 /* We could not copy the entire target property to the
                  * temporary file, and would truncate the target if we
-                 * copied the temporary file on top of it. Skip this target. 
-                 *
-                 * ### dannas: Do we really want to skip an entire target
-                 * ### if one of the properties does not apply cleanly,
-                 * ### e.g. both text changes and all prop changes will not be
-                 * ### installed.
-                 * ### stsp: This is a "should never happen" situation.
-                 * ### It means we've run out of disk space or something
-                 * ### like that, so skipping is appropriate. */
+                 * copied the temporary file on top of it. Skip this target.  */
                 target->skipped = TRUE;
               }
           }
@@ -1821,40 +1851,7 @@ apply_one_patch(patch_target_t **patch_t
 
   svn_pool_destroy(iterpool);
 
-  /* ### Move this a separate function? apply_one_patch() has gotten quite
-   * ### big. We should consider splitting it up into several pieces. */
-    {
-      apr_hash_index_t *hi;
-      target_content_info_t *prop_content_info;
-
-      /* Close the streams of the target so that their content is flushed
-       * to disk. This will also close underlying streams and files. 
-       * First the streams belonging to properties .. */
-          for (hi = apr_hash_first(result_pool, target->prop_targets);
-               hi;
-               hi = apr_hash_next(hi))
-            {
-              prop_patch_target_t *prop_target;
-              prop_target = svn__apr_hash_index_val(hi);
-              prop_content_info = prop_target->content_info;
-
-              /* ### If the prop did not exist pre-patching we'll not have a
-               * ### stream to read from. Find a better way to store info on
-               * ### the existence of the target prop. */
-              if (prop_content_info->stream)
-                SVN_ERR(svn_stream_close(prop_content_info->stream));
-
-              SVN_ERR(svn_stream_close(prop_content_info->patched));
-            }
-
-
-       /* .. And then streams associted with the file. The reject stream is
-        * shared between all target_content_info structures. */
-      if (target->kind_on_disk == svn_node_file)
-        SVN_ERR(svn_stream_close(target->content_info->stream));
-      SVN_ERR(svn_stream_close(target->content_info->patched));
-      SVN_ERR(svn_stream_close(target->content_info->reject));
-    }
+  SVN_ERR(close_target_streams(target, scratch_pool));
 
   if (! target->skipped)
     {

Modified: subversion/branches/javahl-ra/subversion/libsvn_diff/diff_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_diff/diff_file.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_diff/diff_file.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_diff/diff_file.c Wed Sep 15 07:44:02 2010
@@ -860,7 +860,7 @@ output_unified_line(svn_diff__file_outpu
             {
               if (type != svn_diff__file_output_unified_skip)
                 {
-                  svn_stringbuf_appendbytes(baton->hunk, curp, 1);
+                  svn_stringbuf_appendbyte(baton->hunk, *curp);
                 }
               /* We don't append the LF to extra_context, since it would
                * just be stripped anyway. */

Modified: subversion/branches/javahl-ra/subversion/libsvn_diff/parse-diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_diff/parse-diff.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_diff/parse-diff.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_diff/parse-diff.c Wed Sep 15 07:44:02 2010
@@ -45,8 +45,8 @@ struct svn_diff_hunk_t {
   svn_stream_t *original_text;
   svn_stream_t *modified_text;
 
-  /* Whether the hunk is being interpreted in reverse. */
-  svn_boolean_t reverse;
+  /* The patch this hunk belongs to. */
+  svn_patch_t *patch;
 
   /* Hunk ranges as they appeared in the patch file.
    * All numbers are lines, not bytes. */
@@ -69,37 +69,43 @@ svn_diff_hunk_reset_diff_text(const svn_
 svn_error_t *
 svn_diff_hunk_reset_original_text(const svn_diff_hunk_t *hunk)
 {
-  return svn_error_return(svn_stream_reset(hunk->original_text));
+  if (hunk->patch->reverse)
+    return svn_error_return(svn_stream_reset(hunk->modified_text));
+  else
+    return svn_error_return(svn_stream_reset(hunk->original_text));
 }
 
 svn_error_t *
 svn_diff_hunk_reset_modified_text(const svn_diff_hunk_t *hunk)
 {
-  return svn_error_return(svn_stream_reset(hunk->modified_text));
+  if (hunk->patch->reverse)
+    return svn_error_return(svn_stream_reset(hunk->original_text));
+  else
+    return svn_error_return(svn_stream_reset(hunk->modified_text));
 }
 
 svn_linenum_t
 svn_diff_hunk_get_original_start(const svn_diff_hunk_t *hunk)
 {
-  return hunk->original_start;
+  return hunk->patch->reverse ? hunk->modified_start : hunk->original_start;
 }
 
 svn_linenum_t
 svn_diff_hunk_get_original_length(const svn_diff_hunk_t *hunk)
 {
-  return hunk->original_length;
+  return hunk->patch->reverse ? hunk->modified_length : hunk->original_length;
 }
 
 svn_linenum_t
 svn_diff_hunk_get_modified_start(const svn_diff_hunk_t *hunk)
 {
-  return hunk->modified_start;
+  return hunk->patch->reverse ? hunk->original_start : hunk->modified_start;
 }
 
 svn_linenum_t
 svn_diff_hunk_get_modified_length(const svn_diff_hunk_t *hunk)
 {
-  return hunk->modified_length;
+  return hunk->patch->reverse ? hunk->original_length : hunk->modified_length;
 }
 
 svn_linenum_t
@@ -181,7 +187,7 @@ parse_range(svn_linenum_t *start, svn_li
  * Do all allocations in POOL. */
 static svn_boolean_t
 parse_hunk_header(const char *header, svn_diff_hunk_t *hunk,
-                  const char *atat, svn_boolean_t reverse, apr_pool_t *pool)
+                  const char *atat, apr_pool_t *pool)
 {
   const char *p;
   svn_stringbuf_t *range;
@@ -199,7 +205,7 @@ parse_hunk_header(const char *header, sv
   p++;
   while (*p && *p != ' ')
     {
-      svn_stringbuf_appendbytes(range, p, 1);
+      svn_stringbuf_appendbyte(range, *p);
       p++;
     }
   if (*p != ' ')
@@ -207,16 +213,8 @@ parse_hunk_header(const char *header, sv
     return FALSE;
 
   /* Try to parse the first range. */
-  if (reverse)
-    {
-      if (! parse_range(&hunk->modified_start, &hunk->modified_length, range->data))
-        return FALSE;
-    }
-  else
-    {
-      if (! parse_range(&hunk->original_start, &hunk->original_length, range->data))
-        return FALSE;
-    }
+  if (! parse_range(&hunk->original_start, &hunk->original_length, range->data))
+    return FALSE;
 
   /* Clear the stringbuf so we can reuse it for the second range. */
   svn_stringbuf_setempty(range);
@@ -228,7 +226,7 @@ parse_hunk_header(const char *header, sv
   p++;
   while (*p && *p != ' ')
     {
-      svn_stringbuf_appendbytes(range, p, 1);
+      svn_stringbuf_appendbyte(range, *p);
       p++;
     }
   if (*p != ' ')
@@ -244,16 +242,8 @@ parse_hunk_header(const char *header, sv
    * but we ignore that. */
 
   /* Try to parse the second range. */
-  if (reverse)
-    {
-      if (! parse_range(&hunk->original_start, &hunk->original_length, range->data))
-        return FALSE;
-    }
-  else
-    {
-      if (! parse_range(&hunk->modified_start, &hunk->modified_length, range->data))
-        return FALSE;
-    }
+  if (! parse_range(&hunk->modified_start, &hunk->modified_length, range->data))
+    return FALSE;
 
   /* Hunk header is good. */
   return TRUE;
@@ -372,7 +362,7 @@ hunk_readline(svn_stream_t *stream,
           else
             match = eol_str;
 
-          svn_stringbuf_appendbytes(str, &c, 1);
+          svn_stringbuf_appendbyte(str, c);
         }
 
       svn_stringbuf_chop(str, match - eol_str);
@@ -412,8 +402,11 @@ svn_diff_hunk_readline_original_text(con
                                      apr_pool_t *result_pool,
                                      apr_pool_t *scratch_pool)
 {
-  return svn_error_return(hunk_readline(hunk->original_text, stringbuf,
-                                        eol, eof, hunk->reverse ? '-' : '+',
+  return svn_error_return(hunk_readline(hunk->patch->reverse ?
+                                          hunk->modified_text :
+                                          hunk->original_text,
+                                        stringbuf, eol, eof,
+                                        hunk->patch->reverse ? '-' : '+',
                                         result_pool, scratch_pool));
 }
 
@@ -425,8 +418,11 @@ svn_diff_hunk_readline_modified_text(con
                                      apr_pool_t *result_pool,
                                      apr_pool_t *scratch_pool)
 {
-  return svn_error_return(hunk_readline(hunk->modified_text, stringbuf,
-                                        eol, eof, hunk->reverse ? '+' : '-',
+  return svn_error_return(hunk_readline(hunk->patch->reverse ?
+                                          hunk->original_text :
+                                          hunk->modified_text,
+                                        stringbuf, eol, eof,
+                                        hunk->patch->reverse ? '+' : '-',
                                         result_pool, scratch_pool));
 }
 
@@ -444,9 +440,9 @@ svn_diff_hunk_readline_diff_text(const s
   SVN_ERR(svn_stream_readline_detect_eol(hunk->diff_text, &line, eol, eof,
                                          result_pool));
   
-  if (hunk->reverse)
+  if (hunk->patch->reverse)
     {
-      if (parse_hunk_header(line->data, &dummy, "@@", FALSE, scratch_pool))
+      if (parse_hunk_header(line->data, &dummy, "@@", scratch_pool))
         {
           /* Line is a hunk header, reverse it. */
           *stringbuf = svn_stringbuf_createf(result_pool,
@@ -456,7 +452,7 @@ svn_diff_hunk_readline_diff_text(const s
                                              hunk->original_start,
                                              hunk->original_length);
         }
-      else if (parse_hunk_header(line->data, &dummy, "##", FALSE, scratch_pool))
+      else if (parse_hunk_header(line->data, &dummy, "##", scratch_pool))
         {
           /* Line is a hunk header, reverse it. */
           *stringbuf = svn_stringbuf_createf(result_pool,
@@ -504,8 +500,7 @@ parse_prop_name(const char **prop_name, 
  * IS_PROPERTY to TRUE if we have a property hunk. If the returned HUNK is
  * the first belonging to a certain property, then PROP_NAME and
  * PROP_OPERATION will be set too. If we have a text hunk, PROP_NAME will be
- * NULL. If REVERSE is TRUE, invert the hunk while parsing it. If
- * IGNORE_WHiTESPACES is TRUE, let lines without leading spaces be
+ * NULL. If IGNORE_WHITESPACE is TRUE, let lines without leading spaces be
  * recognized as context lines.  Allocate results in
  * RESULT_POOL.  Use SCRATCH_POOL for all other allocations. */
 static svn_error_t *
@@ -515,7 +510,6 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
                 svn_diff_operation_kind_t *prop_operation,
                 svn_patch_t *patch,
                 svn_stream_t *stream,
-                svn_boolean_t reverse,
                 svn_boolean_t ignore_whitespace,
                 apr_pool_t *result_pool,
                 apr_pool_t *scratch_pool)
@@ -588,19 +582,8 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
       if (in_hunk)
         {
           char c;
-          char add;
-          char del;
-
-          if (reverse)
-            {
-              add = '-';
-              del = '+';
-            }
-          else
-            {
-              add = '+';
-              del = '-';
-            }
+          static const char add = '+';
+          static const char del = '-';
 
           if (! hunk_seen)
             {
@@ -668,7 +651,7 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
             {
               /* Looks like we have a hunk header, try to rip it apart. */
               in_hunk = parse_hunk_header(line->data, *hunk, text_atat,
-                                          reverse, iterpool);
+                                          iterpool);
               if (in_hunk)
                 {
                   original_lines = (*hunk)->original_length;
@@ -681,7 +664,7 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
               /* Looks like we have a property hunk header, try to rip it
                * apart. */
               in_hunk = parse_hunk_header(line->data, *hunk, prop_atat,
-                                          reverse, iterpool);
+                                          iterpool);
               if (in_hunk)
                 {
                   original_lines = (*hunk)->original_length;
@@ -752,7 +735,7 @@ parse_next_hunk(svn_diff_hunk_t **hunk,
                                                              result_pool);
 
       (*hunk)->diff_text = diff_text;
-      (*hunk)->reverse = reverse;
+      (*hunk)->patch = patch;
       (*hunk)->original_text = original_text;
       (*hunk)->modified_text = modified_text;
       (*hunk)->leading_context = leading_context;
@@ -1258,6 +1241,7 @@ svn_diff_parse_next_patch(svn_patch_t **
 
     } while (! eof);
 
+  (*patch)->reverse = reverse;
   if (reverse)
     {
       const char *temp;
@@ -1288,7 +1272,7 @@ svn_diff_parse_next_patch(svn_patch_t **
           svn_pool_clear(iterpool);
 
           SVN_ERR(parse_next_hunk(&hunk, &is_property, &prop_name,
-                                  &prop_operation, *patch, stream, reverse,
+                                  &prop_operation, *patch, stream,
                                   ignore_whitespace,
                                   result_pool, iterpool));
 

Modified: subversion/branches/javahl-ra/subversion/libsvn_fs_base/util/fs_skels.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_fs_base/util/fs_skels.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_fs_base/util/fs_skels.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_fs_base/util/fs_skels.c Wed Sep 15 07:44:02 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));
             }
         }
     }

Modified: subversion/branches/javahl-ra/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_fs_fs/fs_fs.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_fs_fs/fs_fs.c Wed Sep 15 07:44:02 2010
@@ -44,9 +44,11 @@
 #include "svn_hash.h"
 #include "svn_props.h"
 #include "svn_sorts.h"
+#include "svn_string.h"
 #include "svn_time.h"
 #include "svn_mergeinfo.h"
 #include "svn_config.h"
+#include "svn_ctype.h"
 
 #include "fs.h"
 #include "err.h"
@@ -916,7 +918,7 @@ check_format_file_buffer_numeric(const c
   const char *p;
 
   for (p = buf + offset; *p; p++)
-    if (!apr_isdigit(*p))
+    if (!svn_ctype_isdigit(*p))
       return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
         _("Format file '%s' contains unexpected non-digit '%c' within '%s'"),
         svn_dirent_local_style(path, pool), *p, buf);
@@ -974,7 +976,7 @@ read_format(int *pformat, int *max_files
 
   /* Check that the first line contains only digits. */
   SVN_ERR(check_format_file_buffer_numeric(buf, 0, path, pool));
-  *pformat = atoi(buf);
+  SVN_ERR(svn_cstring_atoi(pformat, buf));
 
   /* Set the default values for anything that can be set via an option. */
   *max_files_per_dir = 0;
@@ -1005,7 +1007,7 @@ read_format(int *pformat, int *max_files
             {
               /* Check that the argument is numeric. */
               SVN_ERR(check_format_file_buffer_numeric(buf, 15, path, pool));
-              *max_files_per_dir = atoi(buf+15);
+              SVN_ERR(svn_cstring_atoi(max_files_per_dir, buf + 15));
               continue;
             }
         }
@@ -1944,18 +1946,20 @@ get_packed_offset(apr_off_t *rev_offset,
     {
       svn_stringbuf_t *sb;
       svn_boolean_t eof;
+      apr_int64_t val;
+      svn_error_t *err;
 
       svn_pool_clear(iterpool);
       SVN_ERR(svn_stream_readline(manifest_stream, &sb, "\n", &eof, iterpool));
       if (eof)
         break;
 
-      errno = 0; /* apr_atoi64() in APR-0.9 does not always set errno */
-      APR_ARRAY_PUSH(manifest, apr_off_t) =
-                apr_atoi64(svn_string_create_from_buf(sb, iterpool)->data);
-      if (errno == ERANGE)
-        return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
-                                "Manifest offset too large");
+      err = svn_cstring_atoi64(&val, sb->data);
+      if (err)
+        return svn_error_return(
+                 svn_error_create(SVN_ERR_FS_CORRUPT, err,
+                                  _("Manifest offset too large")));
+      APR_ARRAY_PUSH(manifest, apr_off_t) = (apr_off_t)val;
     }
   svn_pool_destroy(iterpool);
 
@@ -2056,6 +2060,7 @@ read_rep_offsets(representation_t **rep_
 {
   representation_t *rep;
   char *str, *last_str;
+  apr_int64_t val;
 
   rep = apr_pcalloc(pool, sizeof(*rep));
   *rep_p = rep;
@@ -2079,21 +2084,24 @@ read_rep_offsets(representation_t **rep_
     return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                             _("Malformed text representation offset line in node-rev"));
 
-  rep->offset = apr_atoi64(str);
+  SVN_ERR(svn_cstring_atoi64(&val, str));
+  rep->offset = (apr_off_t)val;
 
   str = apr_strtok(NULL, " ", &last_str);
   if (str == NULL)
     return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                             _("Malformed text representation offset line in node-rev"));
 
-  rep->size = apr_atoi64(str);
+  SVN_ERR(svn_cstring_atoi64(&val, str));
+  rep->size = (svn_filesize_t)val;
 
   str = apr_strtok(NULL, " ", &last_str);
   if (str == NULL)
     return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                             _("Malformed text representation offset line in node-rev"));
 
-  rep->expanded_size = apr_atoi64(str);
+  SVN_ERR(svn_cstring_atoi64(&val, str));
+  rep->expanded_size = (svn_filesize_t)val;
 
   /* Read in the MD5 hash. */
   str = apr_strtok(NULL, " ", &last_str);
@@ -2209,7 +2217,10 @@ svn_fs_fs__read_noderev(node_revision_t 
 
   /* Read the 'count' field. */
   value = apr_hash_get(headers, HEADER_COUNT, APR_HASH_KEY_STRING);
-  noderev->predecessor_count = (value == NULL) ? 0 : atoi(value);
+  if (value)
+    SVN_ERR(svn_cstring_atoi(&noderev->predecessor_count, value));
+  else
+    noderev->predecessor_count = 0;
 
   /* Get the properties location. */
   value = apr_hash_get(headers, HEADER_PROPS, APR_HASH_KEY_STRING);
@@ -2300,7 +2311,10 @@ svn_fs_fs__read_noderev(node_revision_t 
 
   /* Get the mergeinfo count. */
   value = apr_hash_get(headers, HEADER_MINFO_CNT, APR_HASH_KEY_STRING);
-  noderev->mergeinfo_count = (value == NULL) ? 0 : apr_atoi64(value);
+  if (value)
+    SVN_ERR(svn_cstring_atoi64(&noderev->mergeinfo_count, value));
+  else
+    noderev->mergeinfo_count = 0;
 
   /* Get whether *this* node has mergeinfo. */
   value = apr_hash_get(headers, HEADER_MINFO_HERE, APR_HASH_KEY_STRING);
@@ -2487,6 +2501,7 @@ read_rep_line(struct rep_args **rep_args
   apr_size_t limit;
   struct rep_args *rep_args;
   char *str, *last_str;
+  apr_int64_t val;
 
   limit = sizeof(buffer);
   SVN_ERR(svn_io_read_length_line(file, buffer, &limit, pool));
@@ -2514,24 +2529,30 @@ read_rep_line(struct rep_args **rep_args
 
   /* We have hopefully a DELTA vs. a non-empty base revision. */
   str = apr_strtok(buffer, " ", &last_str);
-  if (! str || (strcmp(str, REP_DELTA) != 0)) goto err;
+  if (! str || (strcmp(str, REP_DELTA) != 0))
+    goto error;
 
   str = apr_strtok(NULL, " ", &last_str);
-  if (! str) goto err;
+  if (! str)
+    goto error;
   rep_args->base_revision = SVN_STR_TO_REV(str);
 
   str = apr_strtok(NULL, " ", &last_str);
-  if (! str) goto err;
-  rep_args->base_offset = (apr_off_t) apr_atoi64(str);
+  if (! str)
+    goto error;
+  SVN_ERR(svn_cstring_atoi64(&val, str));
+  rep_args->base_offset = (apr_off_t)val;
 
   str = apr_strtok(NULL, " ", &last_str);
-  if (! str) goto err;
-  rep_args->base_length = (apr_size_t) apr_atoi64(str);
+  if (! str)
+    goto error;
+  SVN_ERR(svn_cstring_atoi64(&val, str));
+  rep_args->base_length = (apr_size_t)val;
 
   *rep_args_p = rep_args;
   return SVN_NO_ERROR;
 
- err:
+ error:
   return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                           _("Malformed representation header"));
 }
@@ -2594,6 +2615,7 @@ get_root_changes_offset(apr_off_t *root_
   apr_off_t rev_offset;
   char buf[64];
   int i, num_bytes;
+  const char *str;
   apr_size_t len;
   apr_seek_where_t seek_relative;
 
@@ -2648,7 +2670,8 @@ get_root_changes_offset(apr_off_t *root_
   /* Look for the next previous newline. */
   for (i = num_bytes - 2; i >= 0; i--)
     {
-      if (buf[i] == '\n') break;
+      if (buf[i] == '\n')
+        break;
     }
 
   if (i < 0)
@@ -2659,24 +2682,42 @@ get_root_changes_offset(apr_off_t *root_
     }
 
   i++;
-
-  if (root_offset)
-    *root_offset = rev_offset + apr_atoi64(&buf[i]);
+  str = &buf[i];
 
   /* find the next space */
   for ( ; i < (num_bytes - 2) ; i++)
-    if (buf[i] == ' ') break;
+    if (buf[i] == ' ')
+      break;
 
   if (i == (num_bytes - 2))
     return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                             _("Final line in revision file missing space"));
 
+  if (root_offset)
+    {
+      apr_int64_t val;
+
+      buf[i] = '\0';
+      SVN_ERR(svn_cstring_atoi64(&val, str));
+      *root_offset = rev_offset + (apr_off_t)val;
+    }
+
   i++;
+  str = &buf[i];
+
+  /* find the next newline */
+  for ( ; i < num_bytes; i++)
+    if (buf[i] == '\n')
+      break;
 
-  /* note that apr_atoi64() will stop reading as soon as it encounters
-     the final newline. */
   if (changes_offset)
-    *changes_offset = rev_offset + apr_atoi64(&buf[i]);
+    {
+      apr_int64_t val;
+
+      buf[i] = '\0';
+      SVN_ERR(svn_cstring_atoi64(&val, str));
+      *changes_offset = rev_offset + (apr_off_t)val;
+    }
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/javahl-ra/subversion/libsvn_fs_fs/id.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_fs_fs/id.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_fs_fs/id.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_fs_fs/id.c Wed Sep 15 07:44:02 2010
@@ -275,6 +275,9 @@ svn_fs_fs__id_parse(const char *data,
 
   if (str[0] == 'r')
     {
+      apr_int64_t val;
+      svn_error_t *err;
+
       /* This is a revision type ID */
       pvt->txn_id = NULL;
 
@@ -286,7 +289,13 @@ svn_fs_fs__id_parse(const char *data,
       str = apr_strtok(NULL, "/", &last_str);
       if (str == NULL)
         return NULL;
-      pvt->offset = apr_atoi64(str);
+      err = svn_cstring_atoi64(&val, str);
+      if (err)
+        {
+          svn_error_clear(err);
+          return NULL;
+        }
+      pvt->offset = (apr_off_t)val;
     }
   else if (str[0] == 't')
     {

Modified: subversion/branches/javahl-ra/subversion/libsvn_fs_fs/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_fs_fs/lock.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_fs_fs/lock.c Wed Sep 15 07:44:02 2010
@@ -192,7 +192,7 @@ write_digest_file(apr_hash_t *children,
           svn_stringbuf_appendbytes(children_list,
                                     svn__apr_hash_index_key(hi),
                                     svn__apr_hash_index_klen(hi));
-          svn_stringbuf_appendbytes(children_list, "\n", 1);
+          svn_stringbuf_appendbyte(children_list, '\n');
         }
       hash_store(hash, CHILDREN_KEY, sizeof(CHILDREN_KEY)-1,
                  children_list->data, children_list->len, pool);

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_neon/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_neon/lock.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_neon/lock.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_neon/lock.c Wed Sep 15 07:44:02 2010
@@ -32,6 +32,7 @@
 #include "svn_ra.h"
 #include "../libsvn_ra/ra_loader.h"
 #include "svn_path.h"
+#include "svn_string.h"
 #include "svn_time.h"
 #include "svn_private_config.h"
 
@@ -209,8 +210,9 @@ lock_from_baton(svn_lock_t **lock,
         {
           if (strncmp("Second-", timeout_str, strlen("Second-")) == 0)
             {
-              int time_offset = atoi(&(timeout_str[7]));
-
+              int time_offset;
+              
+              SVN_ERR(svn_cstring_atoi(&time_offset, &(timeout_str[7])));
               lck->expiration_date = lck->creation_date
                 + apr_time_from_sec(time_offset);
             }

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_neon/util.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_neon/util.c Wed Sep 15 07:44:02 2010
@@ -775,7 +775,18 @@ start_err_element(void *baton, int paren
                                  atts);
 
         if (errcode_str && *err)
-          (*err)->apr_err = atoi(errcode_str);
+          {
+            apr_int64_t val;
+            svn_error_t *err2;
+
+            err2 = svn_cstring_atoi64(&val, errcode_str);
+            if (err2)
+              {
+                svn_error_clear(err2);
+                break;
+              }
+            (*err)->apr_err = (apr_status_t)val;
+          }
 
         break;
       }

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/property.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/property.c Wed Sep 15 07:44:02 2010
@@ -162,6 +162,16 @@ svn_ra_serf__get_ver_prop(apr_hash_t *pr
   return NULL;
 }
 
+const svn_string_t *
+svn_ra_serf__get_prop_string(apr_hash_t *props,
+                             const char *path,
+                             const char *ns,
+                             const char *name)
+{
+  return svn_ra_serf__get_ver_prop_string(props, path, SVN_INVALID_REVNUM,
+                                          ns, name);
+}
+
 const char *
 svn_ra_serf__get_prop(apr_hash_t *props,
                       const char *path,

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/ra_serf.h?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/ra_serf.h Wed Sep 15 07:44:02 2010
@@ -1033,12 +1033,21 @@ const svn_string_t *
 svn_ra_serf__get_ver_prop_string(apr_hash_t *props,
                                  const char *path, svn_revnum_t rev,
                                  const char *ns, const char *name);
+
+/* Wraps svn_ra_serf__get_ver_prop_string(). */
 const char *
 svn_ra_serf__get_ver_prop(apr_hash_t *props,
                           const char *path, svn_revnum_t rev,
                           const char *ns, const char *name);
 
-/* Same as get_prop, but for the unknown revision */
+/* Same as get_ver_prop_string, but for the unknown revision */
+const svn_string_t *
+svn_ra_serf__get_prop_string(apr_hash_t *props,
+                             const char *path,
+                             const char *ns,
+                             const char *name);
+
+/* Same as get_ver_prop, but for the unknown revision */
 const char *
 svn_ra_serf__get_prop(apr_hash_t *props,
                       const char *path,

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_serf/util.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_serf/util.c Wed Sep 15 07:44:02 2010
@@ -36,6 +36,7 @@
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
 #include "svn_private_config.h"
+#include "svn_string.h"
 #include "svn_xml.h"
 #include "private/svn_dep_compat.h"
 
@@ -736,7 +737,10 @@ start_error(svn_ra_serf__xml_parser_t *p
       err_code = svn_xml_get_attr_value("errcode", attrs);
       if (err_code)
         {
-          ctx->error->apr_err = apr_atoi64(err_code);
+          apr_int64_t val;
+          
+          SVN_ERR(svn_cstring_atoi64(&val, err_code));
+          ctx->error->apr_err = (apr_status_t)val;
         }
       else
         {

Modified: subversion/branches/javahl-ra/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_ra_svn/marshal.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_ra_svn/marshal.c Wed Sep 15 07:44:02 2010
@@ -38,6 +38,7 @@
 #include "svn_pools.h"
 #include "svn_ra_svn.h"
 #include "svn_private_config.h"
+#include "svn_ctype.h"
 
 #include "ra_svn.h"
 
@@ -593,7 +594,7 @@ static svn_error_t *read_item(svn_ra_svn
   /* Determine the item type and read it in.  Make sure that c is the
    * first character at the end of the item so we can test to make
    * sure it's whitespace. */
-  if (apr_isdigit(c))
+  if (svn_ctype_isdigit(c))
     {
       /* It's a number or a string.  Read the number part, either way. */
       val = c - '0';
@@ -601,7 +602,7 @@ static svn_error_t *read_item(svn_ra_svn
         {
           prev_val = val;
           SVN_ERR(readbuf_getchar(conn, pool, &c));
-          if (!apr_isdigit(c))
+          if (!svn_ctype_isdigit(c))
             break;
           val = val * 10 + (c - '0');
           if ((val / 10) != prev_val) /* val wrapped past maximum value */
@@ -621,16 +622,16 @@ static svn_error_t *read_item(svn_ra_svn
           item->u.number = val;
         }
     }
-  else if (apr_isalpha(c))
+  else if (svn_ctype_isalpha(c))
     {
       /* It's a word. */
       str = svn_stringbuf_ncreate(&c, 1, pool);
       while (1)
         {
           SVN_ERR(readbuf_getchar(conn, pool, &c));
-          if (!apr_isalnum(c) && c != '-')
+          if (!svn_ctype_isalnum(c) && c != '-')
             break;
-          svn_stringbuf_appendbytes(str, &c, 1);
+          svn_stringbuf_appendbyte(str, c);
         }
       item->kind = SVN_RA_SVN_WORD;
       item->u.word = str->data;

Modified: subversion/branches/javahl-ra/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_repos/dump.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_repos/dump.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_repos/dump.c Wed Sep 15 07:44:02 2010
@@ -42,6 +42,7 @@
 /*----------------------------------------------------------------------*/
 
 
+
 /* Compute the delta between OLDROOT/OLDPATH and NEWROOT/NEWPATH and
    store it into a new temporary file *TEMPFILE.  OLDROOT may be NULL,
    in which case the delta will be computed against an empty file, as

Modified: subversion/branches/javahl-ra/subversion/libsvn_repos/load.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_repos/load.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_repos/load.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_repos/load.c Wed Sep 15 07:44:02 2010
@@ -34,9 +34,11 @@
 #include "svn_mergeinfo.h"
 #include "svn_checksum.h"
 #include "svn_subst.h"
+#include "svn_ctype.h"
 
 #include <apr_lib.h>
 
+#include "private/svn_dep_compat.h"
 #include "private/svn_mergeinfo_private.h"
 
 /*----------------------------------------------------------------------*/
@@ -449,9 +451,11 @@ parse_property_block(svn_stream_t *strea
       else if ((buf[0] == 'K') && (buf[1] == ' '))
         {
           char *keybuf;
+          apr_uint64_t len;
 
+          SVN_ERR(svn_cstring_strtoui64(&len, buf + 2, 0, APR_SIZE_MAX, 10));
           SVN_ERR(read_key_or_val(&keybuf, actual_length,
-                                  stream, atoi(buf + 2), proppool));
+                                  stream, (apr_size_t)len, proppool));
 
           /* Read a val length line */
           SVN_ERR(svn_stream_readline(stream, &strbuf, "\n", &eof, proppool));
@@ -465,8 +469,10 @@ parse_property_block(svn_stream_t *strea
             {
               svn_string_t propstring;
               char *valbuf;
+              apr_int64_t val;
 
-              propstring.len = atoi(buf + 2);
+              SVN_ERR(svn_cstring_atoi64(&val, buf + 2));
+              propstring.len = (apr_size_t)val;
               SVN_ERR(read_key_or_val(&valbuf, actual_length,
                                       stream, propstring.len, proppool));
               propstring.data = valbuf;
@@ -523,9 +529,11 @@ parse_property_block(svn_stream_t *strea
       else if ((buf[0] == 'D') && (buf[1] == ' '))
         {
           char *keybuf;
+          apr_uint64_t len;
 
+          SVN_ERR(svn_cstring_strtoui64(&len, buf + 2, 0, APR_SIZE_MAX, 10));
           SVN_ERR(read_key_or_val(&keybuf, actual_length,
-                                  stream, atoi(buf + 2), proppool));
+                                  stream, (apr_size_t)len, proppool));
 
           /* We don't expect these in revision properties, and if we see
              one when we don't have a delete_node_property callback,
@@ -642,7 +650,7 @@ parse_format_version(const char *version
     return svn_error_create(SVN_ERR_STREAM_MALFORMED_DATA, NULL,
                             _("Malformed dumpfile header"));
 
-  value = atoi(p+1);
+  SVN_ERR(svn_cstring_atoi(&value, p + 1));
 
   if (value > SVN_REPOS_DUMPFILE_FORMAT_VERSION)
     return svn_error_createf(SVN_ERR_STREAM_MALFORMED_DATA, NULL,
@@ -735,7 +743,7 @@ svn_repos_parse_dumpstream2(svn_stream_t
             return stream_ran_dry();
         }
 
-      if ((linebuf->len == 0) || (apr_isspace(linebuf->data[0])))
+      if ((linebuf->len == 0) || (svn_ctype_isspace(linebuf->data[0])))
         continue; /* empty line ... loop */
 
       /*** Found the beginning of a new record. ***/
@@ -784,7 +792,7 @@ svn_repos_parse_dumpstream2(svn_stream_t
                                      APR_HASH_KEY_STRING)))
         {
           /* ### someday, switch modes of operation here. */
-          version = atoi(value);
+          SVN_ERR(svn_cstring_atoi(&version, value));
         }
       /* Or is this bogosity?! */
       else

Modified: subversion/branches/javahl-ra/subversion/libsvn_repos/reporter.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_repos/reporter.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_repos/reporter.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_repos/reporter.c Wed Sep 15 07:44:02 2010
@@ -32,6 +32,7 @@
 #include "svn_props.h"
 #include "repos.h"
 #include "svn_private_config.h"
+#include "private/svn_dep_compat.h"
 
 #define NUM_CACHED_SOURCE_ROOTS 4
 
@@ -155,11 +156,6 @@ read_number(apr_uint64_t *num, apr_file_
   return SVN_NO_ERROR;
 }
 
-#ifndef APR_SIZE_MAX
-/* APR 0.9 doesn't define APR_SIZE_MAX */
-#define APR_SIZE_MAX    (~((apr_size_t)0))
-#endif
-
 static svn_error_t *
 read_string(const char **str, apr_file_t *temp, apr_pool_t *pool)
 {

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/config_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/config_file.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/config_file.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/config_file.c Wed Sep 15 07:44:02 2010
@@ -34,6 +34,7 @@
 #include "svn_utf.h"
 #include "svn_pools.h"
 #include "svn_user.h"
+#include "svn_ctype.h"
 
 #include "svn_private_config.h"
 
@@ -121,7 +122,7 @@ skip_whitespace(parse_context_t *ctx, in
   int count = 0;
 
   SVN_ERR(parser_getc(ctx, &ch));
-  while (ch != EOF && ch != '\n' && apr_isspace(ch))
+  while (ch != EOF && ch != '\n' && svn_ctype_isspace(ch))
     {
       ++count;
       SVN_ERR(parser_getc(ctx, &ch));
@@ -162,7 +163,7 @@ parse_value(int *pch, parse_context_t *c
     /* last ch seen was ':' or '=' in parse_option. */
     {
       const char char_from_int = ch;
-      svn_stringbuf_appendbytes(ctx->value, &char_from_int, 1);
+      svn_stringbuf_appendbyte(ctx->value, char_from_int);
       SVN_ERR(parser_getc(ctx, &ch));
     }
   /* Leading and trailing whitespace is ignored. */
@@ -213,13 +214,12 @@ parse_value(int *pch, parse_context_t *c
               else
                 {
                   /* This is a continuation line. Read it. */
-                  svn_stringbuf_appendbytes(ctx->value, " ", 1);
+                  svn_stringbuf_appendbyte(ctx->value, ' ');
 
                   while (ch != EOF && ch != '\n')
                     {
                       const char char_from_int = ch;
-                      svn_stringbuf_appendbytes(ctx->value,
-                                                &char_from_int, 1);
+                      svn_stringbuf_appendbyte(ctx->value, char_from_int);
                       SVN_ERR(parser_getc(ctx, &ch));
                     }
                   /* Trailing whitespace is ignored. */
@@ -246,7 +246,7 @@ parse_option(int *pch, parse_context_t *
   while (ch != EOF && ch != ':' && ch != '=' && ch != '\n')
     {
       const char char_from_int = ch;
-      svn_stringbuf_appendbytes(ctx->option, &char_from_int, 1);
+      svn_stringbuf_appendbyte(ctx->option, char_from_int);
       SVN_ERR(parser_getc(ctx, &ch));
     }
 
@@ -289,7 +289,7 @@ parse_section_name(int *pch, parse_conte
   while (ch != EOF && ch != ']' && ch != '\n')
     {
       const char char_from_int = ch;
-      svn_stringbuf_appendbytes(ctx->section, &char_from_int, 1);
+      svn_stringbuf_appendbyte(ctx->section, char_from_int);
       SVN_ERR(parser_getc(ctx, &ch));
     }
 

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/dirent_uri.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/dirent_uri.c Wed Sep 15 07:44:02 2010
@@ -34,6 +34,7 @@
 #include "svn_string.h"
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
+#include "svn_ctype.h"
 
 #include "dirent_uri.h"
 
@@ -549,7 +550,8 @@ canonicalize(path_type_t type, const cha
               case '/':
                 break;
               case '%':
-                if (!apr_isxdigit(*(src+1)) || !apr_isxdigit(*(src+2)))
+                if (!svn_ctype_isxdigit(*(src+1)) ||
+                    !svn_ctype_isxdigit(*(src+2)))
                   need_extra += 2;
                 else
                   src += 2;
@@ -585,7 +587,8 @@ canonicalize(path_type_t type, const cha
                 *(dst++) = '/';
                 break;
               case '%':
-                if (!apr_isxdigit(*(src+1)) || !apr_isxdigit(*(src+2)))
+                if (!svn_ctype_isxdigit(*(src+1)) ||
+                    !svn_ctype_isxdigit(*(src+2)))
                   {
                     *(dst++) = '%';
                     *(dst++) = '2';
@@ -1899,7 +1902,7 @@ svn_uri_is_canonical(const char *uri, ap
               char digitz[3];
               int val;
 
-              /* Can't use apr_isxdigit() because lower case letters are
+              /* Can't usesvn_ctype_isxdigit() because lower case letters are
                  not in our canonical format */
               if (((*(ptr+1) < '0' || *(ptr+1) > '9')) 
                   && (*(ptr+1) < 'A' || *(ptr+1) > 'F'))

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/io.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/io.c Wed Sep 15 07:44:02 2010
@@ -57,6 +57,7 @@
 #include "svn_utf.h"
 #include "svn_config.h"
 #include "svn_private_config.h"
+#include "svn_ctype.h"
 
 #include "private/svn_atomic.h"
 
@@ -3476,8 +3477,11 @@ svn_io_read_version_file(int *version,
         char c = buf[i];
 
         if (i > 0 && (c == '\r' || c == '\n'))
-          break;
-        if (! apr_isdigit(c))
+          {
+            buf[i] = '\0';
+            break;
+          }
+        if (! svn_ctype_isdigit(c))
           return svn_error_createf
             (SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
              _("First line of '%s' contains non-digit"),

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/opt.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/opt.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/opt.c Wed Sep 15 07:44:02 2010
@@ -43,6 +43,7 @@
 #include "svn_utf.h"
 #include "svn_time.h"
 #include "svn_props.h"
+#include "svn_ctype.h"
 
 #include "private/svn_opt_private.h"
 
@@ -456,11 +457,11 @@ static char *parse_one_rev(svn_opt_revis
       revision->value.date = tm;
       return end + 1;
     }
-  else if (apr_isdigit(*str))
+  else if (svn_ctype_isdigit(*str))
     {
       /* It's a number. */
       end = str + 1;
-      while (apr_isdigit(*end))
+      while (svn_ctype_isdigit(*end))
         end++;
       save = *end;
       *end = '\0';
@@ -469,10 +470,10 @@ static char *parse_one_rev(svn_opt_revis
       *end = save;
       return end;
     }
-  else if (apr_isalpha(*str))
+  else if (svn_ctype_isalpha(*str))
     {
       end = str + 1;
-      while (apr_isalpha(*end))
+      while (svn_ctype_isalpha(*end))
         end++;
       save = *end;
       *end = '\0';

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/path.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/path.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/path.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/path.c Wed Sep 15 07:44:02 2010
@@ -727,7 +727,8 @@ svn_path_is_uri_safe(const char *path)
       /* Allow '%XX' (where each X is a hex digit) */
       if (path[i] == '%')
         {
-          if (apr_isxdigit(path[i + 1]) && apr_isxdigit(path[i + 2]))
+          if (svn_ctype_isxdigit(path[i + 1]) &&
+              svn_ctype_isxdigit(path[i + 2]))
             {
               i += 2;
               continue;
@@ -897,8 +898,8 @@ svn_path_uri_decode(const char *path, ap
            * RFC 2396, section 3.3  */
           c = ' ';
         }
-      else if (c == '%' && apr_isxdigit(path[i + 1])
-               && apr_isxdigit(path[i+2]))
+      else if (c == '%' && svn_ctype_isxdigit(path[i + 1])
+               && svn_ctype_isxdigit(path[i+2]))
         {
           char digitz[3];
           digitz[0] = path[++i];

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/prompt.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/prompt.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/prompt.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/prompt.c Wed Sep 15 07:44:02 2010
@@ -147,7 +147,7 @@ prompt(const char **result,
                 SVN_ERR_MALFUNCTION();
             }
 
-          svn_stringbuf_appendbytes(strbuf, &c, 1);
+          svn_stringbuf_appendbyte(strbuf, c);
         }
     }
   else

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/quoprint.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/quoprint.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/quoprint.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/quoprint.c Wed Sep 15 07:44:02 2010
@@ -92,7 +92,7 @@ encode_bytes(svn_stringbuf_t *str, const
       /* Encode this character.  */
       if (ENCODE_AS_LITERAL(*p))
         {
-          svn_stringbuf_appendbytes(str, p, 1);
+          svn_stringbuf_appendbyte(str, *p);
           (*linelen)++;
         }
       else
@@ -218,7 +218,7 @@ decode_bytes(svn_stringbuf_t *str, const
         {
           /* Literal character; append it if it's valid as such.  */
           if (VALID_LITERAL(*inbuf))
-            svn_stringbuf_appendbytes(str, inbuf, 1);
+            svn_stringbuf_appendbyte(str, *inbuf);
           *inbuflen = 0;
         }
       else if (*inbuf == '=' && *inbuflen == 2 && inbuf[1] == '\n')
@@ -234,7 +234,7 @@ decode_bytes(svn_stringbuf_t *str, const
           if (find1 != NULL && find2 != NULL)
             {
               c = ((find1 - hextab) << 4) | (find2 - hextab);
-              svn_stringbuf_appendbytes(str, &c, 1);
+              svn_stringbuf_appendbyte(str, c);
             }
           *inbuflen = 0;
         }

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/skel.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/skel.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/skel.c Wed Sep 15 07:44:02 2010
@@ -535,7 +535,7 @@ unparse(const svn_skel_t *skel, svn_stri
         }
 
       /* Emit a closing parenthesis.  */
-      svn_stringbuf_appendbytes(str, ")", 1);
+      svn_stringbuf_appendbyte(str, ')');
     }
 
   return str;
@@ -666,12 +666,16 @@ svn_skel__list_length(const svn_skel_t *
 
 /* Parsing and unparsing into high-level types. */
 
-apr_int64_t svn_skel__parse_int(const svn_skel_t *skel,
-                                apr_pool_t *scratch_pool)
+svn_error_t *
+svn_skel__parse_int(apr_int64_t *n, const svn_skel_t *skel,
+                    apr_pool_t *scratch_pool)
 {
+  const char *str;
+
   /* We need to duplicate the SKEL contents in order to get a NUL-terminated
      version of it. The SKEL may not have valid memory at DATA[LEN].  */
-  return apr_atoi64(apr_pstrmemdup(scratch_pool, skel->data, skel->len));
+  str = apr_pstrmemdup(scratch_pool, skel->data, skel->len);
+  return svn_error_return(svn_cstring_atoi64(n, str));
 }
 
 

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/stream.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/stream.c Wed Sep 15 07:44:02 2010
@@ -296,7 +296,7 @@ stream_readline(svn_stringbuf_t **string
       else
         match = eol_str;
 
-      svn_stringbuf_appendbytes(str, &c, 1);
+      svn_stringbuf_appendbyte(str, c);
     }
 
   *eof = FALSE;

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/subst.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/subst.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/subst.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/subst.c Wed Sep 15 07:44:02 2010
@@ -211,10 +211,10 @@ keyword_printf(const char *fmt,
             svn_stringbuf_appendcstr(value, url);
           break;
         case '%': /* '%%' => a literal % */
-          svn_stringbuf_appendbytes(value, cur, 1);
+          svn_stringbuf_appendbyte(value, *cur);
           break;
         case '\0': /* '%' as the last character of the string. */
-          svn_stringbuf_appendbytes(value, cur, 1);
+          svn_stringbuf_appendbyte(value, *cur);
           /* Now go back one character, since this was just a one character
            * sequence, whereas all others are two characters, and we do not
            * want to skip the null terminator entirely and carry on

Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/svn_string.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/svn_string.c?rev=997216&r1=997215&r2=997216&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/svn_string.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/svn_string.c Wed Sep 15 07:44:02 2010
@@ -88,7 +88,7 @@ string_first_non_whitespace(const char *
 
   for (i = 0; i < len; i++)
     {
-      if (! apr_isspace(str[i]))
+      if (! svn_ctype_isspace(str[i]))
         return i;
     }
 
@@ -389,6 +389,34 @@ svn_stringbuf_ensure(svn_stringbuf_t *st
 
 
 void
+svn_stringbuf_appendbyte(svn_stringbuf_t *str, char byte)
+{
+  /* In most cases, there will be pre-allocated memory left
+   * to just write the new byte at the end of the used section
+   * and terminate the string properly.
+   */
+  apr_size_t old_len = str->len;
+  if (str->blocksize > old_len + 1)
+    {
+      char *dest = str->data;
+
+      dest[old_len] = byte;
+      dest[old_len+1] = '\0';
+
+      str->len = old_len+1;
+    }
+  else
+    {
+      /* we need to re-allocate the string buffer
+       * -> let the more generic implementation take care of that part
+       */
+      char b = byte;
+      svn_stringbuf_appendbytes(str, &b, 1);
+    }
+}
+
+
+void
 svn_stringbuf_appendbytes(svn_stringbuf_t *str, const char *bytes,
                           apr_size_t count)
 {
@@ -464,7 +492,7 @@ svn_stringbuf_strip_whitespace(svn_strin
   str->blocksize -= offset;
 
   /* Now that we've trimmed the front, trim the end, wasting more RAM. */
-  while ((str->len > 0) && apr_isspace(str->data[str->len - 1]))
+  while ((str->len > 0) && svn_ctype_isspace(str->data[str->len - 1]))
     str->len--;
   str->data[str->len] = '\0';
 }
@@ -506,12 +534,12 @@ svn_cstring_split_append(apr_array_heade
     {
       if (chop_whitespace)
         {
-          while (apr_isspace(*p))
+          while (svn_ctype_isspace(*p))
             p++;
 
           {
             char *e = p + (strlen(p) - 1);
-            while ((e >= p) && (apr_isspace(*e)))
+            while ((e >= p) && (svn_ctype_isspace(*e)))
               e--;
             *(++e) = '\0';
           }
@@ -615,24 +643,27 @@ svn_cstring_strtoui64(apr_uint64_t *n, c
                       apr_uint64_t minval, apr_uint64_t maxval,
                       int base)
 {
-  apr_int64_t parsed;
+  apr_int64_t val;
+  char *endptr;
 
   /* We assume errno is thread-safe. */
   errno = 0; /* APR-0.9 doesn't always set errno */
 
   /* ### We're throwing away half the number range here.
-   * ### Maybe implement our own number parser? */
-  parsed = apr_strtoi64(str, NULL, base);
-  if (errno != 0)
+   * ### APR needs a apr_strtoui64() function. */
+  val = apr_strtoi64(str, &endptr, base);
+  if (errno == EINVAL || endptr == str || str[0] == '\0' || *endptr != '\0')
     return svn_error_return(
              svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
                                _("Could not convert '%s' into a number"),
                                str));
-  if (parsed < 0 || parsed < minval || parsed > maxval)
+  if ((errno == ERANGE && (val == APR_INT64_MIN || val == APR_INT64_MAX)) ||
+      val < 0 || (apr_uint64_t)val < minval || (apr_uint64_t)val > maxval)
     return svn_error_return(
              svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
-                               _("Number '%s' is out of range"), str));
-  *n = parsed;
+                               _("Number '%s' is out of range '[%lu, %lu]'"),
+                               str, minval, maxval));
+  *n = val;
   return SVN_NO_ERROR;
 }
 
@@ -646,10 +677,10 @@ svn_cstring_atoui64(apr_uint64_t *n, con
 svn_error_t *
 svn_cstring_atoui(unsigned int *n, const char *str)
 {
-  apr_uint64_t parsed;
+  apr_uint64_t val;
 
-  SVN_ERR(svn_cstring_strtoui64(&parsed, str, 0, APR_UINT32_MAX, 10));
-  *n = (unsigned int)parsed;
+  SVN_ERR(svn_cstring_strtoui64(&val, str, 0, APR_UINT32_MAX, 10));
+  *n = (unsigned int)val;
   return SVN_NO_ERROR;
 }
 
@@ -658,22 +689,25 @@ svn_cstring_strtoi64(apr_int64_t *n, con
                      apr_int64_t minval, apr_int64_t maxval,
                      int base)
 {
-  apr_int64_t parsed;
+  apr_int64_t val;
+  char *endptr;
 
   /* We assume errno is thread-safe. */
   errno = 0; /* APR-0.9 doesn't always set errno */
 
-  parsed = apr_strtoi64(str, NULL, base);
-  if (errno != 0)
+  val = apr_strtoi64(str, &endptr, base);
+  if (errno == EINVAL || endptr == str || str[0] == '\0' || *endptr != '\0')
     return svn_error_return(
              svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
                                _("Could not convert '%s' into a number"),
                                str));
-  if (parsed < minval || parsed > maxval)
+  if ((errno == ERANGE && (val == APR_INT64_MIN || val == APR_INT64_MAX)) ||
+      val < minval || val > maxval)
     return svn_error_return(
              svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
-                               _("Number '%s' is out of range"), str));
-  *n = parsed;
+                               _("Number '%s' is out of range '[%ld, %ld]'"),
+                               str, minval, maxval));
+  *n = val;
   return SVN_NO_ERROR;
 }
 
@@ -687,10 +721,9 @@ svn_cstring_atoi64(apr_int64_t *n, const
 svn_error_t *
 svn_cstring_atoi(int *n, const char *str)
 {
-  apr_int64_t parsed;
+  apr_int64_t val;
 
-  SVN_ERR(svn_cstring_strtoi64(&parsed, str, APR_INT32_MIN,
-                               APR_INT32_MAX, 10));
-  *n = (int)parsed;
+  SVN_ERR(svn_cstring_strtoi64(&val, str, APR_INT32_MIN, APR_INT32_MAX, 10));
+  *n = (int)val;
   return SVN_NO_ERROR;
 }