svn commit: r1926038 - /subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <[email protected]>
Author: rinrab
Date: Sun Jun  1 12:13:59 2025
New Revision: 1926038

URL: http://svn.apache.org/viewvc?rev=1926038&view=rev
Log:
On the 'utf8-cmdline-prototype' branch: utf8-ize svnmucc program.

* subversion/svnmucc/svnmucc.c
  (sub_main): Convert all args straight to utf8 and remove later conversion.

Modified:
    subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c

Modified: subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c
URL: http://svn.apache.org/viewvc/subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c?rev=1926038&r1=1926037&r2=1926038&view=diff
==============================================================================
--- subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c (original)
+++ subversion/branches/utf8-cmdline-prototype/subversion/svnmucc/svnmucc.c Sun Jun  1 12:13:59 2025
@@ -575,7 +575,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 RA library. */
   SVN_ERR(svn_ra_initialize(pool));
@@ -588,10 +588,9 @@ sub_main(int *exit_code,
   while (1)
     {
       int opt;
-      const char *arg;
       const char *opt_arg;
 
-      apr_status_t status = apr_getopt_long(opts, options, &opt, &arg);
+      apr_status_t status = apr_getopt_long(opts, options, &opt, &opt_arg);
       if (APR_STATUS_IS_EOF(status))
         break;
       if (status != APR_SUCCESS)
@@ -603,41 +602,35 @@ sub_main(int *exit_code,
       switch(opt)
         {
         case 'm':
-          SVN_ERR(svn_utf_cstring_to_utf8(&message, arg, pool));
+          message = apr_pstrdup(pool, opt_arg);
           break;
         case 'F':
-          {
-            const char *filename;
-            SVN_ERR(svn_utf_cstring_to_utf8(&filename, arg, pool));
-            SVN_ERR(svn_stringbuf_from_file2(&filedata, filename, pool));
-            SVN_ERR(svn_utf_stringbuf_to_utf8(&filedata, filedata, pool));
-          }
+          SVN_ERR(svn_stringbuf_from_file2(&filedata, opt_arg, pool));
+          SVN_ERR(svn_utf_stringbuf_to_utf8(&filedata, filedata, pool));
           break;
         case 'u':
-          username = apr_pstrdup(pool, arg);
+          username = apr_pstrdup(pool, opt_arg);
           break;
         case 'p':
-          password = apr_pstrdup(pool, arg);
+          password = apr_pstrdup(pool, opt_arg);
           break;
         case password_from_stdin_opt:
           read_pass_from_stdin = TRUE;
           break;
         case 'U':
-          SVN_ERR(svn_utf_cstring_to_utf8(&root_url, arg, pool));
-          if (! svn_path_is_url(root_url))
+          if (! svn_path_is_url(opt_arg))
             return svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
-                                     "'%s' is not a URL\n", root_url);
-          root_url = sanitize_url(root_url, pool);
+                                     "'%s' is not a URL\n", opt_arg);
+          root_url = sanitize_url(opt_arg, pool);
           break;
         case 'r':
-          SVN_ERR(svn_opt_parse_revnum(&base_revision, arg));
+          SVN_ERR(svn_opt_parse_revnum(&base_revision, opt_arg));
           break;
         case with_revprop_opt:
-          SVN_ERR(svn_utf_cstring_to_utf8(&opt_arg, arg, pool));
           SVN_ERR(svn_opt_parse_revprop2(&revprops, opt_arg, pool));
           break;
         case 'X':
-          SVN_ERR(svn_utf_cstring_to_utf8(&extra_args_file, arg, pool));
+          extra_args_file = apr_pstrdup(pool, opt_arg);
           break;
         case non_interactive_opt:
           non_interactive = TRUE;
@@ -649,7 +642,6 @@ sub_main(int *exit_code,
           trust_unknown_ca = TRUE;
           break;
         case trust_server_cert_failures_opt:
-          SVN_ERR(svn_utf_cstring_to_utf8(&opt_arg, arg, pool));
           SVN_ERR(svn_cmdline__parse_trust_options(
                       &trust_unknown_ca,
                       &trust_cn_mismatch,
@@ -659,10 +651,9 @@ sub_main(int *exit_code,
                       opt_arg, pool));
           break;
         case config_dir_opt:
-          SVN_ERR(svn_utf_cstring_to_utf8(&config_dir, arg, pool));
+          config_dir = apr_pstrdup(pool, opt_arg);
           break;
         case config_inline_opt:
-          SVN_ERR(svn_utf_cstring_to_utf8(&opt_arg, arg, pool));
           SVN_ERR(svn_cmdline__parse_config_option(config_options, opt_arg,
                                                    "svnmucc: ",
                                                    pool));
@@ -712,19 +703,12 @@ sub_main(int *exit_code,
     }
 
 
-  /* Copy the rest of our command-line arguments to an array,
-     UTF-8-ing them along the way. */
-  action_args = apr_array_make(pool, opts->argc, sizeof(const char *));
-  while (opts->ind < opts->argc)
-    {
-      const char *arg;
-
-      SVN_ERR(svn_utf_cstring_to_utf8(&arg, opts->argv[opts->ind++], pool));
-      APR_ARRAY_PUSH(action_args, const char *) = arg;
-    }
+  /* Copy the rest of our command-line arguments to an array. */
+  SVN_ERR(svn_opt_parse_all_args(&action_args, opts, pool));
 
   /* If there are extra arguments in a supplementary file, tack those
-     on, too (again, in UTF8 form). */
+     on, too (also converting them to UTF8 form, since files could be
+     encoded unproperly). */
   if (extra_args_file)
     {
       svn_stringbuf_t *contents, *contents_utf8;
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.