diff options
Diffstat (limited to 'TAO/TAO_IDL/driver/drv_preproc.cpp')
-rw-r--r-- | TAO/TAO_IDL/driver/drv_preproc.cpp | 101 |
1 files changed, 50 insertions, 51 deletions
diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index 51e9804590c..1943bbdf9d3 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -90,9 +90,9 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // Storage for preprocessor args. unsigned long const DRV_MAX_ARGCOUNT = 1024; unsigned long DRV_argcount = 0; -ACE_TCHAR const * DRV_arglist[DRV_MAX_ARGCOUNT] = { 0 }; +ACE_TCHAR const * DRV_arglist[DRV_MAX_ARGCOUNT] = { nullptr }; -static char const * output_arg_format = 0; +static char const * output_arg_format = nullptr; static long output_arg_index = 0; ACE_TCHAR const TCHAR_DIR_DOT[] = ACE_TEXT("."); @@ -112,7 +112,7 @@ static char tmp_ifile[MAXPATHLEN + 1] = { 0 }; // Lines can be 1024 chars long intially - // it will expand as required. #define LINEBUF_SIZE 1024 -char* drv_line = 0; +char* drv_line = nullptr; static size_t drv_line_size = LINEBUF_SIZE + 1; // Push the new CPP location if we got a -Yp argument. @@ -140,7 +140,7 @@ DRV_cpp_putarg (const char *str) if (str && ACE_OS::strchr (str, ' ') && !ACE_OS::strchr (str, '"')) { - ACE_TCHAR *buf = 0; + ACE_TCHAR *buf = nullptr; ACE_NEW_NORETURN (buf, ACE_TCHAR[ACE_OS::strlen (str) + 3]); if (buf) { @@ -161,11 +161,11 @@ DRV_cpp_putarg (const char *str) void DRV_cpp_expand_output_arg (const char *filename) { - if (output_arg_format != 0) + if (output_arg_format != nullptr) { ACE::strdelete (const_cast<ACE_TCHAR *> ( DRV_arglist[output_arg_index])); - DRV_arglist[output_arg_index] = 0; + DRV_arglist[output_arg_index] = nullptr; ACE_NEW (DRV_arglist[output_arg_index], ACE_TCHAR [ACE_OS::strlen (output_arg_format) @@ -181,11 +181,11 @@ DRV_cpp_expand_output_arg (const char *filename) // calculate the total size of all commandline arguments unsigned int -DRV_cpp_calc_total_argsize(void) +DRV_cpp_calc_total_argsize() { unsigned long size = 0; unsigned long ix = 0; - while (DRV_arglist[ix] != 0) + while (DRV_arglist[ix] != nullptr) { size += ACE_Utils::truncate_cast<unsigned long> (ACE_OS::strlen (DRV_arglist[ix]) + 1); ++ix; @@ -233,7 +233,7 @@ DRV_get_line (FILE *file) { // Create a bigger buffer size_t temp_size = drv_line_size * 2; - char *temp = 0; + char *temp = nullptr; ACE_NEW_RETURN (temp, char [temp_size], false); ACE_OS::strcpy (temp, drv_line); delete [] drv_line; @@ -251,7 +251,7 @@ DRV_get_line (FILE *file) // Initialize the cpp argument list. void -DRV_cpp_init (void) +DRV_cpp_init () { // Create the line buffer. // (JP) Deleting this at the end or DRV_pre_proc() causes @@ -280,7 +280,7 @@ DRV_cpp_init (void) const char *platform_cpp_args = FE_get_cpp_args_from_env (); - if (platform_cpp_args == 0) + if (platform_cpp_args == nullptr) { // If no cpp flag was defined by the user, we define some // platform specific flags here. @@ -298,11 +298,11 @@ DRV_cpp_init (void) char* TAO_ROOT = ACE_OS::getenv ("TAO_ROOT"); - if (TAO_ROOT != 0) + if (TAO_ROOT != nullptr) { DRV_add_include_path (include_path1, TAO_ROOT, - 0, + nullptr, true); DRV_add_include_path (include_path2, @@ -314,7 +314,7 @@ DRV_cpp_init (void) { char* ACE_ROOT = ACE_OS::getenv ("ACE_ROOT"); - if (ACE_ROOT != 0) + if (ACE_ROOT != nullptr) { DRV_add_include_path (include_path1, ACE_ROOT, @@ -343,7 +343,7 @@ DRV_cpp_init (void) #else DRV_add_include_path (include_path1, ".", - 0, + nullptr, true); #endif /* TAO_IDL_INCLUDE_DIR */ } @@ -360,13 +360,13 @@ DRV_cpp_init (void) { // Check for an argument that specifies // the preprocessor's output file. - if (ACE_OS::strstr (platform_arglist[i], ACE_TEXT ("%s")) != 0 - && output_arg_format == 0) + if (ACE_OS::strstr (platform_arglist[i], ACE_TEXT ("%s")) != nullptr + && output_arg_format == nullptr) { output_arg_format = ACE::strnew (ACE_TEXT_ALWAYS_CHAR (platform_arglist[i])); output_arg_index = DRV_argcount; - DRV_cpp_putarg (0); + DRV_cpp_putarg (nullptr); } else { @@ -381,7 +381,7 @@ DRV_sweep_dirs (const char *rel_path, { // Zero rel_path means we're not using this option, and // so we become a no-op. - if (rel_path == 0) + if (rel_path == nullptr) { return 0; } @@ -400,9 +400,9 @@ DRV_sweep_dirs (const char *rel_path, bname += rel_path; bool include_added = false; char abspath[MAXPATHLEN] = ""; - char *full_path = 0; + char *full_path = nullptr; - for (ACE_DIRENT *dir_entry; (dir_entry = dir.read ()) != 0;) + for (ACE_DIRENT *dir_entry; (dir_entry = dir.read ()) != nullptr;) { // Skip the ".." and "." files in each directory. if (ACE::isdotdir (dir_entry->d_name) == true) @@ -448,7 +448,7 @@ DRV_sweep_dirs (const char *rel_path, idl_global->add_rel_include_path (bname.c_str ()); full_path = ACE_OS::realpath ("", abspath); - if (full_path != 0) + if (full_path != nullptr) { idl_global->add_include_path (full_path, false); @@ -492,7 +492,7 @@ DRV_add_include_path (ACE_CString& include_path, const char *suffix, bool is_system) { - if (path == 0) + if (path == nullptr) { return include_path; } @@ -530,7 +530,7 @@ DRV_add_include_path (ACE_CString& include_path, ) ) ); - if (suffix != 0) + if (suffix != nullptr) { if (!include_path.length () && ((nativeDir == *suffix) || (foreignDir == *suffix))) @@ -580,7 +580,7 @@ DRV_add_include_path (ACE_CString& include_path, // Adds additional include paths, but after parse_args() has // added user-defined include paths. void -DRV_cpp_post_init (void) +DRV_cpp_post_init () { // Add include path for TAO_ROOT/orbsvcs. char* TAO_ROOT = ACE_OS::getenv ("TAO_ROOT"); @@ -589,7 +589,7 @@ DRV_cpp_post_init (void) // When adding new dirs here don't forget to update // FE_Utils::validate_orb_include accordingly. - if (TAO_ROOT != 0) + if (TAO_ROOT != nullptr) { DRV_add_include_path (include_path3, TAO_ROOT, @@ -601,7 +601,7 @@ DRV_cpp_post_init (void) // If TAO_ROOT isn't defined, assume it's under ACE_ROOT. char* ACE_ROOT = ACE_OS::getenv ("ACE_ROOT"); - if (ACE_ROOT != 0) + if (ACE_ROOT != nullptr) { DRV_add_include_path (include_path3, ACE_ROOT, @@ -620,7 +620,7 @@ DRV_cpp_post_init (void) // be a warning from DRV_preproc(). DRV_add_include_path (include_path3, ".", - 0, + nullptr, true); #endif /* TAO_IDL_INCLUDE_DIR */ } @@ -631,11 +631,11 @@ DRV_cpp_post_init (void) // When adding new dirs here don't forget to update // FE_Utils::validate_orb_include accordingly. - if (CIAO_ROOT != 0) + if (CIAO_ROOT != nullptr) { DRV_add_include_path (include_path4, CIAO_ROOT, - 0, + nullptr, true); DRV_add_include_path (include_path5, @@ -656,7 +656,7 @@ DRV_cpp_post_init (void) // have to be restored. char cwd_path[MAXPATHLEN]; - if (ACE_OS::getcwd (cwd_path, sizeof (cwd_path)) == 0) + if (ACE_OS::getcwd (cwd_path, sizeof (cwd_path)) == nullptr) { ACE_ERROR ((LM_ERROR, "DRV_cpp_post_init: ACE_OS::getcwd failed\n")); @@ -906,15 +906,15 @@ namespace } // End of local/internal namespace void -DRV_get_orb_idl_includes (void) +DRV_get_orb_idl_includes () { static char const orb_idl[] = "tao/orb.idl"; // Search for orb.idl in supplied include file search paths. - char const * directory = 0; + char const * directory = nullptr; FILE * fp = FE_Utils::open_included_file (orb_idl, directory); - if (fp == 0) + if (fp == nullptr) { // Fall back on $TAO_ROOT/tao/orb.idl if orb.idl is not in the // include path. @@ -924,7 +924,7 @@ DRV_get_orb_idl_includes (void) fp = ACE_OS::fopen (orb_idl_path.c_str (), "r"); - if (fp == 0) + if (fp == nullptr) { ACE_ERROR ((LM_ERROR, "TAO_IDL: cannot open or find file: %C\n", @@ -959,7 +959,7 @@ DRV_copy_input (FILE *fin, const char *fn, const char *orig_filename) { - if (f == 0) + if (f == nullptr) { ACE_ERROR ((LM_ERROR, "%C: cannot open temp file \"%C\" for copying from \"%C\": %m\n", @@ -970,7 +970,7 @@ DRV_copy_input (FILE *fin, throw Bailout (); } - if (fin == 0) + if (fin == nullptr) { ACE_ERROR ((LM_ERROR, "%C: cannot open input file\n", @@ -1035,9 +1035,9 @@ DRV_stripped_name (char *fn) char *n = fn; size_t l; - if (n == 0) + if (n == nullptr) { - return 0; + return nullptr; } l = ACE_OS::strlen (n); @@ -1132,13 +1132,12 @@ DRV_pre_proc (const char *myfile) // Rename temporary files so that they have extensions accepted // by the preprocessor. - FILE * const file = ACE_OS::fopen (myfile, "r"); - if (file == 0) + if (file == nullptr) { ACE_ERROR ((LM_ERROR, - "%C: Unable to open file : %m\n", + "%C: ERROR: Unable to open file : %m\n", idl_global->prog_name (), myfile)); @@ -1153,7 +1152,7 @@ DRV_pre_proc (const char *myfile) myfile); ACE_OS::fclose (file); - UTL_String *utl_string = 0; + UTL_String *utl_string = nullptr; #if defined (ACE_OPENVMS) { @@ -1187,13 +1186,13 @@ DRV_pre_proc (const char *myfile) ACE_Auto_String_Free safety (ACE_OS::strdup (myfile)); - UTL_String *stripped_tmp = 0; + UTL_String *stripped_tmp = nullptr; ACE_NEW (stripped_tmp, UTL_String (DRV_stripped_name (safety.get ()), true)); idl_global->set_stripped_filename (stripped_tmp); - UTL_String *real_tmp = 0; + UTL_String *real_tmp = nullptr; ACE_NEW (real_tmp, UTL_String (t_ifile, true)); @@ -1205,14 +1204,14 @@ DRV_pre_proc (const char *myfile) DRV_cpp_expand_output_arg (t_file); DRV_cpp_putarg (t_ifile); - DRV_cpp_putarg (0); // Null terminate the DRV_arglist. + DRV_cpp_putarg (nullptr); // Null terminate the DRV_arglist. // For complex builds, the default // command line buffer size of 1024 // is often not enough. We determine // the required space and arg nr // dynamically here. - ACE_Process_Options cpp_options (1, // Inherit environment. + ACE_Process_Options cpp_options (true, // Inherit environment. DRV_cpp_calc_total_argsize (), 16 * 1024, 512, @@ -1267,7 +1266,7 @@ DRV_pre_proc (const char *myfile) ACE_HANDLE fd = ACE_INVALID_HANDLE; - if (output_arg_format == 0) + if (output_arg_format == nullptr) { // If the following open() fails, then we're either being hit with a // symbolic link attack, or another process opened the file before @@ -1348,7 +1347,7 @@ DRV_pre_proc (const char *myfile) DRV_argcount -= 2; ACE::strdelete ( const_cast<ACE_TCHAR *> (DRV_arglist[DRV_argcount])); - DRV_arglist[DRV_argcount] = 0; + DRV_arglist[DRV_argcount] = nullptr; ACE_exitcode status = 0; if (process.wait (&status) == ACE_INVALID_PID) @@ -1407,7 +1406,7 @@ DRV_pre_proc (const char *myfile) FILE * const yyin = ACE_OS::fopen (t_file, "r"); - if (yyin == 0) + if (yyin == nullptr) { ACE_ERROR ((LM_ERROR, "%C: Could not open cpp " @@ -1428,7 +1427,7 @@ DRV_pre_proc (const char *myfile) char buffer[ACE_MAXLOGMSGLEN]; size_t bytes; - if (preproc == 0) + if (preproc == nullptr) { ACE_ERROR ((LM_ERROR, "%C: Could not open cpp " |