Author: rinrab
Date: Tue May 27 21:34:31 2025
New Revision: 1925879
URL: http://svn.apache.org/viewvc?rev=1925879&view=rev
Log:
On the 'utf8-cmdline-prototype' branch: utf8-ize svnadmin program 🧑💻
* subversion/svnadmin/svnadmin.c
(parse_args,
subcommand_freeze): Remove conversion to UTF8; we work with normalized strings.
(subcommand_lslocks): Use svn_opt_args_to_target_array4 instead of
svn_opt__args_to_target_array which does exactly the same thing, but
without utf conversion.
(sub_main): Initialize argv using svn_cmdline__get_utf8_argv() instead of
svn_cmdline__get_cstring_argv() which returns utf8 array straight away and
read args directly to utf8_opt_arg in the loop.
(-r, -F, svnadmin__fs_type, svnadmin__parent_dir, svnadmin__config_dir,
svnadmin__exclude, svnadmin__include, first_arg, repos_path):
Remove conversion to UTF8; we work with normalized strings.
(-r, -t, -M, svnadmin__compatible_version): Silently migrate to use utf8
encoded strings instead of hell-encoded ones; it should not matter at all.
Modified:
subversion/branches/utf8-cmdline-prototype/subversion/svnadmin/svnadmin.c
Modified: subversion/branches/utf8-cmdline-prototype/subversion/svnadmin/svnadmin.c
URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svnadmin/svnadmin.c?rev=1925879&r1=1925878&r2=1925879&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/svnadmin/svnadmin.c (original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/svnadmin/svnadmin.c Tue May 27 21:34:31 2025
@@ -803,10 +803,7 @@ parse_args(apr_array_header_t **args,
if (num_args)
while (os->ind < os->argc)
{
- const char *arg;
-
- SVN_ERR(svn_utf_cstring_to_utf8(&arg, os->argv[os->ind++], pool));
- APR_ARRAY_PUSH(*args, const char *) = arg;
+ APR_ARRAY_PUSH(*args, const char *) = os->argv[os->ind++];
}
}
@@ -1591,11 +1588,9 @@ subcommand_freeze(apr_getopt_t *os, void
else
{
svn_stringbuf_t *buf;
- const char *utf8;
/* Read repository paths from the -F file. */
SVN_ERR(svn_stringbuf_from_file2(&buf, opt_state->file, pool));
- SVN_ERR(svn_utf_cstring_to_utf8(&utf8, buf->data, pool));
- paths = svn_cstring_split(utf8, "\r\n", FALSE, pool);
+ paths = svn_cstring_split(buf->data, "\r\n", FALSE, pool);
}
b.command = APR_ARRAY_IDX(args, 0, const char *);
@@ -2595,7 +2590,7 @@ subcommand_lslocks(apr_getopt_t *os, voi
apr_hash_index_t *hi;
apr_pool_t *iterpool = svn_pool_create(pool);
- SVN_ERR(svn_opt__args_to_target_array(&targets, os,
+ SVN_ERR(svn_opt_args_to_target_array4(&targets, os,
apr_array_make(pool, 0,
sizeof(const char *)),
pool));
@@ -3075,7 +3070,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));
/* Initialize the FS library. */
SVN_ERR(svn_fs_initialize(pool));
@@ -3099,11 +3094,10 @@ sub_main(int *exit_code,
while (1)
{
- const char *opt_arg;
const char *utf8_opt_arg;
/* Parse the next option. */
- apr_err = apr_getopt_long(os, options_table, &opt_id, &opt_arg);
+ apr_err = apr_getopt_long(os, options_table, &opt_id, &utf8_opt_arg);
if (APR_STATUS_IS_EOF(apr_err))
break;
else if (apr_err)
@@ -3127,10 +3121,8 @@ sub_main(int *exit_code,
}
if (svn_opt_parse_revision(&(opt_state.start_revision),
&(opt_state.end_revision),
- opt_arg, pool) != 0)
+ utf8_opt_arg, pool) != 0)
{
- SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
-
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
_("Syntax error in revision argument '%s'"),
utf8_opt_arg);
@@ -3138,7 +3130,7 @@ sub_main(int *exit_code,
}
break;
case 't':
- opt_state.txn_id = opt_arg;
+ opt_state.txn_id = utf8_opt_arg;
break;
case 'q':
@@ -3151,13 +3143,13 @@ sub_main(int *exit_code,
case 'M':
{
apr_uint64_t sz_val;
- SVN_ERR(svn_cstring_atoui64(&sz_val, opt_arg));
+ SVN_ERR(svn_cstring_atoui64(&sz_val, utf8_opt_arg));
opt_state.memory_cache_size = 0x100000 * sz_val;
}
break;
case 'F':
- SVN_ERR(svn_utf_cstring_to_utf8(&(opt_state.file), opt_arg, pool));
+ opt_state.file = utf8_opt_arg;
dash_F_arg = TRUE;
break;
case svnadmin__version:
@@ -3199,7 +3191,7 @@ sub_main(int *exit_code,
/* Parse the version string which carries our target
compatibility. */
SVN_ERR(svn_version__parse_version_string(&compatible_version,
- opt_arg, pool));
+ utf8_opt_arg, pool));
/* We can't create repository with a version older than 1.0.0. */
if (! svn_version__at_least(compatible_version, 1, 0, 0))
@@ -3236,13 +3228,10 @@ sub_main(int *exit_code,
opt_state.metadata_only = TRUE;
break;
case svnadmin__fs_type:
- SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.fs_type, opt_arg, pool));
+ opt_state.fs_type = utf8_opt_arg;
break;
case svnadmin__parent_dir:
- SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.parent_dir, opt_arg,
- pool));
- opt_state.parent_dir
- = svn_dirent_internal_style(opt_state.parent_dir, pool);
+ opt_state.parent_dir = svn_dirent_internal_style(utf8_opt_arg, pool);
break;
case svnadmin__use_pre_commit_hook:
opt_state.use_pre_commit_hook = TRUE;
@@ -3275,7 +3264,6 @@ sub_main(int *exit_code,
opt_state.clean_logs = TRUE;
break;
case svnadmin__config_dir:
- SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
opt_state.config_dir =
apr_pstrdup(pool, svn_dirent_canonicalize(utf8_opt_arg, pool));
break;
@@ -3289,15 +3277,11 @@ sub_main(int *exit_code,
opt_state.normalize_props = TRUE;
break;
case svnadmin__exclude:
- SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
-
if (! opt_state.exclude)
opt_state.exclude = apr_array_make(pool, 1, sizeof(const char *));
APR_ARRAY_PUSH(opt_state.exclude, const char *) = utf8_opt_arg;
break;
case svnadmin__include:
- SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
-
if (! opt_state.include)
opt_state.include = apr_array_make(pool, 1, sizeof(const char *));
APR_ARRAY_PUSH(opt_state.include, const char *) = utf8_opt_arg;
@@ -3349,10 +3333,8 @@ sub_main(int *exit_code,
}
else
{
- const char *first_arg;
+ const char *first_arg = os->argv[os->ind++];
- SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
- pool));
subcommand = svn_opt_get_canonical_subcommand3(cmd_table, first_arg);
if (subcommand == NULL)
{
@@ -3381,7 +3363,7 @@ sub_main(int *exit_code,
_("Repository argument required"));
}
- SVN_ERR(svn_utf_cstring_to_utf8(&repos_path, os->argv[os->ind++], pool));
+ repos_path = os->argv[os->ind++], pool;
if (svn_path_is_url(repos_path))
{
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.