Author: rinrab Date: Mon May 26 17:58:39 2025 New Revision: 1925836 URL: http://svn.apache.org/viewvc?rev=1925836&view=rev Log: On the 'utf8-cmdline-prototype' branch: Finally, switch 'svn' program to utf8 arguments.
* subversion/svn/svn.c (sub_main): Use svn_cmdline__get_utf8_argv instead of svn_cmdline__get_cstring_argv to get normalized arguments. (sub_main): Read opt arg directly to utf8_opt_arg and remove conversion. (sub_main): For some options which wants cstring, convert utf8_opt_arg back. (sub_main): Do not utf8-ize first_arg. * subversion/svn/util.c (svn_cl__args_to_target_array_print_reserved): Use svn_client_args_to_target_array_utf8 instead of svn_client_args_to_target_array2, which doesn't convert result to utf8, since we are working with already converted 'os'. * subversion/svn/auth-cmd.c * subversion/svn/changelist-cmd.c * subversion/svn/propdel-cmd.c * subversion/svn/propedit-cmd.c * subversion/svn/propget-cmd.c * subversion/svn/propset-cmd.c * subversion/svn/shelf-cmd.c * subversion/svn/shelf2-cmd.c (everywhere): Remove unneeded conversions to utf8 using svn_utf_cstring_to_utf8(), since we are working with already normalized args. Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/auth-cmd.c subversion/branches/utf8-cmdline-prototype/subversion/svn/changelist-cmd.c subversion/branches/utf8-cmdline-prototype/subversion/svn/propdel-cmd.c subversion/branches/utf8-cmdline-prototype/subversion/svn/propedit-cmd.c subversion/branches/utf8-cmdline-prototype/subversion/svn/propget-cmd.c subversion/branches/utf8-cmdline-prototype/subversion/svn/propset-cmd.c subversion/branches/utf8-cmdline-prototype/subversion/svn/shelf-cmd.c subversion/branches/utf8-cmdline-prototype/subversion/svn/shelf2-cmd.c subversion/branches/utf8-cmdline-prototype/subversion/svn/svn.c subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/auth-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/auth-cmd.c?rev=1925836&r1=1925835&r2=1925836&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/svn/auth-cmd.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/svn/auth-cmd.c Mon May 26 17:58:39 2025 @@ -419,13 +419,7 @@ svn_cl__auth(apr_getopt_t *os, void *bat b.patterns = apr_array_make(pool, 1, sizeof(const char *)); for (; os->ind < os->argc; os->ind++) { - /* The apr_getopt targets are still in native encoding. */ - const char *raw_target = os->argv[os->ind]; - const char *utf8_target; - - SVN_ERR(svn_utf_cstring_to_utf8(&utf8_target, - raw_target, pool)); - APR_ARRAY_PUSH(b.patterns, const char *) = utf8_target; + APR_ARRAY_PUSH(b.patterns, const char *) = os->argv[os->ind]; } SVN_ERR(svn_config_get_user_config_path(&config_path, Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/changelist-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/changelist-cmd.c?rev=1925836&r1=1925835&r2=1925836&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/svn/changelist-cmd.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/svn/changelist-cmd.c Mon May 26 17:58:39 2025 @@ -55,8 +55,6 @@ svn_cl__changelist(apr_getopt_t *os, apr_array_header_t *args; SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool)); changelist_name = APR_ARRAY_IDX(args, 0, const char *); - SVN_ERR(svn_utf_cstring_to_utf8(&changelist_name, - changelist_name, pool)); } /* Parse the remaining arguments as paths. */ Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/propdel-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/propdel-cmd.c?rev=1925836&r1=1925835&r2=1925836&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/svn/propdel-cmd.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/svn/propdel-cmd.c Mon May 26 17:58:39 2025 @@ -52,10 +52,9 @@ svn_cl__propdel(apr_getopt_t *os, const char *pname; apr_array_header_t *args, *targets; - /* Get the property's name (and a UTF-8 version of that name). */ + /* Get the property's 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, 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. */ Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/propedit-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/propedit-cmd.c?rev=1925836&r1=1925835&r2=1925836&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/svn/propedit-cmd.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/svn/propedit-cmd.c Mon May 26 17:58:39 2025 @@ -77,11 +77,9 @@ svn_cl__propedit(apr_getopt_t *os, 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). */ + /* Validate the input and get the property's 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, 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"), Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/propget-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/propget-cmd.c?rev=1925836&r1=1925835&r2=1925836&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/svn/propget-cmd.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/svn/propget-cmd.c Mon May 26 17:58:39 2025 @@ -335,7 +335,6 @@ svn_cl__propget(apr_getopt_t *os, /* 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, 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"), Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/propset-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/propset-cmd.c?rev=1925836&r1=1925835&r2=1925836&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/svn/propset-cmd.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/svn/propset-cmd.c Mon May 26 17:58:39 2025 @@ -57,12 +57,10 @@ svn_cl__propset(apr_getopt_t *os, apr_array_header_t *args, *targets; /* PNAME and PROPVAL expected as first 2 arguments if filedata was - NULL, else PNAME alone will precede the targets. Get a UTF-8 - version of the name, too. */ + NULL, else PNAME alone will precede the targets. */ 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, 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"), Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/shelf-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/shelf-cmd.c?rev=1925836&r1=1925835&r2=1925836&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/svn/shelf-cmd.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/svn/shelf-cmd.c Mon May 26 17:58:39 2025 @@ -72,9 +72,8 @@ get_next_argument(const char **arg, apr_array_header_t *args; SVN_ERR(svn_opt_parse_num_args(&args, os, 1, scratch_pool)); - SVN_ERR(svn_utf_cstring_to_utf8(arg, - APR_ARRAY_IDX(args, 0, const char *), - result_pool)); + *arg = APR_ARRAY_IDX(args, 0, const char *); + return SVN_NO_ERROR; } Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/shelf2-cmd.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/shelf2-cmd.c?rev=1925836&r1=1925835&r2=1925836&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/svn/shelf2-cmd.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/svn/shelf2-cmd.c Mon May 26 17:58:39 2025 @@ -72,9 +72,8 @@ get_next_argument(const char **arg, apr_array_header_t *args; SVN_ERR(svn_opt_parse_num_args(&args, os, 1, scratch_pool)); - SVN_ERR(svn_utf_cstring_to_utf8(arg, - APR_ARRAY_IDX(args, 0, const char *), - result_pool)); + *arg = APR_ARRAY_IDX(args, 0, const char *); + return SVN_NO_ERROR; } Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/svn.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/svn.c?rev=1925836&r1=1925835&r2=1925836&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/svn/svn.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/svn/svn.c Mon May 26 17:58:39 2025 @@ -2234,7 +2234,7 @@ sub_main(int *exit_code, /* Check library versions */ SVN_ERR(check_lib_versions()); - SVN_ERR(svn_cmdline__get_cstring_argv(&argv, argc, cmdline_argv, pool)); + SVN_ERR(svn_cmdline__get_utf8_argv(&argv, argc, cmdline_argv, pool)); #if defined(WIN32) || defined(__CYGWIN__) /* Set the working copy administrative directory name. */ @@ -2295,8 +2295,8 @@ sub_main(int *exit_code, const char *utf8_opt_arg; /* Parse the next option. */ - apr_status_t apr_err = apr_getopt_long(os, svn_cl__options, &opt_id, - &opt_arg); + apr_status_t apr_err = apr_getopt_long(os, svn_cl__options, + &opt_id, &utf8_opt_arg); if (APR_STATUS_IS_EOF(apr_err)) break; else if (apr_err) @@ -2306,11 +2306,6 @@ sub_main(int *exit_code, return SVN_NO_ERROR; } - if (opt_arg != NULL) - SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool)); - else - utf8_opt_arg = NULL; - /* Stash the option code in an array before parsing it. */ APR_ARRAY_PUSH(received_opts, int) = opt_id; @@ -2526,15 +2521,18 @@ sub_main(int *exit_code, opt_state.extensions = apr_pstrdup(pool, utf8_opt_arg); break; case opt_diff_cmd: + SVN_ERR(svn_utf_cstring_from_utf8(&opt_arg, utf8_opt_arg, pool)); opt_state.diff.diff_cmd = apr_pstrdup(pool, opt_arg); break; case opt_merge_cmd: + SVN_ERR(svn_utf_cstring_from_utf8(&opt_arg, utf8_opt_arg, pool)); opt_state.merge_cmd = apr_pstrdup(pool, opt_arg); break; case opt_record_only: opt_state.record_only = TRUE; break; case opt_editor_cmd: + SVN_ERR(svn_utf_cstring_from_utf8(&opt_arg, utf8_opt_arg, pool)); opt_state.editor_cmd = apr_pstrdup(pool, opt_arg); break; case opt_old_cmd: @@ -2823,8 +2821,7 @@ sub_main(int *exit_code, { const char *first_arg; - SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++], - pool)); + first_arg = os->argv[os->ind++]; subcommand = svn_opt_get_canonical_subcommand3(svn_cl__cmd_table, first_arg); if (subcommand == NULL) Modified: subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c?rev=1925836&r1=1925835&r2=1925836&view=diff ============================================================================== --- subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c (original) +++ subversion/branches/utf8-cmdline-prototype/subversion/svn/util.c Mon May 26 17:58:39 2025 @@ -803,12 +803,10 @@ svn_cl__args_to_target_array_print_reser svn_boolean_t keep_last_origpath_on_truepath_collision, apr_pool_t *pool) { - svn_error_t *err = svn_client_args_to_target_array2(targets, - os, - known_targets, - ctx, - keep_last_origpath_on_truepath_collision, - pool); + svn_error_t *err = svn_client_args_to_target_array_utf8( + targets, os, known_targets, ctx, + keep_last_origpath_on_truepath_collision, pool); + if (err) { if (err->apr_err == SVN_ERR_RESERVED_FILENAME_SPECIFIED)