diff options
author | Adam Mitz <mitza@objectcomputing.com> | 2022-02-01 14:57:43 -0600 |
---|---|---|
committer | Adam Mitz <mitza@objectcomputing.com> | 2022-02-01 14:59:11 -0600 |
commit | 57c9ec77ae81388bc212820417d1cc27ab9e4b3a (patch) | |
tree | 0b15341f14935acda36edd1011cf38f877e782da /TAO | |
parent | d8f8bf25f3cb9ba25a115d1d865a9ac3c7c70160 (diff) | |
download | ATCD-57c9ec77ae81388bc212820417d1cc27ab9e4b3a.tar.gz |
Merge pull request #1772 from ClaytonCalabrese/resolve_space_in_path
TAO_IDL: Fix Space In Path Handling
(cherry picked from commit e4b72cc9a0fcc5e0f4449eef2598d84df37715b2)
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/TAO_IDL/driver/drv_args.cpp | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/driver/drv_preproc.cpp | 31 |
2 files changed, 13 insertions, 30 deletions
diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp index f2ef45176fa..a2ad4de81e8 100644 --- a/TAO/TAO_IDL/driver/drv_args.cpp +++ b/TAO/TAO_IDL/driver/drv_args.cpp @@ -186,7 +186,6 @@ DRV_parse_args (long ac, char **av) ACE_CString buffer; char *s = 0; long i; - bool has_space = false; // After -- process all arguments as files bool just_files = false; @@ -285,14 +284,9 @@ DRV_parse_args (long ac, char **av) if (i < ac - 1) { idl_global->append_idl_flag (av[i + 1]); - has_space = FE_Utils::hasspace (av[i + 1]); - // If the include path has a space, we need to - // add literal "s. ACE_CString arg = av[i]; - arg += (has_space ? "\"" : ""); arg += av[i + 1]; - arg += (has_space ? "\"" : ""); DRV_cpp_putarg (arg.c_str ()); idl_global->add_include_path (arg.substr (2).c_str (), false); @@ -305,14 +299,8 @@ DRV_parse_args (long ac, char **av) } else { - has_space = FE_Utils::hasspace (av[i]); - - // If the include path has a space, we need to - // add literal "s. ACE_CString arg (av[i], 2); - arg += (has_space ? "\"" : ""); arg += av[i] + 2; - arg += (has_space? "\"" : ""); idl_global->add_include_path (arg.substr (2).c_str (), false); DRV_cpp_putarg (arg.c_str ()); diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index b7ec256a9cb..0082367f965 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -146,19 +146,8 @@ DRV_cpp_putarg (const char *str) const char *const first_quote = ACE_OS::strchr (str, '"'); bool allocate_error = false; - if (ACE_OS::strchr (str, ' ') && !first_quote) - { - ACE_NEW_NORETURN (replace, char[ACE_OS::strlen (str) + 3]); - allocate_error = !replace; - if (replace) - { - replace[0] = '"'; - ACE_OS::strcpy (replace + 1, str); - ACE_OS::strcat (replace, "\""); - } - } #ifdef ACE_WIN32 - else if (first_quote) + if (first_quote) { // Escape Doublequotes on Windows @@ -188,6 +177,17 @@ DRV_cpp_putarg (const char *str) } } #endif + if (ACE_OS::strchr (str, ' ')) + { + ACE_NEW_NORETURN (replace, char[ACE_OS::strlen (str) + 3]); + allocate_error = !replace; + if (replace) + { + replace[0] = '"'; + ACE_OS::strcpy (replace + 1, str); + ACE_OS::strcat (replace, "\""); + } + } if (allocate_error) { @@ -485,13 +485,8 @@ DRV_sweep_dirs (const char *rel_path, { if (!include_added) { - /// Surround the path name with quotes, in - /// case the original path argument included - /// spaces. If it didn't, no harm done. - ACE_CString incl_arg ("-I "); - incl_arg += '\"'; + ACE_CString incl_arg ("-I"); incl_arg += bname; - incl_arg += '\"'; DRV_cpp_putarg (incl_arg.c_str ()); idl_global->add_rel_include_path (bname.c_str ()); full_path = ACE_OS::realpath ("", abspath); |