diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2007-07-12 23:43:35 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2007-07-12 23:43:35 +0000 |
commit | c6173c09556825bf63824a20a3059399616e36dd (patch) | |
tree | 20b16c02d4304b771a6b1e54e0cac9b16598a627 | |
parent | f7825eb50319e21d76b38ccb1fca826f42d86161 (diff) | |
download | ATCD-c6173c09556825bf63824a20a3059399616e36dd.tar.gz |
ChangeLogTag:Thu Jul 12 23:42:00 UTC 2007 Ossama Othman <ossama_othman at symantec dot com>
24 files changed, 359 insertions, 331 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 40c30615d19..204bd5dfdcc 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,100 @@ +Thu Jul 12 23:42:00 UTC 2007 Ossama Othman <ossama_othman at symantec dot com> + + * TAO_IDL/tao_idl.cpp: + + Paired deallocation of ACE::strnew()-created string array with + ACE::strdelete() instead operator delete[](). + + * TAO_IDL/driver/drv_preproc.cpp: + + Paired deallocation of ACE::strnew()-created string array with + ACE::strdelete() instead operator delete[](). + + Statically initialize argument array elements to zero. + + Corrected problem where memory corresponding to tao_idl command + line "-Yp" argument owned by the shell was being deallocated. + + Changed DRV_cpp_new_location() parameter from "char*" to "char + const*" to better enforce proper argument list memory + management. + + Search for orb.idl in supplied include path, and only fallback + on $TAO_ROOT/tao if the include path search fails. Addresses + regression where orb.idl could not be found if $TAO_ROOT was not + set even if it existed in the include path, as well allowing the + user to override $TAO_ROOT/tao, if necessary. + + Const correctness imrovements. + + * TAO_IDL/include/drv_extern.h: + + Match function protototype signature with implementation + signature. Necessitated by const correctness improvements + above. + + * TAO_IDL/include/idl_global.h (open_included_file): + * TAO_IDL/util/utl_global.cpp (open_included_file): + + New utility function that searches for the given file in the + include path supplied to the TAO_IDL compiler, and opens it. + + * TAO_IDL/include/idl_narrow.h: + + Replaced legacy type narrowing code with standard C++ + dynamic_cast<> calls. This is now possible since ACE/TAO + require RTTI to be enabled. + + * tao/Exception.h: + * tao/SystemException.h: + + Moved #undef of THREAD_CANCELLED to tao/SystemException.h. + + (SystemException): + + For g++ >= 4, exceptions found in DLL A but potentially thrown + in DLL B must always be exported. + + * tao/ORB_Core.h (open_called_): + + Removed unused TAO_ORB_Core member. + + * tao/Unbounded_Octet_Sequence_T.h (operator==): + + Use the subscript operator instead of get_buffer() to avoid a + potential buffer allocation. + + * tao/AnyTypeCode/Any_Array_Impl_T.cpp (extract): + * tao/Valuetype/AbstractBase_T.cpp (unchecked_narrow): + + Check for null pointer before dereferencing dynamic_cast<> + result. Addresses FORWARD_NULL Coverity error. + + * tao/BiDir_GIOP/BiDir_ORBInitializer.cpp: + + Addressed Coverity UNUSED_VALUE error. + + * tests/Bug_1495_Regression/Client_Task.cpp: + * tests/Bug_1495_Regression/Client_Task.h: + * tests/Bug_1495_Regression/test.idl: + * tests/Bug_1495_Regression/test_i.cpp: + * tests/Bug_1495_Regression/test_i.h: + * tests/Bug_2084_Regression/EventNode.cpp: + * tests/Bug_2084_Regression/EventNode.h: + * tests/Bug_2084_Regression/Hello.cpp: + * tests/Bug_2084_Regression/Hello.h: + * tests/Bug_2084_Regression/Test.idl: + + Support platforms with 64 bit thread IDs. + + * utils/catior/catior.cpp: + + Fixed memory leak. + + Added CDR demarshaling operation check. + + Converted boolean 1's and 0's to true and false, respectively. + Thu Jul 12 23:33:43 UTC 2007 Abdullah Sowayan <abdullah.sowayan@lmco.com> * tests/objref_comparison_test/foo.idl: diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index 73eee7257ec..53d124f79ce 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -93,15 +93,15 @@ ACE_RCSID (driver, "$Id$") // Storage for preprocessor args. -const unsigned long DRV_MAX_ARGCOUNT = 128; +unsigned long const DRV_MAX_ARGCOUNT = 128; unsigned long DRV_argcount = 0; -const char *DRV_arglist[DRV_MAX_ARGCOUNT]; +char const * DRV_arglist[DRV_MAX_ARGCOUNT] = { 0 }; -static const char *output_arg_format = 0; +static char const * output_arg_format = 0; static long output_arg_index = 0; -const char *DIR_DOT = "."; -const char *DIR_DOT_DOT = ".."; +char const DIR_DOT[] = "."; +char const DIR_DOT_DOT[] = ".."; // File names. static char tmp_file [MAXPATHLEN + 1] = { 0 }; @@ -114,9 +114,10 @@ static size_t drv_line_size = LINEBUF_SIZE + 1; // Push the new CPP location if we got a -Yp argument. void -DRV_cpp_new_location (char *new_loc) +DRV_cpp_new_location (char const * new_loc) { - DRV_arglist[0] = new_loc; + ACE::strdelete (const_cast<char *> (DRV_arglist[0])); + DRV_arglist[0] = ACE::strnew (new_loc); } // Push an argument into the DRV_arglist. @@ -145,7 +146,7 @@ DRV_cpp_expand_output_arg (const char *filename) { if (output_arg_format != 0) { - delete [] const_cast<char *> (DRV_arglist[output_arg_index]); + ACE::strdelete (const_cast<char *> (DRV_arglist[output_arg_index])); DRV_arglist[output_arg_index] = 0; char *output_arg = 0; @@ -232,7 +233,7 @@ DRV_cpp_init (void) ACE_NEW (drv_line, char [drv_line_size]); - const char *cpp_loc = FE_get_cpp_loc_from_env (); + char const * const cpp_loc = FE_get_cpp_loc_from_env (); DRV_cpp_putarg (cpp_loc); // Add an option to the IDL compiler to make the TAO version @@ -322,13 +323,8 @@ DRV_cpp_init (void) ACE_OS::strcat (option1, TAO_IDL_INCLUDE_DIR); ACE_OS::strcat (option2, "."); #else - ACE_ERROR ((LM_WARNING, - "NOTE: The environment variables " - "TAO_ROOT and ACE_ROOT are not defined.\n" - " TAO_IDL may not be able to " - "locate orb.idl\n")); - ACE_OS::strcat (option1, "."); + ACE_OS::strcat (option2, "."); #endif /* TAO_IDL_INCLUDE_DIR */ } } @@ -422,12 +418,12 @@ DRV_sweep_dirs (const char *rel_path, incl_arg += bname; DRV_cpp_putarg (incl_arg.c_str ()); full_path = ACE_OS::realpath ("", abspath); - + if (full_path != 0) { idl_global->add_include_path (full_path); } - + include_added = true; } @@ -678,14 +674,15 @@ DRV_check_for_include (const char* buf) } // Check whether this word is `include` or no. - const char* include_str = "include"; + static const char include_str[] = "include"; for (size_t ii = 0; - ii < ACE_OS::strlen ("include") && *r != '\0' && *r != ' ' && *r != '\t'; + ii < (sizeof (include_str) / sizeof (include_str[0]) - 1) + && *r != '\0' && *r != ' ' && *r != '\t'; ++r, ++ii) { // Return if it doesn't match. - if (include_str [ii] != *r) + if (include_str[ii] != *r) { return; } @@ -760,11 +757,11 @@ DRV_check_for_include (const char* buf) // Terminate this string. incl_file [i] = '\0'; - size_t len = ACE_OS::strlen (incl_file); - ACE_CString name_str (incl_file); - ACE_CString simple ("orb.idl"); - ACE_CString nix_path ("tao/orb.idl"); - ACE_CString win_path ("tao\\orb.idl"); + size_t const len = ACE_OS::strlen (incl_file); + ACE_CString const name_str (incl_file); + ACE_CString const simple ("orb.idl"); + ACE_CString const nix_path ("tao/orb.idl"); + ACE_CString const win_path ("tao\\orb.idl"); // Some backends pass this file through, others don't. if (name_str == simple || name_str == nix_path || name_str == win_path) @@ -778,6 +775,7 @@ DRV_check_for_include (const char* buf) DRV_get_orb_idl_includes (); } } + // We have special lookup for orb.idl (TAO_ROOT/tao) that // also kicks in for .pidl files. If one of the latter is // included as a local name only, we add the 'tao/' prefix @@ -788,6 +786,7 @@ DRV_check_for_include (const char* buf) { ACE_CString fixed_name ("tao/"); fixed_name += incl_file; + idl_global->add_to_included_idl_files (fixed_name.rep ()); } else @@ -833,14 +832,15 @@ DRV_convert_includes (const char* buf) } // Check whether this word is `include` or no. - const char* include_str = "include"; + static const char include_str[] = "include"; for (size_t ii = 0; - ii < ACE_OS::strlen ("include") && *r != '\0' && *r != ' ' && *r != '\t'; + ii < (sizeof (include_str) / sizeof (include_str[0]) - 1) + && *r != '\0' && *r != ' ' && *r != '\t'; ++r, ++ii) { // Return if it doesn't match. - if (include_str [ii] != *r) + if (include_str[ii] != *r) { return; } @@ -886,30 +886,58 @@ DRV_convert_includes (const char* buf) void DRV_get_orb_idl_includes (void) { - ACE_CString orb_idl_path (idl_global->tao_root ()); - orb_idl_path += "/tao/orb.idl"; - FILE *fd = ACE_OS::fopen (orb_idl_path.fast_rep (), "r"); + static char const orb_idl[] = "tao/orb.idl"; + + // Search for orb.idl in supplied include file search paths. + char const * directory = 0; + FILE * fp = idl_global->open_included_file (orb_idl, directory); - if (fd == 0) + if (fp == 0) { - ACE_ERROR ((LM_ERROR, - "%s%s", - orb_idl_path.fast_rep (), - ": cannot open input file\n")); + // Fall back on $TAO_ROOT/tao/orb.idl if orb.idl is not in the + // include path. + ACE_CString orb_idl_path (ACE_CString (idl_global->tao_root ()) + + ACE_CString ('/') + + ACE_CString (orb_idl)); + fp = ACE_OS::fopen (orb_idl_path.c_str (), "r"); - idl_global->set_err_count (idl_global->err_count () + 1); - throw FE_Bailout (); + if (fp == 0) + { + ACE_ERROR ((LM_ERROR, + "TAO_IDL: cannot open or find file: %s\n", + orb_idl_path.c_str ())); + + idl_global->set_err_count (idl_global->err_count () + 1); + throw FE_Bailout (); + } + } + else + { + // Make sure the include directory containing orb.idl is passed + // to the preprocessor. + char include_path_arg[2 + MAXPATHLEN + 1] = { 0 }; + include_path_arg[0] = '-'; + include_path_arg[1] = 'I'; + ACE_OS::strcat (include_path_arg, directory); +#if defined (ACE_WIN32) + ACE_OS::strcat (include_path_arg, "\\tao"); +#else + ACE_OS::strcat (include_path_arg, "/tao"); +#endif + + // This should go after user supplied include paths. + DRV_cpp_putarg (include_path_arg); } - while (DRV_get_line (fd)) + while (DRV_get_line (fp)) { - // Find the included .pidl files and add them to - // the included IDL file list. + // Find the included .pidl files in orb.idl and add them to the + // included IDL file list. DRV_check_for_include (drv_line); } - ACE_OS::fclose (fd); + ACE_OS::fclose (fp); } // Copy to a file. @@ -1097,7 +1125,7 @@ DRV_pre_proc (const char *myfile) { char main_abspath[MAXPATHLEN] = ""; char trans_path[MAXPATHLEN] = ""; - char *main_fullpath = + char *main_fullpath = ACE_OS::realpath (IDL_GlobalData::translateName (myfile, trans_path), main_abspath); idl_global->set_main_filename ( @@ -1209,7 +1237,7 @@ DRV_pre_proc (const char *myfile) // Remove the null termination and the input file from the DRV_arglist, // the next file will the previous args. - delete [] const_cast<char *> (DRV_arglist[DRV_argcount - 2]); + ACE::strdelete (const_cast<char *> (DRV_arglist[DRV_argcount - 2])); DRV_argcount -= 2; ACE_exitcode status = 0; diff --git a/TAO/TAO_IDL/include/drv_extern.h b/TAO/TAO_IDL/include/drv_extern.h index 6a4ec26b63b..5b92efa1e94 100644 --- a/TAO/TAO_IDL/include/drv_extern.h +++ b/TAO/TAO_IDL/include/drv_extern.h @@ -73,15 +73,15 @@ const unsigned long TAO_IDL_COMMAND_LINE_BUFFER_SIZE = 4 * 1024; // External functions for the IDL compiler driver program. extern void DRV_parse_args (long, char **); extern void DRV_usage (void); -extern void DRV_pre_proc (const char *myfile); +extern void DRV_pre_proc (char const * myfile); extern void DRV_store_env_include_paths (void); extern void DRV_cpp_init (void); extern void DRV_cpp_post_init (void); -extern void DRV_cpp_putarg (const char *str); -extern void DRV_cpp_new_location (char *new_loc); +extern void DRV_cpp_putarg (char const * str); +extern void DRV_cpp_new_location (char const * new_loc); extern void DRV_get_orb_idl_includes (void); // Not used by all backends. -extern void DRV_push_file (const char *s); +extern void DRV_push_file (char const * s); #endif // _DRV_EXTERN_DRV_EXTERN_HH diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h index 82cc756ff62..08080cb7a82 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -558,6 +558,12 @@ public: void add_include_path (const char *s); // Add another path to 'include_paths_'. + FILE * open_included_file (char const * filename, + char const *& directory); + // Attempt to open file for reading until it is found in one of the + // supplied include paths. If the file was successfully opened, the + // directory within which it was found is returned as well. + ACE_Hash_Map_Manager<char *, char *, ACE_Null_Mutex> & file_prefixes (void); // Accessor for the IDL file prefix container. diff --git a/TAO/TAO_IDL/include/idl_narrow.h b/TAO/TAO_IDL/include/idl_narrow.h index 30f462892be..a2965c08778 100644 --- a/TAO/TAO_IDL/include/idl_narrow.h +++ b/TAO/TAO_IDL/include/idl_narrow.h @@ -95,176 +95,42 @@ trademarks or registered trademarks of Sun Microsystems, Inc. // IMPL_NARROW_METHODSn where n is 0,1,2 and 3 are provided. // DEF_NARROW_METHODSn where n is 0,1,2 and 3 are provided. -extern char *type_id_to_string(long); +extern char * type_id_to_string (long); -#define DEF_NARROW_METHODS0(TYPE)\ -static int type_id(); \ -virtual void *narrow(size_t type_const) +#define DEF_NARROW_METHODS0(TYPE) +#define IMPL_NARROW_METHODS0(TYPE) +#define DEF_NARROW_METHODS1(TYPE,PARENT) +#define IMPL_NARROW_METHODS1(TYPE,PARENT) -#define IMPL_NARROW_METHODS0(TYPE)\ -int \ -TYPE::type_id()\ -{\ - return 0;\ -}\ -void * \ -TYPE::narrow(size_t type_const) {\ - void *rval = 0; \ - size_t temp = (size_t) &TYPE::type_id; \ - if (type_const == temp) \ - rval = this; \ - return rval; \ -} - -#define DEF_NARROW_METHODS1(TYPE,PARENT) \ -static int type_id(); \ -virtual void *narrow(size_t type_const) - - -#define IMPL_NARROW_METHODS1(TYPE,PARENT) \ -int \ -TYPE::type_id() \ -{\ - return 0;\ -}\ -void * \ -TYPE::narrow(size_t type_const) {\ - void *rval = 0; \ - size_t temp = (size_t) &TYPE::type_id; \ - if (type_const == temp) \ - rval = this; \ - if (rval == 0) \ - rval = PARENT::narrow(type_const);\ - return rval;\ -} - -#define DEF_NARROW_METHODS2(TYPE,PARENT1,PARENT2) \ -static int type_id(); \ -virtual void *narrow(size_t type_const) - - -#define IMPL_NARROW_METHODS2(TYPE,PARENT1,PARENT2) \ -int \ -TYPE::type_id() \ -{\ - return 0;\ -}\ -void * \ -TYPE::narrow(size_t type_const) { \ - void *rval = 0; \ - size_t temp = (size_t) &TYPE::type_id; \ - if (type_const == temp) \ - rval = this; \ - if (rval == 0) \ - rval = PARENT1::narrow(type_const);\ - if (rval == 0) \ - rval = PARENT2::narrow(type_const);\ - return rval;\ -} - -#define DEF_NARROW_METHODS3(TYPE,PARENT1,PARENT2,PARENT3) \ -static int type_id(); \ -virtual void *narrow(size_t type_const) +#define DEF_NARROW_METHODS2(TYPE,PARENT1,PARENT2) +#define IMPL_NARROW_METHODS2(TYPE,PARENT1,PARENT2) +#define DEF_NARROW_METHODS3(TYPE,PARENT1,PARENT2,PARENT3) +#define IMPL_NARROW_METHODS3(TYPE,PARENT1,PARENT2,PARENT3) -#define IMPL_NARROW_METHODS3(TYPE,PARENT1,PARENT2,PARENT3) \ -int \ -TYPE::type_id() \ -{\ - return 0;\ -}\ -void * \ -TYPE::narrow(size_t type_const) {\ - void *rval = 0; \ - size_t temp = (size_t) &TYPE::type_id; \ - if (type_const == temp) \ - rval = this; \ - if (rval == 0) \ - rval = PARENT1::narrow(type_const);\ - if (rval == 0) \ - rval = PARENT2::narrow(type_const);\ - if (rval == 0) \ - rval = PARENT3::narrow(type_const);\ - return rval;\ -} - -#define DEF_NARROW_METHODS4(TYPE,PARENT1,PARENT2,PARENT3,PARENT4) \ -static int type_id(); \ -virtual void *narrow(size_t type_const) - - -#define IMPL_NARROW_METHODS4(TYPE,PARENT1,PARENT2,PARENT3,PARENT4) \ -int \ -TYPE::type_id() \ -{\ - return 0;\ -}\ -void * \ -TYPE::narrow(size_t type_const) {\ - void *rval = 0; \ - size_t temp = (size_t) &TYPE::type_id; \ - if (type_const == temp) \ - rval = this; \ - if (rval == 0) \ - rval = PARENT1::narrow(type_const);\ - if (rval == 0) \ - rval = PARENT2::narrow(type_const);\ - if (rval == 0) \ - rval = PARENT3::narrow(type_const);\ - if (rval == 0) \ - rval = PARENT4::narrow(type_const);\ - return rval;\ -} +#define DEF_NARROW_METHODS4(TYPE,PARENT1,PARENT2,PARENT3,PARENT4) +#define IMPL_NARROW_METHODS4(TYPE,PARENT1,PARENT2,PARENT3,PARENT4) -#define DEF_NARROW_METHODS5(TYPE,PARENT1,PARENT2,PARENT3,PARENT4,PARENT5) \ -static int type_id(); \ -virtual void *narrow(size_t type_const) +#define DEF_NARROW_METHODS5(TYPE,PARENT1,PARENT2,PARENT3,PARENT4,PARENT5) +#define IMPL_NARROW_METHODS5(TYPE,PARENT1,PARENT2,PARENT3,PARENT4,PARENT5) +#define DEF_NARROW_FROM_DECL(TYPE) \ +static TYPE* narrow_from_decl(AST_Decl *t) -#define IMPL_NARROW_METHODS5(TYPE,PARENT1,PARENT2,PARENT3,PARENT4,PARENT5) \ -int \ -TYPE::type_id() \ -{\ - return 0;\ -}\ -void * \ -TYPE::narrow(size_t type_const) {\ - void *rval = 0; \ - size_t temp = (size_t) &TYPE::type_id; \ - if (type_const == temp) \ - rval = this; \ - if (rval == 0) \ - rval = PARENT1::narrow(type_const);\ - if (rval == 0) \ - rval = PARENT2::narrow(type_const);\ - if (rval == 0) \ - rval = PARENT3::narrow(type_const);\ - if (rval == 0) \ - rval = PARENT4::narrow(type_const);\ - if (rval == 0) \ - rval = PARENT5::narrow(type_const);\ - return rval;\ +#define IMPL_NARROW_FROM_DECL(TYPE) \ +TYPE * \ +TYPE::narrow_from_decl (AST_Decl *t) { \ + return dynamic_cast<TYPE *> (t); \ } -#define DEF_NARROW_FROM_DECL(TYPE)\ -static TYPE *narrow_from_decl(AST_Decl *t) - - -#define IMPL_NARROW_FROM_DECL(TYPE)\ -TYPE * \ -TYPE::narrow_from_decl(AST_Decl *t) { \ - return (TYPE *)t->narrow((size_t)&TYPE::type_id);\ -} - -#define DEF_NARROW_FROM_SCOPE(TYPE)\ -static TYPE *narrow_from_scope(UTL_Scope *t) - +#define DEF_NARROW_FROM_SCOPE(TYPE) \ +static TYPE * narrow_from_scope(UTL_Scope *t) -#define IMPL_NARROW_FROM_SCOPE(TYPE)\ -TYPE * \ -TYPE::narrow_from_scope(UTL_Scope *t) { \ - return (TYPE *)t->narrow((size_t)&TYPE::type_id);\ +#define IMPL_NARROW_FROM_SCOPE(TYPE) \ +TYPE * \ +TYPE::narrow_from_scope (UTL_Scope *t) { \ + return dynamic_cast<TYPE *> (t); \ } #endif // _IDL_NARROW_IDL_NARROW_HH diff --git a/TAO/TAO_IDL/tao_idl.cpp b/TAO/TAO_IDL/tao_idl.cpp index 015afdf6b6e..052cb98d41c 100644 --- a/TAO/TAO_IDL/tao_idl.cpp +++ b/TAO/TAO_IDL/tao_idl.cpp @@ -166,7 +166,7 @@ DRV_cleanup (void) for (unsigned long i = 0; i < DRV_argcount; ++i) { - delete [] (const_cast<char *> (DRV_arglist[i])); + ACE::strdelete (const_cast<char *> (DRV_arglist[i])); } } diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index 6c2b30ee0e1..8b2abed615f 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -750,17 +750,9 @@ IDL_GlobalData::validate_included_idl_files (void) post_tmp = post_preproc_includes[ni]->get_string (); full_path = ACE_OS::realpath (post_tmp, post_abspath); if (full_path != 0 - && this->path_cmp (pre_abspath, post_abspath) == 0) + && this->path_cmp (pre_abspath, post_abspath) == 0 + && ACE_OS::access (post_abspath, R_OK) == 0) { - FILE *test = ACE_OS::fopen (post_abspath, "r"); - - if (test == 0) - { - continue; - } - - ACE_OS::fclose (test); - // This file name is valid. valid_file = 1; ++n_found; @@ -801,17 +793,9 @@ IDL_GlobalData::validate_included_idl_files (void) full_path = ACE_OS::realpath (post_tmp, post_abspath); if (full_path != 0 - && this->path_cmp (pre_abspath, post_abspath) == 0) + && this->path_cmp (pre_abspath, post_abspath) == 0 + && ACE_OS::access (post_abspath, R_OK) == 0) { - FILE *test = ACE_OS::fopen (post_abspath, "r"); - - if (test == 0) - { - continue; - } - - ACE_OS::fclose (test); - // This file name is valid. valid_file = 1; ++n_found; @@ -1823,3 +1807,33 @@ IDL_GlobalData::is_dcps_type (UTL_ScopedName* target) // No joy. return 0; } + +FILE * +IDL_GlobalData::open_included_file (char const * filename, + char const *& directory) +{ + FILE * f = 0; + ACE_CString const the_file (ACE_CString ('/') + + ACE_CString (filename)); + + for (ACE_Unbounded_Queue_Iterator<char *> i (this->include_paths_); + !i.done () && f == 0; + i.advance ()) + { + char ** path = 0; + (void) i.next (path); + + if (path != 0) + { + ACE_CString const complete_filename (ACE_CString (*path) + + the_file); + + f = ACE_OS::fopen (complete_filename.c_str (), "r"); + + if (f != 0) + directory = *path; + } + } + + return f; +} diff --git a/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp index d4974745cca..1e5a798c3c5 100644 --- a/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp +++ b/TAO/tao/AnyTypeCode/Any_Array_Impl_T.cpp @@ -100,7 +100,11 @@ TAO::Any_Array_Impl_T<T_slice, T_forany>::extract (const CORBA::Any & any, ); // We know this will work since the unencoded case is covered above. - TAO::Unknown_IDL_Type *unk = dynamic_cast<TAO::Unknown_IDL_Type *> (impl); + TAO::Unknown_IDL_Type * const unk = + dynamic_cast<TAO::Unknown_IDL_Type *> (impl); + + if (!unk) + return false; // We don't want the rd_ptr of unk to move, in case it is // shared by another Any. This copies the state, not the buffer. diff --git a/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp b/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp index 948f11e0793..572d93bfd6c 100644 --- a/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp +++ b/TAO/tao/BiDir_GIOP/BiDir_ORBInitializer.cpp @@ -33,7 +33,7 @@ TAO_BiDir_ORBInitializer::register_policy_factories ( { /// Register the BiDir policy factories. PortableInterceptor::PolicyFactory_ptr temp_factory = - PortableInterceptor::PolicyFactory::_nil (); + PortableInterceptor::PolicyFactory_ptr (); /// This policy factory is used for all BiDir related policies. ACE_NEW_THROW_EX (temp_factory, TAO_BiDir_PolicyFactory, diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h index c2783085c39..c540d1b0be5 100644 --- a/TAO/tao/Exception.h +++ b/TAO/tao/Exception.h @@ -32,6 +32,7 @@ #include "ace/iosfwd.h" #include "ace/CORBA_macros.h" + ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Allocator; ACE_END_VERSIONED_NAMESPACE_DECL @@ -41,10 +42,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_OutputCDR; class TAO_InputCDR; -#if defined (THREAD_CANCELLED) -#undef THREAD_CANCELLED -#endif /* THREAD_CANCELLED */ - // This is already done in orbconf.h. But this file is totally // decoupled from its contents that we have to do this here. Including // orbconf.h is probably going to be a overhead. @@ -210,7 +207,7 @@ namespace CORBA // Required by C++ mapping. TAO_Export ACE_OSTREAM_TYPE& operator<< (ACE_OSTREAM_TYPE &os, - const CORBA::Exception &e); + const CORBA::Exception &e); TAO_Export ACE_OSTREAM_TYPE& operator<< (ACE_OSTREAM_TYPE &os, const CORBA::Exception *e); diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 94ac1827a9c..8fa8b6eb809 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -885,7 +885,7 @@ protected: /// Initialize the guts of the ORB Core. It is intended that this be /// called by <CORBA::ORB_init>. - int init (int &argc, char **argv); + int init (int &argc, char *argv[]); /// Final termination hook, typically called by CORBA::ORB's /// destructor. @@ -1149,9 +1149,6 @@ protected: /// Mutual exclusion for calling open. TAO_SYNCH_MUTEX open_lock_; - /// Flag which denotes that the open method was called. - int open_called_; - TAO_Endpoint_Selector_Factory *endpoint_selector_factory_; #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1) diff --git a/TAO/tao/SystemException.h b/TAO/tao/SystemException.h index 956843a6628..743725e2c4f 100644 --- a/TAO/tao/SystemException.h +++ b/TAO/tao/SystemException.h @@ -28,15 +28,25 @@ #include "tao/Exception.h" +#ifndef TAO_Exception_Export +# if (__GNUC__ > 3) +// Exceptions found in DLL A but potentially thrown in DLL B must +// always be exported. +# define TAO_Exception_Export ACE_Proper_Export_Flag +# else +# define TAO_Exception_Export TAO_Export +# endif /* __GNUC__ > 3*/ +#endif /* !TAO_Exception_Export */ + +#ifdef THREAD_CANCELLED +# undef THREAD_CANCELLED +#endif /* THREAD_CANCELLED */ + TAO_BEGIN_VERSIONED_NAMESPACE_DECL class TAO_OutputCDR; class TAO_InputCDR; -#if defined (THREAD_CANCELLED) -#undef THREAD_CANCELLED -#endif /* THREAD_CANCELLED */ - // This is already done in orbconf.h. But this file is totally // decoupled from its contents that we have to do this here. Including // orbconf.h is probably going to be a overhead. @@ -177,7 +187,7 @@ namespace CORBA // inside the ORB. All minor codes should be symbolically catalogued. #define TAO_SYSTEM_EXCEPTION(name) \ - class TAO_Export name : public SystemException \ + class TAO_Exception_Export name : public SystemException \ { \ public: \ name (void); \ diff --git a/TAO/tao/Valuetype/AbstractBase_T.cpp b/TAO/tao/Valuetype/AbstractBase_T.cpp index 5c31e1827aa..42acdb56e79 100644 --- a/TAO/tao/Valuetype/AbstractBase_T.cpp +++ b/TAO/tao/Valuetype/AbstractBase_T.cpp @@ -101,7 +101,8 @@ namespace TAO else { proxy = dynamic_cast<T *> (obj); - proxy->_add_ref (); + if (proxy) + proxy->_add_ref (); } return proxy; diff --git a/TAO/tests/Bug_1495_Regression/Client_Task.cpp b/TAO/tests/Bug_1495_Regression/Client_Task.cpp index 88403f8c7bb..c713e2be3c5 100644 --- a/TAO/tests/Bug_1495_Regression/Client_Task.cpp +++ b/TAO/tests/Bug_1495_Regression/Client_Task.cpp @@ -15,9 +15,9 @@ Client_Task::Client_Task (const char *input, CORBA::ORB_ptr corb, ACE_Thread_Manager *thr_mgr) - : ACE_Task_Base (thr_mgr), - input_ (input), - corb_ (CORBA::ORB::_duplicate (corb)) + : ACE_Task_Base (thr_mgr), + input_ (input), + corb_ (CORBA::ORB::_duplicate (corb)) {} @@ -27,7 +27,7 @@ Client_Task::svc (void) try { CORBA::Object_var object = - corb_->string_to_object (input_); + this->corb_->string_to_object (this->input_); Bug1495_Regression::Bug1495_var server = Bug1495_Regression::Bug1495::_narrow (object.in ()); @@ -42,24 +42,31 @@ Client_Task::svc (void) } // Try multiple calls to see if we keep being forwarded - for (int i = 0; i < 5; i++) + for (int i = 0; i < 5; ++i) { // call the thread_id function on the test object - CORBA::Long remote_thread_id; + Bug1495_Regression::ThreadId remote_thread_id; server->get_thread_id (remote_thread_id); ACE_DEBUG ((LM_INFO, - "Remote thread ID was %i\n", + "Remote thread ID was" + ACE_INT64_FORMAT_SPECIFIER + "\n", remote_thread_id)); - CORBA::Long mythread_id = - static_cast<CORBA::Long> ((size_t)ACE_Thread::self ()); + Bug1495_Regression::ThreadId const mythread_id = + (Bug1495_Regression::ThreadId) ACE_Thread::self (); + if (mythread_id != remote_thread_id) { ACE_ERROR ((LM_ERROR, "ERROR: Failed Bug_1495_Regression test. " - "Expected thread id was %i, received %i.\n", + "Expected thread id was" + ACE_INT64_FORMAT_SPECIFIER + ", received" + ACE_INT64_FORMAT_SPECIFIER + ".\n", mythread_id, remote_thread_id)); } @@ -67,7 +74,11 @@ Client_Task::svc (void) { ACE_DEBUG ((LM_INFO, "Passed Bug_1495_Regression test.\n" - "Local thread id was %i, received %i.\n", + "Local thread id was " + ACE_INT64_FORMAT_SPECIFIER + ", received " + ACE_INT64_FORMAT_SPECIFIER + ".\n", mythread_id, remote_thread_id)); } diff --git a/TAO/tests/Bug_1495_Regression/Client_Task.h b/TAO/tests/Bug_1495_Regression/Client_Task.h index c00a38f7b06..2e3fe575fb7 100644 --- a/TAO/tests/Bug_1495_Regression/Client_Task.h +++ b/TAO/tests/Bug_1495_Regression/Client_Task.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + /** * @file Client_Task.h * @author Will Otte <wotte@dre.vanderbilt.edu>' @@ -22,23 +24,21 @@ class Client_Task : public ACE_Task_Base { - public: - /// Constructor - Client_Task (const char *input, - CORBA::ORB_ptr corb, - ACE_Thread_Manager *thr_mgr); - - /// Thread entry point. - int svc (void); - + public: + /// Constructor + Client_Task (const char *input, + CORBA::ORB_ptr corb, + ACE_Thread_Manager *thr_mgr); - private: - /// File to read in the remote IOR. - const char *input_; + /// Thread entry point. + int svc (void); - /// Client ORB. - CORBA::ORB_var corb_; +private: + /// File to read in the remote IOR. + const char *input_; + /// Client ORB. + CORBA::ORB_var corb_; }; diff --git a/TAO/tests/Bug_1495_Regression/test.idl b/TAO/tests/Bug_1495_Regression/test.idl index 60a9b2e526b..1f070aa6633 100644 --- a/TAO/tests/Bug_1495_Regression/test.idl +++ b/TAO/tests/Bug_1495_Regression/test.idl @@ -18,13 +18,16 @@ module Bug1495_Regression { - /// A test idl to check Bug 1495 - interface Bug1495 - { - /// get the thread id of the thread that services this request. - void get_thread_id (out long thread_id); + // Use "long long" to support platforms with 64-bit thread IDs. + typedef long long ThreadId; - /// Shutdown the ORB. - oneway void shutdown (); - }; + /// A test idl to check Bug 1495 + interface Bug1495 + { + /// get the thread id of the thread that services this request. + void get_thread_id (out ThreadId thread_id); + + /// Shutdown the ORB. + oneway void shutdown (); + }; }; diff --git a/TAO/tests/Bug_1495_Regression/test_i.cpp b/TAO/tests/Bug_1495_Regression/test_i.cpp index 60227c6d081..c1f976a80e6 100644 --- a/TAO/tests/Bug_1495_Regression/test_i.cpp +++ b/TAO/tests/Bug_1495_Regression/test_i.cpp @@ -10,39 +10,30 @@ #include "test_i.h" #include "ace/Thread.h" - -Bug1495_i::Bug1495_i () -{} - -// Implementation skeleton constructor Bug1495_i::Bug1495_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) + : orb_ (CORBA::ORB::_duplicate (orb)) { } -// Implementation skeleton destructor Bug1495_i::~Bug1495_i (void) { } void -Bug1495_i::get_thread_id ( - CORBA::Long_out thread_id - ) +Bug1495_i::get_thread_id (Bug1495_Regression::ThreadId_out thread_id) { - thread_id = static_cast<CORBA::Long> ((size_t)ACE_Thread::self ()); + thread_id = (Bug1495_Regression::ThreadId_type) ACE_Thread::self (); } void -Bug1495_i::shutdown ( - ) +Bug1495_i::shutdown (void) { - ACE_DEBUG ((LM_INFO, - "Shutting down orb %i\n", - ACE_Thread::self())); + ACE_DEBUG ((LM_INFO, + "Shutting down orb %Q\n", + ACE_Thread::self ())); - this->_remove_ref (); + this->_remove_ref (); - this->orb_->shutdown (0); + this->orb_->shutdown (false); } diff --git a/TAO/tests/Bug_1495_Regression/test_i.h b/TAO/tests/Bug_1495_Regression/test_i.h index 709ef8be74d..d27138cf766 100644 --- a/TAO/tests/Bug_1495_Regression/test_i.h +++ b/TAO/tests/Bug_1495_Regression/test_i.h @@ -40,22 +40,18 @@ class Bug1495_i : public virtual POA_Bug1495_Regression::Bug1495 { public: - //Constructor - Bug1495_i (void); - Bug1495_i (CORBA::ORB_ptr orb); + Bug1495_i (CORBA::ORB_ptr orb); + //Destructor + virtual ~Bug1495_i (void); - //Destructor - virtual ~Bug1495_i (void); + virtual void get_thread_id (Bug1495_Regression::ThreadId_out thread_id); - virtual - void get_thread_id (CORBA::Long_out thread_id); - - virtual - void shutdown (void); + virtual void shutdown (void); private: - CORBA::ORB_ptr orb_; + + CORBA::ORB_var orb_; }; diff --git a/TAO/tests/Bug_2084_Regression/EventNode.cpp b/TAO/tests/Bug_2084_Regression/EventNode.cpp index d0471dc8914..644ecb6fc5a 100644 --- a/TAO/tests/Bug_2084_Regression/EventNode.cpp +++ b/TAO/tests/Bug_2084_Regression/EventNode.cpp @@ -7,10 +7,9 @@ ACE_RCSID(EventNode, EventNode, "$Id$") -EventNode::EventNode (CORBA::ORB_ptr orb, - ACE_thread_t thrid) +EventNode::EventNode (CORBA::ORB_ptr orb, ACE_thread_t thrid) : orb_ (CORBA::ORB::_duplicate (orb)) - , thr_id_ (thrid) + , thr_id_ (thrid) { } @@ -48,7 +47,7 @@ void EventNode::registerHello ( ::Test::Hello_ptr h ) } CORBA::String_var str = - h->get_string (static_cast<CORBA::Long> ((size_t)ACE_Thread::self ())); + h->get_string((::Test::ThreadId) ACE_Thread::self ()); ACE_DEBUG ((LM_DEBUG, "(%P|%t) - EventNode: string returned <%s>\n", str.in ())); diff --git a/TAO/tests/Bug_2084_Regression/EventNode.h b/TAO/tests/Bug_2084_Regression/EventNode.h index e39deb0e464..b3e62f57e7c 100644 --- a/TAO/tests/Bug_2084_Regression/EventNode.h +++ b/TAO/tests/Bug_2084_Regression/EventNode.h @@ -1,3 +1,4 @@ +// -*- C++ -*- // // $Id$ // @@ -8,7 +9,7 @@ #include "TestS.h" -#include "ace/OS.h" +#include "ace/OS_NS_Thread.h" /// Implement the Test::EventNode interface class EventNode @@ -29,7 +30,7 @@ private: /// the application. CORBA::ORB_var orb_; - ACE_thread_t thr_id_; + ACE_thread_t const thr_id_; }; #include /**/ "ace/post.h" diff --git a/TAO/tests/Bug_2084_Regression/Hello.cpp b/TAO/tests/Bug_2084_Regression/Hello.cpp index 0a5cfa924b5..a5bf301044d 100644 --- a/TAO/tests/Bug_2084_Regression/Hello.cpp +++ b/TAO/tests/Bug_2084_Regression/Hello.cpp @@ -7,25 +7,27 @@ ACE_RCSID(Hello, Hello, "$Id$") - Hello::Hello (CORBA::ORB_ptr orb, +Hello::Hello (CORBA::ORB_ptr orb, ACE_thread_t thrid) : orb_ (CORBA::ORB::_duplicate (orb)) - , thr_id_ (thrid) + , thr_id_ (thrid) { } char * -Hello::get_string (::CORBA::Long caller_threadid) +Hello::get_string (::Test::ThreadId caller_threadid ACE_ENV_ARG_DECL) { ACE_DEBUG ((LM_DEBUG, "(%P|%t) Upcall in process ..\n")); // Use portable thread IDs ACE_Thread_ID this_ID; - this_ID.id(this->thr_id_); + this_ID.id (this->thr_id_); - if (static_cast<CORBA::Long> ((size_t)ACE_Thread::self ()) != caller_threadid) // this means a remote call was made + if ((::Test::ThreadId) ACE_Thread::self () != caller_threadid) { + // this means a remote call was made + if (this->orb_->orb_core ()->optimize_collocation_objects () && this->orb_->orb_core ()->use_global_collocation ()) { diff --git a/TAO/tests/Bug_2084_Regression/Hello.h b/TAO/tests/Bug_2084_Regression/Hello.h index e5606bf00b1..0f8f1ada1ce 100644 --- a/TAO/tests/Bug_2084_Regression/Hello.h +++ b/TAO/tests/Bug_2084_Regression/Hello.h @@ -1,3 +1,4 @@ +// -*- C++ -*- // // $Id$ // @@ -8,7 +9,7 @@ #include "TestS.h" -#include "ace/OS.h" +#include "ace/OS_NS_Thread.h" /// Implement the Test::Hello interface class Hello @@ -20,7 +21,7 @@ public: ACE_thread_t thr_id); // = The skeleton methods - virtual char * get_string ( ::CORBA::Long caller_threadid ); + virtual char * get_string ( ::Test::ThreadId caller_threadid); virtual void shutdown (void); @@ -29,7 +30,7 @@ private: /// the application. CORBA::ORB_var orb_; - ACE_thread_t thr_id_; + ACE_thread_t const thr_id_; }; #include /**/ "ace/post.h" diff --git a/TAO/tests/Bug_2084_Regression/Test.idl b/TAO/tests/Bug_2084_Regression/Test.idl index 37a1ca19b7d..c7b2b200b52 100644 --- a/TAO/tests/Bug_2084_Regression/Test.idl +++ b/TAO/tests/Bug_2084_Regression/Test.idl @@ -5,11 +5,14 @@ /// Put the interfaces in a module, to avoid global namespace pollution module Test { + // Use "long long" to support platforms with 64-bit thread IDs. + typedef long long ThreadId; + /// A very simple interface interface Hello { /// Return a simple string - string get_string ( in long caller_threadid ); + string get_string (in ThreadId caller_threadid); /// A method to shutdown the ORB /** @@ -21,7 +24,7 @@ module Test /// The server side interface EventNode { - void registerHello( in Hello h ); + void registerHello (in Hello h); oneway void shutdown (); }; }; diff --git a/TAO/utils/catior/catior.cpp b/TAO/utils/catior/catior.cpp index 1dec96f7a7e..70139a19ad0 100644 --- a/TAO/utils/catior/catior.cpp +++ b/TAO/utils/catior/catior.cpp @@ -1295,7 +1295,7 @@ cat_octet_seq (const char *object_name, { CORBA::ULong length = 0; if (stream.read_ulong (length) == 0) - return 1; + return true; ACE_DEBUG ((LM_DEBUG, "%I %s len:\t%d\n", @@ -1307,21 +1307,23 @@ cat_octet_seq (const char *object_name, object_name)); CORBA::Octet anOctet; - char* objKey = CORBA::string_alloc (length + 1); + CORBA::String_var objKey = CORBA::string_alloc (length + 1); short counter = -1; ACE_DEBUG ((LM_DEBUG, "%I ")); - u_int i = 0; + CORBA::ULong i = 0; - for (; i < length; i++) + for (; i < length; ++i) { if (++counter == 16) { ACE_DEBUG ((LM_DEBUG, "\n%I ")); counter = 0; } - stream.read_octet (anOctet); + + if (!stream.read_octet (anOctet)) + return false; ACE_DEBUG ((LM_DEBUG, "%02.2x ", anOctet)); objKey[i] = (char) anOctet; @@ -1333,7 +1335,7 @@ cat_octet_seq (const char *object_name, "\n%I The %s as string:\n%I ", object_name)); - for (i = 0; i < length; i++) + for (i = 0; i < length; ++i) { char c = objKey[i]; int tmp = (unsigned char) c; // isprint doesn't work with negative vals.(except EOF) @@ -1343,10 +1345,9 @@ cat_octet_seq (const char *object_name, ACE_DEBUG ((LM_DEBUG, ".")); } - CORBA::string_free (objKey); ACE_DEBUG ((LM_DEBUG, "\n")); - return 1; + return true; } CORBA::Boolean |