You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2014/11/14 14:18:03 UTC
svn commit: r1639628 [15/23] - in /subversion/branches/svn-auth-x509: ./
build/ build/generator/ notes/ notes/api-errata/1.8/ notes/api-errata/1.9/
notes/wc-ng/ subversion/ subversion/bindings/ctypes-python/
subversion/bindings/cxxhl/ subversion/bindin...
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/commit.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/commit.c Fri Nov 14 13:17:55 2014
@@ -226,7 +226,8 @@ create_checkout_body(serf_bucket_t **bkt
svn_ra_serf__add_close_tag_buckets(body_bkt, alloc, "D:href");
svn_ra_serf__add_close_tag_buckets(body_bkt, alloc, "D:activity-set");
- svn_ra_serf__add_tag_buckets(body_bkt, "D:apply-to-version", NULL, alloc);
+ svn_ra_serf__add_empty_tag_buckets(body_bkt, alloc,
+ "D:apply-to-version", SVN_VA_NULL);
svn_ra_serf__add_close_tag_buckets(body_bkt, alloc, "D:checkout");
*bkt = body_bkt;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/get_lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/get_lock.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/get_lock.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/get_lock.c Fri Nov 14 13:17:55 2014
@@ -243,7 +243,8 @@ create_getlock_body(serf_bucket_t **body
"xmlns", "DAV:",
SVN_VA_NULL);
svn_ra_serf__add_open_tag_buckets(buckets, alloc, "prop", SVN_VA_NULL);
- svn_ra_serf__add_tag_buckets(buckets, "lockdiscovery", NULL, alloc);
+ svn_ra_serf__add_empty_tag_buckets(buckets, alloc,
+ "lockdiscovery", SVN_VA_NULL);
svn_ra_serf__add_close_tag_buckets(buckets, alloc, "prop");
svn_ra_serf__add_close_tag_buckets(buckets, alloc, "propfind");
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/lock.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/lock.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/lock.c Fri Nov 14 13:17:55 2014
@@ -315,6 +315,19 @@ run_locks(svn_ra_serf__session_t *sess,
&& !SVN_ERR_IS_UNLOCK_ERROR(err)
&& !SVN_ERR_IS_LOCK_ERROR(err))
{
+ /* If the error that we are going to report is just about the
+ POST unlock hook, we should first report that the operation
+ succeeded, or the repository and working copy will be
+ out of sync... */
+
+ if (lock_func &&
+ err->apr_err == SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED)
+ {
+ err = svn_error_compose_create(
+ err, lock_func(lock_baton, ctx->path, locking,
+ NULL, NULL, ctx->pool));
+ }
+
return svn_error_trace(err); /* Don't go through callbacks */
}
@@ -399,11 +412,11 @@ create_lock_body(serf_bucket_t **body_bk
SVN_VA_NULL);
svn_ra_serf__add_open_tag_buckets(buckets, alloc, "lockscope", SVN_VA_NULL);
- svn_ra_serf__add_tag_buckets(buckets, "exclusive", NULL, alloc);
+ svn_ra_serf__add_empty_tag_buckets(buckets, alloc, "exclusive", SVN_VA_NULL);
svn_ra_serf__add_close_tag_buckets(buckets, alloc, "lockscope");
svn_ra_serf__add_open_tag_buckets(buckets, alloc, "locktype", SVN_VA_NULL);
- svn_ra_serf__add_tag_buckets(buckets, "write", NULL, alloc);
+ svn_ra_serf__add_empty_tag_buckets(buckets, alloc, "write", SVN_VA_NULL);
svn_ra_serf__add_close_tag_buckets(buckets, alloc, "locktype");
if (ctx->lock->comment)
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/log.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/log.c Fri Nov 14 13:17:55 2014
@@ -442,23 +442,22 @@ create_log_body(serf_bucket_t **body_bkt
if (log_ctx->changed_paths)
{
- svn_ra_serf__add_tag_buckets(buckets,
- "S:discover-changed-paths", NULL,
- alloc);
+ svn_ra_serf__add_empty_tag_buckets(buckets, alloc,
+ "S:discover-changed-paths",
+ SVN_VA_NULL);
}
if (log_ctx->strict_node_history)
{
- svn_ra_serf__add_tag_buckets(buckets,
- "S:strict-node-history", NULL,
- alloc);
+ svn_ra_serf__add_empty_tag_buckets(buckets, alloc,
+ "S:strict-node-history", SVN_VA_NULL);
}
if (log_ctx->include_merged_revisions)
{
- svn_ra_serf__add_tag_buckets(buckets,
- "S:include-merged-revisions", NULL,
- alloc);
+ svn_ra_serf__add_empty_tag_buckets(buckets, alloc,
+ "S:include-merged-revisions",
+ SVN_VA_NULL);
}
if (log_ctx->revprops)
@@ -473,16 +472,14 @@ create_log_body(serf_bucket_t **body_bkt
}
if (log_ctx->revprops->nelts == 0)
{
- svn_ra_serf__add_tag_buckets(buckets,
- "S:no-revprops", NULL,
- alloc);
+ svn_ra_serf__add_empty_tag_buckets(buckets, alloc,
+ "S:no-revprops", SVN_VA_NULL);
}
}
else
{
- svn_ra_serf__add_tag_buckets(buckets,
- "S:all-revprops", NULL,
- alloc);
+ svn_ra_serf__add_empty_tag_buckets(buckets, alloc,
+ "S:all-revprops", SVN_VA_NULL);
}
if (log_ctx->paths)
@@ -497,9 +494,8 @@ create_log_body(serf_bucket_t **body_bkt
}
}
- svn_ra_serf__add_tag_buckets(buckets,
- "S:encode-binary-props", NULL,
- alloc);
+ svn_ra_serf__add_empty_tag_buckets(buckets, alloc,
+ "S:encode-binary-props", SVN_VA_NULL);
svn_ra_serf__add_close_tag_buckets(buckets, alloc,
"S:log-report");
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/merge.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/merge.c Fri Nov 14 13:17:55 2014
@@ -358,15 +358,22 @@ create_merge_body(serf_bucket_t **bkt,
svn_ra_serf__add_close_tag_buckets(body_bkt, alloc, "D:href");
svn_ra_serf__add_close_tag_buckets(body_bkt, alloc, "D:source");
- svn_ra_serf__add_tag_buckets(body_bkt, "D:no-auto-merge", NULL, alloc);
- svn_ra_serf__add_tag_buckets(body_bkt, "D:no-checkout", NULL, alloc);
+ svn_ra_serf__add_empty_tag_buckets(body_bkt, alloc,
+ "D:no-auto-merge", SVN_VA_NULL);
+ svn_ra_serf__add_empty_tag_buckets(body_bkt, alloc,
+ "D:no-checkout", SVN_VA_NULL);
svn_ra_serf__add_open_tag_buckets(body_bkt, alloc, "D:prop", SVN_VA_NULL);
- svn_ra_serf__add_tag_buckets(body_bkt, "D:checked-in", NULL, alloc);
- svn_ra_serf__add_tag_buckets(body_bkt, "D:" SVN_DAV__VERSION_NAME, NULL, alloc);
- svn_ra_serf__add_tag_buckets(body_bkt, "D:resourcetype", NULL, alloc);
- svn_ra_serf__add_tag_buckets(body_bkt, "D:" SVN_DAV__CREATIONDATE, NULL, alloc);
- svn_ra_serf__add_tag_buckets(body_bkt, "D:creator-displayname", NULL, alloc);
+ svn_ra_serf__add_empty_tag_buckets(body_bkt, alloc,
+ "D:checked-in", SVN_VA_NULL);
+ svn_ra_serf__add_empty_tag_buckets(body_bkt, alloc,
+ "D:" SVN_DAV__VERSION_NAME, SVN_VA_NULL);
+ svn_ra_serf__add_empty_tag_buckets(body_bkt, alloc,
+ "D:resourcetype", SVN_VA_NULL);
+ svn_ra_serf__add_empty_tag_buckets(body_bkt, alloc,
+ "D:" SVN_DAV__CREATIONDATE, SVN_VA_NULL);
+ svn_ra_serf__add_empty_tag_buckets(body_bkt, alloc,
+ "D:creator-displayname", SVN_VA_NULL);
svn_ra_serf__add_close_tag_buckets(body_bkt, alloc, "D:prop");
merge_lock_token_list(ctx->lock_tokens, NULL, body_bkt, alloc, pool);
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/ra_serf.h?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/ra_serf.h Fri Nov 14 13:17:55 2014
@@ -54,9 +54,6 @@ extern "C" {
#error Please update your version of serf to at least 1.2.1.
#endif
-/** Use this to silence compiler warnings about unused parameters. */
-#define UNUSED_CTX(x) ((void)(x))
-
/** Wait duration (in microseconds) used in calls to serf_context_run() */
#define SVN_RA_SERF__CONTEXT_RUN_DURATION 500000
@@ -895,6 +892,16 @@ svn_ra_serf__add_close_tag_buckets(serf_
serf_bucket_alloc_t *bkt_alloc,
const char *tag);
+/* Add the appropriate serf buckets to AGG_BUCKET representing the XML
+ * open tag with name TAG, and then immediately closes the tag using the />
+ * notation
+ */
+void
+svn_ra_serf__add_empty_tag_buckets(serf_bucket_t *agg_bucket,
+ serf_bucket_alloc_t *bkt_alloc,
+ const char *tag,
+ ...) SVN_NEEDS_SENTINEL_NULL;
+
/*
* Add the appropriate serf buckets to AGG_BUCKET with xml-escaped
* version of DATA.
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/replay.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/replay.c Fri Nov 14 13:17:55 2014
@@ -61,7 +61,7 @@ typedef enum replay_state_e {
REPLAY_CLOSE_DIRECTORY,
REPLAY_CHANGE_DIRECTORY_PROP,
REPLAY_CHANGE_FILE_PROP,
- REPLAY_APPLY_TEXTDELTA,
+ REPLAY_APPLY_TEXTDELTA
} replay_state_e;
#define S_ SVN_XML_NAMESPACE
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/update.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/update.c Fri Nov 14 13:17:55 2014
@@ -752,22 +752,45 @@ get_best_connection(report_context_t *ct
if (ctx->report_received && (ctx->sess->max_connections > 2))
first_conn = 0;
- /* Currently, we just cycle connections. In the future we could
- store the number of pending requests on each connection, or
- perform other heuristics, to achieve better connection usage.
- (As an optimization, if there's only one available auxiliary
- connection to use, don't bother doing all the cur_conn math --
- just return that one connection.) */
+ /* If there's only one available auxiliary connection to use, don't bother
+ doing all the cur_conn math -- just return that one connection. */
if (ctx->sess->num_conns - first_conn == 1)
{
conn = ctx->sess->conns[first_conn];
}
else
{
+#if SERF_VERSION_AT_LEAST(1, 4, 0)
+ /* Often one connection is slower than others, e.g. because the server
+ process/thread has to do more work for the particular set of requests.
+ In the worst case, when REQUEST_COUNT_TO_RESUME requests are queued
+ on such a slow connection, ra_serf will completely stop sending
+ requests.
+
+ The method used here selects the connection with the least amount of
+ pending requests, thereby giving more work to lightly loaded server
+ processes.
+ */
+ unsigned int i, min = INT_MAX, best_conn = first_conn;
+ for (i = first_conn; i < ctx->sess->num_conns; i++)
+ {
+ serf_connection_t *sc = ctx->sess->conns[i]->conn;
+ unsigned int pending = serf_connection_pending_requests(sc);
+ if (pending < min)
+ {
+ min = pending;
+ best_conn = i;
+ }
+ }
+ conn = ctx->sess->conns[best_conn];
+#else
+ /* We don't know how many requests are pending per connection, so just
+ cycle them. */
conn = ctx->sess->conns[ctx->sess->cur_conn];
ctx->sess->cur_conn++;
if (ctx->sess->cur_conn >= ctx->sess->num_conns)
ctx->sess->cur_conn = first_conn;
+#endif
}
return conn;
}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/xml.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/xml.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/xml.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_serf/xml.c Fri Nov 14 13:17:55 2014
@@ -324,6 +324,49 @@ svn_ra_serf__add_open_tag_buckets(serf_b
}
void
+svn_ra_serf__add_empty_tag_buckets(serf_bucket_t *agg_bucket,
+ serf_bucket_alloc_t *bkt_alloc,
+ const char *tag, ...)
+{
+ va_list ap;
+ const char *key;
+ serf_bucket_t *tmp;
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN("<", 1, bkt_alloc);
+ serf_bucket_aggregate_append(agg_bucket, tmp);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING(tag, bkt_alloc);
+ serf_bucket_aggregate_append(agg_bucket, tmp);
+
+ va_start(ap, tag);
+ while ((key = va_arg(ap, char *)) != NULL)
+ {
+ const char *val = va_arg(ap, const char *);
+ if (val)
+ {
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN(" ", 1, bkt_alloc);
+ serf_bucket_aggregate_append(agg_bucket, tmp);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING(key, bkt_alloc);
+ serf_bucket_aggregate_append(agg_bucket, tmp);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN("=\"", 2, bkt_alloc);
+ serf_bucket_aggregate_append(agg_bucket, tmp);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING(val, bkt_alloc);
+ serf_bucket_aggregate_append(agg_bucket, tmp);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN("\"", 1, bkt_alloc);
+ serf_bucket_aggregate_append(agg_bucket, tmp);
+ }
+ }
+ va_end(ap);
+
+ tmp = SERF_BUCKET_SIMPLE_STRING_LEN("/>", 2, bkt_alloc);
+ serf_bucket_aggregate_append(agg_bucket, tmp);
+}
+
+void
svn_ra_serf__add_close_tag_buckets(serf_bucket_t *agg_bucket,
serf_bucket_alloc_t *bkt_alloc,
const char *tag)
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_svn/client.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_svn/client.c Fri Nov 14 13:17:55 2014
@@ -368,15 +368,16 @@ ra_svn_get_reporter(svn_ra_svn__session_
/* --- RA LAYER IMPLEMENTATION --- */
-/* (Note: *ARGV is an output parameter.) */
+/* (Note: *ARGV_P is an output parameter.) */
static svn_error_t *find_tunnel_agent(const char *tunnel,
const char *hostinfo,
- const char ***argv,
+ const char ***argv_p,
apr_hash_t *config, apr_pool_t *pool)
{
svn_config_t *cfg;
const char *val, *var, *cmd;
char **cmd_argv;
+ const char **argv;
apr_size_t len;
apr_status_t status;
int n;
@@ -430,16 +431,22 @@ static svn_error_t *find_tunnel_agent(co
if (status != APR_SUCCESS)
return svn_error_wrap_apr(status, _("Can't tokenize command '%s'"), cmd);
- /* Append the fixed arguments to the result. */
+ /* Calc number of the fixed arguments. */
for (n = 0; cmd_argv[n] != NULL; n++)
;
- *argv = apr_palloc(pool, (n + 4) * sizeof(char *));
- memcpy(*argv, cmd_argv, n * sizeof(char *));
- (*argv)[n++] = svn_path_uri_decode(hostinfo, pool);
- (*argv)[n++] = "svnserve";
- (*argv)[n++] = "-t";
- (*argv)[n] = NULL;
+ argv = apr_palloc(pool, (n + 4) * sizeof(char *));
+
+ /* Append the fixed arguments to the result. */
+ for (n = 0; cmd_argv[n] != NULL; n++)
+ argv[n] = cmd_argv[n];
+
+ argv[n++] = svn_path_uri_decode(hostinfo, pool);
+ argv[n++] = "svnserve";
+ argv[n++] = "-t";
+ argv[n] = NULL;
+
+ *argv_p = argv;
return SVN_NO_ERROR;
}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_ra_svn/cyrus_auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_ra_svn/cyrus_auth.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_ra_svn/cyrus_auth.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_ra_svn/cyrus_auth.c Fri Nov 14 13:17:55 2014
@@ -93,7 +93,7 @@ static svn_error_t *
sasl_mutex_alloc_cb_internal(svn_mutex__t **mutex)
{
if (apr_is_empty_array(free_mutexes))
- return svn_mutex__init(mutex, TRUE, FALSE, sasl_pool);
+ return svn_mutex__init(mutex, TRUE, sasl_pool);
else
*mutex = *((svn_mutex__t**)apr_array_pop(free_mutexes));
@@ -179,7 +179,7 @@ svn_ra_svn__sasl_common_init(apr_pool_t
sasl_mutex_unlock_cb,
sasl_mutex_free_cb);
free_mutexes = apr_array_make(sasl_pool, 0, sizeof(svn_mutex__t *));
- SVN_ERR(svn_mutex__init(&array_mutex, TRUE, FALSE, sasl_pool));
+ SVN_ERR(svn_mutex__init(&array_mutex, TRUE, sasl_pool));
#endif /* APR_HAS_THREADS */
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_repos/dump.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_repos/dump.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_repos/dump.c Fri Nov 14 13:17:55 2014
@@ -2245,16 +2245,26 @@ svn_repos_verify_fs3(svn_repos_t *repos,
found_corruption = TRUE;
notify_verification_error(SVN_INVALID_REVNUM, err, notify_func,
notify_baton, iterpool);
- svn_error_clear(err);
+ /* If we already reported the error, reset it. */
+ if (notify_func)
+ {
+ svn_error_clear(err);
+ err = NULL;
+ }
+
+ /* If we abort the verification now, combine yet unreported error
+ info with the generic one we return. */
if (!keep_going)
/* ### Jump to "We're done" and so send the final notification,
for consistency? */
- return svn_error_createf(SVN_ERR_REPOS_CORRUPTED, NULL,
+ return svn_error_createf(SVN_ERR_REPOS_CORRUPTED, err,
_("Repository '%s' failed to verify"),
svn_dirent_local_style(svn_repos_path(repos,
pool),
pool));
+
+ svn_error_clear(err);
}
if (!metadata_only)
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_repos/load-fs-vtable.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_repos/load-fs-vtable.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_repos/load-fs-vtable.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_repos/load-fs-vtable.c Fri Nov 14 13:17:55 2014
@@ -62,7 +62,7 @@ struct parse_baton
const char *parent_dir; /* repository relpath, or NULL */
svn_repos_notify_func_t notify_func;
void *notify_baton;
- svn_repos_notify_t *notify;
+ apr_pool_t *notify_pool; /* scratch pool for notifications */
apr_pool_t *pool;
/* Start and end (inclusive) of revision range we'll pay attention
@@ -503,9 +503,14 @@ new_revision_record(void **revision_bato
if (pb->notify_func)
{
- pb->notify->action = svn_repos_notify_load_txn_start;
- pb->notify->old_revision = rb->rev;
- pb->notify_func(pb->notify_baton, pb->notify, rb->pool);
+ /* ### TODO: Use proper scratch pool instead of pb->notify_pool */
+ svn_repos_notify_t *notify = svn_repos_notify_create(
+ svn_repos_notify_load_txn_start,
+ pb->notify_pool);
+
+ notify->old_revision = rb->rev;
+ pb->notify_func(pb->notify_baton, notify, pb->notify_pool);
+ svn_pool_clear(pb->notify_pool);
}
/* Stash the oldest "old" revision committed from the load stream. */
@@ -516,9 +521,14 @@ new_revision_record(void **revision_bato
/* If we're skipping this revision, try to notify someone. */
if (rb->skipped && pb->notify_func)
{
- pb->notify->action = svn_repos_notify_load_skipped_rev;
- pb->notify->old_revision = rb->rev;
- pb->notify_func(pb->notify_baton, pb->notify, rb->pool);
+ /* ### TODO: Use proper scratch pool instead of pb->notify_pool */
+ svn_repos_notify_t *notify = svn_repos_notify_create(
+ svn_repos_notify_load_skipped_rev,
+ pb->notify_pool);
+
+ notify->old_revision = rb->rev;
+ pb->notify_func(pb->notify_baton, notify, pb->notify_pool);
+ svn_pool_clear(pb->notify_pool);
}
/* If we're parsing revision 0, only the revision props are (possibly)
@@ -587,8 +597,13 @@ maybe_add_with_history(struct node_baton
if (pb->notify_func)
{
- pb->notify->action = svn_repos_notify_load_copied_node;
- pb->notify_func(pb->notify_baton, pb->notify, rb->pool);
+ /* ### TODO: Use proper scratch pool instead of pb->notify_pool */
+ svn_repos_notify_t *notify = svn_repos_notify_create(
+ svn_repos_notify_load_copied_node,
+ pb->notify_pool);
+
+ pb->notify_func(pb->notify_baton, notify, pb->notify_pool);
+ svn_pool_clear(pb->notify_pool);
}
}
@@ -657,10 +672,14 @@ new_node_record(void **node_baton,
if (pb->notify_func)
{
- pb->notify->action = svn_repos_notify_load_node_start;
- pb->notify->node_action = nb->action;
- pb->notify->path = nb->path;
- pb->notify_func(pb->notify_baton, pb->notify, rb->pool);
+ /* ### TODO: Use proper scratch pool instead of pb->notify_pool */
+ svn_repos_notify_t *notify = svn_repos_notify_create(
+ svn_repos_notify_load_node_start,
+ pb->notify_pool);
+
+ notify->path = nb->path;
+ pb->notify_func(pb->notify_baton, notify, pb->notify_pool);
+ svn_pool_clear(pb->notify_pool);
}
switch (nb->action)
@@ -773,8 +792,14 @@ set_node_property(void *baton,
if (pb->notify_func)
{
- pb->notify->action = svn_repos_notify_load_normalized_mergeinfo;
- pb->notify_func(pb->notify_baton, pb->notify, nb->pool);
+ /* ### TODO: Use proper scratch pool instead of pb->notify_pool */
+ svn_repos_notify_t *notify
+ = svn_repos_notify_create(
+ svn_repos_notify_load_normalized_mergeinfo,
+ pb->notify_pool);
+
+ pb->notify_func(pb->notify_baton, notify, pb->notify_pool);
+ svn_pool_clear(pb->notify_pool);
}
}
@@ -901,8 +926,13 @@ close_node(void *baton)
if (pb->notify_func)
{
- pb->notify->action = svn_repos_notify_load_node_done;
- pb->notify_func(pb->notify_baton, pb->notify, rb->pool);
+ /* ### TODO: Use proper scratch pool instead of pb->notify_pool */
+ svn_repos_notify_t *notify = svn_repos_notify_create(
+ svn_repos_notify_load_node_done,
+ pb->notify_pool);
+
+ pb->notify_func(pb->notify_baton, notify, pb->notify_pool);
+ svn_pool_clear(pb->notify_pool);
}
return SVN_NO_ERROR;
@@ -1029,12 +1059,17 @@ close_revision(void *baton)
if (pb->notify_func)
{
- pb->notify->action = svn_repos_notify_load_txn_committed;
- pb->notify->new_revision = committed_rev;
- pb->notify->old_revision = ((committed_rev == rb->rev)
+ /* ### TODO: Use proper scratch pool instead of pb->notify_pool */
+ svn_repos_notify_t *notify = svn_repos_notify_create(
+ svn_repos_notify_load_txn_committed,
+ pb->notify_pool);
+
+ notify->new_revision = committed_rev;
+ notify->old_revision = ((committed_rev == rb->rev)
? SVN_INVALID_REVNUM
: rb->rev);
- pb->notify_func(pb->notify_baton, pb->notify, rb->pool);
+ pb->notify_func(pb->notify_baton, notify, pb->notify_pool);
+ svn_pool_clear(pb->notify_pool);
}
return SVN_NO_ERROR;
@@ -1092,10 +1127,10 @@ svn_repos_get_fs_build_parser4(const svn
pb->validate_props = validate_props;
pb->notify_func = notify_func;
pb->notify_baton = notify_baton;
- pb->notify = svn_repos_notify_create(svn_repos_notify_load_txn_start, pool);
pb->uuid_action = uuid_action;
pb->parent_dir = parent_dir;
pb->pool = pool;
+ pb->notify_pool = svn_pool_create(pool);
pb->rev_map = apr_hash_make(pool);
pb->oldest_old_rev = SVN_INVALID_REVNUM;
pb->last_rev_mapped = SVN_INVALID_REVNUM;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_repos/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_repos/replay.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_repos/replay.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_repos/replay.c Fri Nov 14 13:17:55 2014
@@ -548,6 +548,17 @@ path_driver_cb_func(void **dir_baton,
svn_boolean_t src_readable;
svn_fs_root_t *copyfrom_root;
+ /* E.g. when verifying corrupted repositories, their changed path
+ lists may contain an ADD for "/". The delta path driver will
+ call us with a NULL parent in that case. */
+ if (*edit_path == 0)
+ return svn_error_create(SVN_ERR_FS_ALREADY_EXISTS, NULL,
+ _("Root directory already exists."));
+
+ /* A NULL parent_baton will cause a segfault. It should never be
+ NULL for non-root paths. */
+ SVN_ERR_ASSERT(parent_baton);
+
/* Was this node copied? */
SVN_ERR(fill_copyfrom(©from_root, ©from_path, ©from_rev,
&src_readable, root, change,
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_repos/repos.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_repos/repos.c Fri Nov 14 13:17:55 2014
@@ -1690,7 +1690,7 @@ svn_repos_delete(const char *path,
SVN_ERR(svn_fs_delete_fs(db_path, pool));
/* ...then blow away everything else. */
- return svn_io_remove_dir2(path, FALSE, NULL, NULL, pool);
+ return svn_error_trace(svn_io_remove_dir2(path, FALSE, NULL, NULL, pool));
}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_repos/rev_hunt.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_repos/rev_hunt.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_repos/rev_hunt.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_repos/rev_hunt.c Fri Nov 14 13:17:55 2014
@@ -984,7 +984,8 @@ struct path_revision
svn_revnum_t revnum;
const char *path;
- /* Does this path_rev have merges to also be included? */
+ /* Does this path_rev have merges to also be included? If so, this is
+ the union of both additions and (negated) deletions of mergeinfo. */
apr_hash_t *merged_mergeinfo;
/* Is this a merged revision? */
@@ -993,6 +994,7 @@ struct path_revision
/* Check for merges in OLD_PATH_REV->PATH at OLD_PATH_REV->REVNUM. Store
the mergeinfo difference in *MERGED_MERGEINFO, allocated in POOL. The
+ difference is the union of both additions and (negated) deletions. The
returned *MERGED_MERGEINFO will be NULL if there are no changes. */
static svn_error_t *
get_merged_mergeinfo(apr_hash_t **merged_mergeinfo,
@@ -1070,7 +1072,8 @@ get_merged_mergeinfo(apr_hash_t **merged
else
SVN_ERR(err);
- /* Then calculate and merge the differences. */
+ /* Then calculate and merge the differences, combining additions and
+ (negated) deletions as all positive changes in CHANGES. */
SVN_ERR(svn_mergeinfo_diff2(&deleted, &changed, prev_mergeinfo,
curr_mergeinfo, FALSE, result_pool,
scratch_pool));
Propchange: subversion/branches/svn-auth-x509/subversion/libsvn_subr/bit_array.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-inprocess.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-inprocess.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-inprocess.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-inprocess.c Fri Nov 14 13:17:55 2014
@@ -196,7 +196,8 @@ inprocess_cache_get_internal(char **buff
/* duplicate the buffer entry */
*buffer = apr_palloc(result_pool, entry->size);
- memcpy(*buffer, entry->value, entry->size);
+ if (entry->size)
+ memcpy(*buffer, entry->value, entry->size);
*size = entry->size;
}
@@ -680,7 +681,7 @@ svn_cache__create_inprocess(svn_cache__t
/* The sentinel doesn't need a pool. (We're happy to crash if we
* accidentally try to treat it like a real page.) */
- SVN_ERR(svn_mutex__init(&cache->mutex, thread_safe, FALSE, pool));
+ SVN_ERR(svn_mutex__init(&cache->mutex, thread_safe, pool));
cache->cache_pool = pool;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-membuffer.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-membuffer.c Fri Nov 14 13:17:55 2014
@@ -203,20 +203,20 @@ typedef apr_uint64_t entry_key_t[2];
*/
typedef struct entry_tag_t
{
- /* MD5 checksum over the serialized the item data.
+ /* MD5 checksum over the serialized item data.
*/
- unsigned char content_hash [APR_MD5_DIGESTSIZE];
+ unsigned char content_hash[APR_MD5_DIGESTSIZE];
/* Hash value of the svn_cache_t instance that wrote the item
* (i.e. a combination of type and repository)
*/
- unsigned char prefix_hash [APR_MD5_DIGESTSIZE];
+ unsigned char prefix_hash[APR_MD5_DIGESTSIZE];
/* Note that this only covers the variable part of the key,
* i.e. it will be different from the full key hash used for
* cache indexing.
*/
- unsigned char key_hash [APR_MD5_DIGESTSIZE];
+ unsigned char key_hash[APR_MD5_DIGESTSIZE];
/* Last letters from of the key in human readable format
* (ends with the type identifier, e.g. "DAG")
@@ -1817,7 +1817,7 @@ svn_cache__membuffer_cache_create(svn_me
*/
# if USE_SIMPLE_MUTEX
- SVN_ERR(svn_mutex__init(&c[seg].lock, thread_safe, FALSE, pool));
+ SVN_ERR(svn_mutex__init(&c[seg].lock, thread_safe, pool));
# else
@@ -1840,8 +1840,7 @@ svn_cache__membuffer_cache_create(svn_me
/* Since a simple mutex already guarantees fully serialized access,
we need this mutex only when we use multple-reader-1-writer locks. */
SVN_ERR(svn_mutex__init(&c[seg].counter_mutex,
- thread_safe && !USE_SIMPLE_MUTEX, FALSE,
- pool));
+ thread_safe && !USE_SIMPLE_MUTEX, pool));
}
/* done here
@@ -3132,7 +3131,7 @@ svn_cache__create_membuffer_cache(svn_ca
cache->priority = priority;
cache->key_len = klen;
- SVN_ERR(svn_mutex__init(&cache->mutex, thread_safe, FALSE, result_pool));
+ SVN_ERR(svn_mutex__init(&cache->mutex, thread_safe, result_pool));
/* for performance reasons, we don't actually store the full prefix but a
* hash value of it
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-memcache.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-memcache.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-memcache.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/cache-memcache.c Fri Nov 14 13:17:55 2014
@@ -367,7 +367,7 @@ memcache_iter(svn_boolean_t *completed,
static svn_boolean_t
memcache_is_cachable(void *unused, apr_size_t size)
{
- (void)unused; /* silence gcc warning. */
+ SVN_UNUSED(unused);
/* The memcached cutoff seems to be a bit (header length?) under a megabyte.
* We round down a little to be safe.
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/cmdline.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/cmdline.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/cmdline.c Fri Nov 14 13:17:55 2014
@@ -507,31 +507,50 @@ svn_cmdline_handle_exit_error(svn_error_
return EXIT_FAILURE;
}
+struct trust_server_cert_non_interactive_baton {
+ svn_boolean_t trust_server_cert_unknown_ca;
+ svn_boolean_t trust_server_cert_cn_mismatch;
+ svn_boolean_t trust_server_cert_expired;
+ svn_boolean_t trust_server_cert_not_yet_valid;
+ svn_boolean_t trust_server_cert_other_failure;
+};
+
/* This implements 'svn_auth_ssl_server_trust_prompt_func_t'.
Don't actually prompt. Instead, set *CRED_P to valid credentials
- iff FAILURES is empty or is exactly SVN_AUTH_SSL_UNKNOWNCA. If
- there are any other failure bits, then set *CRED_P to null (that
- is, reject the cert).
+ iff FAILURES is empty or may be accepted according to the flags
+ in BATON. If there are any other failure bits, then set *CRED_P
+ to null (that is, reject the cert).
Ignore MAY_SAVE; we don't save certs we never prompted for.
- Ignore BATON, REALM, and CERT_INFO,
+ Ignore REALM and CERT_INFO,
Ignore any further films by George Lucas. */
static svn_error_t *
-ssl_trust_unknown_server_cert
- (svn_auth_cred_ssl_server_trust_t **cred_p,
- void *baton,
- const char *realm,
- apr_uint32_t failures,
- const svn_auth_ssl_server_cert_info_t *cert_info,
- svn_boolean_t may_save,
- apr_pool_t *pool)
+trust_server_cert_non_interactive(svn_auth_cred_ssl_server_trust_t **cred_p,
+ void *baton,
+ const char *realm,
+ apr_uint32_t failures,
+ const svn_auth_ssl_server_cert_info_t
+ *cert_info,
+ svn_boolean_t may_save,
+ apr_pool_t *pool)
{
+ struct trust_server_cert_non_interactive_baton *b = baton;
*cred_p = NULL;
- if (failures == 0 || failures == SVN_AUTH_SSL_UNKNOWNCA)
+ if (failures == 0 ||
+ (b->trust_server_cert_unknown_ca &&
+ (failures & SVN_AUTH_SSL_UNKNOWNCA)) ||
+ (b->trust_server_cert_cn_mismatch &&
+ (failures & SVN_AUTH_SSL_CNMISMATCH)) ||
+ (b->trust_server_cert_expired &&
+ (failures & SVN_AUTH_SSL_EXPIRED)) ||
+ (b->trust_server_cert_not_yet_valid &&
+ (failures & SVN_AUTH_SSL_NOTYETVALID)) ||
+ (b->trust_server_cert_other_failure &&
+ (failures & SVN_AUTH_SSL_OTHER)))
{
*cred_p = apr_pcalloc(pool, sizeof(**cred_p));
(*cred_p)->may_save = FALSE;
@@ -542,17 +561,22 @@ ssl_trust_unknown_server_cert
}
svn_error_t *
-svn_cmdline_create_auth_baton(svn_auth_baton_t **ab,
- svn_boolean_t non_interactive,
- const char *auth_username,
- const char *auth_password,
- const char *config_dir,
- svn_boolean_t no_auth_cache,
- svn_boolean_t trust_server_cert,
- svn_config_t *cfg,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- apr_pool_t *pool)
+svn_cmdline_create_auth_baton2(svn_auth_baton_t **ab,
+ svn_boolean_t non_interactive,
+ const char *auth_username,
+ const char *auth_password,
+ const char *config_dir,
+ svn_boolean_t no_auth_cache,
+ svn_boolean_t trust_server_cert_unknown_ca,
+ svn_boolean_t trust_server_cert_cn_mismatch,
+ svn_boolean_t trust_server_cert_expired,
+ svn_boolean_t trust_server_cert_not_yet_valid,
+ svn_boolean_t trust_server_cert_other_failure,
+ svn_config_t *cfg,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool)
+
{
svn_boolean_t store_password_val = TRUE;
svn_boolean_t store_auth_creds_val = TRUE;
@@ -653,11 +677,22 @@ svn_cmdline_create_auth_baton(svn_auth_b
APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
}
}
- else if (trust_server_cert)
- {
+ else if (trust_server_cert_unknown_ca || trust_server_cert_cn_mismatch ||
+ trust_server_cert_expired || trust_server_cert_not_yet_valid ||
+ trust_server_cert_other_failure)
+ {
+ struct trust_server_cert_non_interactive_baton *b;
+
+ b = apr_palloc(pool, sizeof(*b));
+ b->trust_server_cert_unknown_ca = trust_server_cert_unknown_ca;
+ b->trust_server_cert_cn_mismatch = trust_server_cert_cn_mismatch;
+ b->trust_server_cert_expired = trust_server_cert_expired;
+ b->trust_server_cert_not_yet_valid = trust_server_cert_not_yet_valid;
+ b->trust_server_cert_other_failure = trust_server_cert_other_failure;
+
/* Remember, only register this provider if non_interactive. */
svn_auth_get_ssl_server_trust_prompt_provider
- (&provider, ssl_trust_unknown_server_cert, NULL, pool);
+ (&provider, trust_server_cert_non_interactive, b, pool);
APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;
}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/debug.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/debug.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/debug.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/debug.c Fri Nov 14 13:17:55 2014
@@ -80,7 +80,7 @@ static void
debug_vprintf(const char *fmt, va_list ap)
{
FILE *output = debug_output;
- char prefix[80], buffer[1000];
+ char prefix[80], buffer[4096];
char *s = buffer;
int n;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/deprecated.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/deprecated.c Fri Nov 14 13:17:55 2014
@@ -1387,6 +1387,19 @@ svn_utf_cstring_from_utf8_ex(const char
return svn_utf_cstring_from_utf8_ex2(dest, src, topage, pool);
}
+/*** From error.c ***/
+void
+svn_handle_error(svn_error_t *err, FILE *stream, svn_boolean_t fatal)
+{
+ svn_handle_error2(err, stream, fatal, "svn: ");
+}
+
+void
+svn_handle_warning(FILE *stream, svn_error_t *err)
+{
+ svn_handle_warning2(stream, err, "svn: ");
+}
+
/*** From subst.c ***/
svn_error_t *
@@ -1491,3 +1504,33 @@ svn_auth_get_gpg_agent_simple_provider(s
svn_auth__get_gpg_agent_simple_provider(provider, pool);
}
#endif /* !WIN32 */
+
+svn_error_t *
+svn_cmdline_create_auth_baton(svn_auth_baton_t **ab,
+ svn_boolean_t non_interactive,
+ const char *auth_username,
+ const char *auth_password,
+ const char *config_dir,
+ svn_boolean_t no_auth_cache,
+ svn_boolean_t trust_server_cert,
+ svn_config_t *cfg,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool)
+{
+ return svn_error_trace(svn_cmdline_create_auth_baton2(ab,
+ non_interactive,
+ auth_username,
+ auth_password,
+ config_dir,
+ no_auth_cache,
+ trust_server_cert,
+ FALSE,
+ FALSE,
+ FALSE,
+ FALSE,
+ cfg,
+ cancel_func,
+ cancel_baton,
+ pool));
+}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/dso.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/dso.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/dso.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/dso.c Fri Nov 14 13:17:55 2014
@@ -55,7 +55,7 @@ svn_dso_initialize2(void)
dso_pool = svn_pool_create(NULL);
- SVN_ERR(svn_mutex__init(&dso_mutex, TRUE, TRUE, dso_pool));
+ SVN_ERR(svn_mutex__init(&dso_mutex, TRUE, dso_pool));
dso_cache = apr_hash_make(dso_pool);
return SVN_NO_ERROR;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/error.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/error.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/error.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/error.c Fri Nov 14 13:17:55 2014
@@ -85,34 +85,15 @@ svn_error__locate(const char *file, long
/* Cleanup function for errors. svn_error_clear () removes this so
errors that are properly handled *don't* hit this code. */
-#if defined(SVN_DEBUG)
-/* GCC >= 4.6 has support for diagnostic pragmas that let us
- * turn off warnings. clang also supports the same pragmas */
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) \
- || defined(__clang__))
- #define IGNORING_UNUSED_WARNING
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wunused-variable"
-#endif /* supports diagnostic pragmas */
static apr_status_t err_abort(void *data)
{
svn_error_t *err = data; /* For easy viewing in a debugger */
-#ifndef IGNORING_UNUSED_WARNING
- /* Fake a use for the variable to avoid compiler warnings if we can't turn
- * them off via pragmas. */
- err = err;
-#endif /* IGNORING_UNUSED_WARNING */
+ SVN_UNUSED(err);
if (!getenv("SVN_DBG_NO_ABORT_ON_ERROR_LEAK"))
abort();
return APR_SUCCESS;
}
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) \
- || defined(__clang__))
- #undef IGNORING_UNUSED_WARNING
- #pragma GCC diagnostic pop
-#endif /* supports diagnostic pragmas */
-#endif
static svn_error_t *
@@ -556,12 +537,6 @@ print_error(svn_error_t *err, FILE *stre
}
void
-svn_handle_error(svn_error_t *err, FILE *stream, svn_boolean_t fatal)
-{
- svn_handle_error2(err, stream, fatal, "svn: ");
-}
-
-void
svn_handle_error2(svn_error_t *err,
FILE *stream,
svn_boolean_t fatal,
@@ -632,13 +607,6 @@ svn_handle_error2(svn_error_t *err,
}
}
-
-void
-svn_handle_warning(FILE *stream, svn_error_t *err)
-{
- svn_handle_warning2(stream, err, "svn: ");
-}
-
void
svn_handle_warning2(FILE *stream, const svn_error_t *err, const char *prefix)
{
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/gpg_agent.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/gpg_agent.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/gpg_agent.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/gpg_agent.c Fri Nov 14 13:17:55 2014
@@ -108,7 +108,7 @@ escape_blanks(char *str)
* to other password caching mechanisms. */
static svn_error_t *
get_cache_id(const char **cache_id_p, const char *realmstring,
- apr_pool_t *scratch_pool, apr_pool_t *result_pool)
+ apr_pool_t *result_pool, apr_pool_t *scratch_pool)
{
const char *cache_id = NULL;
svn_checksum_t *digest = NULL;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/io.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/io.c Fri Nov 14 13:17:55 2014
@@ -1154,8 +1154,13 @@ svn_io_make_dir_recursively(const char *
SVN_ERR(cstring_from_utf8(&path_apr, path, pool));
apr_err = apr_dir_make_recursive(path_apr, APR_OS_DEFAULT, pool);
- WIN32_RETRY_LOOP(apr_err, apr_dir_make_recursive(path_apr,
- APR_OS_DEFAULT, pool));
+#ifdef WIN32
+ /* Don't retry on ERROR_ACCESS_DENIED, as that typically signals a
+ permanent error */
+ if (apr_err == APR_FROM_OS_ERROR(ERROR_SHARING_VIOLATION))
+ WIN32_RETRY_LOOP(apr_err, apr_dir_make_recursive(path_apr,
+ APR_OS_DEFAULT, pool));
+#endif
if (apr_err)
return svn_error_wrap_apr(apr_err, _("Can't make directory '%s'"),
@@ -3657,7 +3662,7 @@ svn_io_file_aligned_seek(apr_file_t *fil
buffer and no I/O will actually happen in the FILL_BUFFER
section below.
*/
- SVN_ERR(svn_io_file_seek(file, SEEK_CUR, ¤t, pool));
+ SVN_ERR(svn_io_file_seek(file, APR_CUR, ¤t, pool));
fill_buffer = aligned_offset + file_buffer_size <= current
|| current <= aligned_offset;
}
@@ -3668,7 +3673,7 @@ svn_io_file_aligned_seek(apr_file_t *fil
apr_status_t status;
/* seek to the start of the block and cause APR to read 1 block */
- SVN_ERR(svn_io_file_seek(file, SEEK_SET, &aligned_offset, pool));
+ SVN_ERR(svn_io_file_seek(file, APR_SET, &aligned_offset, pool));
status = apr_file_getc(&dummy, file);
/* read may fail if we seek to or behind EOF. That's ok then. */
@@ -3681,7 +3686,7 @@ svn_io_file_aligned_seek(apr_file_t *fil
/* finally, seek to the OFFSET the caller wants */
desired_offset = offset;
- SVN_ERR(svn_io_file_seek(file, SEEK_SET, &offset, pool));
+ SVN_ERR(svn_io_file_seek(file, APR_SET, &offset, pool));
if (desired_offset != offset)
return do_io_file_wrapper_cleanup(file, APR_EOF,
N_("Can't seek in file '%s'"),
@@ -4083,7 +4088,13 @@ dir_make(const char *path, apr_fileperms
#endif
status = apr_dir_make(path_apr, perm, pool);
- WIN32_RETRY_LOOP(status, apr_dir_make(path_apr, perm, pool));
+
+#ifdef WIN32
+ /* Don't retry on ERROR_ACCESS_DENIED, as that typically signals a
+ permanent error */
+ if (status == APR_FROM_OS_ERROR(ERROR_SHARING_VIOLATION))
+ WIN32_RETRY_LOOP(status, apr_dir_make(path_apr, perm, pool));
+#endif
if (status)
return svn_error_wrap_apr(status, _("Can't create directory '%s'"),
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/mutex.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/mutex.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/mutex.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/mutex.c Fri Nov 14 13:17:55 2014
@@ -35,37 +35,21 @@
*/
struct svn_mutex__t
{
- /* If TRUE, perform extra checks to detect attempts at recursive locking. */
- svn_boolean_t checked;
-
#if APR_HAS_THREADS
apr_thread_mutex_t *mutex;
- /* The owner of this lock, if locked or NULL, otherwise. Since NULL might
- * be a valid owner ID on some systems, checking for NULL may not be 100%
- * accurate. Be sure to only produce false negatives in that case.
- * We can't use apr_os_thread_t directly here as there is no portable way
- * to access them atomically. Instead, we assume that it can always be
- * cast safely to a pointer.
- * This value will only be modified while the lock is being held. So,
- * setting and resetting it is never racy (but reading it may be).
- * Only used when CHECKED is set. */
- volatile void *owner;
-
#else
- /* If there is no multi-threading support, simply count lock attempts. */
- int count;
+ /* Truly empty structs are not allowed. */
+ int dummy;
#endif
-
};
svn_error_t *
svn_mutex__init(svn_mutex__t **mutex_p,
svn_boolean_t mutex_required,
- svn_boolean_t checked,
apr_pool_t *result_pool)
{
/* always initialize the mutex pointer, even though it is not
@@ -85,7 +69,6 @@ svn_mutex__init(svn_mutex__t **mutex_p,
return svn_error_wrap_apr(status, _("Can't create mutex"));
#endif
- mutex->checked = checked;
*mutex_p = mutex;
}
@@ -98,64 +81,9 @@ svn_mutex__lock(svn_mutex__t *mutex)
if (mutex)
{
#if APR_HAS_THREADS
- apr_status_t status;
- void *current_thread;
- void *lock_owner;
-
- /* Detect recursive locking attempts. */
- if (mutex->checked)
- {
- /* "us" */
- current_thread = (void *)apr_os_thread_current();
-
- /* Get the current owner value without actually modifying it
- (idempotent replacement of NULL by NULL). We need the atomic
- operation here since other threads may be writing to this
- variable while we read it (in which case LOCK_OWNER and
- CURRENT_THREAD will differ). */
- lock_owner = apr_atomic_casptr(&mutex->owner, NULL, NULL);
-
- /* If this matches, svn_mutex__unlock did not reset the owner
- since this thread acquired the lock: Because there is no
- exit condition between that reset and the actual mutex unlock,
- and because no other thread would set the owner to this value,
- this thread has simply not released the mutex. */
- if (lock_owner &&
- apr_os_thread_equal((apr_os_thread_t)lock_owner,
- (apr_os_thread_t)current_thread))
- return svn_error_create(SVN_ERR_RECURSIVE_LOCK, NULL,
- _("Recursive locks are not supported"));
- }
-
- /* Acquire the mutex. In the meantime, other threads may acquire and
- release the same lock. Once we got the lock, however, it is in a
- defined state. */
- status = apr_thread_mutex_lock(mutex->mutex);
+ apr_status_t status = apr_thread_mutex_lock(mutex->mutex);
if (status)
return svn_error_wrap_apr(status, _("Can't lock mutex"));
-
- /* We own the lock now. */
- if (mutex->checked)
- {
- /* It must have been released by the previous owner as part of
- the mutex unlock. */
- SVN_ERR_ASSERT(apr_atomic_casptr(&mutex->owner, NULL, NULL) == NULL);
-
- /* Set "us" as the new owner. */
- apr_atomic_casptr(&mutex->owner, current_thread, NULL);
- }
-#else
- if (mutex->checked)
- {
- /* We want non-threaded systems to detect the same coding errors
- as threaded systems. No further sync required. */
- if (mutex->count)
- return svn_error_create(SVN_ERR_RECURSIVE_LOCK, NULL,
- _("Recursive locks are not supported"));
-
- /* Update lock counter. */
- ++mutex->count;
- }
#endif
}
@@ -169,50 +97,9 @@ svn_mutex__unlock(svn_mutex__t *mutex,
if (mutex)
{
#if APR_HAS_THREADS
- apr_status_t status;
-
- /* We will soon no longer be the owner of this lock. So, reset the
- OWNER value. This makes no difference to the recursion check in
- *other* threads; they are known not to hold this mutex and will
- not assume that they do after we set the OWNER to NULL. And the
- current thread is known not to attempt a recursive lock right now;
- it cannot be in two places at the same time. */
- if (mutex->checked)
- {
- /* Reading the current OWNER value is faster and more reliable
- than asking APR for the current thread id (APR might return
- different but equivalent IDs for the same thread). */
- void *lock_owner = apr_atomic_casptr(&mutex->owner, NULL, NULL);
-
- /* Check for double unlock. */
- if (lock_owner == NULL)
- {
- /* There seems to be no guarantee that NULL is _not_ a valid
- thread ID. Double check to be sure. */
- if (!apr_os_thread_equal((apr_os_thread_t)lock_owner,
- apr_os_thread_current()))
- return svn_error_create(SVN_ERR_INVALID_UNLOCK, NULL,
- _("Tried to release a non-locked mutex"));
- }
-
- /* Now, set it to NULL. */
- apr_atomic_casptr(&mutex->owner, NULL, lock_owner);
- }
-
- /* Release the actual mutex. */
- status = apr_thread_mutex_unlock(mutex->mutex);
+ apr_status_t status = apr_thread_mutex_unlock(mutex->mutex);
if (status && !err)
return svn_error_wrap_apr(status, _("Can't unlock mutex"));
-#else
- /* Update lock counter. */
- if (mutex->checked)
- {
- if (mutex->count <= 0)
- return svn_error_create(SVN_ERR_INVALID_UNLOCK, NULL,
- _("Tried to release a non-locked mutex"));
-
- --mutex->count;
- }
#endif
}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/object_pool.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/object_pool.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/object_pool.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/object_pool.c Fri Nov 14 13:17:55 2014
@@ -329,7 +329,7 @@ svn_object_pool__create(svn_object_pool_
* cleanup and to prevent threading issues with the allocator
*/
result = apr_pcalloc(pool, sizeof(*result));
- SVN_ERR(svn_mutex__init(&result->mutex, thread_safe, FALSE, pool));
+ SVN_ERR(svn_mutex__init(&result->mutex, thread_safe, pool));
result->pool = pool;
result->objects = svn_hash__make(result->pool);
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/opt.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/opt.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/opt.c Fri Nov 14 13:17:55 2014
@@ -1012,13 +1012,6 @@ svn_opt__split_arg_at_peg_revision(const
if (peg_start)
{
- /* Error out if target is the empty string. */
- if (ptr == utf8_target)
- return svn_error_createf(SVN_ERR_BAD_FILENAME, NULL,
- _("'%s' is just a peg revision. "
- "Maybe try '%s@' instead?"),
- utf8_target, utf8_target);
-
*true_target = apr_pstrmemdup(pool, utf8_target, ptr - utf8_target);
if (peg_revision)
*peg_revision = apr_pstrdup(pool, peg_start);
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/packed_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/packed_data.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/packed_data.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/packed_data.c Fri Nov 14 13:17:55 2014
@@ -276,6 +276,33 @@ write_packed_uint_body(unsigned char *bu
return buffer;
}
+/* Return remapped VALUE.
+ *
+ * Due to sign conversion and diff underflow, values close to UINT64_MAX
+ * are almost as frequent as those close to 0. Remap them such that the
+ * MSB is stored in the LSB and the remainder stores the absolute distance
+ * to 0.
+ *
+ * This minimizes the absolute value to store in many scenarios.
+ * Hence, the variable-length representation on disk is shorter, too.
+ */
+static apr_uint64_t
+remap_uint(apr_uint64_t value)
+{
+ return value & APR_UINT64_C(0x8000000000000000)
+ ? APR_UINT64_MAX - (2 * value)
+ : 2 * value;
+}
+
+/* Invert remap_uint. */
+static apr_uint64_t
+unmap_uint(apr_uint64_t value)
+{
+ return value & 1
+ ? (APR_UINT64_MAX - value / 2)
+ : value / 2;
+}
+
/* Empty the unprocessed integer buffer in STREAM by either pushing the
* data to the sub-streams or writing to the packed data (in case there
* are no sub-streams).
@@ -313,8 +340,7 @@ svn_packed__data_flush_buffer(svn_packed
for (i = 0; i < stream->buffer_used; ++i)
{
apr_uint64_t temp = stream->buffer[i];
- apr_int64_t diff = (apr_int64_t)(temp - last_value);
- stream->buffer[i] = diff < 0 ? -1 - 2 * diff : 2 * diff;
+ stream->buffer[i] = remap_uint(temp - last_value);
last_value = temp;
}
@@ -327,9 +353,7 @@ svn_packed__data_flush_buffer(svn_packed
63 bits. */
if (!private_data->diff && private_data->is_signed)
for (i = 0; i < stream->buffer_used; ++i)
- stream->buffer[i] = (apr_int64_t)stream->buffer[i] < 0
- ? -1 - 2 * stream->buffer[i]
- : 2 * stream->buffer[i];
+ stream->buffer[i] = remap_uint(stream->buffer[i]);
/* auto-create packed data buffer. Give it some reasonable initial
size - just enough for a few tens of values. */
@@ -771,8 +795,8 @@ svn_packed__data_fill_buffer(svn_packed_
else
{
/* use this local buffer only if the packed data is shorter than this.
- The goal is that we don't need to check for overflows that is not
- detected by read_packed_uint_body. */
+ The goal is that read_packed_uint_body doesn't need check for
+ overflows. */
unsigned char local_buffer[10 * SVN__PACKED_DATA_BUFFER_SIZE];
unsigned char *p;
unsigned char *start;
@@ -808,9 +832,7 @@ svn_packed__data_fill_buffer(svn_packed_
apr_uint64_t last_value = private_data->last_value;
for (i = end; i > 0; --i)
{
- apr_uint64_t temp = stream->buffer[i-1];
- temp = (temp % 2) ? -1 - temp / 2 : temp / 2;
- last_value += temp;
+ last_value += unmap_uint(stream->buffer[i-1]);
stream->buffer[i-1] = last_value;
}
@@ -820,9 +842,7 @@ svn_packed__data_fill_buffer(svn_packed_
/* handle signed values, if configured and not handled already */
if (!private_data->diff && private_data->is_signed)
for (i = 0; i < end; ++i)
- stream->buffer[i] = (stream->buffer[i] % 2)
- ? -1 - stream->buffer[i] / 2
- : stream->buffer[i] / 2;
+ stream->buffer[i] = unmap_uint(stream->buffer[i]);
}
stream->buffer_used = end;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/path.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/path.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/path.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/path.c Fri Nov 14 13:17:55 2014
@@ -1299,7 +1299,7 @@ svn_path_resolve_repos_relative_url(cons
_("Improper relative URL '%s'"),
relative_url);
- /* No assumptions are made about the canonicalization of the inut
+ /* No assumptions are made about the canonicalization of the input
* arguments, it is presumed that the output will be canonicalized after
* this function, which will remove any duplicate path separator.
*/
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/root_pools.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/root_pools.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/root_pools.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/root_pools.c Fri Nov 14 13:17:55 2014
@@ -48,7 +48,7 @@ svn_root_pools__create(svn_root_pools__t
/* construct result object */
svn_root_pools__t *result = apr_pcalloc(pool, sizeof(*result));
- SVN_ERR(svn_mutex__init(&result->mutex, TRUE, FALSE, pool));
+ SVN_ERR(svn_mutex__init(&result->mutex, TRUE, pool));
result->unused_pools = apr_array_make(pool, 16, sizeof(apr_pool_t *));
/* done */
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/sorts.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/sorts.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/sorts.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/sorts.c Fri Nov 14 13:17:55 2014
@@ -244,14 +244,48 @@ svn_sort__array_lookup(const apr_array_h
* hit location) first. This speeds up linear scans. */
if (hint)
{
- idx = *hint;
- *hint = ++idx;
- if (idx >= 0 && idx < array->nelts)
+ /* We intend to insert right behind *HINT.
+ * Exit this function early, if we actually can. */
+ idx = *hint + 1;
+ if (idx >= array->nelts)
{
+ /* We intend to insert after the last entry.
+ * That is only allowed if that last entry is smaller than KEY.
+ * In that case, there will be no current entry, i.e. we must
+ * return NULL. */
+ apr_size_t offset;
+
+ *hint = array->nelts;
+ if (array->nelts == 0)
+ return NULL;
+
+ offset = (array->nelts - 1) * array->elt_size;
+ if (compare_func(array->elts + offset, key) < 0)
+ return NULL;
+ }
+ else if (idx > 0)
+ {
+ /* Intend to insert at a position inside the array, i.e. not
+ * at one of the boundaries. The predecessor must be smaller
+ * and the current entry at IDX must be larger than KEY. */
+ void *previous;
+
+ *hint = idx;
+ previous = array->elts + (idx-1) * array->elt_size;
result = array->elts + idx * array->elt_size;
- if (!compare_func(result, key))
+ if (compare_func(previous, key) && !compare_func(result, key))
return result;
}
+ else if (idx <= 0)
+ {
+ /* Intend to insert at the beginning of an non-empty array.
+ * That requires the first entry to be larger than KEY. */
+ *hint = 0;
+ if (!compare_func(array->elts, key))
+ return array->elts;
+ }
+
+ /* The HINT did not help. */
}
idx = bsearch_lower_bound(key, array->elts, array->nelts, array->elt_size,
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/sqlite.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/sqlite.c Fri Nov 14 13:17:55 2014
@@ -934,7 +934,7 @@ close_apr(void *data)
{
#ifdef SVN_DEBUG
const char *stmt_text = db->statement_strings[i];
- stmt_text = stmt_text; /* Provide value for debugger */
+ SVN_UNUSED(stmt_text);
SVN_ERR_MALFUNCTION_NO_RETURN();
#else
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/stream.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/stream.c Fri Nov 14 13:17:55 2014
@@ -1089,16 +1089,13 @@ svn_stream__aprfile(svn_stream_t *stream
struct zbaton {
z_stream *in; /* compressed stream for reading */
z_stream *out; /* compressed stream for writing */
- svn_read_fn_t read; /* substream's read function */
- svn_write_fn_t write; /* substream's write function */
- svn_close_fn_t close; /* substream's close function */
+ void *substream; /* The substream */
void *read_buffer; /* buffer used for reading from
substream */
int read_flush; /* what flush mode to use while
reading */
apr_pool_t *pool; /* The pool this baton is allocated
on */
- void *subbaton; /* The substream's baton */
};
/* zlib alloc function. opaque is the pool we need. */
@@ -1119,8 +1116,7 @@ zfree(voidpf opaque, voidpf address)
/* Helper function to figure out the sync mode */
static svn_error_t *
-read_helper_gz(svn_read_fn_t read_fn,
- void *baton,
+read_helper_gz(svn_stream_t *substream,
char *buffer,
uInt *len, int *zflush)
{
@@ -1130,7 +1126,7 @@ read_helper_gz(svn_read_fn_t read_fn,
uInt, but Subversion's API requires apr_size_t. */
apr_size_t apr_len = (apr_size_t) *len;
- SVN_ERR((*read_fn)(baton, buffer, &apr_len));
+ SVN_ERR(svn_stream_read_full(substream, buffer, &apr_len));
/* Type cast back to uInt type that zlib uses. On LP64 platforms
apr_size_t will be bigger than uInt. */
@@ -1160,7 +1156,7 @@ read_handler_gz(void *baton, char *buffe
btn->in->next_in = btn->read_buffer;
btn->in->avail_in = ZBUFFER_SIZE;
- SVN_ERR(read_helper_gz(btn->read, btn->subbaton, btn->read_buffer,
+ SVN_ERR(read_helper_gz(btn->substream, btn->read_buffer,
&btn->in->avail_in, &btn->read_flush));
zerr = inflateInit(btn->in);
@@ -1176,7 +1172,7 @@ read_handler_gz(void *baton, char *buffe
{
btn->in->avail_in = ZBUFFER_SIZE;
btn->in->next_in = btn->read_buffer;
- SVN_ERR(read_helper_gz(btn->read, btn->subbaton, btn->read_buffer,
+ SVN_ERR(read_helper_gz(btn->substream, btn->read_buffer,
&btn->in->avail_in, &btn->read_flush));
}
@@ -1238,7 +1234,7 @@ write_handler_gz(void *baton, const char
SVN_ERR(svn_error__wrap_zlib(zerr, "deflate", btn->out->msg));
write_len = buf_size - btn->out->avail_out;
if (write_len > 0)
- SVN_ERR(btn->write(btn->subbaton, write_buf, &write_len));
+ SVN_ERR(svn_stream_write(btn->substream, write_buf, &write_len));
}
svn_pool_destroy(subpool);
@@ -1277,7 +1273,7 @@ close_handler_gz(void *baton)
btn->out->msg));
write_len = ZBUFFER_SIZE - btn->out->avail_out;
if (write_len > 0)
- SVN_ERR(btn->write(btn->subbaton, buf, &write_len));
+ SVN_ERR(svn_stream_write(btn->substream, buf, &write_len));
if (zerr == Z_STREAM_END)
break;
}
@@ -1286,10 +1282,7 @@ close_handler_gz(void *baton)
SVN_ERR(svn_error__wrap_zlib(zerr, "deflateEnd", btn->out->msg));
}
- if (btn->close != NULL)
- return svn_error_trace(btn->close(btn->subbaton));
- else
- return SVN_NO_ERROR;
+ return svn_error_trace(svn_stream_close(btn->substream));
}
@@ -1303,10 +1296,7 @@ svn_stream_compressed(svn_stream_t *stre
baton = apr_palloc(pool, sizeof(*baton));
baton->in = baton->out = NULL;
- baton->read = stream->read_fn;
- baton->write = stream->write_fn;
- baton->close = stream->close_fn;
- baton->subbaton = stream->baton;
+ baton->substream = stream;
baton->pool = pool;
baton->read_buffer = NULL;
baton->read_flush = Z_SYNC_FLUSH;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/string.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/string.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/string.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/string.c Fri Nov 14 13:17:55 2014
@@ -26,6 +26,7 @@
#include <apr.h>
+#include <assert.h>
#include <string.h> /* for memcpy(), memcmp(), strlen() */
#include <apr_fnmatch.h>
@@ -239,7 +240,9 @@ svn_string_ncreate(const char *bytes, ap
new_string->data = data;
new_string->len = size;
- memcpy(data, bytes, size);
+ /* If SIZE is 0, NULL is valid for BYTES. */
+ if (size)
+ memcpy(data, bytes, size);
/* Null termination is the convention -- even if we suspect the data
to be binary, it's not up to us to decide, it's the caller's
@@ -392,7 +395,10 @@ svn_stringbuf_t *
svn_stringbuf_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool)
{
svn_stringbuf_t *strbuf = svn_stringbuf_create_ensure(size, pool);
- memcpy(strbuf->data, bytes, size);
+
+ /* If SIZE is 0, NULL is valid for BYTES. */
+ if (size)
+ memcpy(strbuf->data, bytes, size);
/* Null termination is the convention -- even if we suspect the data
to be binary, it's not up to us to decide, it's the caller's
@@ -589,6 +595,10 @@ svn_stringbuf_appendbytes(svn_stringbuf_
apr_size_t total_len;
void *start_address;
+ if (!count)
+ /* Allow BYTES to be NULL by avoiding passing it to memcpy. */
+ return;
+
total_len = str->len + count; /* total size needed */
/* svn_stringbuf_ensure adds 1 for null terminator. */
@@ -641,6 +651,10 @@ svn_stringbuf_insert(svn_stringbuf_t *st
const char *bytes,
apr_size_t count)
{
+ /* For COUNT==0, we allow BYTES to be NULL. It's a no-op in that case. */
+ if (count == 0)
+ return;
+
if (bytes + count > str->data && bytes < str->data + str->blocksize)
{
/* special case: BYTES overlaps with this string -> copy the source */
@@ -681,6 +695,14 @@ svn_stringbuf_replace(svn_stringbuf_t *s
const char *bytes,
apr_size_t new_count)
{
+ /* For COUNT==0, we allow BYTES to be NULL.
+ * In that case, this is just a substring removal. */
+ if (new_count == 0)
+ {
+ svn_stringbuf_remove(str, pos, old_count);
+ return;
+ }
+
if (bytes + new_count > str->data && bytes < str->data + str->blocksize)
{
/* special case: BYTES overlaps with this string -> copy the source */
@@ -1068,16 +1090,6 @@ svn__strtoul(const char* buffer, const c
return result;
}
-long
-svn__strtol(const char* buffer, const char** end)
-{
- if (*buffer == '-')
- return -(long)svn__strtoul(buffer+1, end);
- else
- return (long)svn__strtoul(buffer, end);
-}
-
-
/* "Precalculated" itoa values for 2 places (including leading zeros).
* For maximum performance, make sure all table entries are word-aligned.
*/
@@ -1174,7 +1186,7 @@ svn__i64toa(char * dest, apr_int64_t num
return svn__ui64toa(dest, (apr_uint64_t)number);
*dest = '-';
- return svn__ui64toa(dest + 1, (apr_uint64_t)(0-number)) + 1;
+ return svn__ui64toa(dest + 1, 0 - (apr_uint64_t)number) + 1;
}
static void
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/subst.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/subst.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/subst.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/subst.c Fri Nov 14 13:17:55 2014
@@ -159,7 +159,7 @@ keyword_printf(const char *fmt,
const char *author,
apr_pool_t *pool)
{
- svn_stringbuf_t *value = svn_stringbuf_ncreate("", 0, pool);
+ svn_stringbuf_t *value = svn_stringbuf_create_empty(pool);
const char *cur;
size_t n;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/sysinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/sysinfo.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/sysinfo.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/sysinfo.c Fri Nov 14 13:17:55 2014
@@ -1042,16 +1042,17 @@ release_name_from_version(const char *os
/* See http://en.wikipedia.org/wiki/History_of_OS_X#Release_timeline */
switch(num)
{
- case 0: return "Cheetah";
- case 1: return "Puma";
- case 2: return "Jaguar";
- case 3: return "Panther";
- case 4: return "Tiger";
- case 5: return "Leopard";
- case 6: return "Snow Leopard";
- case 7: return "Lion";
- case 8: return "Mountain Lion";
- case 9: return "Mavericks";
+ case 0: return "Cheetah";
+ case 1: return "Puma";
+ case 2: return "Jaguar";
+ case 3: return "Panther";
+ case 4: return "Tiger";
+ case 5: return "Leopard";
+ case 6: return "Snow Leopard";
+ case 7: return "Lion";
+ case 8: return "Mountain Lion";
+ case 9: return "Mavericks";
+ case 10: return "Yosemite";
}
return NULL;
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/utf.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/utf.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/utf.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/utf.c Fri Nov 14 13:17:55 2014
@@ -132,7 +132,7 @@ svn_utf_initialize2(svn_boolean_t assume
and pool allocation is not thread-safe. */
apr_pool_t *subpool = svn_pool_create(pool);
svn_mutex__t *mutex;
- svn_error_t *err = svn_mutex__init(&mutex, TRUE, FALSE, subpool);
+ svn_error_t *err = svn_mutex__init(&mutex, TRUE, subpool);
if (err)
{
svn_error_clear(err);
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/utf8proc.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/utf8proc.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/utf8proc.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/utf8proc.c Fri Nov 14 13:17:55 2014
@@ -28,7 +28,6 @@
#include "private/svn_string_private.h"
#include "private/svn_utf_private.h"
#include "svn_private_config.h"
-#define UNUSED(x) ((void)(x))
#define UTF8PROC_INLINE
/* Somehow utf8proc thinks it is nice to use strlen as an argument name,
@@ -41,10 +40,10 @@
const char *svn_utf__utf8proc_version(void)
{
/* Unused static function warning removal hack. */
- UNUSED(utf8proc_NFD);
- UNUSED(utf8proc_NFC);
- UNUSED(utf8proc_NFKD);
- UNUSED(utf8proc_NFKC);
+ SVN_UNUSED(utf8proc_NFD);
+ SVN_UNUSED(utf8proc_NFC);
+ SVN_UNUSED(utf8proc_NFKD);
+ SVN_UNUSED(utf8proc_NFKC);
return utf8proc_version();
}
Propchange: subversion/branches/svn-auth-x509/subversion/libsvn_subr/utf8proc/README
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_subr/win32_xlate.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_subr/win32_xlate.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_subr/win32_xlate.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_subr/win32_xlate.c Fri Nov 14 13:17:55 2014
@@ -116,7 +116,17 @@ get_page_id_from_name(UINT *page_id_p, c
if ((page_name[0] == 'c' || page_name[0] == 'C')
&& (page_name[1] == 'p' || page_name[1] == 'P'))
{
- *page_id_p = atoi(page_name + 2);
+ int page_id;
+
+ err = svn_cstring_atoi(&page_id, page_name + 2);
+ if (err)
+ {
+ apr_status_t saved = err->apr_err;
+ svn_error_clear(err);
+ return saved;
+ }
+
+ *page_id_p = page_id;
return APR_SUCCESS;
}
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_wc/adm_crawler.c
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_wc/adm_crawler.c?rev=1639628&r1=1639627&r2=1639628&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/libsvn_wc/adm_crawler.c (original)
+++ subversion/branches/svn-auth-x509/subversion/libsvn_wc/adm_crawler.c Fri Nov 14 13:17:55 2014
@@ -69,6 +69,8 @@ restore_file(svn_wc__db_t *db,
const char *local_abspath,
svn_boolean_t use_commit_times,
svn_boolean_t mark_resolved_text_conflict,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
apr_pool_t *scratch_pool)
{
svn_skel_t *work_item;
@@ -86,12 +88,14 @@ restore_file(svn_wc__db_t *db,
/* Run the work item immediately. */
SVN_ERR(svn_wc__wq_run(db, local_abspath,
- NULL, NULL, /* ### nice to have cancel_func/baton */
+ cancel_func, cancel_baton,
scratch_pool));
/* Remove any text conflict */
if (mark_resolved_text_conflict)
- SVN_ERR(svn_wc__mark_resolved_text_conflict(db, local_abspath, scratch_pool));
+ SVN_ERR(svn_wc__mark_resolved_text_conflict(db, local_abspath,
+ cancel_func, cancel_baton,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -102,6 +106,7 @@ svn_wc_restore(svn_wc_context_t *wc_ctx,
svn_boolean_t use_commit_times,
apr_pool_t *scratch_pool)
{
+ /* ### If ever revved: Add cancel func. */
svn_wc__db_status_t status;
svn_node_kind_t kind;
svn_node_kind_t disk_kind;
@@ -138,6 +143,7 @@ svn_wc_restore(svn_wc_context_t *wc_ctx,
if (kind == svn_node_file || kind == svn_node_symlink)
SVN_ERR(restore_file(wc_ctx->db, local_abspath, use_commit_times,
FALSE /*mark_resolved_text_conflict*/,
+ NULL, NULL /* cancel func, baton */,
scratch_pool));
else
SVN_ERR(svn_io_dir_make(local_abspath, APR_OS_DEFAULT, scratch_pool));
@@ -157,6 +163,8 @@ restore_node(svn_wc__db_t *db,
const char *local_abspath,
svn_node_kind_t kind,
svn_boolean_t use_commit_times,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
svn_wc_notify_func2_t notify_func,
void *notify_baton,
apr_pool_t *scratch_pool)
@@ -166,6 +174,7 @@ restore_node(svn_wc__db_t *db,
/* Recreate file from text-base; mark any text conflict as resolved */
SVN_ERR(restore_file(db, local_abspath, use_commit_times,
TRUE /*mark_resolved_text_conflict*/,
+ cancel_func, cancel_baton,
scratch_pool));
}
else if (kind == svn_node_dir)
@@ -399,8 +408,9 @@ report_revisions_and_depths(svn_wc__db_t
if (dirent_kind == svn_node_none)
{
SVN_ERR(restore_node(db, this_abspath, wrk_kind,
- use_commit_times, notify_func,
- notify_baton, iterpool));
+ use_commit_times,
+ cancel_func, cancel_baton,
+ notify_func, notify_baton, iterpool));
}
}
}
@@ -734,6 +744,7 @@ svn_wc_crawl_revisions5(svn_wc_context_t
{
SVN_ERR(restore_node(wc_ctx->db, local_abspath,
wrk_kind, use_commit_times,
+ cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));
}