Author: julianfoad
Date: Fri Jun 2 09:53:59 2017
New Revision: 1797362
URL: http://svn.apache.org/viewvc?rev=1797362&view=rev
Log:
Use more robust coding style in handling UTF-8 conversion of command-line
arguments.
Convert to UTF-8 as soon as possible, and name variables assuming UTF-8
encoding is the default rather than an exception, and minimize visibility of
non-UTF-8 values.
* subversion/svn/propdel-cmd.c,
subversion/svn/propedit-cmd.c,
subversion/svn/propget-cmd.c,
subversion/svn/propset-cmd.c:
Rename variables assuming UTF-8; minimize storing non-UTF-8 values.
* subversion/svn/svn.c,
subversion/svnadmin/svnadmin.c,
subversion/svnbench/svnbench.c,
subversion/svndumpfilter/svndumpfilter.c,
subversion/svnfsfs/svnfsfs.c,
subversion/svnlook/svnlook.c,
subversion/svnmucc/svnmucc.c,
subversion/svnrdump/svnrdump.c,
subversion/svnsync/svnsync.c
tools/client-side/svnconflict/svnconflict.c
tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c
tools/dev/svnmover/svnmover.c
tools/server-side/svnauthz.c
(sub_main): Convert to UTF-8 before matching the subcommand name; no
observable change if environment's encoding is a superset of ASCII.
(...): Rename variables assuming UTF-8; minimize storing non-UTF-8 values.
Modified:
subversion/trunk/subversion/svn/propdel-cmd.c
subversion/trunk/subversion/svn/propedit-cmd.c
subversion/trunk/subversion/svn/propget-cmd.c
subversion/trunk/subversion/svn/propset-cmd.c
subversion/trunk/subversion/svn/svn.c
subversion/trunk/subversion/svnadmin/svnadmin.c
subversion/trunk/subversion/svnbench/svnbench.c
subversion/trunk/subversion/svndumpfilter/svndumpfilter.c
subversion/trunk/subversion/svnfsfs/svnfsfs.c
subversion/trunk/subversion/svnlook/svnlook.c
subversion/trunk/subversion/svnmucc/svnmucc.c
subversion/trunk/subversion/svnrdump/svnrdump.c
subversion/trunk/subversion/svnsync/svnsync.c
subversion/trunk/tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c
subversion/trunk/tools/client-side/svnconflict/svnconflict.c
subversion/trunk/tools/dev/svnmover/svnmover.c
subversion/trunk/tools/server-side/svnauthz.c
Modified: subversion/trunk/subversion/svn/propdel-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propdel-cmd.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propdel-cmd.c (original)
+++ subversion/trunk/subversion/svn/propdel-cmd.c Fri Jun 2 09:53:59 2017
@@ -49,13 +49,13 @@ svn_cl__propdel(apr_getopt_t *os,
{
svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
- const char *pname, *pname_utf8;
+ const char *pname;
apr_array_header_t *args, *targets;
/* Get the property's name (and a UTF-8 version of that name). */
SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool));
pname = APR_ARRAY_IDX(args, 0, const char *);
- SVN_ERR(svn_utf_cstring_to_utf8(&pname_utf8, pname, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&pname, pname, pool));
/* No need to check svn_prop_name_is_valid for *deleting*
properties, and it may even be useful to allow, in case invalid
properties sneaked through somehow. */
@@ -78,7 +78,7 @@ svn_cl__propdel(apr_getopt_t *os,
&URL, ctx, pool));
/* Let libsvn_client do the real work. */
- SVN_ERR(svn_client_revprop_set2(pname_utf8, NULL, NULL,
+ SVN_ERR(svn_client_revprop_set2(pname, NULL, NULL,
URL, &(opt_state->start_revision),
&rev, FALSE, ctx, pool));
}
@@ -86,7 +86,7 @@ svn_cl__propdel(apr_getopt_t *os,
{
return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
_("Cannot specify revision for deleting versioned property
'%s'"),
- pname_utf8);
+ pname);
}
else /* operate on a normal, versioned property (not a revprop) */
{
@@ -94,7 +94,7 @@ svn_cl__propdel(apr_getopt_t *os,
opt_state->depth = svn_depth_empty;
/* For each target, remove the property PNAME. */
- SVN_ERR(svn_client_propset_local(pname_utf8, NULL, targets,
+ SVN_ERR(svn_client_propset_local(pname, NULL, targets,
opt_state->depth, FALSE,
opt_state->changelists, ctx, pool));
}
Modified: subversion/trunk/subversion/svn/propedit-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propedit-cmd.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propedit-cmd.c (original)
+++ subversion/trunk/subversion/svn/propedit-cmd.c Fri Jun 2 09:53:59 2017
@@ -47,7 +47,7 @@
/*** Code. ***/
struct commit_info_baton
{
- const char *pname_utf8;
+ const char *pname;
const char *target_local;
};
@@ -60,7 +60,7 @@ commit_info_handler(const svn_commit_inf
SVN_ERR(svn_cmdline_printf(pool,
_("Set new value for property '%s' on '%s'\n"),
- cib->pname_utf8, cib->target_local));
+ cib->pname, cib->target_local));
SVN_ERR(svn_cl__print_commit_info(commit_info, NULL, pool));
return SVN_NO_ERROR;
@@ -74,23 +74,23 @@ svn_cl__propedit(apr_getopt_t *os,
{
svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
- const char *pname, *pname_utf8;
+ const char *pname;
apr_array_header_t *args, *targets;
/* Validate the input and get the property's name (and a UTF-8
version of that name). */
SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool));
pname = APR_ARRAY_IDX(args, 0, const char *);
- SVN_ERR(svn_utf_cstring_to_utf8(&pname_utf8, pname, pool));
- if (! svn_prop_name_is_valid(pname_utf8))
+ SVN_ERR(svn_utf_cstring_to_utf8(&pname, pname, pool));
+ if (! svn_prop_name_is_valid(pname))
return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
_("'%s' is not a valid Subversion property name"),
- pname_utf8);
+ pname);
if (!opt_state->force)
- SVN_ERR(svn_cl__check_svn_prop_name(pname_utf8, opt_state->revprop,
+ SVN_ERR(svn_cl__check_svn_prop_name(pname, opt_state->revprop,
svn_cl__prop_use_edit, pool));
- if (opt_state->encoding && !svn_prop_needs_translation(pname_utf8))
+ if (opt_state->encoding && !svn_prop_needs_translation(pname))
return svn_error_create
(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
_("--encoding option applies only to textual"
@@ -120,7 +120,7 @@ svn_cl__propedit(apr_getopt_t *os,
&URL, ctx, pool));
/* Fetch the current property. */
- SVN_ERR(svn_client_revprop_get(pname_utf8, &propval,
+ SVN_ERR(svn_client_revprop_get(pname, &propval,
URL, &(opt_state->start_revision),
&rev, ctx, pool));
@@ -145,13 +145,13 @@ svn_cl__propedit(apr_getopt_t *os,
opt_state->editor_cmd, temp_dir,
propval, "svn-prop",
ctx->config,
- svn_prop_needs_translation(pname_utf8),
+ svn_prop_needs_translation(pname),
opt_state->encoding, pool));
/* ...and re-set the property's value accordingly. */
if (propval)
{
- SVN_ERR(svn_client_revprop_set2(pname_utf8,
+ SVN_ERR(svn_client_revprop_set2(pname,
propval, &original_propval,
URL, &(opt_state->start_revision),
&rev, opt_state->force, ctx, pool));
@@ -160,13 +160,13 @@ svn_cl__propedit(apr_getopt_t *os,
(svn_cmdline_printf
(pool,
_("Set new value for property '%s' on revision %ld\n"),
- pname_utf8, rev));
+ pname, rev));
}
else
{
SVN_ERR(svn_cmdline_printf
(pool, _("No changes to property '%s' on revision %ld\n"),
- pname_utf8, rev));
+ pname, rev));
}
}
else if (opt_state->start_revision.kind != svn_opt_revision_unspecified)
@@ -174,7 +174,7 @@ svn_cl__propedit(apr_getopt_t *os,
return svn_error_createf
(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("Cannot specify revision for editing versioned property '%s'"),
- pname_utf8);
+ pname);
}
else /* operate on a normal, versioned property (not a revprop) */
{
@@ -206,7 +206,7 @@ svn_cl__propedit(apr_getopt_t *os,
SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, pool));
- cib.pname_utf8 = pname_utf8;
+ cib.pname = pname;
/* For each target, edit the property PNAME. */
for (i = 0; i < targets->nelts; i++)
@@ -234,7 +234,7 @@ svn_cl__propedit(apr_getopt_t *os,
peg_revision.kind = svn_opt_revision_unspecified;
/* Fetch the current property. */
- SVN_ERR(svn_client_propget5(&props, NULL, pname_utf8, abspath_or_url,
+ SVN_ERR(svn_client_propget5(&props, NULL, pname, abspath_or_url,
&peg_revision,
&(opt_state->start_revision),
&base_rev, svn_depth_empty,
@@ -282,7 +282,7 @@ svn_cl__propedit(apr_getopt_t *os,
"svn-prop",
ctx->config,
svn_prop_needs_translation
- (pname_utf8),
+ (pname),
opt_state->encoding,
subpool));
@@ -295,7 +295,7 @@ svn_cl__propedit(apr_getopt_t *os,
{
svn_error_t *err = SVN_NO_ERROR;
- svn_cl__check_boolean_prop_val(pname_utf8, edited_propval->data,
+ svn_cl__check_boolean_prop_val(pname, edited_propval->data,
subpool);
if (ctx->log_msg_func3)
@@ -304,7 +304,7 @@ svn_cl__propedit(apr_getopt_t *os,
subpool));
if (svn_path_is_url(target))
{
- err = svn_client_propset_remote(pname_utf8, edited_propval,
+ err = svn_client_propset_remote(pname, edited_propval,
target, opt_state->force,
base_rev,
opt_state->revprop_table,
@@ -319,9 +319,9 @@ svn_cl__propedit(apr_getopt_t *os,
APR_ARRAY_PUSH(targs, const char *) = target;
SVN_ERR(svn_cl__propset_print_binary_mime_type_warning(
- targs, pname_utf8, propval, subpool));
+ targs, pname, propval, subpool));
- err = svn_client_propset_local(pname_utf8, edited_propval,
+ err = svn_client_propset_local(pname, edited_propval,
targs, svn_depth_empty,
opt_state->force, NULL,
ctx, subpool);
@@ -339,14 +339,14 @@ svn_cl__propedit(apr_getopt_t *os,
if (!svn_path_is_url(target))
SVN_ERR(svn_cmdline_printf(
subpool, _("Set new value for property '%s' on
'%s'\n"),
- pname_utf8, target_local));
+ pname, target_local));
}
else
{
SVN_ERR
(svn_cmdline_printf
(subpool, _("No changes to property '%s' on '%s'\n"),
- pname_utf8, target_local));
+ pname, target_local));
}
}
svn_pool_destroy(subpool);
Modified: subversion/trunk/subversion/svn/propget-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propget-cmd.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propget-cmd.c (original)
+++ subversion/trunk/subversion/svn/propget-cmd.c Fri Jun 2 09:53:59 2017
@@ -137,7 +137,7 @@ print_properties_xml(const char *pname,
return SVN_NO_ERROR;
}
-/* Print the property PNAME_UTF with the value PROPVAL set on ABSPATH_OR_URL
+/* Print the property PNAME with the value PROPVAL set on ABSPATH_OR_URL
to the stream OUT.
If INHERITED_PROPERTY is true then the property described is inherited,
@@ -153,7 +153,7 @@ print_single_prop(svn_string_t *propval,
const char *abspath_or_URL,
const char *wc_path_prefix,
svn_stream_t *out,
- const char *pname_utf8,
+ const char *pname,
svn_boolean_t print_filenames,
svn_boolean_t omit_newline,
svn_boolean_t like_proplist,
@@ -211,14 +211,14 @@ print_single_prop(svn_string_t *propval,
/* Print the property name and value just as "proplist -v" does */
apr_hash_t *hash = apr_hash_make(scratch_pool);
- svn_hash_sets(hash, pname_utf8, propval);
+ svn_hash_sets(hash, pname, propval);
SVN_ERR(svn_cmdline__print_prop_hash(out, hash, FALSE, scratch_pool));
}
else
{
/* If this is a special Subversion property, it is stored as
UTF8, so convert to the native format. */
- if (svn_prop_needs_translation(pname_utf8))
+ if (svn_prop_needs_translation(pname))
SVN_ERR(svn_subst_detranslate_string(&propval, propval,
TRUE, scratch_pool));
@@ -244,7 +244,7 @@ print_single_prop(svn_string_t *propval,
If IS_URL is true, all paths in PROPS are URLs, else all paths are local
paths.
- PNAME_UTF8 is the property name of all the properties.
+ PNAME is the property name of all the properties.
If PRINT_FILENAMES is true, print the item's path before each property.
@@ -255,7 +255,7 @@ print_single_prop(svn_string_t *propval,
static svn_error_t *
print_properties(svn_stream_t *out,
const char *target_abspath_or_url,
- const char *pname_utf8,
+ const char *pname,
apr_hash_t *props,
apr_array_header_t *inherited_props,
svn_boolean_t print_filenames,
@@ -282,7 +282,7 @@ print_properties(svn_stream_t *out,
iprop->prop_hash));
SVN_ERR(print_single_prop(propval, target_abspath_or_url,
iprop->path_or_url,
- path_prefix, out, pname_utf8,
+ path_prefix, out, pname,
print_filenames, omit_newline,
like_proplist, TRUE, iterpool));
}
@@ -298,7 +298,7 @@ print_properties(svn_stream_t *out,
svn_pool_clear(iterpool);
SVN_ERR(print_single_prop(propval, target_abspath_or_url, filename,
- path_prefix, out, pname_utf8, print_filenames,
+ path_prefix, out, pname, print_filenames,
omit_newline, like_proplist, FALSE,
iterpool));
}
@@ -317,7 +317,7 @@ svn_cl__propget(apr_getopt_t *os,
{
svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
- const char *pname, *pname_utf8;
+ const char *pname;
apr_array_header_t *args, *targets;
svn_stream_t *out;
svn_boolean_t warned = FALSE;
@@ -328,15 +328,14 @@ svn_cl__propget(apr_getopt_t *os,
_("--verbose cannot be used with --revprop or "
"--no-newline or --xml"));
- /* PNAME is first argument (and PNAME_UTF8 will be a UTF-8 version
- thereof) */
+ /* PNAME is first argument */
SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool));
pname = APR_ARRAY_IDX(args, 0, const char *);
- SVN_ERR(svn_utf_cstring_to_utf8(&pname_utf8, pname, pool));
- if (! svn_prop_name_is_valid(pname_utf8))
+ SVN_ERR(svn_utf_cstring_to_utf8(&pname, pname, pool));
+ if (! svn_prop_name_is_valid(pname))
return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
_("'%s' is not a valid Subversion property name"),
- pname_utf8);
+ pname);
SVN_ERR(svn_cl__args_to_target_array_print_reserved(&targets, os,
opt_state->targets,
@@ -363,7 +362,7 @@ svn_cl__propget(apr_getopt_t *os,
&URL, ctx, pool));
/* Let libsvn_client do the real work. */
- SVN_ERR(svn_client_revprop_get(pname_utf8, &propval,
+ SVN_ERR(svn_client_revprop_get(pname, &propval,
URL, &(opt_state->start_revision),
&rev, ctx, pool));
@@ -372,7 +371,7 @@ svn_cl__propget(apr_getopt_t *os,
return svn_error_createf(SVN_ERR_PROPERTY_NOT_FOUND, NULL,
_("Property '%s' not found on "
"revision %s"),
- pname_utf8,
+ pname,
svn_opt__revision_to_string(
&opt_state->start_revision,
pool));
@@ -390,7 +389,7 @@ svn_cl__propget(apr_getopt_t *os,
"revprops",
"rev", revstr, SVN_VA_NULL);
- svn_cmdline__print_xml_prop(&sb, pname_utf8, propval, FALSE,
+ svn_cmdline__print_xml_prop(&sb, pname, propval, FALSE,
pool);
svn_xml_make_close_tag(&sb, pool, "revprops");
@@ -405,7 +404,7 @@ svn_cl__propget(apr_getopt_t *os,
/* If this is a special Subversion property, it is stored as
UTF8 and LF, so convert to the native locale and eol-style. */
- if (svn_prop_needs_translation(pname_utf8))
+ if (svn_prop_needs_translation(pname))
SVN_ERR(svn_subst_detranslate_string(&printable_val, propval,
TRUE, pool));
@@ -462,7 +461,7 @@ svn_cl__propget(apr_getopt_t *os,
SVN_ERR(svn_client_propget5(
&props,
opt_state->show_inherited_props ? &inherited_props : NULL,
- pname_utf8, truepath,
+ pname, truepath,
&peg_revision,
&(opt_state->start_revision),
NULL, opt_state->depth,
@@ -491,7 +490,7 @@ svn_cl__propget(apr_getopt_t *os,
svn_error_t *err;
err = svn_error_createf(SVN_ERR_PROPERTY_NOT_FOUND, NULL,
_("Property '%s' not found on '%s'"),
- pname_utf8, target);
+ pname, target);
svn_handle_warning2(stderr, err, "svn: ");
svn_error_clear(err);
warned = TRUE;
@@ -499,12 +498,12 @@ svn_cl__propget(apr_getopt_t *os,
if (opt_state->xml)
SVN_ERR(print_properties_xml(
- pname_utf8, props,
+ pname, props,
opt_state->show_inherited_props ? inherited_props : NULL,
subpool));
else
SVN_ERR(print_properties(
- out, truepath, pname_utf8,
+ out, truepath, pname,
props,
opt_state->show_inherited_props ? inherited_props : NULL,
print_filenames,
Modified: subversion/trunk/subversion/svn/propset-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propset-cmd.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propset-cmd.c (original)
+++ subversion/trunk/subversion/svn/propset-cmd.c Fri Jun 2 09:53:59 2017
@@ -51,7 +51,7 @@ svn_cl__propset(apr_getopt_t *os,
{
svn_cl__opt_state_t *opt_state = ((svn_cl__cmd_baton_t *) baton)->opt_state;
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
- const char *pname, *pname_utf8;
+ const char *pname;
svn_string_t *propval = NULL;
svn_boolean_t propval_came_from_cmdline;
apr_array_header_t *args, *targets;
@@ -62,13 +62,13 @@ svn_cl__propset(apr_getopt_t *os,
SVN_ERR(svn_opt_parse_num_args(&args, os,
opt_state->filedata ? 1 : 2, scratch_pool));
pname = APR_ARRAY_IDX(args, 0, const char *);
- SVN_ERR(svn_utf_cstring_to_utf8(&pname_utf8, pname, scratch_pool));
- if (! svn_prop_name_is_valid(pname_utf8))
+ SVN_ERR(svn_utf_cstring_to_utf8(&pname, pname, scratch_pool));
+ if (! svn_prop_name_is_valid(pname))
return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
_("'%s' is not a valid Subversion property name"),
- pname_utf8);
+ pname);
if (!opt_state->force)
- SVN_ERR(svn_cl__check_svn_prop_name(pname_utf8, opt_state->revprop,
+ SVN_ERR(svn_cl__check_svn_prop_name(pname, opt_state->revprop,
svn_cl__prop_use_set, scratch_pool));
/* Get the PROPVAL from either an external file, or from the command
@@ -87,7 +87,7 @@ svn_cl__propset(apr_getopt_t *os,
/* We only want special Subversion property values to be in UTF-8
and LF line endings. All other propvals are taken literally. */
- if (svn_prop_needs_translation(pname_utf8))
+ if (svn_prop_needs_translation(pname))
SVN_ERR(svn_subst_translate_string2(&propval, NULL, NULL, propval,
opt_state->encoding, FALSE,
scratch_pool, scratch_pool));
@@ -120,7 +120,7 @@ svn_cl__propset(apr_getopt_t *os,
&URL, ctx, scratch_pool));
/* Let libsvn_client do the real work. */
- SVN_ERR(svn_client_revprop_set2(pname_utf8, propval, NULL,
+ SVN_ERR(svn_client_revprop_set2(pname, propval, NULL,
URL, &(opt_state->start_revision),
&rev, opt_state->force, ctx,
scratch_pool));
@@ -130,7 +130,7 @@ svn_cl__propset(apr_getopt_t *os,
return svn_error_createf
(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("Cannot specify revision for setting versioned property '%s'"),
- pname_utf8);
+ pname);
}
else /* operate on a normal, versioned property (not a revprop) */
{
@@ -174,17 +174,17 @@ svn_cl__propset(apr_getopt_t *os,
}
SVN_ERR(svn_cl__propset_print_binary_mime_type_warning(targets,
- pname_utf8,
+ pname,
propval,
scratch_pool));
- SVN_ERR(svn_client_propset_local(pname_utf8, propval, targets,
+ SVN_ERR(svn_client_propset_local(pname, propval, targets,
opt_state->depth, opt_state->force,
opt_state->changelists, ctx,
scratch_pool));
if (! opt_state->quiet)
- svn_cl__check_boolean_prop_val(pname_utf8, propval->data,
scratch_pool);
+ svn_cl__check_boolean_prop_val(pname, propval->data, scratch_pool);
}
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/svn/svn.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Fri Jun 2 09:53:59 2017
@@ -2576,22 +2576,22 @@ sub_main(int *exit_code, int argc, const
}
else
{
- const char *first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(svn_cl__cmd_table,
first_arg);
if (subcommand == NULL)
{
- const char *first_arg_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
- first_arg, pool));
svn_error_clear
(svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
- first_arg_utf8));
+ first_arg));
svn_error_clear(svn_cl__help(NULL, NULL, pool));
/* Be kind to people who try 'svn undo'. */
- if (strcmp(first_arg_utf8, "undo") == 0)
+ if (strcmp(first_arg, "undo") == 0)
{
svn_error_clear
(svn_cmdline_fprintf(stderr, pool,
@@ -2881,9 +2881,9 @@ sub_main(int *exit_code, int argc, const
{
svn_node_kind_t kind;
const char *local_abspath;
- const char *fname_utf8 = svn_dirent_internal_style(dash_F_arg, pool);
+ const char *fname = svn_dirent_internal_style(dash_F_arg, pool);
- err = svn_dirent_get_absolute(&local_abspath, fname_utf8, pool);
+ err = svn_dirent_get_absolute(&local_abspath, fname, pool);
if (!err)
{
Modified: subversion/trunk/subversion/svnadmin/svnadmin.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnadmin/svnadmin.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svnadmin/svnadmin.c (original)
+++ subversion/trunk/subversion/svnadmin/svnadmin.c Fri Jun 2 09:53:59 2017
@@ -1729,12 +1729,12 @@ list_dblogs(apr_getopt_t *os, void *bato
style before printing. */
for (i = 0; i < logfiles->nelts; i++)
{
- const char *log_utf8;
- log_utf8 = svn_dirent_join(opt_state->repository_path,
+ const char *log_path;
+ log_path = svn_dirent_join(opt_state->repository_path,
APR_ARRAY_IDX(logfiles, i, const char *),
pool);
- log_utf8 = svn_dirent_local_style(log_utf8, pool);
- SVN_ERR(svn_cmdline_printf(pool, "%s\n", log_utf8));
+ log_path = svn_dirent_local_style(log_path, pool);
+ SVN_ERR(svn_cmdline_printf(pool, "%s\n", log_path));
}
return SVN_NO_ERROR;
@@ -2305,7 +2305,6 @@ subcommand_lock(apr_getopt_t *os, void *
const char *lock_path;
const char *comment_file_name;
svn_stringbuf_t *file_contents;
- const char *lock_path_utf8;
svn_lock_t *lock;
const char *lock_token = NULL;
@@ -2332,10 +2331,10 @@ subcommand_lock(apr_getopt_t *os, void *
SVN_ERR(svn_stringbuf_from_file2(&file_contents, comment_file_name, pool));
- SVN_ERR(target_arg_to_fspath(&lock_path_utf8, lock_path, pool, pool));
+ SVN_ERR(target_arg_to_fspath(&lock_path, lock_path, pool, pool));
if (opt_state->bypass_hooks)
- SVN_ERR(svn_fs_lock(&lock, fs, lock_path_utf8,
+ SVN_ERR(svn_fs_lock(&lock, fs, lock_path,
lock_token,
file_contents->data, /* comment */
0, /* is_dav_comment */
@@ -2343,7 +2342,7 @@ subcommand_lock(apr_getopt_t *os, void *
SVN_INVALID_REVNUM,
FALSE, pool));
else
- SVN_ERR(svn_repos_fs_lock(&lock, repos, lock_path_utf8,
+ SVN_ERR(svn_repos_fs_lock(&lock, repos, lock_path,
lock_token,
file_contents->data, /* comment */
0, /* is_dav_comment */
@@ -2353,7 +2352,7 @@ subcommand_lock(apr_getopt_t *os, void *
if (! opt_state->quiet)
SVN_ERR(svn_cmdline_printf(pool, _("'%s' locked by user '%s'.\n"),
- lock_path_utf8, username));
+ lock_path, username));
return SVN_NO_ERROR;
}
@@ -2523,7 +2522,6 @@ subcommand_unlock(apr_getopt_t *os, void
apr_array_header_t *args;
const char *username;
const char *lock_path;
- const char *lock_path_utf8;
const char *lock_token = NULL;
/* Expect three more arguments: PATH USERNAME TOKEN */
@@ -2539,17 +2537,17 @@ subcommand_unlock(apr_getopt_t *os, void
SVN_ERR(svn_fs_create_access(&access, username, pool));
SVN_ERR(svn_fs_set_access(fs, access));
- SVN_ERR(target_arg_to_fspath(&lock_path_utf8, lock_path, pool, pool));
+ SVN_ERR(target_arg_to_fspath(&lock_path, lock_path, pool, pool));
if (opt_state->bypass_hooks)
- SVN_ERR(svn_fs_unlock(fs, lock_path_utf8, lock_token,
+ SVN_ERR(svn_fs_unlock(fs, lock_path, lock_token,
FALSE, pool));
else
- SVN_ERR(svn_repos_fs_unlock(repos, lock_path_utf8, lock_token,
+ SVN_ERR(svn_repos_fs_unlock(repos, lock_path, lock_token,
FALSE, pool));
if (! opt_state->quiet)
SVN_ERR(svn_cmdline_printf(pool, _("'%s' unlocked by user '%s'.\n"),
- lock_path_utf8, username));
+ lock_path, username));
return SVN_NO_ERROR;
}
@@ -2930,17 +2928,17 @@ sub_main(int *exit_code, int argc, const
}
else
{
- const char *first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(cmd_table, first_arg);
if (subcommand == NULL)
{
- const char *first_arg_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
- first_arg, pool));
svn_error_clear(
svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
- first_arg_utf8));
+ first_arg));
SVN_ERR(subcommand_help(NULL, NULL, pool));
*exit_code = EXIT_FAILURE;
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/svnbench/svnbench.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnbench/svnbench.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svnbench/svnbench.c (original)
+++ subversion/trunk/subversion/svnbench/svnbench.c Fri Jun 2 09:53:59 2017
@@ -747,18 +747,18 @@ sub_main(int *exit_code, int argc, const
}
else
{
- const char *first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(svn_cl__cmd_table,
first_arg);
if (subcommand == NULL)
{
- const char *first_arg_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
- first_arg, pool));
svn_error_clear
(svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
- first_arg_utf8));
+ first_arg));
SVN_ERR(svn_cl__help(NULL, NULL, pool));
*exit_code = EXIT_FAILURE;
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/svndumpfilter/svndumpfilter.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svndumpfilter/svndumpfilter.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svndumpfilter/svndumpfilter.c (original)
+++ subversion/trunk/subversion/svndumpfilter/svndumpfilter.c Fri Jun 2
09:53:59 2017
@@ -1371,7 +1371,8 @@ sub_main(int *exit_code, int argc, const
opt_state.skip_missing_merge_sources = TRUE;
break;
case svndumpfilter__targets:
- opt_state.targets_file = opt_arg;
+ SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.targets_file,
+ opt_arg, pool));
break;
default:
{
@@ -1428,18 +1429,17 @@ sub_main(int *exit_code, int argc, const
}
else
{
- const char *first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(cmd_table, first_arg);
if (subcommand == NULL)
{
- const char* first_arg_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8, first_arg,
- pool));
-
svn_error_clear(
svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
- first_arg_utf8));
+ first_arg));
SVN_ERR(subcommand_help(NULL, NULL, pool));
*exit_code = EXIT_FAILURE;
return SVN_NO_ERROR;
@@ -1472,18 +1472,13 @@ sub_main(int *exit_code, int argc, const
if (opt_state.targets_file)
{
svn_stringbuf_t *buffer, *buffer_utf8;
- const char *utf8_targets_file;
apr_array_header_t *targets = apr_array_make(pool, 0,
sizeof(const char *));
/* We need to convert to UTF-8 now, even before we divide
the targets into an array, because otherwise we wouldn't
know what delimiter to use for svn_cstring_split(). */
-
- SVN_ERR(svn_utf_cstring_to_utf8(&utf8_targets_file,
- opt_state.targets_file, pool));
-
- SVN_ERR(svn_stringbuf_from_file2(&buffer, utf8_targets_file,
+ SVN_ERR(svn_stringbuf_from_file2(&buffer, opt_state.targets_file,
pool));
SVN_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool));
Modified: subversion/trunk/subversion/svnfsfs/svnfsfs.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnfsfs/svnfsfs.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svnfsfs/svnfsfs.c (original)
+++ subversion/trunk/subversion/svnfsfs/svnfsfs.c Fri Jun 2 09:53:59 2017
@@ -355,17 +355,17 @@ sub_main(int *exit_code, int argc, const
}
else
{
- const char *first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(cmd_table, first_arg);
if (subcommand == NULL)
{
- const char *first_arg_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
- first_arg, pool));
svn_error_clear(
svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
- first_arg_utf8));
+ first_arg));
SVN_ERR(subcommand__help(NULL, NULL, pool));
*exit_code = EXIT_FAILURE;
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/svnlook/svnlook.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/svnlook.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svnlook/svnlook.c (original)
+++ subversion/trunk/subversion/svnlook/svnlook.c Fri Jun 2 09:53:59 2017
@@ -2665,21 +2665,21 @@ sub_main(int *exit_code, int argc, const
}
else
{
- const char *first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(cmd_table, first_arg);
if (subcommand == NULL)
{
- const char *first_arg_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8, first_arg,
- pool));
svn_error_clear(
svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
- first_arg_utf8));
+ first_arg));
SVN_ERR(subcommand_help(NULL, NULL, pool));
/* Be kind to people who try 'svnlook verify'. */
- if (strcmp(first_arg_utf8, "verify") == 0)
+ if (strcmp(first_arg, "verify") == 0)
{
svn_error_clear(
svn_cmdline_fprintf(stderr, pool,
Modified: subversion/trunk/subversion/svnmucc/svnmucc.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnmucc/svnmucc.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svnmucc/svnmucc.c (original)
+++ subversion/trunk/subversion/svnmucc/svnmucc.c Fri Jun 2 09:53:59 2017
@@ -598,7 +598,7 @@ sub_main(int *exit_code, int argc, const
SVN_ERR(svn_opt_parse_revprop(&revprops, arg, pool));
break;
case 'X':
- extra_args_file = apr_pstrdup(pool, arg);
+ SVN_ERR(svn_utf_cstring_to_utf8(&extra_args_file, arg, pool));
break;
case non_interactive_opt:
non_interactive = TRUE;
@@ -677,22 +677,19 @@ sub_main(int *exit_code, int argc, const
action_args = apr_array_make(pool, opts->argc, sizeof(const char *));
while (opts->ind < opts->argc)
{
- const char *arg = opts->argv[opts->ind++];
- SVN_ERR(svn_utf_cstring_to_utf8(&APR_ARRAY_PUSH(action_args,
- const char *),
- arg, pool));
+ const char *arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&arg, opts->argv[opts->ind++], pool));
+ APR_ARRAY_PUSH(action_args, const char *) = arg;
}
/* If there are extra arguments in a supplementary file, tack those
on, too (again, in UTF8 form). */
if (extra_args_file)
{
- const char *extra_args_file_utf8;
svn_stringbuf_t *contents, *contents_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&extra_args_file_utf8,
- extra_args_file, pool));
- SVN_ERR(svn_stringbuf_from_file2(&contents, extra_args_file_utf8, pool));
+ SVN_ERR(svn_stringbuf_from_file2(&contents, extra_args_file, pool));
SVN_ERR(svn_utf_stringbuf_to_utf8(&contents_utf8, contents, pool));
svn_cstring_split_append(action_args, contents_utf8->data, "\n\r",
FALSE, pool);
Modified: subversion/trunk/subversion/svnrdump/svnrdump.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnrdump/svnrdump.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svnrdump/svnrdump.c (original)
+++ subversion/trunk/subversion/svnrdump/svnrdump.c Fri Jun 2 09:53:59 2017
@@ -770,7 +770,6 @@ sub_main(int *exit_code, int argc, const
svn_boolean_t force_interactive = FALSE;
apr_array_header_t *config_options = NULL;
apr_getopt_t *os;
- const char *first_arg;
apr_array_header_t *received_opts;
int i;
@@ -932,19 +931,19 @@ sub_main(int *exit_code, int argc, const
}
else
{
- first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(svnrdump__cmd_table,
first_arg);
if (subcommand == NULL)
{
- const char *first_arg_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8, first_arg,
- pool));
svn_error_clear(
svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
- first_arg_utf8));
+ first_arg));
SVN_ERR(help_cmd(NULL, NULL, pool));
*exit_code = EXIT_FAILURE;
return SVN_NO_ERROR;
Modified: subversion/trunk/subversion/svnsync/svnsync.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnsync/svnsync.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/subversion/svnsync/svnsync.c (original)
+++ subversion/trunk/subversion/svnsync/svnsync.c Fri Jun 2 09:53:59 2017
@@ -1770,12 +1770,12 @@ copy_revprops_cmd(apr_getopt_t *os, void
the source URL. */
if (os->argc - os->ind == 2)
{
- const char *arg_str = os->argv[os->argc - 1];
- const char *utf_arg_str;
+ const char *arg_str;
- SVN_ERR(svn_utf_cstring_to_utf8(&utf_arg_str, arg_str, pool));
+ SVN_ERR(svn_utf_cstring_to_utf8(&arg_str, os->argv[os->argc - 1],
+ pool));
- if (! svn_path_is_url(utf_arg_str))
+ if (! svn_path_is_url(arg_str))
{
/* This is the old "... TO_URL REV[:REV2]" syntax.
Revisions come only from this argument. (We effectively
@@ -2081,11 +2081,11 @@ sub_main(int *exit_code, int argc, const
case svnsync_opt_config_dir:
{
- const char *path_utf8;
- opt_err = svn_utf_cstring_to_utf8(&path_utf8, opt_arg, pool);
+ const char *path;
+ opt_err = svn_utf_cstring_to_utf8(&path, opt_arg, pool);
if (!opt_err)
- opt_baton.config_dir = svn_dirent_internal_style(path_utf8,
pool);
+ opt_baton.config_dir = svn_dirent_internal_style(path, pool);
}
break;
case svnsync_opt_config_options:
@@ -2286,7 +2286,10 @@ sub_main(int *exit_code, int argc, const
}
else
{
- const char *first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(svnsync_cmd_table,
first_arg);
if (subcommand == NULL)
Modified:
subversion/trunk/tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
---
subversion/trunk/tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c
(original)
+++
subversion/trunk/tools/client-side/svn-mergeinfo-normalizer/svn-mergeinfo-normalizer.c
Fri Jun 2 09:53:59 2017
@@ -656,18 +656,18 @@ sub_main(int *exit_code, int argc, const
}
else
{
- const char *first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(svn_min__cmd_table,
first_arg);
if (subcommand == NULL)
{
- const char *first_arg_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
- first_arg, pool));
svn_error_clear
(svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
- first_arg_utf8));
+ first_arg));
svn_error_clear(svn_min__help(NULL, NULL, pool));
*exit_code = EXIT_FAILURE;
Modified: subversion/trunk/tools/client-side/svnconflict/svnconflict.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/client-side/svnconflict/svnconflict.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/tools/client-side/svnconflict/svnconflict.c (original)
+++ subversion/trunk/tools/client-side/svnconflict/svnconflict.c Fri Jun 2
09:53:59 2017
@@ -764,18 +764,18 @@ sub_main(int *exit_code, int argc, const
}
else
{
- const char *first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(svnconflict_cmd_table,
first_arg);
if (subcommand == NULL)
{
- const char *first_arg_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
- first_arg, pool));
svn_error_clear
(svn_cmdline_fprintf(stderr, pool,
_("Unknown subcommand: '%s'\n"),
- first_arg_utf8));
+ first_arg));
svn_error_clear(svnconflict_help(NULL, NULL, pool));
*exit_code = EXIT_FAILURE;
return SVN_NO_ERROR;
Modified: subversion/trunk/tools/dev/svnmover/svnmover.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/dev/svnmover/svnmover.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/tools/dev/svnmover/svnmover.c (original)
+++ subversion/trunk/tools/dev/svnmover/svnmover.c Fri Jun 2 09:53:59 2017
@@ -4460,7 +4460,7 @@ sub_main(int *exit_code, int argc, const
SVN_ERR(svn_opt_parse_revprop(&revprops, arg, pool));
break;
case 'X':
- extra_args_file = apr_pstrdup(pool, arg);
+ SVN_ERR(svn_utf_cstring_to_utf8(&extra_args_file, arg, pool));
break;
case non_interactive_opt:
non_interactive = TRUE;
@@ -4633,12 +4633,9 @@ sub_main(int *exit_code, int argc, const
action_args = apr_array_make(pool, opts->argc, sizeof(const char *));
if (extra_args_file)
{
- const char *extra_args_file_utf8;
svn_stringbuf_t *contents, *contents_utf8;
- SVN_ERR(svn_utf_cstring_to_utf8(&extra_args_file_utf8,
- extra_args_file, pool));
- SVN_ERR(svn_stringbuf_from_file2(&contents, extra_args_file_utf8, pool));
+ SVN_ERR(svn_stringbuf_from_file2(&contents, extra_args_file, pool));
SVN_ERR(svn_utf_stringbuf_to_utf8(&contents_utf8, contents, pool));
svn_cstring_split_append(action_args, contents_utf8->data, "\n\r",
FALSE, pool);
Modified: subversion/trunk/tools/server-side/svnauthz.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/server-side/svnauthz.c?rev=1797362&r1=1797361&r2=1797362&view=diff
==============================================================================
--- subversion/trunk/tools/server-side/svnauthz.c (original)
+++ subversion/trunk/tools/server-side/svnauthz.c Fri Jun 2 09:53:59 2017
@@ -581,19 +581,18 @@ sub_main(int *exit_code, int argc, const
}
else
{
- const char *first_arg = os->argv[os->ind++];
+ const char *first_arg;
+
+ SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
+ pool));
subcommand = svn_opt_get_canonical_subcommand2(cmd_table, first_arg);
if (subcommand == NULL)
{
- const char *first_arg_utf8;
-
os->ind++;
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
- first_arg, pool));
svn_error_clear(
svn_cmdline_fprintf(stderr, pool,
("Unknown subcommand: '%s'\n"),
- first_arg_utf8));
+ first_arg));
SVN_ERR(subcommand_help(NULL, NULL, pool));
*exit_code = EXIT_FAILURE;
return SVN_NO_ERROR;