From 9d42538910817fe80869d5d7f5109bba571af5be Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Thu, 11 Jul 2002 19:05:11 +0000 Subject: ChangeLogTag:Thu Jul 11 15:03:47 2002 Steve Huston --- ChangeLog | 73 +++++++++++++++++++++++++++++++++++++++++++++ ChangeLogs/ChangeLog-03a | 73 +++++++++++++++++++++++++++++++++++++++++++++ ace/ARGV.cpp | 9 +++--- ace/Activation_Queue.h | 2 +- ace/Activation_Queue.i | 2 +- ace/Arg_Shifter.cpp | 7 +++-- ace/CDR_Base.cpp | 8 ++--- ace/CDR_Stream.cpp | 15 +++++----- ace/CDR_Stream.i | 8 +++-- ace/Codecs.cpp | 4 +-- ace/DEV_Addr.i | 3 +- ace/DEV_IO.cpp | 8 ++--- ace/DEV_IO.i | 16 +++++----- ace/DLL_Manager.cpp | 11 +++---- ace/Hash_Map_Manager_T.cpp | 14 ++++----- ace/Hash_Map_Manager_T.h | 2 +- ace/Hash_Map_Manager_T.i | 6 ++-- ace/OS.h | 4 +-- ace/Parse_Node.cpp | 27 +++++------------ ace/Reactor_Impl.h | 6 ++-- ace/Select_Reactor_Base.cpp | 2 +- ace/Select_Reactor_Base.h | 6 ++-- ace/Select_Reactor_T.cpp | 11 ++++++- ace/String_Base.h | 42 +++++++++++++------------- ace/String_Base.i | 28 ++++++++--------- ace/String_Base_Const.cpp | 2 +- ace/String_Base_Const.h | 3 +- ace/Timer_Heap_T.cpp | 16 +++++----- ace/Timer_Heap_T.h | 4 +-- ace/WFMO_Reactor.cpp | 10 ++++--- ace/WFMO_Reactor.h | 6 ++-- ace/WIN32_Proactor.cpp | 12 ++++++-- ace/ace_dll64.mak | 2 +- 33 files changed, 300 insertions(+), 142 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ea3409748e..4a860fce368 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,76 @@ +Thu Jul 11 15:03:47 2002 Steve Huston + + * ace/ace_dll64.mak: TEMPORARILY added /wd4267 to disable the + conversion size_t to int warning. + + * ace/Activation_Queue.{h i} (method_count): Change return type + from int to size_t. + + * ace/Arg_Shifter.cpp (cur_arg_strncasecmp): Change flag_length var + to size_t to match string function signatures. If returning a + 'remaining' length, cast back to int. + + * ace/ARGV.cpp (ctor): Build string length using size_t, not int. + + * ace/CDR_Base.cpp (ACE_CDR::consolidate): Use ptrdiff_t, not the + nonstandard ptr_arith_t. + + * ace/CDR_Stream.cpp (grow_and_adjust): Use ptrdiff_t, notptr_arith_t. + (write_string): Cast ACE_SString:length result to ACE_CDR::ULong. + A number of other size_t<->ACE_CDR::ULong casts. + + * ace/CDR_Stream.i (write_string, operator<<): Use a ACE_CDR::ULong + len, can't directly use the return from strlen(), a size_t. + + * ace/Codecs.cpp: size_t conversions. + + * ace/DEV_Addr.i (set): Cast strlen result to int for base_set. + + * ace/DEV_IO.{i cpp} (send, recv): Cast iovec count from size_t to + int for call to ACE_OS level. + + * ace/Hash_Map_Manager_T.{h, i, cpp} (shared_find): Change loc argument + from u_long to size_t. Better match for its use. + + * ace/OS.h (ACE_align_binary, ACE_ptr_align_binary): Change from + using ptr_arith_t to the standard ptrdiff_t. + + * ace/DLL_Manager.cpp: + * ace/Parse_Node.cpp: Avoid casting a void * to a long then back to a + function pointer. Cast using proper calling signature. + + * ace/Reactor_Impl.h (ACE_Reactor_Notify::notify): + * ace/Select_Reactor_Base.{h cpp} (ACE_Select_Reactor_Notify::notify): + Change return type from ssize_t to int to match advertised return + type from ACE_Reactor. + + * ace/Select_Reactor_T.cpp (check_handles): Use an int select_width + to pass width to select() so it can be ignored on ACE_WIN64. + + * ace/String_Base_Const.{h cpp}: Changed npos from int to ssize_t. + + * ace/String_Base.{h i}: (operator[]) changed slot arg from int + to size_t. (strstr(), find(), rfind()) changed return type from + int to ssize_t; change pos arg from int to size_t. + + * ace/Timer_Heap_T.{h cpp}: Change 'slot' arg from int to size_t. + Also changed timer_ids_ to use ssize_t rather than long to + avoid length mismatches between the max size and the timer + queue (a size_t) and the arrays. + + * ace/WFMO_Reactor.h (ACE_WFMO_Reactor_Notify): Change return type + from ssize_to to int to match corresponding change in + ACE_Reactor_Notify, above. The implementation already was returning + int. + + * ace/WFMO_Reactor.cpp (make_changes_in_current_infos, + make_changes_in_suspension_infos): Align use of size_t. + (wait_for_multiple_events)...........Should maybe make the + sizes in this class DWORD????? + + * ace/WIN32_Proactor.cpp (close, handle_events): completion_key + needs to be a different on Win64 than on Win32. + Thu Jul 11 08:34:22 2002 Chad Elliott * bin/MakeProjectCreator/USAGE: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 5ea3409748e..4a860fce368 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,76 @@ +Thu Jul 11 15:03:47 2002 Steve Huston + + * ace/ace_dll64.mak: TEMPORARILY added /wd4267 to disable the + conversion size_t to int warning. + + * ace/Activation_Queue.{h i} (method_count): Change return type + from int to size_t. + + * ace/Arg_Shifter.cpp (cur_arg_strncasecmp): Change flag_length var + to size_t to match string function signatures. If returning a + 'remaining' length, cast back to int. + + * ace/ARGV.cpp (ctor): Build string length using size_t, not int. + + * ace/CDR_Base.cpp (ACE_CDR::consolidate): Use ptrdiff_t, not the + nonstandard ptr_arith_t. + + * ace/CDR_Stream.cpp (grow_and_adjust): Use ptrdiff_t, notptr_arith_t. + (write_string): Cast ACE_SString:length result to ACE_CDR::ULong. + A number of other size_t<->ACE_CDR::ULong casts. + + * ace/CDR_Stream.i (write_string, operator<<): Use a ACE_CDR::ULong + len, can't directly use the return from strlen(), a size_t. + + * ace/Codecs.cpp: size_t conversions. + + * ace/DEV_Addr.i (set): Cast strlen result to int for base_set. + + * ace/DEV_IO.{i cpp} (send, recv): Cast iovec count from size_t to + int for call to ACE_OS level. + + * ace/Hash_Map_Manager_T.{h, i, cpp} (shared_find): Change loc argument + from u_long to size_t. Better match for its use. + + * ace/OS.h (ACE_align_binary, ACE_ptr_align_binary): Change from + using ptr_arith_t to the standard ptrdiff_t. + + * ace/DLL_Manager.cpp: + * ace/Parse_Node.cpp: Avoid casting a void * to a long then back to a + function pointer. Cast using proper calling signature. + + * ace/Reactor_Impl.h (ACE_Reactor_Notify::notify): + * ace/Select_Reactor_Base.{h cpp} (ACE_Select_Reactor_Notify::notify): + Change return type from ssize_t to int to match advertised return + type from ACE_Reactor. + + * ace/Select_Reactor_T.cpp (check_handles): Use an int select_width + to pass width to select() so it can be ignored on ACE_WIN64. + + * ace/String_Base_Const.{h cpp}: Changed npos from int to ssize_t. + + * ace/String_Base.{h i}: (operator[]) changed slot arg from int + to size_t. (strstr(), find(), rfind()) changed return type from + int to ssize_t; change pos arg from int to size_t. + + * ace/Timer_Heap_T.{h cpp}: Change 'slot' arg from int to size_t. + Also changed timer_ids_ to use ssize_t rather than long to + avoid length mismatches between the max size and the timer + queue (a size_t) and the arrays. + + * ace/WFMO_Reactor.h (ACE_WFMO_Reactor_Notify): Change return type + from ssize_to to int to match corresponding change in + ACE_Reactor_Notify, above. The implementation already was returning + int. + + * ace/WFMO_Reactor.cpp (make_changes_in_current_infos, + make_changes_in_suspension_infos): Align use of size_t. + (wait_for_multiple_events)...........Should maybe make the + sizes in this class DWORD????? + + * ace/WIN32_Proactor.cpp (close, handle_events): completion_key + needs to be a different on Win64 than on Win32. + Thu Jul 11 08:34:22 2002 Chad Elliott * bin/MakeProjectCreator/USAGE: diff --git a/ace/ARGV.cpp b/ace/ARGV.cpp index 8fb4668518d..5ef10f7da8d 100644 --- a/ace/ARGV.cpp +++ b/ace/ARGV.cpp @@ -99,7 +99,7 @@ ACE_ARGV::ACE_ARGV (ACE_TCHAR *argv[], if (argv == 0 || argv[0] == 0) return; - int buf_len = 0; + size_t buf_len = 0; // Determine the length of the buffer. @@ -184,17 +184,18 @@ ACE_ARGV::ACE_ARGV (ACE_TCHAR *first_argv[], // Add the number of arguments in both the argvs. this->argc_ = first_argc + second_argc; - int buf_len = ACE_OS::strlen (first_buf) + ACE_OS::strlen (second_buf) + 1; + size_t buf_len = + ACE_OS::strlen (first_buf) + ACE_OS::strlen (second_buf) + 1; // Allocate memory to the lenght of the combined argv string. ACE_NEW (this->buf_, ACE_TCHAR[buf_len + 1]); // copy the first argv string to the buffer - ACE_OS::strcpy (this->buf_,first_buf); + ACE_OS::strcpy (this->buf_, first_buf); // concatenate the second argv string to the buffer - ACE_OS::strcat (this->buf_,second_buf); + ACE_OS::strcat (this->buf_, second_buf); // Delete the first and second buffers diff --git a/ace/Activation_Queue.h b/ace/Activation_Queue.h index 120afac92a7..75011059365 100644 --- a/ace/Activation_Queue.h +++ b/ace/Activation_Queue.h @@ -114,7 +114,7 @@ public: ACE_Time_Value *tv = 0); /// Get the current number of method objects in the queue. - int method_count (void) const; + size_t method_count (void) const; /// Returns 1 if the queue is empty, 0 otherwise. int is_empty (void) const; diff --git a/ace/Activation_Queue.i b/ace/Activation_Queue.i index 11cb0132710..b4b9283bced 100644 --- a/ace/Activation_Queue.i +++ b/ace/Activation_Queue.i @@ -3,7 +3,7 @@ // Activation_Queue.i -ACE_INLINE int +ACE_INLINE size_t ACE_Activation_Queue::method_count (void) const { return queue_->message_count (); diff --git a/ace/Arg_Shifter.cpp b/ace/Arg_Shifter.cpp index d1b0f7b91db..eb75b6723d9 100644 --- a/ace/Arg_Shifter.cpp +++ b/ace/Arg_Shifter.cpp @@ -112,7 +112,7 @@ ACE_Arg_Shifter::cur_arg_strncasecmp (const ACE_TCHAR *flag) // Check for a current argument if (this->is_anything_left()) { - unsigned int flag_length = ACE_OS_String::strlen (flag); + size_t flag_length = ACE_OS_String::strlen (flag); // Check for presence of the flag if (ACE_OS_String::strncasecmp(this->temp_[current_index_], @@ -128,9 +128,10 @@ ACE_Arg_Shifter::cur_arg_strncasecmp (const ACE_TCHAR *flag) else { // matches, with more info to boot! - return ACE_OS_String::strspn - (this->temp_[current_index_] + flag_length, + size_t remaining = ACE_OS_String::strspn + (this->temp_[current_index_] + flag_length, ACE_LIB_TEXT (" ")) + flag_length; + return ACE_static_cast (int, remaining); } } } diff --git a/ace/CDR_Base.cpp b/ace/CDR_Base.cpp index 6130a598947..a6afa86830b 100644 --- a/ace/CDR_Base.cpp +++ b/ace/CDR_Base.cpp @@ -519,10 +519,10 @@ ACE_CDR::consolidate (ACE_Message_Block *dst, // We must copy the contents of into the new buffer, but // respecting the alignment. - ptr_arith_t srcalign = - ptr_arith_t(src->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - ptr_arith_t dstalign = - ptr_arith_t(dst->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; + ptrdiff_t srcalign = + ptrdiff_t(src->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; + ptrdiff_t dstalign = + ptrdiff_t(dst->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; int offset = srcalign - dstalign; if (offset < 0) offset += ACE_CDR::MAX_ALIGNMENT; diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp index 66dec226759..5c6ecbcfcb6 100644 --- a/ace/CDR_Stream.cpp +++ b/ace/CDR_Stream.cpp @@ -144,10 +144,10 @@ ACE_OutputCDR::grow_and_adjust (size_t size, // The new block must start with the same alignment as the // previous block finished. - ptr_arith_t tmpalign = - ptr_arith_t(tmp->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - ptr_arith_t curalign = - ptr_arith_t(this->current_alignment_) % ACE_CDR::MAX_ALIGNMENT; + ptrdiff_t tmpalign = + ptrdiff_t(tmp->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; + ptrdiff_t curalign = + ptrdiff_t(this->current_alignment_) % ACE_CDR::MAX_ALIGNMENT; int offset = curalign - tmpalign; if (offset < 0) offset += ACE_CDR::MAX_ALIGNMENT; @@ -226,7 +226,8 @@ ACE_OutputCDR::write_string (const ACE_CString &x) { // @@ Leave this method in here, not the `.i' file so that we don't // have to unnecessarily pull in the `ace/SString.h' header. - return this->write_string (x.length(), x.c_str()); + return this->write_string (ACE_static_cast (ACE_CDR::ULong, x.length()), + x.c_str()); } ACE_CDR::Boolean @@ -292,7 +293,7 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) if (! this->write_array (i->rd_ptr (), ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, - length)) + ACE_static_cast (ACE_CDR::ULong, length))) { return 0; } @@ -305,7 +306,7 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) if (! this->write_array (i->rd_ptr (), ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, - length)) + ACE_static_cast (ACE_CDR::ULong, length))) { return 0; } diff --git a/ace/CDR_Stream.i b/ace/CDR_Stream.i index 6bc3346eed4..90b73d012bb 100644 --- a/ace/CDR_Stream.i +++ b/ace/CDR_Stream.i @@ -246,7 +246,11 @@ ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_string (const ACE_CDR::Char *x) { if (x != 0) - return this->write_string (ACE_OS::strlen(x), x); + { + ACE_CDR::ULong len = + ACE_static_cast (ACE_CDR::ULong, ACE_OS_String::strlen (x)); + return this->write_string (len, x); + } return this->write_string (0, 0); } @@ -1064,7 +1068,7 @@ operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_string x) { ACE_CDR::ULong len = 0; if (x.val_ != 0) - len = ACE_OS::strlen (x.val_); + len = ACE_static_cast (ACE_CDR::ULong, ACE_OS_String::strlen (x.val_)); os.write_string (len, x.val_); return os.good_bit () && (len <= x.bound_); } diff --git a/ace/Codecs.cpp b/ace/Codecs.cpp index 724ed292ac1..bbfc8fa4d8d 100644 --- a/ace/Codecs.cpp +++ b/ace/Codecs.cpp @@ -30,7 +30,7 @@ ACE_Base64::encode (const ACE_Byte* input, ACE_Byte* result = 0; size_t length = ((input_len + 2) / 3) * 4; - int num_lines = length / ACE_Base64::max_columns_ + 1; + size_t num_lines = length / ACE_Base64::max_columns_ + 1; length += num_lines + 1; ACE_NEW_RETURN (result, ACE_Byte[length], 0); @@ -201,7 +201,7 @@ ACE_Base64::init () { if (!ACE_Base64::init_) { - for (size_t i = 0; i < sizeof (ACE_Base64::alphabet_); ++i) + for (ACE_Byte i = 0; i < sizeof (ACE_Base64::alphabet_); ++i) { ACE_Base64::decoder_[ACE_Base64::alphabet_[i]] = i; ACE_Base64::member_[ACE_Base64::alphabet_[i]] = 1; diff --git a/ace/DEV_Addr.i b/ace/DEV_Addr.i index 53ff88d47bc..3be347d99b9 100644 --- a/ace/DEV_Addr.i +++ b/ace/DEV_Addr.i @@ -8,7 +8,8 @@ ACE_DEV_Addr::set (const ACE_TCHAR *devname) { ACE_TRACE ("ACE_DEV_Addr::set"); - this->ACE_Addr::base_set (AF_DEV, ACE_OS::strlen (devname)); + this->ACE_Addr::base_set + (AF_DEV, ACE_static_cast (int, ACE_OS::strlen (devname))); ACE_OS::strsncpy (this->devname_, devname, MAXNAMLEN); } diff --git a/ace/DEV_IO.cpp b/ace/DEV_IO.cpp index a6dbee87627..221dc888e35 100644 --- a/ace/DEV_IO.cpp +++ b/ace/DEV_IO.cpp @@ -61,7 +61,7 @@ ACE_DEV_IO::send (size_t n, ...) const { ACE_TRACE ("ACE_DEV_IO::send"); va_list argp; - size_t total_tuples = n / 2; + int total_tuples = ACE_static_cast (int, (n / 2)); iovec *iovp; #if defined (ACE_HAS_ALLOCA) iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); @@ -73,7 +73,7 @@ ACE_DEV_IO::send (size_t n, ...) const va_start (argp, n); - for (size_t i = 0; i < total_tuples; i++) + for (int i = 0; i < total_tuples; i++) { iovp[i].iov_base = va_arg (argp, char *); iovp[i].iov_len = va_arg (argp, int); @@ -98,7 +98,7 @@ ACE_DEV_IO::recv (size_t n, ...) const { ACE_TRACE ("ACE_DEV_IO::recv"); va_list argp; - size_t total_tuples = n / 2; + int total_tuples = ACE_static_cast (int, (n / 2)); iovec *iovp; #if defined (ACE_HAS_ALLOCA) iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); @@ -110,7 +110,7 @@ ACE_DEV_IO::recv (size_t n, ...) const va_start (argp, n); - for (size_t i = 0; i < total_tuples; i++) + for (int i = 0; i < total_tuples; i++) { iovp[i].iov_base = va_arg (argp, char *); iovp[i].iov_len = va_arg (argp, int); diff --git a/ace/DEV_IO.i b/ace/DEV_IO.i index 90c825ebf50..0e18eee81ba 100644 --- a/ace/DEV_IO.i +++ b/ace/DEV_IO.i @@ -41,33 +41,33 @@ ASYS_INLINE ssize_t ACE_DEV_IO::send (const iovec iov[], size_t n) const { ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::writev (this->get_handle (), iov, n); + return ACE_OS::writev (this->get_handle (), iov, ACE_static_cast (int, n)); } ASYS_INLINE ssize_t ACE_DEV_IO::recv (iovec iov[], size_t n) const { ACE_TRACE ("ACE_DEV_IO::recv"); - return ACE_OS::readv (this->get_handle (), iov, n); + return ACE_OS::readv (this->get_handle (), iov, ACE_static_cast (int, n)); } ASYS_INLINE ssize_t ACE_DEV_IO::send (const void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const + ACE_OVERLAPPED *overlapped) const { ACE_TRACE ("ACE_DEV_IO::send"); - return ACE_OS::write (this->get_handle (), - (const char *) buf, n, - overlapped); + return ACE_OS::write (this->get_handle (), + (const char *) buf, n, + overlapped); } ASYS_INLINE ssize_t ACE_DEV_IO::recv (void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const + ACE_OVERLAPPED *overlapped) const { ACE_TRACE ("ACE_DEV_IO::recv"); return ACE_OS::read (this->get_handle (), (char *) buf, n, - overlapped); + overlapped); } #if defined (ACE_HAS_STREAM_PIPES) diff --git a/ace/DLL_Manager.cpp b/ace/DLL_Manager.cpp index 4ab860c7636..59fec231b24 100644 --- a/ace/DLL_Manager.cpp +++ b/ace/DLL_Manager.cpp @@ -460,13 +460,10 @@ ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload) { // Declare the type of the symbol: typedef int (*dll_unload_policy)(void); - - // Try to get the symbol, and have symbol() ignore errors. - void *foo = dll_handle->symbol (ACE_TEXT ("_get_dll_unload_policy"), 1); - - // Cast the void* to long first. - long tmp = ACE_reinterpret_cast (long, foo); - dll_unload_policy the_policy = ACE_reinterpret_cast (dll_unload_policy, tmp); + dll_unload_policy the_policy = 0; + the_policy = + ACE_reinterpret_cast (dll_unload_policy, + dll_handle->symbol (ACE_TEXT ("_get_dll_unload_policy"), 1)); if (the_policy != 0) unload = ACE_BIT_DISABLED (the_policy (), ACE_DLL_UNLOAD_POLICY_LAZY); diff --git a/ace/Hash_Map_Manager_T.cpp b/ace/Hash_Map_Manager_T.cpp index 669ca4bc756..f8d6ae6aaa3 100644 --- a/ace/Hash_Map_Manager_T.cpp +++ b/ace/Hash_Map_Manager_T.cpp @@ -204,7 +204,7 @@ ACE_Hash_Map_Manager_Ex::bind_ const INT_ID &int_id, ACE_Hash_Map_Entry *&entry) { - u_long loc; + size_t loc; int result = this->shared_find (ext_id, entry, loc); if (result == -1) @@ -233,7 +233,7 @@ ACE_Hash_Map_Manager_Ex::trybi INT_ID &int_id, ACE_Hash_Map_Entry *&entry) { - u_long loc; + size_t loc; int result = this->shared_find (ext_id, entry, loc); if (result == -1) @@ -263,7 +263,7 @@ ACE_Hash_Map_Manager_Ex::unbin { ACE_Hash_Map_Entry *temp; - u_long loc; + size_t loc; int result = this->shared_find (ext_id, temp, loc); if (result == -1) @@ -293,7 +293,7 @@ ACE_Hash_Map_Manager_Ex::unbin template int ACE_Hash_Map_Manager_Ex::shared_find (const EXT_ID &ext_id, ACE_Hash_Map_Entry *&entry, - u_long &loc) + size_t &loc) { loc = this->hash (ext_id) % this->total_size_; @@ -319,7 +319,7 @@ ACE_Hash_Map_Manager_Ex::rebin const INT_ID &int_id, ACE_Hash_Map_Entry *&entry) { - u_long dummy; + size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) return this->bind_i (ext_id, int_id); else @@ -336,7 +336,7 @@ ACE_Hash_Map_Manager_Ex::rebin INT_ID &old_int_id, ACE_Hash_Map_Entry *&entry) { - u_long dummy; + size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) return this->bind_i (ext_id, int_id); else @@ -355,7 +355,7 @@ ACE_Hash_Map_Manager_Ex::rebin INT_ID &old_int_id, ACE_Hash_Map_Entry *&entry) { - u_long dummy; + size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) return this->bind_i (ext_id, int_id); else diff --git a/ace/Hash_Map_Manager_T.h b/ace/Hash_Map_Manager_T.h index 37f7370dfa2..a19404229d0 100644 --- a/ace/Hash_Map_Manager_T.h +++ b/ace/Hash_Map_Manager_T.h @@ -442,7 +442,7 @@ protected: /// Returns the that corresponds to . int shared_find (const EXT_ID &ext_id, ACE_Hash_Map_Entry *&entry, - u_long &loc); + size_t &loc); private: /** diff --git a/ace/Hash_Map_Manager_T.i b/ace/Hash_Map_Manager_T.i index d57997a72bf..e3b8372440b 100644 --- a/ace/Hash_Map_Manager_T.i +++ b/ace/Hash_Map_Manager_T.i @@ -177,7 +177,7 @@ ACE_Hash_Map_Manager_Ex::find_ { ACE_Hash_Map_Entry *entry; - u_long dummy; + size_t dummy; if (this->shared_find (ext_id, entry, dummy) == -1) return -1; else @@ -192,7 +192,7 @@ ACE_Hash_Map_Manager_Ex::find_ { ACE_Hash_Map_Entry *entry; - u_long dummy; + size_t dummy; return this->shared_find (ext_id, entry, dummy); } @@ -224,7 +224,7 @@ template ::find_i (const EXT_ID &ext_id, ACE_Hash_Map_Entry *&entry) { - u_long dummy; + size_t dummy; return this->shared_find (ext_id, entry, dummy); } diff --git a/ace/OS.h b/ace/OS.h index 1372311a55d..0104b1e81ab 100644 --- a/ace/OS.h +++ b/ace/OS.h @@ -7107,11 +7107,11 @@ typedef ACE_TRANSMIT_FILE_BUFFERS* ACE_LPTRANSMIT_FILE_BUFFERS; * @param alignment the required alignment */ #define ACE_align_binary(ptr, alignment) \ - ((ptr + ((ptr_arith_t)((alignment)-1))) & (~((ptr_arith_t)((alignment)-1)))) + ((ptr + ((ptr_arith_t)((alignment)-1))) & (~((ptrdiff_t)((alignment)-1)))) /// Return the next address aligned to a required boundary #define ACE_ptr_align_binary(ptr, alignment) \ - ((char *) ACE_align_binary (((ptr_arith_t) (ptr)), (alignment))) + ((char *) ACE_align_binary (((ptrdiff_t) (ptr)), (alignment))) //@} // Defining POSIX4 real-time signal range. diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp index 3e364b275a7..788207faf02 100644 --- a/ace/Parse_Node.cpp +++ b/ace/Parse_Node.cpp @@ -464,34 +464,21 @@ ACE_Function_Node::ACE_Function_Node (const ACE_TCHAR *path, void * ACE_Function_Node::symbol (ACE_Service_Object_Exterminator *gobbler) { + typedef ACE_Service_Object *(*ACE_Service_Factory_Ptr) + (ACE_Service_Object_Exterminator *); + ACE_TRACE ("ACE_Function_Node::symbol"); if (this->open_dll () == 0) { - void *(*func) (ACE_Service_Object_Exterminator *) = 0; + ACE_Service_Factory_Ptr func = 0; this->symbol_ = 0; // Locate the factory function in the shared // object. - ACE_TCHAR *function_name = ACE_const_cast (ACE_TCHAR *, - this->function_name_); - - // According to the new ANSI C++ specification, casting a void* - // pointer to a function pointer is not allowed. However, - // casting a void* pointer to an integer type that is large - // enough to hold the pointer value is legal. I (Nanbor) chose - // to cast the return value to long since it should be large - // enough to hold the void* pointer's value on most platforms. - // I am not sure if casting a long value to a function pointer - // is legal or not (can't find a good explanation in spec) but - // SunC++, egcs, and KAI compilers, all of which are pretty - // close to (or, at least claim to conform with) the standard - // did not complain about this as an illegal pointer conversion. - long temp_ptr = - ACE_reinterpret_cast(long, this->dll_.symbol (function_name)); - func = ACE_reinterpret_cast(void *(*)(ACE_Service_Object_Exterminator *), - temp_ptr); - + this->function_name_); + func = ACE_reinterpret_cast (ACE_Service_Factory_Ptr, + this->dll_.symbol (function_name)); if (func == 0) { ace_yyerrno++; diff --git a/ace/Reactor_Impl.h b/ace/Reactor_Impl.h index 8a41ce30644..5ff0d2bcfb0 100644 --- a/ace/Reactor_Impl.h +++ b/ace/Reactor_Impl.h @@ -60,9 +60,9 @@ public: * caller will block until action is possible, else will wait until * the relative time specified in * elapses). */ - virtual ssize_t notify (ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value * = 0) = 0; + virtual int notify (ACE_Event_Handler * = 0, + ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value * = 0) = 0; /// Handles pending threads (if any) that are waiting to unblock the /// . diff --git a/ace/Select_Reactor_Base.cpp b/ace/Select_Reactor_Base.cpp index af203a4e4b9..f74cc42835c 100644 --- a/ace/Select_Reactor_Base.cpp +++ b/ace/Select_Reactor_Base.cpp @@ -666,7 +666,7 @@ ACE_Select_Reactor_Notify::close (void) return this->notification_pipe_.close (); } -ssize_t +int ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *eh, ACE_Reactor_Mask mask, ACE_Time_Value *timeout) diff --git a/ace/Select_Reactor_Base.h b/ace/Select_Reactor_Base.h index 0f04e51eeec..6f4c4923d54 100644 --- a/ace/Select_Reactor_Base.h +++ b/ace/Select_Reactor_Base.h @@ -143,9 +143,9 @@ public: * the caller will block until action is possible, else will wait * until the relative time specified in * elapses). */ - virtual ssize_t notify (ACE_Event_Handler * = 0, - ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value * = 0); + virtual int notify (ACE_Event_Handler * = 0, + ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value * = 0); /// Handles pending threads (if any) that are waiting to unblock the /// . diff --git a/ace/Select_Reactor_T.cpp b/ace/Select_Reactor_T.cpp index b3887d7d4a7..9a45c4183ff 100644 --- a/ace/Select_Reactor_T.cpp +++ b/ace/Select_Reactor_T.cpp @@ -1398,7 +1398,16 @@ ACE_Select_Reactor_T::check_handles (void) // variant since fstat always returns an error on socket FDs. rd_mask.set_bit (handle); - if (ACE_OS::select (int (handle) + 1, + int select_width; +# if defined (ACE_WIN64) + // This arg is ignored on Windows and causes pointer truncation + // warnings on 64-bit compiles. + select_width = 0; +# else + select_width = int (handle) + 1; +# endif /* ACE_WIN64 */ + + if (ACE_OS::select (select_width, rd_mask, 0, 0, &time_poll) < 0) { diff --git a/ace/String_Base.h b/ace/String_Base.h index 6fa80965470..35bc1c740aa 100644 --- a/ace/String_Base.h +++ b/ace/String_Base.h @@ -30,20 +30,20 @@ class ACE_Allocator; * * @brief This class provides a wrapper facade for C strings. * - * This class uses an to allocate memory. The + * This class uses an ACE_Allocator to allocate memory. The * user can make this a persistant class by providing an * ACE_Allocator with a persistable memory pool. This class is * optimized for efficiency, so it doesn't provide any internal * locking. * NOTE: if an instance of this class is constructed from or * assigned an empty string (with first element of '\0'), then it - * is _not_ allocated new space. Instead, its internal + * is not allocated new space. Instead, its internal * representation is set equal to a global empty string. * CAUTION: in cases when ACE_String_Base is constructed from a * provided buffer with the release parameter set to 0, * ACE_String_Base is not guaranteed to be '\0' terminated. */ -template < class CHAR > class ACE_String_Base:public ACE_String_Base_Const +template class ACE_String_Base : public ACE_String_Base_Const { public: /** @@ -67,8 +67,8 @@ public: * @return ACE_String_Base containing const CHAR *s */ ACE_String_Base (const CHAR * s, - ACE_Allocator * alloc = 0, - int release = 1); + ACE_Allocator * alloc = 0, + int release = 1); /** * Constructor that copies @a len CHARs of @a s into dynamically @@ -84,9 +84,9 @@ public: * @return ACE_String_Base containing const CHAR *s */ ACE_String_Base (const CHAR * s, - size_t len, - ACE_Allocator * alloc = 0, - int release = 1); + size_t len, + ACE_Allocator * alloc = 0, + int release = 1); /** * Copy constructor. @@ -104,7 +104,7 @@ public: * @return ACE_String_Base containing CHAR 'c' */ ACE_String_Base (CHAR c, - ACE_Allocator * alloc = 0); + ACE_Allocator * alloc = 0); /** * Constructor that dynamically allocate @a len long of char array @@ -116,8 +116,8 @@ public: * @return ACE_String_Base containing character array 'c' */ ACE_String_Base (size_t len, - CHAR c = 0, - ACE_Allocator * alloc = 0); + CHAR c = 0, + ACE_Allocator * alloc = 0); /** * Deletes the memory... @@ -129,18 +129,18 @@ public: * bounds checking). * * @param slot Index of the desired character - * @return The character at index 'slot' + * @return The character at index @a slot */ - const CHAR & operator[] (int slot) const; + const CHAR & operator[] (size_t slot) const; /** * Return the character by reference in the string * (doesn't perform bounds checking). * * @param slot Index of the desired character - * @return The character at index 'slot' + * @return The character at index @a slot */ - CHAR & operator[](int slot); + CHAR & operator[] (size_t slot); /** * Assignment operator (does copy memory). @@ -188,7 +188,7 @@ public: * @return The string containing the desired substring */ ACE_String_Base < CHAR > substring (size_t offset, - ssize_t length = -1) const; + ssize_t length = -1) const; /** * Same as . @@ -258,7 +258,7 @@ public: * @return Integer index value of the first location of string @a s or * -1 (not found). */ - int strstr (const ACE_String_Base &s) const; + ssize_t strstr (const ACE_String_Base &s) const; /** * Find starting at pos. Returns the slot of the first @@ -268,7 +268,7 @@ public: * @param pos Starting index position to start searching for string @a str. * @return Index value of the first location of string @a str else npos. */ - int find (const ACE_String_Base &str, int pos = 0) const; + ssize_t find (const ACE_String_Base &str, size_t pos = 0) const; /** * Find @a s starting at pos. Returns the slot of the first @@ -278,7 +278,7 @@ public: * @param pos Starting index position to start searching for string @a str. * @return Index value of the first location of string @a str else npos. */ - int find (const CHAR *s, int pos = 0) const; + ssize_t find (const CHAR *s, size_t pos = 0) const; /** * Find @a c starting at pos. Returns the slot of the first @@ -288,7 +288,7 @@ public: * @param pos Starting index position to start searching for string @a str. * @return Index value of the first location of string @a str else npos. */ - int find (CHAR c, int pos = 0) const; + ssize_t find (CHAR c, size_t pos = 0) const; /** * Find @a c starting at pos (counting from the end). Returns the @@ -298,7 +298,7 @@ public: * @param pos Starting index position to start searching for string @a str. * @return Index value of the first location of string @a str else npos. */ - int rfind (CHAR c, int pos = npos) const; + ssize_t rfind (CHAR c, size_t pos = ACE_static_cast (size_t, npos)) const; /** * Equality comparison operator (must match entire string). diff --git a/ace/String_Base.i b/ace/String_Base.i index b4a9120f60e..0ac1ff3f764 100644 --- a/ace/String_Base.i +++ b/ace/String_Base.i @@ -171,7 +171,7 @@ ACE_String_Base::substr (size_t offset, // Return the character in the string. template ACE_INLINE const CHAR & -ACE_String_Base::operator[] (int slot) const +ACE_String_Base::operator[] (size_t slot) const { ACE_TRACE ("ACE_String_Base::operator[]"); return this->rep_[slot]; @@ -180,7 +180,7 @@ ACE_String_Base::operator[] (int slot) const // Return the character in the string by reference. template ACE_INLINE CHAR & -ACE_String_Base::operator[] (int slot) +ACE_String_Base::operator[] (size_t slot) { ACE_TRACE ("ACE_String_Base::operator[]"); return this->rep_[slot]; @@ -343,8 +343,8 @@ ACE_String_Base::compare (const ACE_String_Base &s) const } } -template ACE_INLINE int -ACE_String_Base::find (const CHAR *s, int pos) const +template ACE_INLINE ssize_t +ACE_String_Base::find (const CHAR *s, size_t pos) const { CHAR *substr = this->rep_ + pos; size_t len = ACE_OS::strlen (s); @@ -359,8 +359,8 @@ ACE_String_Base::find (const CHAR *s, int pos) const } } -template ACE_INLINE int -ACE_String_Base::find (CHAR c, int pos) const +template ACE_INLINE ssize_t +ACE_String_Base::find (CHAR c, size_t pos) const { CHAR *substr = this->rep_ + pos; CHAR *pointer = ACE_OS::strnchr (substr, c, this->len_ - pos); @@ -374,13 +374,13 @@ ACE_String_Base::find (CHAR c, int pos) const } } -template ACE_INLINE int -ACE_String_Base::find (const ACE_String_Base &str, int pos) const +template ACE_INLINE ssize_t +ACE_String_Base::find (const ACE_String_Base&str, size_t pos) const { return this->find (str.rep_, pos); } -template ACE_INLINE int +template ACE_INLINE ssize_t ACE_String_Base::strstr (const ACE_String_Base &s) const { ACE_TRACE ("ACE_String_Base::strstr"); @@ -388,19 +388,19 @@ ACE_String_Base::strstr (const ACE_String_Base &s) const return this->find (s.rep_); } -template ACE_INLINE int -ACE_String_Base::rfind (CHAR c, int pos) const +template ACE_INLINE ssize_t +ACE_String_Base::rfind (CHAR c, size_t pos) const { - if (pos == ACE_String_Base::npos) + if (pos > this->len_) { pos = this->len_; } - for (int i = pos - 1; i >= 0; i--) + for (size_t i = pos - 1; i >= 0; i--) { if (this->rep_[i] == c) { - return i; + return ACE_static_cast (ssize_t, i); } } diff --git a/ace/String_Base_Const.cpp b/ace/String_Base_Const.cpp index 914c18a0341..bf66b2cf873 100644 --- a/ace/String_Base_Const.cpp +++ b/ace/String_Base_Const.cpp @@ -2,4 +2,4 @@ #include "ace/String_Base_Const.h" -int ACE_String_Base_Const::npos = -1; +ssize_t ACE_String_Base_Const::npos = -1; diff --git a/ace/String_Base_Const.h b/ace/String_Base_Const.h index d6f796ae8c6..d0dd5b744a1 100644 --- a/ace/String_Base_Const.h +++ b/ace/String_Base_Const.h @@ -16,6 +16,7 @@ #include "ace/pre.h" #include "ace/ACE_export.h" +#include "ace/Basic_Types.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -31,7 +32,7 @@ class ACE_Export ACE_String_Base_Const { public: - static int npos; + static ssize_t npos; }; #include "ace/post.h" diff --git a/ace/Timer_Heap_T.cpp b/ace/Timer_Heap_T.cpp index c3596238621..d0d73150149 100644 --- a/ace/Timer_Heap_T.cpp +++ b/ace/Timer_Heap_T.cpp @@ -155,7 +155,7 @@ ACE_Timer_Heap_T::ACE_Timer_Heap_T (FUNCTOR *upcall_fun // Create the parallel array. ACE_NEW (this->timer_ids_, - long[this->max_size_]); + ssize_t[this->max_size_]); // Initialize the "freelist," which uses negative values to // distinguish freelist elements from "pointers" into the @@ -328,7 +328,7 @@ ACE_Timer_Heap_T::dump (void) const } template void -ACE_Timer_Heap_T::copy (int slot, +ACE_Timer_Heap_T::copy (size_t slot, ACE_Timer_Node_T *moved_node) { // Insert into its new location in the heap. @@ -488,21 +488,21 @@ ACE_Timer_Heap_T::grow_heap (void) // Grow the array of timer ids. - long *new_timer_ids = 0; + ssize_t *new_timer_ids = 0; ACE_NEW (new_timer_ids, - long[new_size]); + ssize_t[new_size]); ACE_OS::memcpy (new_timer_ids, this->timer_ids_, - this->max_size_ * sizeof (long)); + this->max_size_ * sizeof (ssize_t)); delete [] timer_ids_; this->timer_ids_ = new_timer_ids; // And add the new elements to the end of the "freelist". for (size_t i = this->max_size_; i < new_size; i++) - this->timer_ids_[i] = -((long) (i + 1)); + this->timer_ids_[i] = -(i + 1); // Grow the preallocation array (if using preallocation) if (this->preallocated_nodes_ != 0) @@ -664,7 +664,7 @@ ACE_Timer_Heap_T::cancel (long timer_id, || (size_t) timer_id > this->max_size_) return 0; - long timer_node_slot = this->timer_ids_[timer_id]; + ssize_t timer_node_slot = this->timer_ids_[timer_id]; // Check to see if timer_id is still valid. if (timer_node_slot < 0) @@ -709,7 +709,7 @@ ACE_Timer_Heap_T::reset_interval (long timer_id, || (size_t) timer_id > this->max_size_) return -1; - long timer_node_slot = this->timer_ids_[timer_id]; + ssize_t timer_node_slot = this->timer_ids_[timer_id]; // Check to see if timer_id is still valid. if (timer_node_slot < 0) diff --git a/ace/Timer_Heap_T.h b/ace/Timer_Heap_T.h index 60f64211df2..8541ce2b828 100644 --- a/ace/Timer_Heap_T.h +++ b/ace/Timer_Heap_T.h @@ -240,7 +240,7 @@ private: /// Copy into the slot of and move /// into the corresponding slot in the array. - void copy (int slot, ACE_Timer_Node_T *moved_node); + void copy (size_t slot, ACE_Timer_Node_T *moved_node); /** * Returns a timer id that uniquely identifies this timer. This id @@ -287,7 +287,7 @@ private: * indications of free timer IDs, whereas positive values are * "pointers" into the array for assigned timer IDs. */ - long *timer_ids_; + ssize_t *timer_ids_; /// "Pointer" to the element in the array that was /// last given out as a timer ID. diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp index 303b18de723..4105763137a 100644 --- a/ace/WFMO_Reactor.cpp +++ b/ace/WFMO_Reactor.cpp @@ -674,7 +674,7 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_current_infos (void) { // This will help us in keeping track of the last valid slot in the // handle arrays - int last_valid_slot = this->max_handlep1_ - 1; + size_t last_valid_slot = this->max_handlep1_ - 1; for (int i = last_valid_slot; i >= 0; i--) { @@ -776,7 +776,7 @@ ACE_WFMO_Reactor_Handler_Repository::make_changes_in_suspension_infos (void) // Go through the array if (this->handles_to_be_deleted_ > 0 || this->handles_to_be_resumed_ > 0) { - int last_valid_slot = this->suspended_handles_ - 1; + size_t last_valid_slot = this->suspended_handles_ - 1; for (i = last_valid_slot; i >= 0; i--) { // This stuff is necessary here, since we should not make @@ -1723,16 +1723,18 @@ ACE_WFMO_Reactor::wait_for_multiple_events (int timeout, // Wait for any of handles_ to be active, or until timeout expires. // If is enabled allow asynchronous completion of // ReadFile and WriteFile operations. + DWORD handle_count = ACE_static_cast (DWORD, + this->handler_rep_.max_handlep1 ()); #if defined (ACE_HAS_PHARLAP) || defined (ACE_HAS_WINCE) // PharLap doesn't do async I/O and doesn't implement // WaitForMultipleObjectsEx, so use WaitForMultipleObjects. ACE_UNUSED_ARG (alertable); - return ::WaitForMultipleObjects (this->handler_rep_.max_handlep1 (), + return ::WaitForMultipleObjects (handle_count, this->handler_rep_.handles (), FALSE, timeout); #else - return ::WaitForMultipleObjectsEx (this->handler_rep_.max_handlep1 (), + return ::WaitForMultipleObjectsEx (handle_count, this->handler_rep_.handles (), FALSE, timeout, diff --git a/ace/WFMO_Reactor.h b/ace/WFMO_Reactor.h index 0aeac50beef..f76203e65c1 100644 --- a/ace/WFMO_Reactor.h +++ b/ace/WFMO_Reactor.h @@ -495,9 +495,9 @@ public: * 0, the caller will block until action is possible, else will wait * until the relative time specified in elapses). */ - ssize_t notify (ACE_Event_Handler *event_handler = 0, - ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, - ACE_Time_Value *timeout = 0); + virtual int notify (ACE_Event_Handler *event_handler = 0, + ACE_Reactor_Mask mask = ACE_Event_Handler::EXCEPT_MASK, + ACE_Time_Value *timeout = 0); /// No-op. virtual int dispatch_notifications (int &number_of_active_handles, diff --git a/ace/WIN32_Proactor.cpp b/ace/WIN32_Proactor.cpp index ad4fb83df36..1ba58165d94 100644 --- a/ace/WIN32_Proactor.cpp +++ b/ace/WIN32_Proactor.cpp @@ -83,7 +83,11 @@ ACE_WIN32_Proactor::close (void) { ACE_OVERLAPPED *overlapped = 0; u_long bytes_transferred = 0; - u_long completion_key = 0; +#if defined (ACE_WIN64) + ULONG_PTR completion_key = 0; +#else + ULONG completion_key = 0; +#endif /* ACE_WIN64 */ // Get the next asynchronous operation that completes BOOL res = ::GetQueuedCompletionStatus @@ -547,7 +551,11 @@ ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds) { ACE_OVERLAPPED *overlapped = 0; u_long bytes_transferred = 0; - u_long completion_key = 0; +#if defined (ACE_WIN64) + ULONG_PTR completion_key = 0; +#else + ULONG completion_key = 0; +#endif /* ACE_WIN64 */ // Get the next asynchronous operation that completes BOOL result = ::GetQueuedCompletionStatus (this->completion_port_, diff --git a/ace/ace_dll64.mak b/ace/ace_dll64.mak index 74520af81f7..b96042ff477 100644 --- a/ace/ace_dll64.mak +++ b/ace/ace_dll64.mak @@ -1901,7 +1901,7 @@ CLEAN : if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)" CPP=cl.exe -CPP_PROJ=/nologo /MDd /W3 /Wp64 /Gm /GX /Zi /Od /Gy /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ACE_BUILD_DLL" /D "ACE_OS_BUILD_DLL" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +CPP_PROJ=/nologo /MDd /W3 /wd4267 /Wp64 /Gm /GX /Zi /Od /Gy /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "ACE_BUILD_DLL" /D "ACE_OS_BUILD_DLL" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c .c{$(INTDIR)}.obj:: $(CPP) @<< -- cgit v1.2.1