Author: rinrab
Date: Tue May 20 18:31:35 2025
New Revision: 1925722
URL: http://svn.apache.org/viewvc?rev=1925722&view=rev
Log:
On the 'utf8-cmdline-prototype' branch: add a new function that retrieves
target list from args, instead of converting the encoding, assumes that
args have already been converted.
* subversion/include/svn_client.h
(svn_client_args_to_target_array_utf8): Declare symbol.
* subversion/libsvn_client/cmdline.c
(args_to_target_array): Factor out an internal helper.
(svn_client_args_to_target_array2): Implement through args_to_target_array().
(svn_client_args_to_target_array_utf8): Implement function.
No functional changes in the cmdline.
Modified:
subversion/branches/utf8-cmdline-prototype/subversion/include/svn_client.h
subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
Modified: subversion/branches/utf8-cmdline-prototype/subversion/include/svn_client.h
URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/include/svn_client.h?rev=1925722&r1=1925721&r2=1925722&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/include/svn_client.h (original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/include/svn_client.h Tue May 20 18:31:35 2025
@@ -1197,6 +1197,20 @@ svn_client_args_to_target_array(apr_arra
svn_client_ctx_t *ctx,
apr_pool_t *pool);
+/**
+ * Similar to svn_client_args_to_target_array2() but assuming that the targets
+ * in @a os are already UTF-8 encoded.
+ *
+ * @since New in 1.15.0
+ */
+svn_error_t *
+svn_client_args_to_target_array_utf8(apr_array_header_t **targets_p,
+ apr_getopt_t *os,
+ const apr_array_header_t *known_targets,
+ svn_client_ctx_t *ctx,
+ svn_boolean_t keep_last_origpath_on_truepath_collision,
+ apr_pool_t *pool);
+
/** @} group end: Client command-line processing */
/** @} */
Modified: subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c?rev=1925722&r1=1925721&r2=1925722&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c (original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/libsvn_client/cmdline.c Tue May 20 18:31:35 2025
@@ -110,15 +110,16 @@ check_root_url_of_target(const char **ro
return SVN_NO_ERROR;
}
-/* Note: This is substantially copied from svn_opt__args_to_target_array() in
- * order to move to libsvn_client while maintaining backward compatibility. */
-svn_error_t *
-svn_client_args_to_target_array2(apr_array_header_t **targets_p,
- apr_getopt_t *os,
- const apr_array_header_t *known_targets,
- svn_client_ctx_t *ctx,
- svn_boolean_t keep_last_origpath_on_truepath_collision,
- apr_pool_t *pool)
+/* Internal helper for public interfaces svn_client_args_to_target_array2
+ * and svn_client_args_to_target_array_utf8.
+ */
+static svn_error_t *
+args_to_target_array(apr_array_header_t **targets_p,
+ apr_array_header_t *utf8_targets,
+ const apr_array_header_t *known_targets,
+ svn_client_ctx_t *ctx,
+ svn_boolean_t keep_last_origpath_on_truepath_collision,
+ apr_pool_t *pool)
{
int i;
svn_boolean_t rel_url_found = FALSE;
@@ -135,14 +136,9 @@ svn_client_args_to_target_array2(apr_arr
If any of the targets are relative urls, then set the rel_url_found
flag.*/
- for (; os->ind < os->argc; os->ind++)
+ for (i = 0; i < utf8_targets->nelts; i++)
{
- /* 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));
+ const char *utf8_target = APR_ARRAY_IDX(utf8_targets, i, const char *);
if (svn_path_is_repos_relative_url(utf8_target))
rel_url_found = TRUE;
@@ -370,3 +366,54 @@ svn_client_args_to_target_array2(apr_arr
return SVN_NO_ERROR;
}
+
+/* Note: This is substantially copied from svn_opt__args_to_target_array() in
+ * order to move to libsvn_client while maintaining backward compatibility. */
+svn_error_t *
+svn_client_args_to_target_array2(apr_array_header_t **targets_p,
+ apr_getopt_t *os,
+ const apr_array_header_t *known_targets,
+ svn_client_ctx_t *ctx,
+ svn_boolean_t keep_last_origpath_on_truepath_collision,
+ apr_pool_t *pool)
+{
+ apr_array_header_t *utf8_input_targets =
+ apr_array_make(pool, DEFAULT_ARRAY_SIZE, 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(utf8_input_targets, const char *) = utf8_target;
+ }
+
+ return svn_error_trace(
+ args_to_target_array(targets_p, utf8_input_targets, known_targets, ctx,
+ keep_last_origpath_on_truepath_collision, pool));
+}
+
+svn_error_t *
+svn_client_args_to_target_array_utf8(apr_array_header_t **targets_p,
+ apr_getopt_t *os,
+ const apr_array_header_t *known_targets,
+ svn_client_ctx_t *ctx,
+ svn_boolean_t keep_last_origpath_on_truepath_collision,
+ apr_pool_t *pool)
+{
+ apr_array_header_t *utf8_input_targets =
+ apr_array_make(pool, DEFAULT_ARRAY_SIZE, sizeof(const char *));
+
+ for (; os->ind < os->argc; os->ind++)
+ {
+ APR_ARRAY_PUSH(utf8_input_targets, const char *) = os->argv[os->ind];
+ }
+
+ return svn_error_trace(
+ args_to_target_array(targets_p, utf8_input_targets, known_targets, ctx,
+ keep_last_origpath_on_truepath_collision, pool));
+}
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.