diff options
author | cbeaulac <cbeaulac@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-02-25 18:38:07 +0000 |
---|---|---|
committer | cbeaulac <cbeaulac@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2010-02-25 18:38:07 +0000 |
commit | 8be9c73e395c0abc981f8d5765fc443031ccb65a (patch) | |
tree | d5f755802b78703275f6120b595ea16344e3832a | |
parent | 70cd12e08ea8460f45978b5d0b53fc41efc811fd (diff) | |
download | ATCD-8be9c73e395c0abc981f8d5765fc443031ccb65a.tar.gz |
Thu Feb 25 18:37:24 UTC 2010 Chad Beaulac <chad@objectivesolutions.com>
* ...
Merged files from trunk for Bugzilla #3334 branch work-in-progress
78 files changed, 1346 insertions, 1007 deletions
diff --git a/ace/Acceptor.h b/ace/Acceptor.h index 499bfc38277..9ff18245638 100644 --- a/ace/Acceptor.h +++ b/ace/Acceptor.h @@ -503,21 +503,30 @@ protected: * @class ACE_Oneshot_Acceptor * * @brief Generic factory for passively connecting clients and creating - * exactly one service handler (SVC_HANDLER). + * exactly one service handler of the type SVC_HANDLER specified in the + * template. * - * This class works similarly to the regular {ACE_Acceptor}, + * This class works similarly to the regular ACE_Acceptor, but * with the following differences: - * 1. This class doesn't automagically register {this} with the - * {ACE_Reactor} since it expects to have its {accept} method - * called directly. However, it stashes the {ACE_Reactor} - * pointer away in case it's needed later to finish accepting - * a connection asynchronously. - * 2. The class doesn't need an {ACE_Creation_Strategy} (since - * the user supplies the SVC_HANDLER) or an - * {ACE_Accept_Strategy} (since this class only accepts one - * connection and then removes all traces of itself from the - * {ACE_Reactor} if it was registered for asynchronous - * accepts). + * -# ACE_Oneshot_Acceptor doesn't automatically register itself with the + * ACE_Reactor; the caller is expected to call the accept() method + * directly. Since a later call to accept() may require a reactor, + * the constructor and open() methods both accept an ACE_Reactor pointer + * which is saved in case it's needed in accept(). + * -# ACE_Oneshot_Acceptor doesn't need an ACE_Creation_Strategy (because + * the user supplies the SVC_HANDLER) or an ACE_Accept_Strategy (because + * this class only accepts one connection and then removes all traces of + * itself from the ACE_Reactor if it was registered for asynchronous + * accepts). + * + * The usage model for ACE_Oneshot_Acceptor is: + * - Instantiate an object and establish its local address to listen at. + * This can be accomplished using either the address-accepting constructor + * (but there's no error indication) or the default constructor followed + * by a call to open(). + * - Call the accept() method. This will attempt to accept a connection + * immediately. If there is no immediately available connection to accept, + * behavior is governed by the ACE_Synch_Options argument passed to open(). */ template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> class ACE_Oneshot_Acceptor : public ACE_Service_Object @@ -535,10 +544,10 @@ public: /** * Initialize the appropriate strategies for concurrency and then - * open the {peer_acceptor} at the designated {local_addr}. Note - * that unlike the {ACE_Acceptor} and {ACE_Strategy_Acceptor}, this - * method does NOT register {this} acceptor with the {reactor} at - * this point -- it just stashes the {reactor} away in case it's + * open the acceptor at the designated @a local_addr. Note + * that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this + * method does NOT register this acceptor with the @a reactor at + * this point -- the @a reactor parameter is saved in case it's * needed later. */ ACE_Oneshot_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, @@ -547,10 +556,10 @@ public: /** * Initialize the appropriate strategies for concurrency and then - * open the {peer_acceptor} at the designated {local_addr}. Note - * that unlike the {ACE_Acceptor} and {ACE_Strategy_Acceptor}, this - * method does NOT register {this} acceptor with the {reactor} at - * this point -- it just stashes the {reactor} away in case it's + * open the acceptor at the designated @a local_addr. Note + * that unlike ACE_Acceptor and ACE_Strategy_Acceptor, this + * method does NOT register this acceptor with the @a reactor at + * this point -- the @a reactor parameter is saved in case it's * needed later. */ int open (const ACE_PEER_ACCEPTOR_ADDR &, diff --git a/ace/Atomic_Op.h b/ace/Atomic_Op.h index d7cbdc37c67..f74bb66e285 100644 --- a/ace/Atomic_Op.h +++ b/ace/Atomic_Op.h @@ -45,6 +45,9 @@ # define ACE_HAS_BUILTIN_ATOMIC_OP # elif defined (ACE_HAS_VXATOMICLIB) # define ACE_HAS_BUILTIN_ATOMIC_OP +# elif defined (ACE_HAS_GCC_ATOMIC_BUILTINS) && (ACE_HAS_GCC_ATOMIC_BUILTINS == 1) +# define ACE_HAS_BUILTIN_ATOMIC_OP +# define ACE_USES_GCC_ATOMIC_BUILTINS 1 # endif /* WIN32 */ #endif /* ACE_HAS_THREADS */ @@ -229,9 +232,9 @@ public: private: - // This function cannot be supported by this template specialization. - // If you need access to an underlying lock, use the ACE_Atomic_Op_Ex - // template instead. + /// This function cannot be supported by this template specialization. + /// If you need access to an underlying lock, use the ACE_Atomic_Op_Ex + /// template instead. ACE_Thread_Mutex &mutex (void); private: diff --git a/ace/Atomic_Op.inl b/ace/Atomic_Op.inl index a79cc9e230e..88853d65497 100644 --- a/ace/Atomic_Op.inl +++ b/ace/Atomic_Op.inl @@ -44,6 +44,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator++ (void) return ::InterlockedIncrement (const_cast<long *> (&this->value_)); #elif defined (ACE_HAS_VXATOMICLIB) return ::vxAtomicInc (reinterpret_cast <atomic_t*>(const_cast<long *> (&this->value_))) + 1; +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + return __sync_add_and_fetch (&this->value_, 1); #else /* WIN32 */ return (*increment_fn_) (&this->value_); #endif /* WIN32 */ @@ -64,6 +66,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-- (void) return ::InterlockedDecrement (const_cast<long *> (&this->value_)); #elif defined (ACE_HAS_VXATOMICLIB) return ::vxAtomicDec (reinterpret_cast <atomic_t*>(const_cast<long *> (&this->value_))) - 1; +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + return __sync_sub_and_fetch (&this->value_, 1); #else /* WIN32 */ return (*decrement_fn_) (&this->value_); #endif /* WIN32 */ @@ -86,6 +90,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator+= (long rhs) rhs) + rhs; #elif defined (ACE_HAS_VXATOMICLIB) return ::vxAtomicAdd (reinterpret_cast <atomic_t*>(const_cast<long *> (&this->value_)), rhs) + rhs; +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + return __sync_add_and_fetch (&this->value_, rhs); #else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ return (*exchange_add_fn_) (&this->value_, rhs) + rhs; #endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ @@ -102,6 +108,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator-= (long rhs) -rhs) - rhs; #elif defined (ACE_HAS_VXATOMICLIB) return ::vxAtomicSub (reinterpret_cast <atomic_t*>(const_cast<long *> (&this->value_)), rhs) - rhs; +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + return __sync_sub_and_fetch (&this->value_, rhs); #else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ return (*exchange_add_fn_) (&this->value_, -rhs) - rhs; #endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ @@ -152,6 +160,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= (long rhs) ::InterlockedExchange (const_cast<long *> (&this->value_), rhs); #elif defined (ACE_HAS_VXATOMICLIB) ::vxAtomicSet (reinterpret_cast <atomic_t*>(const_cast<long *> (&this->value_)), rhs); +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + __sync_lock_test_and_set (&this->value_, rhs); #else /* WIN32 */ (*exchange_fn_) (&this->value_, rhs); #endif /* WIN32 */ @@ -168,6 +178,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::operator= ( ::InterlockedExchange (const_cast<long *> (&this->value_), rhs.value_); #elif defined (ACE_HAS_VXATOMICLIB) ::vxAtomicSet (reinterpret_cast <atomic_t*>(const_cast<long *> (&this->value_)), rhs.value_); +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + __sync_lock_test_and_set (&this->value_, rhs.value_); #else /* WIN32 */ (*exchange_fn_) (&this->value_, rhs.value_); #endif /* WIN32 */ @@ -215,6 +227,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator++ (void) return static_cast<unsigned long> (::InterlockedIncrement (const_cast<long *> (reinterpret_cast<volatile long *>(&this->value_)))); #elif defined (ACE_HAS_VXATOMICLIB) return static_cast<unsigned long> (::vxAtomicInc (reinterpret_cast <atomic_t*>(const_cast<long *> (reinterpret_cast<volatile long *>(&this->value_))))) + 1; +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + return __sync_add_and_fetch (&this->value_, 1); #else /* WIN32 */ return static_cast<unsigned long> ((*increment_fn_) (reinterpret_cast<volatile long *> (&this->value_))); #endif /* WIN32 */ @@ -235,6 +249,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-- (void) return static_cast<unsigned long> (::InterlockedDecrement (const_cast<long *> (reinterpret_cast<volatile long *>(&this->value_)))); #elif defined (ACE_HAS_VXATOMICLIB) return static_cast<unsigned long> (::vxAtomicDec (reinterpret_cast <atomic_t*>(const_cast<long *> (reinterpret_cast<volatile long *>(&this->value_))))) - 1; +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + return __sync_sub_and_fetch (&this->value_, 1); #else /* WIN32 */ return static_cast<unsigned long> ((*decrement_fn_) (reinterpret_cast<volatile long *> (&this->value_))); #endif /* WIN32 */ @@ -257,6 +273,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator+= (unsigned long rhs) rhs)) + rhs; #elif defined (ACE_HAS_VXATOMICLIB) return static_cast<unsigned long> (::vxAtomicAdd (reinterpret_cast <atomic_t*>(const_cast<long *> (reinterpret_cast<volatile long *>(&this->value_))), rhs)) + rhs; +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + return __sync_add_and_fetch (&this->value_, rhs); #else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ return static_cast<unsigned long> ((*exchange_add_fn_) (reinterpret_cast<volatile long *> (&this->value_), rhs)) + rhs; #endif /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ @@ -273,6 +291,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator-= (unsigned long rhs) -static_cast<long>(rhs))) - rhs; #elif defined (ACE_HAS_VXATOMICLIB) return static_cast<unsigned long> (::vxAtomicSub (reinterpret_cast <atomic_t*>(const_cast<long *> (reinterpret_cast<volatile long *>(&this->value_))), rhs)) - rhs; +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + return __sync_sub_and_fetch (&this->value_, rhs); #else /* WIN32 && ACE_HAS_INTERLOCKED_EXCHANGEADD */ long l_rhs = static_cast<long> (rhs); return static_cast<unsigned long> ((*exchange_add_fn_) (reinterpret_cast<volatile long *> (&this->value_), -l_rhs)) - rhs; @@ -324,6 +344,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= (unsigned long rhs) ::InterlockedExchange (const_cast<long *> (reinterpret_cast<volatile long*> (&this->value_)), rhs); #elif defined (ACE_HAS_VXATOMICLIB) ::vxAtomicSet (reinterpret_cast <atomic_t*>(const_cast<long *> (reinterpret_cast<volatile long*> (&this->value_))), rhs); +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + __sync_lock_test_and_set (&this->value_, rhs); #else /* WIN32 */ (*exchange_fn_) (reinterpret_cast<volatile long *> (&this->value_), rhs); #endif /* WIN32 */ @@ -340,6 +362,8 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::operator= ( ::InterlockedExchange (const_cast<long *> (reinterpret_cast<volatile long*> (&this->value_)), rhs.value_); #elif defined (ACE_HAS_VXATOMICLIB) ::vxAtomicSet (reinterpret_cast <atomic_t*>(const_cast<long *> (reinterpret_cast<volatile long*> (&this->value_))), rhs.value_); +#elif defined (ACE_USES_GCC_ATOMIC_BUILTINS) && (ACE_USES_GCC_ATOMIC_BUILTINS == 1) + __sync_lock_test_and_set (&this->value_, rhs.value_); #else /* WIN32 */ (*exchange_fn_) (reinterpret_cast<volatile long *> (&this->value_), rhs.value_); #endif /* WIN32 */ diff --git a/ace/CDR_Base.h b/ace/CDR_Base.h index 2cddbc0c12b..da0215327ac 100644 --- a/ace/CDR_Base.h +++ b/ace/CDR_Base.h @@ -220,7 +220,6 @@ public: // complain about no ANSI C++ long long. typedef longlong_t LongLong; # else - // LynxOS 2.5.0 and Linux don't have u_longlong_t. typedef long long LongLong; # endif /* sun */ # else /* no native 64 bit integer type */ diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp index f00a4c0c5b3..3d3975fc9aa 100644 --- a/ace/CDR_Stream.cpp +++ b/ace/CDR_Stream.cpp @@ -533,7 +533,7 @@ ACE_OutputCDR::write_8 (const ACE_CDR::ULongLong *x) if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) { -#if defined (__arm__) +#if defined (__arm__) && !defined (ACE_HAS_IPHONE) // Convert to Intel format (12345678 => 56781234) const char *orig = reinterpret_cast<const char *> (x); char *target = buf; @@ -1612,7 +1612,7 @@ ACE_InputCDR::read_8 (ACE_CDR::ULongLong *x) if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) { #if !defined (ACE_DISABLE_SWAP_ON_READ) -# if defined (__arm__) +# if defined (__arm__) && !defined (ACE_HAS_IPHONE) if (!this->do_byte_swap_) { // Convert from Intel format (12345678 => 56781234) diff --git a/ace/Condition_Recursive_Thread_Mutex.cpp b/ace/Condition_Recursive_Thread_Mutex.cpp index f95fdaf0939..01607d8c52c 100644 --- a/ace/Condition_Recursive_Thread_Mutex.cpp +++ b/ace/Condition_Recursive_Thread_Mutex.cpp @@ -63,7 +63,7 @@ ACE_Condition<ACE_Recursive_Thread_Mutex>::wait (ACE_Recursive_Thread_Mutex &mut const ACE_Time_Value *abstime) { ACE_recursive_mutex_state mutex_state_holder; - ACE_recursive_thread_mutex_t &recursive_mutex = mutex.mutex (); + ACE_recursive_thread_mutex_t &recursive_mutex = mutex.lock (); if (ACE_OS::recursive_mutex_cond_unlock (&recursive_mutex, mutex_state_holder) == -1) diff --git a/ace/Condition_T.cpp b/ace/Condition_T.cpp index bc63d7411f2..0e2c465f75f 100644 --- a/ace/Condition_T.cpp +++ b/ace/Condition_T.cpp @@ -87,7 +87,7 @@ ACE_Condition<MUTEX>::wait (void) { // ACE_TRACE ("ACE_Condition<MUTEX>::wait"); return ACE_OS::cond_wait (&this->cond_, - &this->mutex_.lock_); + &this->mutex_.lock ()); } template <class MUTEX> int @@ -96,13 +96,15 @@ ACE_Condition<MUTEX>::wait (MUTEX &mutex, { // ACE_TRACE ("ACE_Condition<MUTEX>::wait"); if (abstime == 0) + { return ACE_OS::cond_wait (&this->cond_, - &mutex.lock_); + &mutex.lock ()); + } else { ACE_Time_Value tv = *abstime; return ACE_OS::cond_timedwait (&this->cond_, - &mutex.lock_, + &mutex.lock (), &tv); } } diff --git a/ace/Connector.cpp b/ace/Connector.cpp index d3298942196..db184ac1253 100644 --- a/ace/Connector.cpp +++ b/ace/Connector.cpp @@ -122,7 +122,7 @@ ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_timeout ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_timeout"); SVC_HANDLER *svc_handler = 0; - int retval = this->close (svc_handler) ? 0 : -1; + int const retval = this->close (svc_handler) ? 0 : -1; // Forward to the SVC_HANDLER the <arg> that was passed in as a // magic cookie during ACE_Connector::connect(). This gives the diff --git a/ace/Containers_T.h b/ace/Containers_T.h index 25a46450abd..e14357c352d 100644 --- a/ace/Containers_T.h +++ b/ace/Containers_T.h @@ -1993,13 +1993,8 @@ class ACE_Array : public ACE_Array_Base<T> public: // Define a "trait" typedef T TYPE; - typedef ACE_Array_Iterator<T> ITERATOR; - - // = Exceptions. - - // = Initialization and termination methods. - + /// Dynamically create an uninitialized array. /** * Initialize an empty array of the specified size using the provided diff --git a/ace/Dev_Poll_Reactor.cpp b/ace/Dev_Poll_Reactor.cpp index 75b88255e23..66a0a1ef19c 100644 --- a/ace/Dev_Poll_Reactor.cpp +++ b/ace/Dev_Poll_Reactor.cpp @@ -492,11 +492,23 @@ ACE_Dev_Poll_Reactor::Handler_Repository::unbind_all (void) { ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::unbind_all"); - // Unbind all of the event handlers. + // Unbind all of the event handlers; similar to remove_handler() on all. for (int handle = 0; handle < this->max_size_; ++handle) - this->unbind (handle); + { + Event_Tuple *entry = this->find (handle); + if (entry == 0) + continue; + + // Check for ref counting now - handle_close () may delete eh. + bool const requires_reference_counting = + entry->event_handler->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + + (void) entry->event_handler->handle_close (handle, entry->mask); + this->unbind (handle, requires_reference_counting); + } return 0; } @@ -597,6 +609,9 @@ ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor (ACE_Sig_Handler *sh, , poll_fd_ (ACE_INVALID_HANDLE) , size_ (0) // , ready_set_ () +#if defined (ACE_HAS_EVENT_POLL) + , epoll_wait_in_progress_ (false) +#endif /* ACE_HAS_EVENT_POLL */ #if defined (ACE_HAS_DEV_POLL) , dp_fds_ (0) , start_pfds_ (0) @@ -864,7 +879,7 @@ ACE_Dev_Poll_Reactor::close (void) this->delete_signal_handler_ = false; } - (void) this->handler_rep_.close (); + (void) this->handler_rep_.close (); if (this->delete_timer_queue_) { @@ -953,11 +968,33 @@ ACE_Dev_Poll_Reactor::work_pending_i (ACE_Time_Value * max_wait_time) #if defined (ACE_HAS_EVENT_POLL) - // Wait for an event. - int const nfds = ::epoll_wait (this->poll_fd_, - &this->event_, - 1, - static_cast<int> (timeout)); + // See if there are handlers that have to be resumed before waiting. + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, grd, this->to_be_resumed_lock_, -1); + this->epoll_wait_in_progress_ = true; + for (Resume_Map::iterator i = this->to_be_resumed_.begin (); + i != this->to_be_resumed_.end (); + ++i) + { + // Make sure that 1) the handle is still registered, + // 2) the registered handler is the one we're waiting to resume. + Event_Tuple *info = this->handler_rep_.find (i->first); + if (info != 0 && info->event_handler == i->second) + { + this->resume_handler_i (i->first); + } + } + this->to_be_resumed_.clear (); + } + + // Wait for an event. + int const nfds = ::epoll_wait (this->poll_fd_, + &this->event_, + 1, + static_cast<int> (timeout)); + // Count on this being an atomic update; at worst, we may get an + // extraneous notify() from dispatch_io_event. + this->epoll_wait_in_progress_ = false; #else @@ -1269,13 +1306,21 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard) // With epoll, events are registered with oneshot, so the handle is // effectively suspended; future calls to epoll_wait() will select // the next event, so they're not managed here. - // The hitch to this is that the notify handler must always be resumed - // immediately, before letting go of the guard. Else it's possible to - // get into a state where all handles, including the notify pipe, are - // suspended and that means the wait thread can't be interrupted. - info->suspended = true; - if (eh == this->notify_handler_) - this->resume_handler_i (handle); + // The hitch to this is that the notify handler is always registered + // WITHOUT oneshot and is never suspended/resumed. This avoids endless + // notify loops caused by the notify handler requiring a resumption + // which requires the token, which requires a notify, etc. described + // in Bugzilla 3714. So, never suspend the notify handler. + + bool reactor_resumes_eh = false; + if (eh != this->notify_handler_) + { + info->suspended = true; + + reactor_resumes_eh = + eh->resume_handler () == + ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER; + } #endif /* ACE_HAS_DEV_POLL */ int status = 0; // gets callback status, below. @@ -1294,6 +1339,39 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard) // if callback returns > 0. We come back with either 0 or < 0. status = this->upcall (eh, callback, handle); + if (eh == this->notify_handler_) + return status == 0 ? 1 : -1; + + // If the callback returned 0, epoll-based needs to resume the + // suspended handler but dev/poll doesn't. + // The epoll case is optimized to not acquire the token in order + // to resume the handler; the handler is added to a list of those + // that need to be resumed and is handled by the next leader + // that does an epoll_wait(). + // In both epoll and dev/poll cases, if the callback returns <0, + // the token needs to be acquired and the handler checked and + // removed if it hasn't already been. + if (status == 0) + { +#ifdef ACE_HAS_EVENT_POLL + // epoll-based effectively suspends handlers around the upcall. + // If the handler must be resumed, add it to the list. + if (reactor_resumes_eh) + { + ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, + grd, + this->to_be_resumed_lock_, + -1); + bool map_was_empty = this->to_be_resumed_.empty(); + this->to_be_resumed_.insert + (Resume_Map::value_type (handle, eh)); + if (this->epoll_wait_in_progress_ && map_was_empty) + this->notify(); + } +#endif /* ACE_HAS_EVENT_POLL */ + return 1; + } + // All state in the handler repository may have changed during the // upcall while other threads had the token. Thus, reacquire the // token and evaluate what's needed. If the upcalled handler is still @@ -1305,15 +1383,6 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard) { if (status < 0) this->remove_handler_i (handle, disp_mask); - -#ifdef ACE_HAS_EVENT_POLL - // epoll-based effectively suspends handlers around the upcall. - // If the handler must be resumed here, do it now. - if (info->suspended && - (eh->resume_handler () == - ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER)) - this->resume_handler_i (handle); -#endif /* ACE_HAS_EVENT_POLL */ } } // Scope close handles eh ref count decrement, if needed. @@ -1416,8 +1485,13 @@ ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle, ACE_OS::memset (&epev, 0, sizeof (epev)); static const int op = EPOLL_CTL_ADD; - epev.events = this->reactor_mask_to_poll_event (mask) | EPOLLONESHOT; epev.data.fd = handle; + epev.events = this->reactor_mask_to_poll_event (mask); + // All but the notify handler get registered with oneshot to facilitate + // auto suspend before the upcall. See dispatch_io_event for more + // information. + if (event_handler != this->notify_handler_) + epev.events |= EPOLLONESHOT; if (::epoll_ctl (this->poll_fd_, op, handle, &epev) == -1) { @@ -1575,7 +1649,7 @@ ACE_Dev_Poll_Reactor::remove_handler_i (ACE_HANDLE handle, // If registered event handler not the same as eh, don't mess with // the mask, but do the proper callback and refcount when needed. bool handle_reg_changed = true; - Event_Tuple *info = this->handler_rep_.find (handle); + Event_Tuple *info = this->handler_rep_.find (handle); if (info == 0 && eh == 0) // Nothing to work with return -1; if (info != 0 && (eh == 0 || info->event_handler == eh)) @@ -1599,12 +1673,6 @@ ACE_Dev_Poll_Reactor::remove_handler_i (ACE_HANDLE handle, if (!handle_reg_changed && info->mask == ACE_Event_Handler::NULL_MASK) this->handler_rep_.unbind (handle, requires_reference_counting); - // Note the fact that we've changed the state of the wait_set, - // i.e. the "interest set," which is used by the dispatching loop to - // determine whether it can keep going or if it needs to reconsult - // /dev/poll or /dev/epoll. - // this->state_changed_ = 1; - return 0; } diff --git a/ace/Dev_Poll_Reactor.h b/ace/Dev_Poll_Reactor.h index 02f5f7fd457..53b8befb7cb 100644 --- a/ace/Dev_Poll_Reactor.h +++ b/ace/Dev_Poll_Reactor.h @@ -43,6 +43,7 @@ #if defined (ACE_HAS_DEV_POLL) struct pollfd; #elif defined (ACE_HAS_EVENT_POLL) +# include "ace/Array_Map.h" # include /**/ <sys/epoll.h> #endif @@ -1055,6 +1056,17 @@ protected: /// epoll_wait() but not yet processed. struct epoll_event event_; + /// Event handlers that are suspended/resumed around upcalls are not + /// immediately resumed; they're added to this list for resumption at + /// the next epoll_wait() call. This avoids always needing to acquire the + /// token just to resume a handler. Of course, if there are no other + /// handlers in the to-be-resumed list and an epoll_wait is already in + /// progress, the reactor needs to be notified to force another run around + /// the epoll_wait() call. + typedef ACE_Array_Map<ACE_HANDLE, ACE_Event_Handler *> Resume_Map; + Resume_Map to_be_resumed_; + volatile bool epoll_wait_in_progress_; + ACE_SYNCH_MUTEX to_be_resumed_lock_; #else /// The pollfd array that `/dev/poll' will feed its results to. struct pollfd *dp_fds_; diff --git a/ace/ETCL/ETCL_l.cpp b/ace/ETCL/ETCL_l.cpp index 37ca3d8d26d..bb343092dfc 100644 --- a/ace/ETCL/ETCL_l.cpp +++ b/ace/ETCL/ETCL_l.cpp @@ -563,7 +563,7 @@ YY_MALLOC_DECL /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ETCL_ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ETCL_ECHO { size_t __dum_ret = fwrite( yytext, yyleng, 1, yyout ); (void) __dum_ret; } #endif //FUZZ: enable check_for_lack_ACE_OS diff --git a/ace/FoxReactor/FoxReactor.h b/ace/FoxReactor/FoxReactor.h index 94ffd92508b..5033c8f61ac 100644 --- a/ace/FoxReactor/FoxReactor.h +++ b/ace/FoxReactor/FoxReactor.h @@ -28,7 +28,7 @@ #include "ace/Select_Reactor.h" #include "ace/FoxReactor/ACE_FoxReactor_export.h" -#include <fox/fx.h> +#include <fx.h> /** * @class ACE_FoxReactor diff --git a/ace/Init_ACE.h b/ace/Init_ACE.h index 164f61e1d70..596e2b5f591 100644 --- a/ace/Init_ACE.h +++ b/ace/Init_ACE.h @@ -6,8 +6,11 @@ * * $Id$ * - * Initialize ACE library services. Can be called only once per - * program invocation. + * Initialize and finalize the ACE library services. You can + * generally execute the @a ACE::init() and @a ACE::fini() sequence + * multiple times, but be aware that nothing that ACE controls (e.g., + * singletons, thread-specific services, loaded services, etc.) will + * survive the @a ACE::fini(). */ //============================================================================= @@ -28,17 +31,22 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE { /** - * This class implements the functions for the initialization and - * shutting down ACE. These functions are called only once per ACE - * invokation. - * @return Returns 0 on success, -1 on failure, and 1 if it had already been - * called. + * This method initializes the ACE library services and initializes + * ACE's internal resources. Applications should not instantiate + * ACE classes or call methods on objects of these classes until @a + * ACE::init() returns successfully. + + * @return Returns 0 on success, -1 on failure, and 1 if it had + * already been called. */ extern ACE_Export int init (void); /** - * Shut down ACE library services. Can be called only once per - * program invocation. + * Finalize the ACE library services and releases ACE's internal + * resources. In general, do not instantiate ACE classes or call + * methods on objects of these classes after @a ACE::fini() has been + * called. + * * @return Returns 0 on success, -1 on failure, and 1 if it had already been * called. */ diff --git a/ace/LSOCK.cpp b/ace/LSOCK.cpp index 71f93fdde9c..3b3c46885bf 100644 --- a/ace/LSOCK.cpp +++ b/ace/LSOCK.cpp @@ -59,7 +59,8 @@ ACE_LSOCK::send_handle (const ACE_HANDLE handle) const cmsgptr->cmsg_len = sizeof cmsgbuf; send_msg.msg_control = cmsgbuf; send_msg.msg_controllen = sizeof cmsgbuf; - *(ACE_HANDLE *) CMSG_DATA (cmsgptr) = handle; + ACE_HANDLE *ph = (ACE_HANDLE *) CMSG_DATA (cmsgptr); + *ph = handle; send_msg.msg_flags = 0; #else send_msg.msg_accrights = (char *) &handle; @@ -143,7 +144,9 @@ ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const { #if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) // Close down the socket that was returned by the MSG_PEEK. - ACE_OS::closesocket (*(ACE_HANDLE *) CMSG_DATA ((cmsghdr *) cmsgbuf)); + cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf; + ACE_HANDLE * ph = (ACE_HANDLE *) CMSG_DATA (cmsgptr); + ACE_OS::closesocket (*ph); recv_msg.msg_control = cmsgbuf; recv_msg.msg_controllen = sizeof cmsgbuf; #else @@ -158,7 +161,8 @@ ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const { #if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) cmsghdr *cmsgptr = (cmsghdr *) cmsgbuf; - handle = *(ACE_HANDLE *) CMSG_DATA (cmsgptr); + ACE_HANDLE * ph = (ACE_HANDLE *) CMSG_DATA (cmsgptr); + handle = *ph; #endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ return 1; } diff --git a/ace/MEM_IO.cpp b/ace/MEM_IO.cpp index 4fdbd50b72e..1b61ead04a7 100644 --- a/ace/MEM_IO.cpp +++ b/ace/MEM_IO.cpp @@ -54,7 +54,7 @@ ACE_Reactive_MEM_IO::recv_buf (ACE_MEM_SAP_Node *&buf, buf = 0; return 0; } - else if (retv != sizeof (ACE_OFF_T)) + else if (retv != static_cast <ssize_t> (sizeof (ACE_OFF_T))) { // Nothing available or we are really screwed. buf = 0; @@ -75,26 +75,26 @@ ACE_Reactive_MEM_IO::send_buf (ACE_MEM_SAP_Node *buf, { return -1; } - + // The offset. ACE_OFF_T offset = ACE_Utils::truncate_cast<ACE_OFF_T> ( reinterpret_cast<char *> (buf) - static_cast<char *> (this->shm_malloc_->base_addr ())); - + // Send the offset value over the socket. if (ACE::send (this->handle_, (const char *) &offset, sizeof (offset), flags, - timeout) != sizeof (offset)) + timeout) != static_cast <ssize_t> (sizeof (offset))) { // unsucessful send, release the memory in the shared-memory. this->release_buffer (buf); return -1; } - + return ACE_Utils::truncate_cast<ssize_t> (buf->size ()); } diff --git a/ace/Message_Queue_NT.cpp b/ace/Message_Queue_NT.cpp index 3c4fbe99c64..ede04803e56 100644 --- a/ace/Message_Queue_NT.cpp +++ b/ace/Message_Queue_NT.cpp @@ -1,5 +1,6 @@ // $Id$ +#include "ace/Message_Queue.h" #include "ace/Message_Queue_NT.h" #include "ace/Log_Msg.h" @@ -11,7 +12,6 @@ ACE_RCSID (ace, Message_Queue_NT, "$Id$") - ACE_BEGIN_VERSIONED_NAMESPACE_DECL #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) diff --git a/ace/Message_Queue_T.cpp b/ace/Message_Queue_T.cpp index 71ff07b8ec5..762482949bb 100644 --- a/ace/Message_Queue_T.cpp +++ b/ace/Message_Queue_T.cpp @@ -9,6 +9,10 @@ #include "ace/Log_Msg.h" #include "ace/OS_NS_sys_time.h" +#if defined (ACE_HAS_WIN32_OVERLAPPED_IO) +#include "ace/Message_Queue_NT.h" +#endif /* ACE_HAS_WIN32_OVERLAPPED_IO */ + #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ diff --git a/ace/OS_NS_Thread.cpp b/ace/OS_NS_Thread.cpp index 9315613c74b..a428378f7bf 100644 --- a/ace/OS_NS_Thread.cpp +++ b/ace/OS_NS_Thread.cpp @@ -5164,9 +5164,9 @@ add_to_argv (int& argc, char** argv, int max_args, char* string) } else if (string[i] == '\\') // Escape the next character { - // The next character is automatically - // skipped because of the strcpy - ACE_OS::strcpy (string + i, string + i + 1); + // The next character is automatically skipped because + // of the memmove(). + ACE_OS::memmove (string + i, string + i + 1, length); --length; } else if (!indouble && diff --git a/ace/OS_NS_arpa_inet.cpp b/ace/OS_NS_arpa_inet.cpp index 6dd3d2a75c5..5ad33ea732c 100644 --- a/ace/OS_NS_arpa_inet.cpp +++ b/ace/OS_NS_arpa_inet.cpp @@ -36,7 +36,7 @@ ACE_OS::inet_aton (const char *host_name, struct in_addr *addr) addr->s_addr = ip_addr; // Network byte ordered return 1; } -#elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670) +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x680) // inet_aton() returns OK (0) on success and ERROR (-1) on failure. // Must reset errno first. Refer to WindRiver SPR# 34949, SPR# 36026 ::errnoSet(0); diff --git a/ace/OS_NS_math.h b/ace/OS_NS_math.h index 49143738a79..ac02cd3070f 100644 --- a/ace/OS_NS_math.h +++ b/ace/OS_NS_math.h @@ -91,9 +91,17 @@ namespace ACE_OS ACE_NAMESPACE_INLINE_FUNCTION double floor (double x); + /// This method computes the largest integral value not greater than x. + ACE_NAMESPACE_INLINE_FUNCTION + long double floor (long double x); + /// This method computes the smallest integral value not less than x. ACE_NAMESPACE_INLINE_FUNCTION double ceil (double x); + + /// This method computes the smallest integral value not less than x. + ACE_NAMESPACE_INLINE_FUNCTION + long double ceil (long double x); /// This method computes the base-2 logarithm of x. ACE_NAMESPACE_INLINE_FUNCTION diff --git a/ace/OS_NS_math.inl b/ace/OS_NS_math.inl index ff368b53c0d..a07cc081299 100644 --- a/ace/OS_NS_math.inl +++ b/ace/OS_NS_math.inl @@ -22,6 +22,22 @@ namespace ACE_OS { #endif } + ACE_INLINE long double + floor (long double x) + { +#if defined (ACE_LACKS_FLOORL) + // This method computes the largest integral value not greater than x. + if(x > 0) + return static_cast<long> (x); + else if ((static_cast<long> (x) < x) || (static_cast<long> (x) > x) ) + return static_cast<long>(x) - 1; + else + return x; +#else + return ::floorl (x); +#endif + } + ACE_INLINE double ceil (double x) { @@ -38,6 +54,22 @@ namespace ACE_OS { #endif } + ACE_INLINE long double + ceil (long double x) + { +#if defined (ACE_LACKS_CEILL) + // This method computes the smallest integral value not less than x. + if (x < 0) + return static_cast<long> (x); + else if ((static_cast<long> (x) < x) || (static_cast<long> (x) > x)) + return static_cast<long> (x) + 1; + else + return x; +#else + return ::ceill (x); +#endif + } + ACE_INLINE double log2 (double x) { diff --git a/ace/OS_NS_netdb.cpp b/ace/OS_NS_netdb.cpp index bb53fdaf446..345162a4a3c 100644 --- a/ace/OS_NS_netdb.cpp +++ b/ace/OS_NS_netdb.cpp @@ -385,6 +385,58 @@ ACE_OS::getmacaddress (struct macaddr_node_t *node) return 0; +#elif defined (ACE_HAS_IPHONE) || defined (ACE_HAS_MAC_OSX) + + const long BUFFERSIZE = 4000; + char buffer[BUFFERSIZE]; + + struct ifconf ifc; + struct ifreq* ifr; + + ACE_HANDLE handle = + ACE_OS::socket (AF_INET, SOCK_DGRAM, 0); + + if (handle == ACE_INVALID_HANDLE) + return -1; + + ifc.ifc_len = BUFFERSIZE; + ifc.ifc_buf = buffer; + + if (ACE_OS::ioctl (handle, SIOCGIFCONF, &ifc) < 0) + { + ACE_OS::close (handle); + return -1; + } + + for(char* ptr=buffer; ptr < buffer + ifc.ifc_len; ) + { + ifr = (struct ifreq *) ptr; + + if (ifr->ifr_addr.sa_family == AF_LINK) + { + if(ACE_OS::strcmp (ifr->ifr_name, "en0") == 0) + { + struct sockaddr_dl* sdl = + (struct sockaddr_dl *) &ifr->ifr_addr; + + ACE_OS::memcpy (node->node, + LLADDR(sdl), + 6); + } + } + + ptr += sizeof(ifr->ifr_name); + + if(sizeof(ifr->ifr_addr) > ifr->ifr_addr.sa_len) + ptr += sizeof(ifr->ifr_addr); + else + ptr += ifr->ifr_addr.sa_len; + } + + ACE_OS::close (handle); + + return 0; + #else ACE_UNUSED_ARG (node); ACE_NOTSUP_RETURN (-1); diff --git a/ace/OS_NS_stdlib.h b/ace/OS_NS_stdlib.h index 8385df4da44..9f5dcb340a7 100644 --- a/ace/OS_NS_stdlib.h +++ b/ace/OS_NS_stdlib.h @@ -242,7 +242,7 @@ namespace ACE_OS { #else extern ACE_Export ACE_TCHAR *mktemp (ACE_TCHAR *s); -#endif /* !ACE_LACKS_MSTEMP */ +#endif /* !ACE_LACKS_MKTEMP */ ACE_NAMESPACE_INLINE_FUNCTION int putenv (const char *string); diff --git a/ace/OS_NS_unistd.inl b/ace/OS_NS_unistd.inl index 414cb40688b..ac103088ed2 100644 --- a/ace/OS_NS_unistd.inl +++ b/ace/OS_NS_unistd.inl @@ -23,7 +23,7 @@ # include "ace/os_include/os_unistd.h" #endif /* ACE_HAS_ACCESS_EMULATION */ -#if defined (ACE_VXWORKS) && (((ACE_VXWORKS >= 0x620) && (ACE_VXWORKS <= 0x670)) || defined (ACE_HAS_VXWORKS551_MEDUSA)) +#if defined (ACE_VXWORKS) && (((ACE_VXWORKS >= 0x620) && (ACE_VXWORKS <= 0x680)) || defined (ACE_HAS_VXWORKS551_MEDUSA)) # if defined (__RTP__) # include "ace/os_include/os_strings.h" # else diff --git a/ace/Obstack_T.cpp b/ace/Obstack_T.cpp index ecce0636b2d..dc1d0acfc6c 100644 --- a/ace/Obstack_T.cpp +++ b/ace/Obstack_T.cpp @@ -19,11 +19,11 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Obstack_T) -template <class CHAR> void -ACE_Obstack_T<CHAR>::dump (void) const +template <class ACE_CHAR_T> void +ACE_Obstack_T<ACE_CHAR_T>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_Obstack_T<CHAR>::dump"); + ACE_TRACE ("ACE_Obstack_T<ACE_CHAR_T>::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("size_ = %d\n"), this->size_)); @@ -33,13 +33,13 @@ ACE_Obstack_T<CHAR>::dump (void) const #endif /* ACE_HAS_DUMP */ } -template <class CHAR> int -ACE_Obstack_T<CHAR>::request (size_t len) +template <class ACE_CHAR_T> int +ACE_Obstack_T<ACE_CHAR_T>::request (size_t len) { - ACE_TRACE ("ACE_Obstack_T<CHAR>::request"); + ACE_TRACE ("ACE_Obstack_T<ACE_CHAR_T>::request"); // normalize the length. - len *= sizeof (CHAR); + len *= sizeof (ACE_CHAR_T); // Check to see if there's room for the requested length, including // any part of an existing string, if any. @@ -89,15 +89,15 @@ ACE_Obstack_T<CHAR>::request (size_t len) return 0; } -template <class CHAR> CHAR * -ACE_Obstack_T<CHAR>::grow (CHAR c) +template <class ACE_CHAR_T> ACE_CHAR_T * +ACE_Obstack_T<ACE_CHAR_T>::grow (ACE_CHAR_T c) { - ACE_TRACE ("ACE_Obstack_T<CHAR>::grow"); + ACE_TRACE ("ACE_Obstack_T<ACE_CHAR_T>::grow"); if (this->request (1) == 0) { - CHAR *retv = reinterpret_cast<CHAR *> (this->curr_->cur_); - this->curr_->cur_ += sizeof (CHAR); + ACE_CHAR_T *retv = reinterpret_cast<ACE_CHAR_T *> (this->curr_->cur_); + this->curr_->cur_ += sizeof (ACE_CHAR_T); *retv = c; return retv; } @@ -105,10 +105,10 @@ ACE_Obstack_T<CHAR>::grow (CHAR c) return 0; } -template <class CHAR> ACE_Obchunk * -ACE_Obstack_T<CHAR>::new_chunk (void) +template <class ACE_CHAR_T> ACE_Obchunk * +ACE_Obstack_T<ACE_CHAR_T>::new_chunk (void) { - ACE_TRACE ("ACE_Obstack_T<CHAR>::new_chunk"); + ACE_TRACE ("ACE_Obstack_T<ACE_CHAR_T>::new_chunk"); ACE_Obchunk *temp = 0; @@ -120,15 +120,15 @@ ACE_Obstack_T<CHAR>::new_chunk (void) return temp; } -template <class CHAR> -ACE_Obstack_T<CHAR>::ACE_Obstack_T (size_t size, +template <class ACE_CHAR_T> +ACE_Obstack_T<ACE_CHAR_T>::ACE_Obstack_T (size_t size, ACE_Allocator *allocator_strategy) : allocator_strategy_ (allocator_strategy), size_ (size), head_ (0), curr_ (0) { - ACE_TRACE ("ACE_Obstack_T<CHAR>::ACE_Obstack"); + ACE_TRACE ("ACE_Obstack_T<ACE_CHAR_T>::ACE_Obstack"); if (this->allocator_strategy_ == 0) ACE_ALLOCATOR (this->allocator_strategy_, @@ -138,10 +138,10 @@ ACE_Obstack_T<CHAR>::ACE_Obstack_T (size_t size, this->curr_ = this->head_; } -template <class CHAR> -ACE_Obstack_T<CHAR>::~ACE_Obstack_T (void) +template <class ACE_CHAR_T> +ACE_Obstack_T<ACE_CHAR_T>::~ACE_Obstack_T (void) { - ACE_TRACE ("ACE_Obstack_T<CHAR>::~ACE_Obstack_T"); + ACE_TRACE ("ACE_Obstack_T<ACE_CHAR_T>::~ACE_Obstack_T"); ACE_Obchunk *temp = this->head_; @@ -154,23 +154,23 @@ ACE_Obstack_T<CHAR>::~ACE_Obstack_T (void) } } -template <class CHAR> CHAR * -ACE_Obstack_T<CHAR>::copy (const CHAR *s, +template <class ACE_CHAR_T> ACE_CHAR_T * +ACE_Obstack_T<ACE_CHAR_T>::copy (const ACE_CHAR_T *s, size_t len) { - ACE_TRACE ("ACE_Obstack_T<CHAR>::copy"); + ACE_TRACE ("ACE_Obstack_T<ACE_CHAR_T>::copy"); if (this->request (len) != 0) return 0; - size_t tsize = len * sizeof (CHAR); + size_t tsize = len * sizeof (ACE_CHAR_T); ACE_OS::memcpy (this->curr_->cur_, s, tsize); this->curr_->cur_ += tsize ; return this->freeze (); } -template <class CHAR> void -ACE_Obstack_T<CHAR>::unwind (void* obj) +template <class ACE_CHAR_T> void +ACE_Obstack_T<ACE_CHAR_T>::unwind (void* obj) { if (obj >= this->curr_->contents_ && obj < this->curr_->end_) this->curr_->block_ = this->curr_->cur_ = reinterpret_cast<char*> (obj); @@ -178,8 +178,8 @@ ACE_Obstack_T<CHAR>::unwind (void* obj) this->unwind_i (obj); } -template <class CHAR> void -ACE_Obstack_T<CHAR>::unwind_i (void* obj) +template <class ACE_CHAR_T> void +ACE_Obstack_T<ACE_CHAR_T>::unwind_i (void* obj) { ACE_Obchunk* curr = this->head_; while (curr != 0 && (curr->contents_ > obj || curr->end_ < obj)) @@ -194,29 +194,29 @@ ACE_Obstack_T<CHAR>::unwind_i (void* obj) ACE_TEXT ("Deletion of non-existent object.\n%a"))); } -template <class CHAR> void -ACE_Obstack_T<CHAR>::release (void) +template <class ACE_CHAR_T> void +ACE_Obstack_T<ACE_CHAR_T>::release (void) { - ACE_TRACE ("ACE_Obstack_T<CHAR>::release"); + ACE_TRACE ("ACE_Obstack_T<ACE_CHAR_T>::release"); this->curr_ = this->head_; this->curr_->block_ = this->curr_->cur_ = this->curr_->contents_; } -template <class CHAR> void -ACE_Obstack_T<CHAR>::grow_fast (CHAR c) +template <class ACE_CHAR_T> void +ACE_Obstack_T<ACE_CHAR_T>::grow_fast (ACE_CHAR_T c) { - * (reinterpret_cast<CHAR *> (this->curr_->cur_)) = c; - this->curr_->cur_ += sizeof (CHAR); + * (reinterpret_cast<ACE_CHAR_T *> (this->curr_->cur_)) = c; + this->curr_->cur_ += sizeof (ACE_CHAR_T); } -template <class CHAR> CHAR * -ACE_Obstack_T<CHAR>::freeze (void) +template <class ACE_CHAR_T> ACE_CHAR_T * +ACE_Obstack_T<ACE_CHAR_T>::freeze (void) { - CHAR *retv = reinterpret_cast<CHAR *> (this->curr_->block_); - * (reinterpret_cast<CHAR *> (this->curr_->cur_)) = 0; + ACE_CHAR_T *retv = reinterpret_cast<ACE_CHAR_T *> (this->curr_->block_); + * (reinterpret_cast<ACE_CHAR_T *> (this->curr_->cur_)) = 0; - this->curr_->cur_ += sizeof (CHAR); + this->curr_->cur_ += sizeof (ACE_CHAR_T); this->curr_->block_ = this->curr_->cur_; return retv; } diff --git a/ace/Obstack_T.h b/ace/Obstack_T.h index 3e24ab31925..ed1d1d20259 100644 --- a/ace/Obstack_T.h +++ b/ace/Obstack_T.h @@ -34,12 +34,12 @@ class ACE_Allocator; * The implementation is similar to the GNU obstack utility, * which is used extensively in the GCC compiler. */ -template <class CHAR> +template <class ACE_CHAR_T> class ACE_Obstack_T { public: // = Initialization and termination methods. - ACE_Obstack_T (size_t size = (4096 * sizeof (CHAR)) - sizeof (ACE_Obchunk), + ACE_Obstack_T (size_t size = (4096 * sizeof (ACE_CHAR_T)) - sizeof (ACE_Obchunk), ACE_Allocator *allocator_strategy = 0); ~ACE_Obstack_T (void); @@ -47,32 +47,32 @@ public: /// a new string. Return -1 if fail, 0 if success. int request (size_t len); - /// Inserting a new CHAR \a c into the current building + /// Inserting a new ACE_CHAR_T \a c into the current building /// block without freezing (null terminating) the block. /// This function will create new chunk by checking the /// boundary of current Obchunk. Return /// the location \a c gets inserted to, or 0 if error. - CHAR *grow (CHAR c); + ACE_CHAR_T *grow (ACE_CHAR_T c); - /// Inserting a new CHAR \a c into the current building + /// Inserting a new ACE_CHAR_T \a c into the current building /// block without freezing (null terminating) the block and without /// checking for out-of-bound error. - void grow_fast (CHAR c); + void grow_fast (ACE_CHAR_T c); /// Freeze the current building block by null terminating it. /// Return the starting address of the current building block, 0 /// if error occurs. - CHAR *freeze (void); + ACE_CHAR_T *freeze (void); /// Copy the data into the current Obchunk and freeze the current /// block. Return the starting address of the current building /// block, 0 if error occurs. @a len specify the string length, /// not the actually data size. - CHAR *copy (const CHAR *data, + ACE_CHAR_T *copy (const ACE_CHAR_T *data, size_t len); /// Return the maximum @a length or @a size of a string that can be put - /// into this Obstack. @a size = @a length * sizeof (CHAR). + /// into this Obstack. @a size = @a length * sizeof (ACE_CHAR_T). /// /// @deprecated No need to use this function as you can put objects of /// arbitrary lengths into the obstack now. diff --git a/ace/Obstack_T.inl b/ace/Obstack_T.inl index 1eddbdcf4e6..411b6aea1e0 100644 --- a/ace/Obstack_T.inl +++ b/ace/Obstack_T.inl @@ -4,14 +4,14 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <class CHAR> ACE_INLINE size_t -ACE_Obstack_T<CHAR>::length () const +template <class ACE_CHAR_T> ACE_INLINE size_t +ACE_Obstack_T<ACE_CHAR_T>::length () const { - return this->size_ / sizeof (CHAR); + return this->size_ / sizeof (ACE_CHAR_T); } -template <class CHAR> ACE_INLINE size_t -ACE_Obstack_T<CHAR>::size () const +template <class ACE_CHAR_T> ACE_INLINE size_t +ACE_Obstack_T<ACE_CHAR_T>::size () const { return this->size_; } diff --git a/ace/README b/ace/README index 4db871d9c7a..da3f1f1688c 100644 --- a/ace/README +++ b/ace/README @@ -245,8 +245,6 @@ ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR ACE_HAS_BROKEN_ACCEPT_ADDR Platform can't correctly deal with a NULL addr to accept() (e.g, VxWorks). -ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS Compiler can't handle const char * - as rvalue in conditional operator. ACE_HAS_BROKEN_DGRAM_SENDV Platform sendv() does not work properly with datagrams, i.e. it fails when the iovec @@ -307,13 +305,6 @@ ACE_HAS_EBCDIC Compile in the ACE code set classes that support EBCDIC. ACE_HAS_EXCEPTIONS Compiler supports C++ exception handling -ACE_HAS_BROKEN_UNEXPECTED_EXCEPTIONS Compiler does not call - unexpected exception handler - if exception not listed in - exception specification is - thrown. In particular, the - exception specification is not - respected. ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT When a base-class is a specialization of a class template then this class template must be @@ -852,17 +843,6 @@ ACE_LACKS_OPENDIR Platform lacks opendir and the opendir emulation must be used ACE_LACKS_READDIR Platform lacks readdir and the readdir emulation must be used -ACE_LACKS_CMSG_DATA_MACRO Platform has - ACE_HAS_4_4BSD_SENDMSG_RECVMSG but does - not define CMSG_DATA (cmsg) macro. -ACE_LACKS_CMSG_DATA_MEMBER Platform has - ACE_HAS_4_4BSD_SENDMSG_RECVMSG but its - cmsghdr structure does not contain - an 'unsigned char cmsg_data[0]' - member. (This may be - 'unsigned char __cmsg_data[0]' on some - platforms, in which case we need - another macro.) ACE_LACKS_COND_TIMEDWAIT_RESET pthread_cond_timedwait does *not* reset the time argument when the lock is acquired. @@ -992,7 +972,6 @@ ACE_LACKS_PUTENV_PROTOTYPE Platform/compiler lacks the LynxOS) ACE_LACKS_PWD_REENTRANT_FUNCTIONS Platform lacks getpwnam_r() methods (e.g., SGI 6.2). -ACE_LACKS_SID Platform lacks setsid() ACE_LACKS_QSORT Compiler/platform lacks the standard C library qsort() function @@ -1045,7 +1024,6 @@ ACE_LACKS_SIGSET Platform lacks signal sets (e.g., Chorus and Win32) ACE_LACKS_STRPTIME Platform/compiler lacks the strptime() function. -ACE_LACKS_STRCHR Platform/compiler lacks strchr() ACE_LACKS_WCSCHR Platform/compiler lacks wcschr() ACE_LACKS_STRDUP Platform/compiler lacks strdup() ACE_LACKS_WCSDUP Platform/compiler lacks wcsdup() diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp index ed9d70be269..8b8be61d4df 100644 --- a/ace/Reactor.cpp +++ b/ace/Reactor.cpp @@ -477,7 +477,9 @@ ACE_Reactor::notify (ACE_Event_Handler *event_handler, // First, try to remember this reactor in the event handler, in case // the event handler goes away before the notification is delivered. if (event_handler != 0 && event_handler->reactor () == 0) - event_handler->reactor (this); + { + event_handler->reactor (this); + } return this->implementation ()->notify (event_handler, mask, tv); } diff --git a/ace/Reactor.h b/ace/Reactor.h index a791a65227d..1e20c358bf7 100644 --- a/ace/Reactor.h +++ b/ace/Reactor.h @@ -281,8 +281,8 @@ public: * that were dispatched, 0 if the @a max_wait_time elapsed without * dispatching any handlers, or -1 if an error occurs. * - * The only difference between <alertable_handle_events> and - * <handle_events> is that in the alertable case, the eventloop will + * The only difference between alertable_handle_events() and + * handle_events() is that in the alertable case, the eventloop will * return when the system queues an I/O completion routine or an * Asynchronous Procedure Call. */ @@ -294,8 +294,8 @@ public: * @a max_wait_time value is a reference and can therefore never be * NULL. * - * The only difference between <alertable_handle_events> and - * <handle_events> is that in the alertable case, the eventloop will + * The only difference between alertable_handle_events() and + * handle_events() is that in the alertable case, the eventloop will * return when the system queues an I/O completion routine or an * Asynchronous Procedure Call. */ @@ -703,7 +703,7 @@ public: * Set the maximum number of times that ACE_Reactor will * iterate and dispatch the ACE_Event_Handlers that are passed in * via the notify queue before breaking out of its - * <ACE_Message_Queue::dequeue> loop. By default, this is set to + * ACE_Message_Queue::dequeue() loop. By default, this is set to * -1, which means "iterate until the queue is empty." Setting this * to a value like "1 or 2" will increase "fairness" (and thus * prevent starvation) at the expense of slightly higher dispatching @@ -715,7 +715,7 @@ public: * Get the maximum number of times that the ACE_Reactor will * iterate and dispatch the ACE_Event_Handler's that are passed in * via the notify queue before breaking out of its - * <ACE_Message_Queue::dequeue> loop. + * ACE_Message_Queue::dequeue() loop. */ int max_notify_iterations (void); diff --git a/ace/Recursive_Thread_Mutex.h b/ace/Recursive_Thread_Mutex.h index 38effc66afb..65807b64b47 100644 --- a/ace/Recursive_Thread_Mutex.h +++ b/ace/Recursive_Thread_Mutex.h @@ -151,6 +151,9 @@ public: int get_nesting_level (void); /// Returns a reference to the recursive mutex; + ACE_recursive_thread_mutex_t &lock (void); + + /// @deprecated Returns a reference to the recursive mutex; ACE_recursive_thread_mutex_t &mutex (void); /// Returns a reference to the recursive mutex's internal mutex; diff --git a/ace/Recursive_Thread_Mutex.inl b/ace/Recursive_Thread_Mutex.inl index 0269de24d6b..6a7b55dc6a2 100644 --- a/ace/Recursive_Thread_Mutex.inl +++ b/ace/Recursive_Thread_Mutex.inl @@ -5,7 +5,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_recursive_thread_mutex_t & -ACE_Recursive_Thread_Mutex::mutex (void) +ACE_Recursive_Thread_Mutex::lock (void) { return lock_; } diff --git a/ace/Registry.cpp b/ace/Registry.cpp index dc60e119788..ee1863a8b88 100644 --- a/ace/Registry.cpp +++ b/ace/Registry.cpp @@ -1094,6 +1094,7 @@ ACE_Predefined_Naming_Contexts::connect (ACE_Registry::Naming_Context &naming_co predefined, &naming_context.key_); if (predefined == HKEY_CURRENT_USER || predefined == HKEY_CLASSES_ROOT) + { // Make sure that for these types, the machine is local if (machine_name == 0 || ACE_Predefined_Naming_Contexts::is_local_host (machine_name)) @@ -1103,6 +1104,7 @@ ACE_Predefined_Naming_Contexts::connect (ACE_Registry::Naming_Context &naming_co } else result = -1; + } ACE_REGISTRY_CALL_RETURN (result); #endif // ACE_HAS_WINCE diff --git a/ace/SPIPE_Stream.inl b/ace/SPIPE_Stream.inl index 94ca51dcf65..e70bd5367fe 100644 --- a/ace/SPIPE_Stream.inl +++ b/ace/SPIPE_Stream.inl @@ -111,7 +111,7 @@ ACE_SPIPE_Stream::send_handle (ACE_HANDLE handle) const DWORD procID; WSAPROTOCOL_INFO protInfo; ssize_t res = this->recv(&procID, sizeof(procID)); - if (res != sizeof(procID)) + if (res != static_cast <ssize_t> (sizeof(procID))) { if(res != -1) errno = ENXIO; @@ -123,7 +123,7 @@ ACE_SPIPE_Stream::send_handle (ACE_HANDLE handle) const return -1; } res = this->send(&protInfo, sizeof(protInfo)); - if (res != sizeof(protInfo)) + if (res != static_cast <ssize_t> (sizeof(protInfo))) { if(res != -1) errno = ENXIO; @@ -131,7 +131,7 @@ ACE_SPIPE_Stream::send_handle (ACE_HANDLE handle) const } // This is just for synchronization, we will ignore the data res = this->recv(&procID, sizeof(procID)); - if (res != sizeof(procID)) + if (res != static_cast <ssize_t> (sizeof(procID))) { if(res != -1) errno = ENXIO; @@ -165,14 +165,14 @@ ACE_SPIPE_Stream::recv_handle (ACE_HANDLE &handle) const pid_t procID = ACE_OS::getpid(); WSAPROTOCOL_INFO protInfo; ssize_t res = this->send(&procID, sizeof(procID)); - if (res != sizeof(procID)) + if (res != static_cast <ssize_t> (sizeof(procID))) { if(res != -1) errno = ENXIO; return -1; } res = this->recv(&protInfo, sizeof(protInfo)); - if (res != sizeof(protInfo)) + if (res != static_cast <ssize_t> (sizeof(protInfo))) { if(res != -1) errno = ENXIO; @@ -187,7 +187,7 @@ ACE_SPIPE_Stream::recv_handle (ACE_HANDLE &handle) const // Since it does not matter what the data is, just send something to // synchronize the end of the exchange res = this->send(&procID, sizeof(procID)); - if (res != sizeof(procID)) + if (res != static_cast <ssize_t> (sizeof(procID))) { if(res != -1) errno = ENXIO; diff --git a/ace/SStringfwd.h b/ace/SStringfwd.h index fb28ee8a469..cab3ecfe8ec 100644 --- a/ace/SStringfwd.h +++ b/ace/SStringfwd.h @@ -33,7 +33,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <class CHAR> class ACE_String_Base; // Forward declaration. +template <class ACE_CHAR_T> class ACE_String_Base; // Forward declaration. typedef ACE_WCHAR_T ACE_WSTRING_TYPE; diff --git a/ace/Select_Reactor_Base.cpp b/ace/Select_Reactor_Base.cpp index 2c45a7ce0ff..d6d90752655 100644 --- a/ace/Select_Reactor_Base.cpp +++ b/ace/Select_Reactor_Base.cpp @@ -691,7 +691,9 @@ ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *event_handler, ACE_Event_Handler_var safe_handler (event_handler); if (event_handler) - event_handler->add_reference (); + { + event_handler->add_reference (); + } ACE_Notification_Buffer buffer (event_handler, mask); @@ -718,7 +720,9 @@ ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *event_handler, sizeof buffer, timeout); if (n == -1) - return -1; + { + return -1; + } // No failures. safe_handler.release (); diff --git a/ace/String_Base.cpp b/ace/String_Base.cpp index 75e958335b5..b674c659859 100644 --- a/ace/String_Base.cpp +++ b/ace/String_Base.cpp @@ -19,26 +19,26 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_String_Base) -template <class CHAR> -CHAR ACE_String_Base<CHAR>::NULL_String_ = 0; +template <class ACE_CHAR_T> +ACE_CHAR_T ACE_String_Base<ACE_CHAR_T>::NULL_String_ = 0; // Default constructor. -template <class CHAR> -ACE_String_Base<CHAR>::ACE_String_Base (ACE_Allocator *the_allocator) +template <class ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T>::ACE_String_Base (ACE_Allocator *the_allocator) : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()), len_ (0), buf_len_ (0), - rep_ (&ACE_String_Base<CHAR>::NULL_String_), + rep_ (&ACE_String_Base<ACE_CHAR_T>::NULL_String_), release_ (false) { - ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base"); } // Constructor that actually copies memory. -template <class CHAR> -ACE_String_Base<CHAR>::ACE_String_Base (const CHAR *s, +template <class ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T>::ACE_String_Base (const ACE_CHAR_T *s, ACE_Allocator *the_allocator, bool release) : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()), @@ -47,12 +47,12 @@ ACE_String_Base<CHAR>::ACE_String_Base (const CHAR *s, rep_ (0), release_ (false) { - ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base"); this->set (s, release); } -template <class CHAR> -ACE_String_Base<CHAR>::ACE_String_Base (CHAR c, +template <class ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T>::ACE_String_Base (ACE_CHAR_T c, ACE_Allocator *the_allocator) : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()), len_ (0), @@ -60,17 +60,17 @@ ACE_String_Base<CHAR>::ACE_String_Base (CHAR c, rep_ (0), release_ (false) { - ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base"); this->set (&c, 1, true); } // Constructor that actually copies memory. -template <class CHAR> -ACE_String_Base<CHAR>::ACE_String_Base ( - const CHAR *s, - typename ACE_String_Base<CHAR>::size_type len, +template <class ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T>::ACE_String_Base ( + const ACE_CHAR_T *s, + typename ACE_String_Base<ACE_CHAR_T>::size_type len, ACE_Allocator *the_allocator, bool release) : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()), @@ -79,30 +79,30 @@ ACE_String_Base<CHAR>::ACE_String_Base ( rep_ (0), release_ (false) { - ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base"); this->set (s, len, release); } // Copy constructor. -template <class CHAR> -ACE_String_Base<CHAR>::ACE_String_Base (const ACE_String_Base<CHAR> &s) +template <class ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T>::ACE_String_Base (const ACE_String_Base<ACE_CHAR_T> &s) : allocator_ (s.allocator_ ? s.allocator_ : ACE_Allocator::instance ()), len_ (0), buf_len_ (0), rep_ (0), release_ (false) { - ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base"); this->set (s.rep_, s.len_, true); } -template <class CHAR> -ACE_String_Base<CHAR>::ACE_String_Base ( - typename ACE_String_Base<CHAR>::size_type len, - CHAR c, +template <class ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T>::ACE_String_Base ( + typename ACE_String_Base<ACE_CHAR_T>::size_type len, + ACE_CHAR_T c, ACE_Allocator *the_allocator) : allocator_ (the_allocator ? the_allocator : ACE_Allocator::instance ()), len_ (0), @@ -110,33 +110,33 @@ ACE_String_Base<CHAR>::ACE_String_Base ( rep_ (0), release_ (false) { - ACE_TRACE ("ACE_String_Base<CHAR>::ACE_String_Base"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::ACE_String_Base"); this->resize (len, c); } -template <class CHAR> -ACE_String_Base<CHAR>::~ACE_String_Base (void) +template <class ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T>::~ACE_String_Base (void) { - ACE_TRACE ("ACE_String_Base<CHAR>::~ACE_String_Base"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::~ACE_String_Base"); if (this->buf_len_ != 0 && this->release_) this->allocator_->free (this->rep_); } // this method might benefit from a little restructuring. -template <class CHAR> void -ACE_String_Base<CHAR>::set (const CHAR *s, - typename ACE_String_Base<CHAR>::size_type len, +template <class ACE_CHAR_T> void +ACE_String_Base<ACE_CHAR_T>::set (const ACE_CHAR_T *s, + typename ACE_String_Base<ACE_CHAR_T>::size_type len, bool release) { // Case 1. Going from memory to more memory size_type new_buf_len = len + 1; if (s != 0 && len != 0 && release && this->buf_len_ < new_buf_len) { - CHAR *temp = 0; + ACE_CHAR_T *temp = 0; ACE_ALLOCATOR (temp, - (CHAR *) this->allocator_->malloc (new_buf_len * sizeof (CHAR))); + (ACE_CHAR_T *) this->allocator_->malloc (new_buf_len * sizeof (ACE_CHAR_T))); if (this->buf_len_ != 0 && this->release_) this->allocator_->free (this->rep_); @@ -145,7 +145,7 @@ ACE_String_Base<CHAR>::set (const CHAR *s, this->buf_len_ = new_buf_len; this->release_ = true; this->len_ = len; - ACE_OS::memcpy (this->rep_, s, len * sizeof (CHAR)); + ACE_OS::memcpy (this->rep_, s, len * sizeof (ACE_CHAR_T)); this->rep_[len] = 0; } else // Case 2. No memory allocation is necessary. @@ -164,19 +164,19 @@ ACE_String_Base<CHAR>::set (const CHAR *s, { this->buf_len_ = 0; this->len_ = 0; - this->rep_ = &ACE_String_Base<CHAR>::NULL_String_; + this->rep_ = &ACE_String_Base<ACE_CHAR_T>::NULL_String_; this->release_ = false; } else if (!release) // Note: No guarantee that rep_ is null terminated. { this->buf_len_ = len; this->len_ = len; - this->rep_ = const_cast <CHAR *> (s); + this->rep_ = const_cast <ACE_CHAR_T *> (s); this->release_ = false; } else { - ACE_OS::memcpy (this->rep_, s, len * sizeof (CHAR)); + ACE_OS::memcpy (this->rep_, s, len * sizeof (ACE_CHAR_T)); this->rep_[len] = 0; this->len_ = len; } @@ -184,12 +184,12 @@ ACE_String_Base<CHAR>::set (const CHAR *s, } // Return substring. -template <class CHAR> ACE_String_Base<CHAR> -ACE_String_Base<CHAR>::substring ( - typename ACE_String_Base<CHAR>::size_type offset, - typename ACE_String_Base<CHAR>::size_type length) const +template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T>::substring ( + typename ACE_String_Base<ACE_CHAR_T>::size_type offset, + typename ACE_String_Base<ACE_CHAR_T>::size_type length) const { - ACE_String_Base<CHAR> nill; + ACE_String_Base<ACE_CHAR_T> nill; size_type count = length; // case 1. empty string @@ -206,36 +206,36 @@ ACE_String_Base<CHAR>::substring ( else if (length == npos || count > (this->len_ - offset)) count = this->len_ - offset; - return ACE_String_Base<CHAR> (&this->rep_[offset], count, this->allocator_); + return ACE_String_Base<ACE_CHAR_T> (&this->rep_[offset], count, this->allocator_); } -template <class CHAR> ACE_String_Base<CHAR> & -ACE_String_Base<CHAR>::append (const CHAR* s, - typename ACE_String_Base<CHAR>::size_type slen) +template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> & +ACE_String_Base<ACE_CHAR_T>::append (const ACE_CHAR_T* s, + typename ACE_String_Base<ACE_CHAR_T>::size_type slen) { - ACE_TRACE ("ACE_String_Base<CHAR>::append(const CHAR*, size_type)"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::append(const ACE_CHAR_T*, size_type)"); if (slen > 0 && slen != npos) { // case 1. No memory allocation needed. if (this->buf_len_ >= this->len_ + slen + 1) { // Copy in data from new string. - ACE_OS::memcpy (this->rep_ + this->len_, s, slen * sizeof (CHAR)); + ACE_OS::memcpy (this->rep_ + this->len_, s, slen * sizeof (ACE_CHAR_T)); } else // case 2. Memory reallocation is needed { const size_type new_buf_len = ace_max(this->len_ + slen + 1, this->buf_len_ + this->buf_len_ / 2); - CHAR *t = 0; + ACE_CHAR_T *t = 0; ACE_ALLOCATOR_RETURN (t, - (CHAR *) this->allocator_->malloc (new_buf_len * sizeof (CHAR)), *this); + (ACE_CHAR_T *) this->allocator_->malloc (new_buf_len * sizeof (ACE_CHAR_T)), *this); // Copy memory from old string into new string. - ACE_OS::memcpy (t, this->rep_, this->len_ * sizeof (CHAR)); + ACE_OS::memcpy (t, this->rep_, this->len_ * sizeof (ACE_CHAR_T)); - ACE_OS::memcpy (t + this->len_, s, slen * sizeof (CHAR)); + ACE_OS::memcpy (t + this->len_, s, slen * sizeof (ACE_CHAR_T)); if (this->buf_len_ != 0 && this->release_) this->allocator_->free (this->rep_); @@ -252,29 +252,29 @@ ACE_String_Base<CHAR>::append (const CHAR* s, return *this; } -template <class CHAR> u_long -ACE_String_Base<CHAR>::hash (void) const +template <class ACE_CHAR_T> u_long +ACE_String_Base<ACE_CHAR_T>::hash (void) const { return ACE::hash_pjw (reinterpret_cast<char *> ( - const_cast<CHAR *> (this->rep_)), - this->len_ * sizeof (CHAR)); + const_cast<ACE_CHAR_T *> (this->rep_)), + this->len_ * sizeof (ACE_CHAR_T)); } -template <class CHAR> void -ACE_String_Base<CHAR>::resize (typename ACE_String_Base<CHAR>::size_type len, - CHAR c) +template <class ACE_CHAR_T> void +ACE_String_Base<ACE_CHAR_T>::resize (typename ACE_String_Base<ACE_CHAR_T>::size_type len, + ACE_CHAR_T c) { - ACE_TRACE ("ACE_String_Base<CHAR>::resize"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::resize"); fast_resize(len); - ACE_OS::memset (this->rep_, c, this->buf_len_ * sizeof (CHAR)); + ACE_OS::memset (this->rep_, c, this->buf_len_ * sizeof (ACE_CHAR_T)); } -template <class CHAR> void -ACE_String_Base<CHAR>::fast_resize (size_t len) +template <class ACE_CHAR_T> void +ACE_String_Base<ACE_CHAR_T>::fast_resize (size_t len) { - ACE_TRACE ("ACE_String_Base<CHAR>::fast_resize"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::fast_resize"); // Only reallocate if we don't have enough space... if (this->buf_len_ <= len) @@ -282,8 +282,8 @@ ACE_String_Base<CHAR>::fast_resize (size_t len) if (this->buf_len_ != 0 && this->release_) this->allocator_->free (this->rep_); - this->rep_ = static_cast<CHAR*> - (this->allocator_->malloc ((len + 1) * sizeof (CHAR))); + this->rep_ = static_cast<ACE_CHAR_T*> + (this->allocator_->malloc ((len + 1) * sizeof (ACE_CHAR_T))); this->buf_len_ = len + 1; this->release_ = true; } @@ -292,8 +292,8 @@ ACE_String_Base<CHAR>::fast_resize (size_t len) this->rep_[0] = 0; } -template <class CHAR> void -ACE_String_Base<CHAR>::clear (bool release) +template <class ACE_CHAR_T> void +ACE_String_Base<ACE_CHAR_T>::clear (bool release) { // This can't use set(), because that would free memory if release=false if (release) @@ -301,7 +301,7 @@ ACE_String_Base<CHAR>::clear (bool release) if (this->buf_len_ != 0 && this->release_) this->allocator_->free (this->rep_); - this->rep_ = &ACE_String_Base<CHAR>::NULL_String_; + this->rep_ = &ACE_String_Base<ACE_CHAR_T>::NULL_String_; this->len_ = 0; this->buf_len_ = 0; this->release_ = false; @@ -313,20 +313,20 @@ ACE_String_Base<CHAR>::clear (bool release) } // Assignment operator (does copy memory). -template <class CHAR> ACE_String_Base<CHAR> & -ACE_String_Base<CHAR>::operator= (const CHAR *s) +template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> & +ACE_String_Base<ACE_CHAR_T>::operator= (const ACE_CHAR_T *s) { - ACE_TRACE ("ACE_String_Base<CHAR>::operator="); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator="); if (s != 0) this->set (s, true); return *this; } // Assignment operator (does copy memory). -template <class CHAR> ACE_String_Base<CHAR> & -ACE_String_Base<CHAR>::operator= (const ACE_String_Base<CHAR> &s) +template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> & +ACE_String_Base<ACE_CHAR_T>::operator= (const ACE_String_Base<ACE_CHAR_T> &s) { - ACE_TRACE ("ACE_String_Base<CHAR>::operator="); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator="); // Check for self-assignment. if (this != &s) @@ -337,8 +337,8 @@ ACE_String_Base<CHAR>::operator= (const ACE_String_Base<CHAR> &s) return *this; } -template <class CHAR> void -ACE_String_Base<CHAR>::set (const CHAR *s, bool release) +template <class ACE_CHAR_T> void +ACE_String_Base<ACE_CHAR_T>::set (const ACE_CHAR_T *s, bool release) { size_t length = 0; if (s != 0) @@ -347,42 +347,42 @@ ACE_String_Base<CHAR>::set (const CHAR *s, bool release) this->set (s, length, release); } -template <class CHAR> void -ACE_String_Base<CHAR>::fast_clear (void) +template <class ACE_CHAR_T> void +ACE_String_Base<ACE_CHAR_T>::fast_clear (void) { this->len_ = 0; if (this->release_) { // String retains the original buffer. - if (this->rep_ != &ACE_String_Base<CHAR>::NULL_String_) + if (this->rep_ != &ACE_String_Base<ACE_CHAR_T>::NULL_String_) this->rep_[0] = 0; } else { // External buffer: string relinquishes control of it. this->buf_len_ = 0; - this->rep_ = &ACE_String_Base<CHAR>::NULL_String_; + this->rep_ = &ACE_String_Base<ACE_CHAR_T>::NULL_String_; } } // Get a copy of the underlying representation. -template <class CHAR> CHAR * -ACE_String_Base<CHAR>::rep (void) const +template <class ACE_CHAR_T> ACE_CHAR_T * +ACE_String_Base<ACE_CHAR_T>::rep (void) const { - ACE_TRACE ("ACE_String_Base<CHAR>::rep"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::rep"); - CHAR *new_string; - ACE_NEW_RETURN (new_string, CHAR[this->len_ + 1], 0); + ACE_CHAR_T *new_string; + ACE_NEW_RETURN (new_string, ACE_CHAR_T[this->len_ + 1], 0); ACE_OS::strsncpy (new_string, this->rep_, this->len_+1); return new_string; } -template <class CHAR> int -ACE_String_Base<CHAR>::compare (const ACE_String_Base<CHAR> &s) const +template <class ACE_CHAR_T> int +ACE_String_Base<ACE_CHAR_T>::compare (const ACE_String_Base<ACE_CHAR_T> &s) const { - ACE_TRACE ("ACE_String_Base<CHAR>::compare"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::compare"); if (this->rep_ == s.rep_) return 0; @@ -392,7 +392,7 @@ ACE_String_Base<CHAR>::compare (const ACE_String_Base<CHAR> &s) const int result = ACE_OS::memcmp (this->rep_, s.rep_, - smaller_length * sizeof (CHAR)); + smaller_length * sizeof (ACE_CHAR_T)); if (result == 0 && this->len_ != s.len_) result = this->len_ > s.len_ ? 1 : -1; @@ -401,56 +401,56 @@ ACE_String_Base<CHAR>::compare (const ACE_String_Base<CHAR> &s) const // Comparison operator. -template <class CHAR> bool -ACE_String_Base<CHAR>::operator== (const ACE_String_Base<CHAR> &s) const +template <class ACE_CHAR_T> bool +ACE_String_Base<ACE_CHAR_T>::operator== (const ACE_String_Base<ACE_CHAR_T> &s) const { return this->len_ == s.len_ && ACE_OS::memcmp (this->rep_, s.rep_, - this->len_ * sizeof (CHAR)) == 0; + this->len_ * sizeof (ACE_CHAR_T)) == 0; } -template <class CHAR> bool -ACE_String_Base<CHAR>::operator== (const CHAR *s) const +template <class ACE_CHAR_T> bool +ACE_String_Base<ACE_CHAR_T>::operator== (const ACE_CHAR_T *s) const { size_t len = ACE_OS::strlen (s); return this->len_ == len && ACE_OS::memcmp (this->rep_, s, - len * sizeof (CHAR)) == 0; + len * sizeof (ACE_CHAR_T)) == 0; } -template <class CHAR> typename ACE_String_Base<CHAR>::size_type -ACE_String_Base<CHAR>::find ( - const CHAR *s, - typename ACE_String_Base<CHAR>::size_type pos) const +template <class ACE_CHAR_T> typename ACE_String_Base<ACE_CHAR_T>::size_type +ACE_String_Base<ACE_CHAR_T>::find ( + const ACE_CHAR_T *s, + typename ACE_String_Base<ACE_CHAR_T>::size_type pos) const { - CHAR *substr = this->rep_ + pos; + ACE_CHAR_T *substr = this->rep_ + pos; size_t len = ACE_OS::strlen (s); - CHAR *pointer = ACE_OS::strnstr (substr, s, len); + ACE_CHAR_T *pointer = ACE_OS::strnstr (substr, s, len); if (pointer == 0) - return ACE_String_Base<CHAR>::npos; + return ACE_String_Base<ACE_CHAR_T>::npos; else return pointer - this->rep_; } -template <class CHAR> typename ACE_String_Base<CHAR>::size_type -ACE_String_Base<CHAR>::find ( - CHAR c, - typename ACE_String_Base<CHAR>::size_type pos) const +template <class ACE_CHAR_T> typename ACE_String_Base<ACE_CHAR_T>::size_type +ACE_String_Base<ACE_CHAR_T>::find ( + ACE_CHAR_T c, + typename ACE_String_Base<ACE_CHAR_T>::size_type pos) const { - CHAR *substr = this->rep_ + pos; - CHAR *pointer = ACE_OS::strnchr (substr, c, this->len_ - pos); + ACE_CHAR_T *substr = this->rep_ + pos; + ACE_CHAR_T *pointer = ACE_OS::strnchr (substr, c, this->len_ - pos); if (pointer == 0) - return ACE_String_Base<CHAR>::npos; + return ACE_String_Base<ACE_CHAR_T>::npos; else return pointer - this->rep_; } -template <class CHAR> typename ACE_String_Base<CHAR>::size_type -ACE_String_Base<CHAR>::rfind ( - CHAR c, - typename ACE_String_Base<CHAR>::size_type pos) const +template <class ACE_CHAR_T> typename ACE_String_Base<ACE_CHAR_T>::size_type +ACE_String_Base<ACE_CHAR_T>::rfind ( + ACE_CHAR_T c, + typename ACE_String_Base<ACE_CHAR_T>::size_type pos) const { if (pos == npos || pos > this->len_) pos = this->len_; @@ -461,11 +461,11 @@ ACE_String_Base<CHAR>::rfind ( if (this->rep_[i] == c) return i; - return ACE_String_Base<CHAR>::npos; + return ACE_String_Base<ACE_CHAR_T>::npos; } -template <class CHAR> void -ACE_String_Base<CHAR>::swap (ACE_String_Base<CHAR> & str) +template <class ACE_CHAR_T> void +ACE_String_Base<ACE_CHAR_T>::swap (ACE_String_Base<ACE_CHAR_T> & str) { std::swap (this->allocator_ , str.allocator_); std::swap (this->len_ , str.len_); @@ -476,10 +476,10 @@ ACE_String_Base<CHAR>::swap (ACE_String_Base<CHAR> & str) // ---------------------------------------------- -template <class CHAR> -int ACE_String_Base_Iterator <CHAR>::next (CHAR * & ch) const +template <class ACE_CHAR_T> +int ACE_String_Base_Iterator <ACE_CHAR_T>::next (ACE_CHAR_T * & ch) const { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::next"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::next"); if (0 == this->done ()) { @@ -493,10 +493,10 @@ int ACE_String_Base_Iterator <CHAR>::next (CHAR * & ch) const } } -template <class CHAR> -int ACE_String_Base_Iterator <CHAR>::advance (void) +template <class ACE_CHAR_T> +int ACE_String_Base_Iterator <ACE_CHAR_T>::advance (void) { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::advance"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::advance"); if (this->index_ < this->str_->length ()) { @@ -509,12 +509,12 @@ int ACE_String_Base_Iterator <CHAR>::advance (void) } } -template <class CHAR> -const ACE_String_Base_Iterator <CHAR> & -ACE_String_Base_Iterator <CHAR>:: -operator = (const ACE_String_Base_Iterator <CHAR> & rhs) +template <class ACE_CHAR_T> +const ACE_String_Base_Iterator <ACE_CHAR_T> & +ACE_String_Base_Iterator <ACE_CHAR_T>:: +operator = (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::operator ="); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::operator ="); if (this == &rhs) return *this; @@ -526,10 +526,10 @@ operator = (const ACE_String_Base_Iterator <CHAR> & rhs) // ---------------------------------------------- -template <class CHAR> -int ACE_String_Base_Const_Iterator <CHAR>::next (const CHAR * & ch) const +template <class ACE_CHAR_T> +int ACE_String_Base_Const_Iterator <ACE_CHAR_T>::next (const ACE_CHAR_T * & ch) const { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::next"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::next"); if (0 == this->done ()) { @@ -543,10 +543,10 @@ int ACE_String_Base_Const_Iterator <CHAR>::next (const CHAR * & ch) const } } -template <class CHAR> -int ACE_String_Base_Const_Iterator <CHAR>::advance (void) +template <class ACE_CHAR_T> +int ACE_String_Base_Const_Iterator <ACE_CHAR_T>::advance (void) { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::advance"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::advance"); if (this->index_ < this->str_->length ()) { @@ -559,12 +559,12 @@ int ACE_String_Base_Const_Iterator <CHAR>::advance (void) } } -template <class CHAR> -const ACE_String_Base_Const_Iterator <CHAR> & -ACE_String_Base_Const_Iterator <CHAR>:: -operator = (const ACE_String_Base_Const_Iterator <CHAR> & rhs) +template <class ACE_CHAR_T> +const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & +ACE_String_Base_Const_Iterator <ACE_CHAR_T>:: +operator = (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator ="); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::operator ="); if (this == &rhs) return *this; @@ -576,64 +576,64 @@ operator = (const ACE_String_Base_Const_Iterator <CHAR> & rhs) // ---------------------------------------------- -template <class CHAR> ACE_String_Base<CHAR> -operator+ (const ACE_String_Base<CHAR> &s, const ACE_String_Base<CHAR> &t) +template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> +operator+ (const ACE_String_Base<ACE_CHAR_T> &s, const ACE_String_Base<ACE_CHAR_T> &t) { - ACE_String_Base<CHAR> temp (s.length () + t.length ()); + ACE_String_Base<ACE_CHAR_T> temp (s.length () + t.length ()); temp += s; temp += t; return temp; } -template <class CHAR> ACE_String_Base<CHAR> -operator+ (const CHAR *s, const ACE_String_Base<CHAR> &t) +template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> +operator+ (const ACE_CHAR_T *s, const ACE_String_Base<ACE_CHAR_T> &t) { size_t slen = 0; if (s != 0) slen = ACE_OS::strlen (s); - ACE_String_Base<CHAR> temp (slen + t.length ()); + ACE_String_Base<ACE_CHAR_T> temp (slen + t.length ()); if (slen > 0) temp.append (s, slen); temp += t; return temp; } -template <class CHAR> ACE_String_Base<CHAR> -operator+ (const ACE_String_Base<CHAR> &s, const CHAR *t) +template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> +operator+ (const ACE_String_Base<ACE_CHAR_T> &s, const ACE_CHAR_T *t) { size_t tlen = 0; if (t != 0) tlen = ACE_OS::strlen (t); - ACE_String_Base<CHAR> temp (s.length () + tlen); + ACE_String_Base<ACE_CHAR_T> temp (s.length () + tlen); temp += s; if (tlen > 0) temp.append (t, tlen); return temp; } -template <class CHAR> ACE_String_Base<CHAR> -operator + (const ACE_String_Base<CHAR> &t, - const CHAR c) +template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> +operator + (const ACE_String_Base<ACE_CHAR_T> &t, + const ACE_CHAR_T c) { - ACE_String_Base<CHAR> temp (t.length () + 1); + ACE_String_Base<ACE_CHAR_T> temp (t.length () + 1); temp += t; temp += c; return temp; } -template <class CHAR> ACE_String_Base<CHAR> -operator + (const CHAR c, - const ACE_String_Base<CHAR> &t) +template <class ACE_CHAR_T> ACE_String_Base<ACE_CHAR_T> +operator + (const ACE_CHAR_T c, + const ACE_String_Base<ACE_CHAR_T> &t) { - ACE_String_Base<CHAR> temp (t.length () + 1); + ACE_String_Base<ACE_CHAR_T> temp (t.length () + 1); temp += c; temp += t; return temp; } -template <class CHAR> -ACE_String_Base<CHAR> & -ACE_String_Base<CHAR>::operator+= (const CHAR* s) +template <class ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T> & +ACE_String_Base<ACE_CHAR_T>::operator+= (const ACE_CHAR_T* s) { size_t slen = 0; if (s != 0) @@ -641,19 +641,19 @@ ACE_String_Base<CHAR>::operator+= (const CHAR* s) return this->append (s, slen); } -template <class CHAR> -ACE_String_Base<CHAR> & -ACE_String_Base<CHAR>::operator+= (const ACE_String_Base<CHAR> &s) +template <class ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T> & +ACE_String_Base<ACE_CHAR_T>::operator+= (const ACE_String_Base<ACE_CHAR_T> &s) { - ACE_TRACE ("ACE_String_Base<CHAR>::operator+=(const ACE_String_Base<CHAR> &)"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator+=(const ACE_String_Base<ACE_CHAR_T> &)"); return this->append (s.rep_, s.len_); } -template <class CHAR> -ACE_String_Base<CHAR> & -ACE_String_Base<CHAR>::operator+= (const CHAR c) +template <class ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T> & +ACE_String_Base<ACE_CHAR_T>::operator+= (const ACE_CHAR_T c) { - ACE_TRACE ("ACE_String_Base<CHAR>::operator+=(const CHAR)"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator+=(const ACE_CHAR_T)"); const size_type slen = 1; return this->append (&c, slen); } diff --git a/ace/String_Base.h b/ace/String_Base.h index 55c2eb3f9a4..ae775c35dc3 100644 --- a/ace/String_Base.h +++ b/ace/String_Base.h @@ -28,11 +28,11 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward decl. -template <class CHAR> +template <class ACE_CHAR_T> class ACE_String_Base_Iterator; // Forward decl. -template <class CHAR> +template <class ACE_CHAR_T> class ACE_String_Base_Const_Iterator; /** @@ -63,22 +63,22 @@ class ACE_String_Base_Const_Iterator; * many STL class templates. If you find yourself casting you're * probably doing something wrong. */ -template <class CHAR> +template <class ACE_CHAR_T> class ACE_String_Base : public ACE_String_Base_Const { public: using ACE_String_Base_Const::size_type; - friend class ACE_String_Base_Iterator <CHAR>; - friend class ACE_String_Base_Const_Iterator <CHAR>; + friend class ACE_String_Base_Iterator <ACE_CHAR_T>; + friend class ACE_String_Base_Const_Iterator <ACE_CHAR_T>; // ACE-style iterators - typedef ACE_String_Base_Iterator <CHAR> ITERATOR; - typedef ACE_String_Base_Const_Iterator <CHAR> CONST_ITERATOR; + typedef ACE_String_Base_Iterator <ACE_CHAR_T> ITERATOR; + typedef ACE_String_Base_Const_Iterator <ACE_CHAR_T> CONST_ITERATOR; // STL-style iterators - typedef ACE_String_Base_Iterator <CHAR> iterator; - typedef ACE_String_Base_Const_Iterator <CHAR> const_iterator; + typedef ACE_String_Base_Iterator <ACE_CHAR_T> iterator; + typedef ACE_String_Base_Const_Iterator <ACE_CHAR_T> const_iterator; /** * Default constructor. @@ -101,9 +101,9 @@ public: * @param the_allocator ACE_Allocator associated with string * @param release Allocator responsible(true)/not reponsible(false) for * freeing memory. - * @return ACE_String_Base containing const CHAR *s + * @return ACE_String_Base containing const ACE_CHAR_T *s */ - ACE_String_Base (const CHAR *s, + ACE_String_Base (const ACE_CHAR_T *s, ACE_Allocator *the_allocator = 0, bool release = true); @@ -122,9 +122,9 @@ public: * @param the_allocator ACE_Allocator associated with string * @param release Allocator responsible(true)/not reponsible(false) for * freeing memory. - * @return ACE_String_Base containing const CHAR *s + * @return ACE_String_Base containing const ACE_CHAR_T *s */ - ACE_String_Base (const CHAR *s, + ACE_String_Base (const ACE_CHAR_T *s, size_type len, ACE_Allocator *the_allocator = 0, bool release = true); @@ -135,16 +135,16 @@ public: * @param s Input ACE_String_Base string to copy * @return Copy of input string @a s */ - ACE_String_Base (const ACE_String_Base < CHAR > &s); + ACE_String_Base (const ACE_String_Base < ACE_CHAR_T > &s); /** * Constructor that copies @a c into dynamically allocated memory. * * @param c Single input character. * @param the_allocator ACE_Allocator associated with string - * @return ACE_String_Base containing CHAR 'c' + * @return ACE_String_Base containing ACE_CHAR_T 'c' */ - ACE_String_Base (CHAR c, ACE_Allocator *the_allocator = 0); + ACE_String_Base (ACE_CHAR_T c, ACE_Allocator *the_allocator = 0); /** * Constructor that allocates a len long string. @@ -160,7 +160,7 @@ public: * @return Empty ACE_String_Base with room for len CHARs */ ACE_String_Base (size_type len, - CHAR c = 0, + ACE_CHAR_T c = 0, ACE_Allocator *the_allocator = 0); /** @@ -175,7 +175,7 @@ public: * @param slot Index of the desired character * @return The character at index @a slot */ - const CHAR & operator[] (size_type slot) const; + const ACE_CHAR_T & operator[] (size_type slot) const; /** * Return the <slot'th> character by reference in the string @@ -184,15 +184,15 @@ public: * @param slot Index of the desired character * @return The character at index @a slot */ - CHAR & operator[] (size_type slot); + ACE_CHAR_T & operator[] (size_type slot); /** * Assignment operator (does copy memory). * - * @param s Input null-terminated CHAR string to assign to this object. + * @param s Input null-terminated ACE_CHAR_T string to assign to this object. * @return Return a copy of the this string. */ - ACE_String_Base < CHAR > &operator = (const CHAR * s); + ACE_String_Base < ACE_CHAR_T > &operator = (const ACE_CHAR_T * s); /** * Assignment operator (does copy memory). @@ -200,7 +200,7 @@ public: * @param s Input ACE_String_Base string to assign to this object. * @return Return a copy of the this string. */ - ACE_String_Base < CHAR > &operator = (const ACE_String_Base < CHAR > &s); + ACE_String_Base < ACE_CHAR_T > &operator = (const ACE_String_Base < ACE_CHAR_T > &s); /** * Assignment alternative method (does not copy memory). @@ -208,7 +208,7 @@ public: * @param s Input ACE_String_Base string to assign to this object. * @return Return this string. */ - ACE_String_Base < CHAR > &assign_nocopy (const ACE_String_Base < CHAR > &s); + ACE_String_Base < ACE_CHAR_T > &assign_nocopy (const ACE_String_Base < ACE_CHAR_T > &s); /** * Copy @a s into this @a ACE_String_Base. @@ -227,7 +227,7 @@ public: * @param release Allocator responsible(true)/not reponsible(false) for * freeing memory. */ - void set (const CHAR * s, bool release = true); + void set (const ACE_CHAR_T * s, bool release = true); /** * Copy @a len bytes of @a s (will zero terminate the result). @@ -247,7 +247,7 @@ public: * @param release Allocator responsible(true)/not reponsible(false) for * freeing memory. */ - void set (const CHAR * s, size_type len, bool release); + void set (const ACE_CHAR_T * s, size_type len, bool release); /** * Clear this string. Memory is _not_ freed if @a release is false. @@ -291,7 +291,7 @@ public: * @param length How many characters to return starting at the offset. * @return The string containing the desired substring */ - ACE_String_Base < CHAR > substring (size_type offset, + ACE_String_Base < ACE_CHAR_T > substring (size_type offset, size_type length = npos) const; /** @@ -301,7 +301,7 @@ public: * @param length How many characters to return starting at the offset. * @return The string containing the desired substring */ - ACE_String_Base < CHAR > substr (size_type offset, + ACE_String_Base < ACE_CHAR_T > substr (size_type offset, size_type length = npos) const; /** @@ -311,7 +311,7 @@ public: * @return The combined string (input append to the end of the old). New * string is zero terminated. */ - ACE_String_Base < CHAR > &operator += (const ACE_String_Base < CHAR > &s); + ACE_String_Base < ACE_CHAR_T > &operator += (const ACE_String_Base < ACE_CHAR_T > &s); /** * Concat operator (copies memory). @@ -320,26 +320,26 @@ public: * @return The combined string (input append to the end of the old). New * string is zero terminated. */ - ACE_String_Base < CHAR >& operator += (const CHAR* s); + ACE_String_Base < ACE_CHAR_T >& operator += (const ACE_CHAR_T* s); /** * Concat operator (copies memory). * - * @param c Input CHAR to concatenate to this string. + * @param c Input ACE_CHAR_T to concatenate to this string. * @return The combined string (input append to the end of the old). New * string is zero terminated. */ - ACE_String_Base < CHAR >& operator += (const CHAR c); + ACE_String_Base < ACE_CHAR_T >& operator += (const ACE_CHAR_T c); /** * Append function (copies memory). * - * @param s Input CHAR array to concatenate to this string. + * @param s Input ACE_CHAR_T array to concatenate to this string. * @param slen The length of the array. * @return The combined string (input append to the end of the old). New * string is zero terminated. */ - ACE_String_Base < CHAR >& append (const CHAR* s, size_type slen); + ACE_String_Base < ACE_CHAR_T >& append (const ACE_CHAR_T* s, size_type slen); /** * Returns a hash value for this string. @@ -359,7 +359,7 @@ public: * Return the number of allocated CHARs in the string object. * This may be greater than the current length of the string. * - * @return Maximum number of CHAR units that can be stored, including + * @return Maximum number of ACE_CHAR_T units that can be stored, including * any terminating nul that may be needed. */ size_t capacity (void) const; @@ -386,7 +386,7 @@ public: * @return Pointer reference to the string data. Returned string is * zero terminated. */ - CHAR *rep (void) const; + ACE_CHAR_T *rep (void) const; /** * Get at the underlying representation directly! @@ -397,12 +397,12 @@ public: * that the string is zero terminated. * */ - const CHAR *fast_rep (void) const; + const ACE_CHAR_T *fast_rep (void) const; /** * Same as STL String's <c_str> and <fast_rep>. */ - const CHAR *c_str (void) const; + const ACE_CHAR_T *c_str (void) const; /** * Comparison operator that will match substrings. Returns the @@ -412,7 +412,7 @@ public: * @return Integer index value of the first location of string @a s or * @c npos (not found). */ - size_type strstr (const ACE_String_Base<CHAR> &s) const; + size_type strstr (const ACE_String_Base<ACE_CHAR_T> &s) const; /** * Find <str> starting at pos. Returns the slot of the first @@ -423,7 +423,7 @@ public: * @return Index value of the first location of string @a str else * @c npos. */ - size_type find (const ACE_String_Base<CHAR> &str, size_type pos = 0) const; + size_type find (const ACE_String_Base<ACE_CHAR_T> &str, size_type pos = 0) const; /** * Find @a s starting at pos. Returns the slot of the first @@ -434,7 +434,7 @@ public: * @return Index value of the first location of string @a str else * @c npos. */ - size_type find (const CHAR *s, size_type pos = 0) const; + size_type find (const ACE_CHAR_T *s, size_type pos = 0) const; /** * Find @a c starting at pos. Returns the slot of the first @@ -445,7 +445,7 @@ public: * @return Index value of the first location of string @a str else * @c npos. */ - size_type find (CHAR c, size_type pos = 0) const; + size_type find (ACE_CHAR_T c, size_type pos = 0) const; /** * Find @a c starting at pos (counting from the end). Returns the @@ -456,7 +456,7 @@ public: * @return Index value of the first location of string @a str else * @c npos. */ - size_type rfind (CHAR c, size_type pos = npos) const; + size_type rfind (ACE_CHAR_T c, size_type pos = npos) const; /** * Equality comparison operator (must match entire string). @@ -464,7 +464,7 @@ public: * @param s Input ACE_String_Base string to compare against stored string. * @return @c true if equal, @c false otherwise. */ - bool operator == (const ACE_String_Base<CHAR> &s) const; + bool operator == (const ACE_String_Base<ACE_CHAR_T> &s) const; /** * Equality comparison operator (must match entire string). @@ -472,7 +472,7 @@ public: * @param s Null terminated string to compare against stored string. * @return @c true if equal, @c false otherwise. */ - bool operator == (const CHAR *s) const; + bool operator == (const ACE_CHAR_T *s) const; /** * Less than comparison operator. @@ -480,7 +480,7 @@ public: * @param s Input ACE_String_Base string to compare against stored string. * @return @c true if less than, @c false otherwise. */ - bool operator < (const ACE_String_Base<CHAR> &s) const; + bool operator < (const ACE_String_Base<ACE_CHAR_T> &s) const; /** * Greater than comparison operator. @@ -488,7 +488,7 @@ public: * @param s Input ACE_String_Base string to compare against stored string. * @return @c true if greater than, @c false otherwise. */ - bool operator > (const ACE_String_Base<CHAR> &s) const; + bool operator > (const ACE_String_Base<ACE_CHAR_T> &s) const; /** * Inequality comparison operator. @@ -496,7 +496,7 @@ public: * @param s String to compare against stored string. * @return @c true if not equal, @c false otherwise. */ - bool operator != (const ACE_String_Base<CHAR> &s) const; + bool operator != (const ACE_String_Base<ACE_CHAR_T> &s) const; /** * Inequality comparison operator. @@ -504,7 +504,7 @@ public: * @param s Null terminated string to compare against stored string. * @return @c true if not equal, @c false otherwise. */ - bool operator != (const CHAR *s) const; + bool operator != (const ACE_CHAR_T *s) const; /** * Performs a strncmp comparison. @@ -513,7 +513,7 @@ public: * @return Integer value of result (less than 0, 0, greater than 0) * depending on how input string @a s is to the stored string. */ - int compare (const ACE_String_Base<CHAR> &s) const; + int compare (const ACE_String_Base<ACE_CHAR_T> &s) const; /** * Dump the state of an object. @@ -537,16 +537,16 @@ public: * it doesn't fill the buffer, so is much faster. * * @param len The number of CHARs to reserve - * @param c The CHAR to use when filling the string. + * @param c The ACE_CHAR_T to use when filling the string. */ - void resize (size_type len, CHAR c = 0); + void resize (size_type len, ACE_CHAR_T c = 0); void fast_resize (size_t len); /// Swap the contents of this @c ACE_String_Base with @a str. /** * @note This is non-throwing operation. */ - void swap (ACE_String_Base<CHAR> & str); + void swap (ACE_String_Base<ACE_CHAR_T> & str); iterator begin (void); const_iterator begin (void) const; @@ -579,7 +579,7 @@ protected: /** * Pointer to data. */ - CHAR *rep_; + ACE_CHAR_T *rep_; /** * Flag that indicates if we own the memory @@ -589,7 +589,7 @@ protected: /** * Represents the "NULL" string to simplify the internal logic. */ - static CHAR NULL_String_; + static ACE_CHAR_T NULL_String_; }; /** @@ -603,15 +603,15 @@ protected: * category. Future versions of the class will support the operations * of std::random_access_iterator_tag. */ -template <class CHAR> +template <class ACE_CHAR_T> class ACE_String_Base_Iterator { public: // = std::iterator_traits typedefs/traits. typedef std::bidirectional_iterator_tag iterator_category; - typedef CHAR value_type; - typedef CHAR & reference; - typedef CHAR * pointer; + typedef ACE_CHAR_T value_type; + typedef ACE_CHAR_T & reference; + typedef ACE_CHAR_T * pointer; typedef ptrdiff_t difference_type; /** @@ -619,14 +619,14 @@ public: * * @param[in] str Target string for iterator. */ - ACE_String_Base_Iterator (ACE_String_Base <CHAR> & str, int end = 0); + ACE_String_Base_Iterator (ACE_String_Base <ACE_CHAR_T> & str, int end = 0); /** * Copy constructor * * @param[in] iter Iterator to copy. */ - ACE_String_Base_Iterator (const ACE_String_Base_Iterator <CHAR> & iter); + ACE_String_Base_Iterator (const ACE_String_Base_Iterator <ACE_CHAR_T> & iter); /// Destructor. ~ACE_String_Base_Iterator (void); @@ -646,7 +646,7 @@ public: * @retval 0 All characters have been seen. * @retval 1 Items still remain to be seen. */ - int next (CHAR * & ch) const; + int next (ACE_CHAR_T * & ch) const; /** * Move to the next character in the string. @@ -662,58 +662,58 @@ public: * @param[in] iter Right-hand side of operator. * @return Reference to self. */ - const ACE_String_Base_Iterator <CHAR> & operator = (const ACE_String_Base_Iterator <CHAR> & iter); + const ACE_String_Base_Iterator <ACE_CHAR_T> & operator = (const ACE_String_Base_Iterator <ACE_CHAR_T> & iter); /** * Dereference operator * * @return Reference to current character seen by iterator. */ - CHAR & operator * (void); + ACE_CHAR_T & operator * (void); /** * Prefix operator */ - ACE_String_Base_Iterator <CHAR> & operator ++ (void); + ACE_String_Base_Iterator <ACE_CHAR_T> & operator ++ (void); /** * Postfix operator */ - ACE_String_Base_Iterator <CHAR> operator ++ (int); + ACE_String_Base_Iterator <ACE_CHAR_T> operator ++ (int); /** * Prefix operator */ - ACE_String_Base_Iterator <CHAR> & operator -- (void); + ACE_String_Base_Iterator <ACE_CHAR_T> & operator -- (void); /** * Postfix operator */ - ACE_String_Base_Iterator <CHAR> operator -- (int); + ACE_String_Base_Iterator <ACE_CHAR_T> operator -- (int); /** * Eqaulity comparison operator * * @param[in] rhs Right-hand side of operator. */ - bool operator == (const ACE_String_Base_Iterator <CHAR> & rhs) const; + bool operator == (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const; /** * Ineqaulity comparison operator * * @param[in] rhs Right-hand side of operator. */ - bool operator != (const ACE_String_Base_Iterator <CHAR> & rhs) const; + bool operator != (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const; - bool operator < (const ACE_String_Base_Iterator <CHAR> & rhs) const; - bool operator > (const ACE_String_Base_Iterator <CHAR> & rhs) const; + bool operator < (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const; + bool operator > (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const; - bool operator <= (const ACE_String_Base_Iterator <CHAR> & rhs) const; - bool operator >= (const ACE_String_Base_Iterator <CHAR> & rhs) const; + bool operator <= (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const; + bool operator >= (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const; private: /// Target string to iterate over. - ACE_String_Base <CHAR> * str_; + ACE_String_Base <ACE_CHAR_T> * str_; /// Current location in the string. size_t index_; @@ -730,15 +730,15 @@ private: * category. Future versions of the class will support the operations * of std::random_access_iterator_tag. */ -template <class CHAR> +template <class ACE_CHAR_T> class ACE_String_Base_Const_Iterator { public: // = std::iterator_traits typedefs/traits. typedef std::bidirectional_iterator_tag iterator_category; - typedef const CHAR value_type; - typedef const CHAR & reference; - typedef const CHAR * pointer; + typedef const ACE_CHAR_T value_type; + typedef const ACE_CHAR_T & reference; + typedef const ACE_CHAR_T * pointer; typedef ptrdiff_t difference_type; /** @@ -746,14 +746,14 @@ public: * * @param[in] str Target string for iterator. */ - ACE_String_Base_Const_Iterator (const ACE_String_Base <CHAR> & str, int end = 0); + ACE_String_Base_Const_Iterator (const ACE_String_Base <ACE_CHAR_T> & str, int end = 0); /** * Copy constructor * * @param[in] iter Iterator to copy. */ - ACE_String_Base_Const_Iterator (const ACE_String_Base_Const_Iterator <CHAR> & iter); + ACE_String_Base_Const_Iterator (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & iter); /// Destructor. ~ACE_String_Base_Const_Iterator (void); @@ -773,7 +773,7 @@ public: * @retval 0 All characters have been seen. * @retval 1 Items still remain to be seen. */ - int next (const CHAR * & ch) const; + int next (const ACE_CHAR_T * & ch) const; /** * Move to the next character in the string. @@ -789,88 +789,88 @@ public: * @param[in] iter Right-hand side of operator. * @return Reference to self. */ - const ACE_String_Base_Const_Iterator <CHAR> & operator = (const ACE_String_Base_Const_Iterator <CHAR> & iter); + const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & operator = (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & iter); /** * Dereference operator * * @return Reference to current character seen by iterator. */ - const CHAR & operator * (void); + const ACE_CHAR_T & operator * (void); /** * Prefix operator */ - ACE_String_Base_Const_Iterator <CHAR> & operator ++ (void); + ACE_String_Base_Const_Iterator <ACE_CHAR_T> & operator ++ (void); /** * Postfix operator */ - ACE_String_Base_Const_Iterator <CHAR> operator ++ (int); + ACE_String_Base_Const_Iterator <ACE_CHAR_T> operator ++ (int); /** * Prefix operator */ - ACE_String_Base_Const_Iterator <CHAR> & operator -- (void); + ACE_String_Base_Const_Iterator <ACE_CHAR_T> & operator -- (void); /** * Postfix operator */ - ACE_String_Base_Const_Iterator <CHAR> operator -- (int); + ACE_String_Base_Const_Iterator <ACE_CHAR_T> operator -- (int); /** * Eqaulity comparison operator * * @param[in] rhs Right-hand side of operator. */ - bool operator == (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const; + bool operator == (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const; /** * Ineqaulity comparison operator * * @param[in] rhs Right-hand side of operator. */ - bool operator != (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const; + bool operator != (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const; - bool operator < (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const; - bool operator > (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const; + bool operator < (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const; + bool operator > (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const; - bool operator <= (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const; - bool operator >= (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const; + bool operator <= (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const; + bool operator >= (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const; private: /// Target string to iterate over. - const ACE_String_Base <CHAR> * str_; + const ACE_String_Base <ACE_CHAR_T> * str_; /// Current location in the string. size_t index_; }; -template < class CHAR > - ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &, - const ACE_String_Base < CHAR > &); -template < class CHAR > - ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &, - const CHAR *); -template < class CHAR > - ACE_String_Base < CHAR > operator + (const CHAR *, - const ACE_String_Base < CHAR > &); - -template < class CHAR > - ACE_String_Base < CHAR > operator + (const ACE_String_Base < CHAR > &t, - const CHAR c); - -template < class CHAR > - ACE_String_Base < CHAR > operator + (const CHAR c, - const ACE_String_Base < CHAR > &t); - -template <class CHAR> - bool operator == (const CHAR *s, - const ACE_String_Base<CHAR> &t); - -template <class CHAR> - bool operator != (const CHAR *s, - const ACE_String_Base<CHAR> &t); +template < class ACE_CHAR_T > + ACE_String_Base < ACE_CHAR_T > operator + (const ACE_String_Base < ACE_CHAR_T > &, + const ACE_String_Base < ACE_CHAR_T > &); +template < class ACE_CHAR_T > + ACE_String_Base < ACE_CHAR_T > operator + (const ACE_String_Base < ACE_CHAR_T > &, + const ACE_CHAR_T *); +template < class ACE_CHAR_T > + ACE_String_Base < ACE_CHAR_T > operator + (const ACE_CHAR_T *, + const ACE_String_Base < ACE_CHAR_T > &); + +template < class ACE_CHAR_T > + ACE_String_Base < ACE_CHAR_T > operator + (const ACE_String_Base < ACE_CHAR_T > &t, + const ACE_CHAR_T c); + +template < class ACE_CHAR_T > + ACE_String_Base < ACE_CHAR_T > operator + (const ACE_CHAR_T c, + const ACE_String_Base < ACE_CHAR_T > &t); + +template <class ACE_CHAR_T> + bool operator == (const ACE_CHAR_T *s, + const ACE_String_Base<ACE_CHAR_T> &t); + +template <class ACE_CHAR_T> + bool operator != (const ACE_CHAR_T *s, + const ACE_String_Base<ACE_CHAR_T> &t); ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/String_Base.inl b/ace/String_Base.inl index 17643cbe089..29c262e2b56 100644 --- a/ace/String_Base.inl +++ b/ace/String_Base.inl @@ -9,214 +9,214 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <class CHAR> ACE_INLINE void -ACE_String_Base<CHAR>::dump (void) const +template <class ACE_CHAR_T> ACE_INLINE void +ACE_String_Base<ACE_CHAR_T>::dump (void) const { #if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_String_Base<CHAR>::dump"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::dump"); #endif /* ACE_HAS_DUMP */ } // Assignment method (does not copy memory) -template <class CHAR> ACE_INLINE ACE_String_Base<CHAR> & -ACE_String_Base<CHAR>::assign_nocopy (const ACE_String_Base<CHAR> &s) +template <class ACE_CHAR_T> ACE_INLINE ACE_String_Base<ACE_CHAR_T> & +ACE_String_Base<ACE_CHAR_T>::assign_nocopy (const ACE_String_Base<ACE_CHAR_T> &s) { - ACE_TRACE ("ACE_String_Base<CHAR>::assign_nocopy"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::assign_nocopy"); this->set (s.rep_, s.len_, false); return *this; } -template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::size_type -ACE_String_Base<CHAR>::length (void) const +template <class ACE_CHAR_T> ACE_INLINE typename ACE_String_Base<ACE_CHAR_T>::size_type +ACE_String_Base<ACE_CHAR_T>::length (void) const { - ACE_TRACE ("ACE_String_Base<CHAR>::length"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::length"); return this->len_; } -template <class CHAR> ACE_INLINE size_t -ACE_String_Base<CHAR>::capacity (void) const +template <class ACE_CHAR_T> ACE_INLINE size_t +ACE_String_Base<ACE_CHAR_T>::capacity (void) const { - ACE_TRACE ("ACE_String_Base<CHAR>::capacity"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::capacity"); return this->buf_len_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base<CHAR>::is_empty (void) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base<ACE_CHAR_T>::is_empty (void) const { return this->len_ == 0; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base<CHAR>::empty (void) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base<ACE_CHAR_T>::empty (void) const { return this->is_empty (); } -template <class CHAR> ACE_INLINE ACE_String_Base<CHAR> -ACE_String_Base<CHAR>::substr ( - typename ACE_String_Base<CHAR>::size_type offset, - typename ACE_String_Base<CHAR>::size_type length) const +template <class ACE_CHAR_T> ACE_INLINE ACE_String_Base<ACE_CHAR_T> +ACE_String_Base<ACE_CHAR_T>::substr ( + typename ACE_String_Base<ACE_CHAR_T>::size_type offset, + typename ACE_String_Base<ACE_CHAR_T>::size_type length) const { - ACE_TRACE ("ACE_String_Base<CHAR>::substr"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::substr"); return this->substring (offset, length); } // Return the <slot'th> character in the string. -template <class CHAR> ACE_INLINE const CHAR & -ACE_String_Base<CHAR>::operator[] ( - typename ACE_String_Base<CHAR>::size_type slot) const +template <class ACE_CHAR_T> ACE_INLINE const ACE_CHAR_T & +ACE_String_Base<ACE_CHAR_T>::operator[] ( + typename ACE_String_Base<ACE_CHAR_T>::size_type slot) const { - ACE_TRACE ("ACE_String_Base<CHAR>::operator[]"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator[]"); return this->rep_[slot]; } // Return the <slot'th> character in the string by reference. -template <class CHAR> ACE_INLINE CHAR & -ACE_String_Base<CHAR>::operator[] ( - typename ACE_String_Base<CHAR>::size_type slot) +template <class ACE_CHAR_T> ACE_INLINE ACE_CHAR_T & +ACE_String_Base<ACE_CHAR_T>::operator[] ( + typename ACE_String_Base<ACE_CHAR_T>::size_type slot) { - ACE_TRACE ("ACE_String_Base<CHAR>::operator[]"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator[]"); return this->rep_[slot]; } -template <class CHAR> ACE_INLINE const CHAR * -ACE_String_Base<CHAR>::fast_rep (void) const +template <class ACE_CHAR_T> ACE_INLINE const ACE_CHAR_T * +ACE_String_Base<ACE_CHAR_T>::fast_rep (void) const { return this->rep_; } -template <class CHAR> ACE_INLINE const CHAR * -ACE_String_Base<CHAR>::c_str (void) const +template <class ACE_CHAR_T> ACE_INLINE const ACE_CHAR_T * +ACE_String_Base<ACE_CHAR_T>::c_str (void) const { return this->rep_; } // Less than comparison operator. -template <class CHAR> ACE_INLINE bool -ACE_String_Base<CHAR>::operator < (const ACE_String_Base<CHAR> &s) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base<ACE_CHAR_T>::operator < (const ACE_String_Base<ACE_CHAR_T> &s) const { - ACE_TRACE ("ACE_String_Base<CHAR>::operator <"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator <"); return compare (s) < 0; } // Greater than comparison operator. -template <class CHAR> ACE_INLINE bool -ACE_String_Base<CHAR>::operator > (const ACE_String_Base &s) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base<ACE_CHAR_T>::operator > (const ACE_String_Base &s) const { - ACE_TRACE ("ACE_String_Base<CHAR>::operator >"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator >"); return compare (s) > 0; } // Comparison operator. -template <class CHAR> ACE_INLINE bool -ACE_String_Base<CHAR>::operator!= (const ACE_String_Base<CHAR> &s) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base<ACE_CHAR_T>::operator!= (const ACE_String_Base<ACE_CHAR_T> &s) const { - ACE_TRACE ("ACE_String_Base<CHAR>::operator!="); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::operator!="); return !(*this == s); } -template <class CHAR> ACE_INLINE bool -ACE_String_Base<CHAR>::operator!= (const CHAR *s) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base<ACE_CHAR_T>::operator!= (const ACE_CHAR_T *s) const { return !(*this == s); } -template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::size_type -ACE_String_Base<CHAR>::find (const ACE_String_Base<CHAR>&str, - typename ACE_String_Base<CHAR>::size_type pos) const +template <class ACE_CHAR_T> ACE_INLINE typename ACE_String_Base<ACE_CHAR_T>::size_type +ACE_String_Base<ACE_CHAR_T>::find (const ACE_String_Base<ACE_CHAR_T>&str, + typename ACE_String_Base<ACE_CHAR_T>::size_type pos) const { - ACE_TRACE ("ACE_String_Base<CHAR>::find"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::find"); return this->find (str.rep_, pos); } -template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::size_type -ACE_String_Base<CHAR>::strstr (const ACE_String_Base<CHAR> &s) const +template <class ACE_CHAR_T> ACE_INLINE typename ACE_String_Base<ACE_CHAR_T>::size_type +ACE_String_Base<ACE_CHAR_T>::strstr (const ACE_String_Base<ACE_CHAR_T> &s) const { - ACE_TRACE ("ACE_String_Base<CHAR>::strstr"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::strstr"); return this->find (s.rep_); } -template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::iterator -ACE_String_Base<CHAR>::begin (void) +template <class ACE_CHAR_T> ACE_INLINE typename ACE_String_Base<ACE_CHAR_T>::iterator +ACE_String_Base<ACE_CHAR_T>::begin (void) { - ACE_TRACE ("ACE_String_Base<CHAR>::begin"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::begin"); return iterator (*this); } -template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::const_iterator -ACE_String_Base<CHAR>::begin (void) const +template <class ACE_CHAR_T> ACE_INLINE typename ACE_String_Base<ACE_CHAR_T>::const_iterator +ACE_String_Base<ACE_CHAR_T>::begin (void) const { - ACE_TRACE ("ACE_String_Base<CHAR>::begin"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::begin"); return const_iterator (*this); } -template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::iterator -ACE_String_Base<CHAR>::end (void) +template <class ACE_CHAR_T> ACE_INLINE typename ACE_String_Base<ACE_CHAR_T>::iterator +ACE_String_Base<ACE_CHAR_T>::end (void) { - ACE_TRACE ("ACE_String_Base<CHAR>::end"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::end"); return iterator (*this, 1); } -template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::const_iterator -ACE_String_Base<CHAR>::end (void) const +template <class ACE_CHAR_T> ACE_INLINE typename ACE_String_Base<ACE_CHAR_T>::const_iterator +ACE_String_Base<ACE_CHAR_T>::end (void) const { - ACE_TRACE ("ACE_String_Base<CHAR>::end"); + ACE_TRACE ("ACE_String_Base<ACE_CHAR_T>::end"); return const_iterator (*this, 1); } // ---------------------------------------------- -template <class CHAR> ACE_INLINE -ACE_String_Base_Iterator <CHAR>:: -ACE_String_Base_Iterator (ACE_String_Base <CHAR> & str, int end) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Iterator <ACE_CHAR_T>:: +ACE_String_Base_Iterator (ACE_String_Base <ACE_CHAR_T> & str, int end) : str_ (&str), index_ (0 == end ? 0 : str.length ()) { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::ACE_String_Base_Iterator"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::ACE_String_Base_Iterator"); } -template <class CHAR> ACE_INLINE -ACE_String_Base_Iterator <CHAR>:: -ACE_String_Base_Iterator (const ACE_String_Base_Iterator <CHAR> & iter) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Iterator <ACE_CHAR_T>:: +ACE_String_Base_Iterator (const ACE_String_Base_Iterator <ACE_CHAR_T> & iter) : str_ (iter.str_), index_ (iter.index_) { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::ACE_String_Base_Iterator"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::ACE_String_Base_Iterator"); } -template <class CHAR> ACE_INLINE -ACE_String_Base_Iterator <CHAR>::~ACE_String_Base_Iterator (void) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Iterator <ACE_CHAR_T>::~ACE_String_Base_Iterator (void) { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::~ACE_String_Base_Iterator"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::~ACE_String_Base_Iterator"); } -template <class CHAR> ACE_INLINE -int ACE_String_Base_Iterator <CHAR>::done (void) const +template <class ACE_CHAR_T> ACE_INLINE +int ACE_String_Base_Iterator <ACE_CHAR_T>::done (void) const { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::done"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::done"); return this->index_ >= this->str_->length () ? 1 : 0; } -template <class CHAR> ACE_INLINE -CHAR & ACE_String_Base_Iterator <CHAR>::operator * (void) +template <class ACE_CHAR_T> ACE_INLINE +ACE_CHAR_T & ACE_String_Base_Iterator <ACE_CHAR_T>::operator * (void) { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::operator *"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::operator *"); return this->str_->rep_[this->index_]; } -template <class CHAR> ACE_INLINE -ACE_String_Base_Iterator <CHAR> & -ACE_String_Base_Iterator <CHAR>::operator ++ (void) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Iterator <ACE_CHAR_T> & +ACE_String_Base_Iterator <ACE_CHAR_T>::operator ++ (void) { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::operator ++"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::operator ++"); if (0 == this->done ()) ++ this->index_; @@ -224,13 +224,13 @@ ACE_String_Base_Iterator <CHAR>::operator ++ (void) return *this; } -template <class CHAR> ACE_INLINE -ACE_String_Base_Iterator <CHAR> -ACE_String_Base_Iterator <CHAR>::operator ++ (int) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Iterator <ACE_CHAR_T> +ACE_String_Base_Iterator <ACE_CHAR_T>::operator ++ (int) { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::operator ++ (int)"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::operator ++ (int)"); - ACE_String_Base_Iterator <CHAR> temp (*this); + ACE_String_Base_Iterator <ACE_CHAR_T> temp (*this); if (0 == this->done ()) ++ this->index_; @@ -238,11 +238,11 @@ ACE_String_Base_Iterator <CHAR>::operator ++ (int) return temp; } -template <class CHAR> ACE_INLINE -ACE_String_Base_Iterator <CHAR> & -ACE_String_Base_Iterator <CHAR>::operator -- (void) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Iterator <ACE_CHAR_T> & +ACE_String_Base_Iterator <ACE_CHAR_T>::operator -- (void) { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::operator --"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::operator --"); if (0 < this->index_) -- this->index_; @@ -250,13 +250,13 @@ ACE_String_Base_Iterator <CHAR>::operator -- (void) return *this; } -template <class CHAR> ACE_INLINE -ACE_String_Base_Iterator <CHAR> -ACE_String_Base_Iterator <CHAR>::operator -- (int) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Iterator <ACE_CHAR_T> +ACE_String_Base_Iterator <ACE_CHAR_T>::operator -- (int) { - ACE_TRACE ("ACE_String_Base_Iterator<CHAR>::operator -- (int)"); + ACE_TRACE ("ACE_String_Base_Iterator<ACE_CHAR_T>::operator -- (int)"); - ACE_String_Base_Iterator <CHAR> temp (*this); + ACE_String_Base_Iterator <ACE_CHAR_T> temp (*this); if (0 < this->index_) -- this->index_; @@ -264,95 +264,95 @@ ACE_String_Base_Iterator <CHAR>::operator -- (int) return temp; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Iterator <CHAR>:: -operator == (const ACE_String_Base_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Iterator <ACE_CHAR_T>:: +operator == (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ == rhs.index_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Iterator <CHAR>:: -operator != (const ACE_String_Base_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Iterator <ACE_CHAR_T>:: +operator != (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ != rhs.index_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Iterator <CHAR>:: -operator < (const ACE_String_Base_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Iterator <ACE_CHAR_T>:: +operator < (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ < rhs.index_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Iterator <CHAR>:: -operator > (const ACE_String_Base_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Iterator <ACE_CHAR_T>:: +operator > (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ > rhs.index_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Iterator <CHAR>:: -operator >= (const ACE_String_Base_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Iterator <ACE_CHAR_T>:: +operator >= (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ >= rhs.index_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Iterator <CHAR>:: -operator <= (const ACE_String_Base_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Iterator <ACE_CHAR_T>:: +operator <= (const ACE_String_Base_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ <= rhs.index_; } // ---------------------------------------------- -template <class CHAR> ACE_INLINE -ACE_String_Base_Const_Iterator <CHAR>:: -ACE_String_Base_Const_Iterator (const ACE_String_Base <CHAR> & str, int end) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Const_Iterator <ACE_CHAR_T>:: +ACE_String_Base_Const_Iterator (const ACE_String_Base <ACE_CHAR_T> & str, int end) : str_ (&str), index_ (0 == end ? 0 : str.length ()) { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::ACE_String_Base_Const_Iterator"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::ACE_String_Base_Const_Iterator"); } -template <class CHAR> ACE_INLINE -ACE_String_Base_Const_Iterator <CHAR>:: -ACE_String_Base_Const_Iterator (const ACE_String_Base_Const_Iterator <CHAR> & iter) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Const_Iterator <ACE_CHAR_T>:: +ACE_String_Base_Const_Iterator (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & iter) : str_ (iter.str_), index_ (iter.index_) { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::ACE_String_Base_Const_Iterator"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::ACE_String_Base_Const_Iterator"); } -template <class CHAR> ACE_INLINE -ACE_String_Base_Const_Iterator <CHAR>::~ACE_String_Base_Const_Iterator (void) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Const_Iterator <ACE_CHAR_T>::~ACE_String_Base_Const_Iterator (void) { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::~ACE_String_Base_Const_Iterator"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::~ACE_String_Base_Const_Iterator"); } -template <class CHAR> ACE_INLINE -int ACE_String_Base_Const_Iterator <CHAR>::done (void) const +template <class ACE_CHAR_T> ACE_INLINE +int ACE_String_Base_Const_Iterator <ACE_CHAR_T>::done (void) const { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::done"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::done"); return this->index_ >= this->str_->length () ? 1 : 0; } -template <class CHAR> ACE_INLINE -const CHAR & ACE_String_Base_Const_Iterator <CHAR>::operator * (void) +template <class ACE_CHAR_T> ACE_INLINE +const ACE_CHAR_T & ACE_String_Base_Const_Iterator <ACE_CHAR_T>::operator * (void) { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator *"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::operator *"); return this->str_->rep_[this->index_]; } -template <class CHAR> ACE_INLINE -ACE_String_Base_Const_Iterator <CHAR> & -ACE_String_Base_Const_Iterator <CHAR>::operator ++ (void) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Const_Iterator <ACE_CHAR_T> & +ACE_String_Base_Const_Iterator <ACE_CHAR_T>::operator ++ (void) { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator ++"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::operator ++"); if (0 == this->done ()) ++ this->index_; @@ -360,13 +360,13 @@ ACE_String_Base_Const_Iterator <CHAR>::operator ++ (void) return *this; } -template <class CHAR> ACE_INLINE -ACE_String_Base_Const_Iterator <CHAR> -ACE_String_Base_Const_Iterator <CHAR>::operator ++ (int) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Const_Iterator <ACE_CHAR_T> +ACE_String_Base_Const_Iterator <ACE_CHAR_T>::operator ++ (int) { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator ++ (int)"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::operator ++ (int)"); - ACE_String_Base_Const_Iterator <CHAR> temp (*this); + ACE_String_Base_Const_Iterator <ACE_CHAR_T> temp (*this); if (0 == this->done ()) ++ this->index_; @@ -374,11 +374,11 @@ ACE_String_Base_Const_Iterator <CHAR>::operator ++ (int) return temp; } -template <class CHAR> ACE_INLINE -ACE_String_Base_Const_Iterator <CHAR> & -ACE_String_Base_Const_Iterator <CHAR>::operator -- (void) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Const_Iterator <ACE_CHAR_T> & +ACE_String_Base_Const_Iterator <ACE_CHAR_T>::operator -- (void) { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator --"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::operator --"); if (0 < this->index_) -- this->index_; @@ -386,13 +386,13 @@ ACE_String_Base_Const_Iterator <CHAR>::operator -- (void) return *this; } -template <class CHAR> ACE_INLINE -ACE_String_Base_Const_Iterator <CHAR> -ACE_String_Base_Const_Iterator <CHAR>::operator -- (int) +template <class ACE_CHAR_T> ACE_INLINE +ACE_String_Base_Const_Iterator <ACE_CHAR_T> +ACE_String_Base_Const_Iterator <ACE_CHAR_T>::operator -- (int) { - ACE_TRACE ("ACE_String_Base_Const_Iterator<CHAR>::operator -- (int)"); + ACE_TRACE ("ACE_String_Base_Const_Iterator<ACE_CHAR_T>::operator -- (int)"); - ACE_String_Base_Const_Iterator <CHAR> temp (*this); + ACE_String_Base_Const_Iterator <ACE_CHAR_T> temp (*this); if (0 < this->index_) -- this->index_; @@ -400,60 +400,60 @@ ACE_String_Base_Const_Iterator <CHAR>::operator -- (int) return temp; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Const_Iterator <CHAR>:: -operator == (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Const_Iterator <ACE_CHAR_T>:: +operator == (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ == rhs.index_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Const_Iterator <CHAR>:: -operator != (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Const_Iterator <ACE_CHAR_T>:: +operator != (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ != rhs.index_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Const_Iterator <CHAR>:: -operator < (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Const_Iterator <ACE_CHAR_T>:: +operator < (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ < rhs.index_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Const_Iterator <CHAR>:: -operator > (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Const_Iterator <ACE_CHAR_T>:: +operator > (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ > rhs.index_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Const_Iterator <CHAR>:: -operator >= (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Const_Iterator <ACE_CHAR_T>:: +operator >= (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ >= rhs.index_; } -template <class CHAR> ACE_INLINE bool -ACE_String_Base_Const_Iterator <CHAR>:: -operator <= (const ACE_String_Base_Const_Iterator <CHAR> & rhs) const +template <class ACE_CHAR_T> ACE_INLINE bool +ACE_String_Base_Const_Iterator <ACE_CHAR_T>:: +operator <= (const ACE_String_Base_Const_Iterator <ACE_CHAR_T> & rhs) const { return this->index_ <= rhs.index_; } // ---------------------------------------------- -template <class CHAR> ACE_INLINE bool -operator== (const CHAR *s, - const ACE_String_Base<CHAR> &t) +template <class ACE_CHAR_T> ACE_INLINE bool +operator== (const ACE_CHAR_T *s, + const ACE_String_Base<ACE_CHAR_T> &t) { return t == s; } -template <class CHAR> ACE_INLINE bool -operator!= (const CHAR *s, - const ACE_String_Base<CHAR> &t) +template <class ACE_CHAR_T> ACE_INLINE bool +operator!= (const ACE_CHAR_T *s, + const ACE_String_Base<ACE_CHAR_T> &t) { return !(t == s); } diff --git a/ace/Thread_Mutex.h b/ace/Thread_Mutex.h index d8f5369b01a..2c5d7bfca88 100644 --- a/ace/Thread_Mutex.h +++ b/ace/Thread_Mutex.h @@ -130,15 +130,16 @@ public: int tryacquire_write (void); /** - * This is only here to make the ACE_Thread_Mutex - * interface consistent with the other synchronization APIs. - * Assumes the caller has already acquired the mutex using one of - * the above calls, and returns 0 (success) always. + * This is only here to make the ACE_Thread_Mutex interface + * consistent with the other synchronization APIs. Assumes the + * caller has already acquired the mutex using one of the above + * calls, and returns 0 (success) always. */ int tryacquire_write_upgrade (void); /// Return the underlying mutex. const ACE_thread_mutex_t &lock (void) const; + ACE_thread_mutex_t &lock (void); /// Dump the state of an object. void dump (void) const; @@ -146,7 +147,7 @@ public: /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; - // protected: +protected: /// Mutex type that supports single-process locking efficiently. ACE_thread_mutex_t lock_; diff --git a/ace/Thread_Mutex.inl b/ace/Thread_Mutex.inl index dbef586fbc3..0a9abbd3b9e 100644 --- a/ace/Thread_Mutex.inl +++ b/ace/Thread_Mutex.inl @@ -11,6 +11,13 @@ ACE_Thread_Mutex::lock (void) const return this->lock_; } +ACE_INLINE ACE_thread_mutex_t & +ACE_Thread_Mutex::lock (void) +{ +// ACE_TRACE ("ACE_Thread_Mutex::lock"); + return this->lock_; +} + ACE_INLINE int ACE_Thread_Mutex::acquire_read (void) { diff --git a/ace/Time_Value.cpp b/ace/Time_Value.cpp index 4f6953be055..e40f98af10e 100644 --- a/ace/Time_Value.cpp +++ b/ace/Time_Value.cpp @@ -10,6 +10,12 @@ ACE_RCSID (ace, #include "ace/Numeric_Limits.h" #include "ace/If_Then_Else.h" +#include "ace/OS_NS_math.h" + +#ifdef ACE_HAS_CPP98_IOSTREAMS +#include <ostream> +#include <iomanip> +#endif /* ACE_HAS_CPP98_IOSTREAMS */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -162,7 +168,7 @@ ACE_Time_Value::dump (void) const } void -ACE_Time_Value::normalize (void) +ACE_Time_Value::normalize (bool saturate) { // // ACE_OS_TRACE ("ACE_Time_Value::normalize"); // From Hans Rohnert... @@ -171,23 +177,45 @@ ACE_Time_Value::normalize (void) { /*! \todo This loop needs some optimization. */ - do - { - ++this->tv_.tv_sec; - this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; - } - while (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS); + if (!saturate) // keep the conditionnal expression outside the while loop to minimize performance cost + do + { + ++this->tv_.tv_sec; + this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; + } + while (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS); + else + do + if (this->tv_.tv_sec < ACE_Numeric_Limits<time_t>::max()) + { + ++this->tv_.tv_sec; + this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; + } + else + this->tv_.tv_usec = ACE_ONE_SECOND_IN_USECS - 1; + while (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS); } else if (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS) { /*! \todo This loop needs some optimization. */ - do - { - --this->tv_.tv_sec; - this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; - } - while (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS); + if (!saturate) + do + { + --this->tv_.tv_sec; + this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; + } + while (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS); + else + do + if (this->tv_.tv_sec > ACE_Numeric_Limits<time_t>::min()) + { + --this->tv_.tv_sec; + this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; + } + else + this->tv_.tv_usec = -ACE_ONE_SECOND_IN_USECS + 1; + while (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS); } if (this->tv_.tv_sec >= 1 && this->tv_.tv_usec < 0) @@ -195,7 +223,7 @@ ACE_Time_Value::normalize (void) --this->tv_.tv_sec; this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; } -// tv_sec in qnxnto is unsigned + // tv_sec in qnxnto is unsigned #if !defined ( __QNXNTO__) else if (this->tv_.tv_sec < 0 && this->tv_.tv_usec > 0) { @@ -209,51 +237,107 @@ ACE_Time_Value::normalize (void) ACE_Time_Value & ACE_Time_Value::operator *= (double d) { - // The floating type to be used in the computations. It should be - // large enough to hold a time_t. We actually want a floating type - // with enough digits in its mantissa to hold a time_t without - // losing precision. For example, if FLT_RADIX is 2 and - // LDBL_MANT_DIG is 64, a long double has a 64 bit wide mantissa, - // which would be sufficient to hold a 64 bit time_t value without - // losing precision. + // To work around the lack of precision of a long double to contain + // a 64-bits time_t + 6 digits after the decimal point for the usec part, + // we perform the multiplication of the 2 timeval parts separately. // - // For now we'll simply go with long double if it is larger than - // time_t. We're hosed if long double isn't large enough. + // This extra precision step is adding a cost when transfering the + // seconds resulting from the usec multiplication. This operation + // correspond to the normalization process performed in normalize() + // but we must absolutly do it here because the usec multiplication + // result value could exceed what can be stored in a suseconds_t + // type variable. + // + // Since this is a costly operation, we try to detect as soon as + // possible if we are having a saturation in order to abort the rest + // of the computation. typedef ACE::If_Then_Else<(sizeof (double) > sizeof (time_t)), - double, - long double>::result_type float_type; + double, + long double>::result_type float_type; - float_type time_total = - (this->sec () - + static_cast<float_type> (this->usec ()) / ACE_ONE_SECOND_IN_USECS) * d; + float_type sec_total = static_cast<float_type> (this->sec()); + sec_total *= d; // shall we saturate the result? static const float_type max_int = - ACE_Numeric_Limits<time_t>::max () + 0.999999; + ACE_Numeric_Limits<time_t>::max() + 0.999999; static const float_type min_int = - ACE_Numeric_Limits<time_t>::min () - 0.999999; - - if (time_total > max_int) - time_total = max_int; - if (time_total < min_int) - time_total = min_int; - - const time_t time_sec = static_cast<time_t> (time_total); + ACE_Numeric_Limits<time_t>::min() - 0.999999; - time_total -= time_sec; - time_total *= ACE_ONE_SECOND_IN_USECS; + if (sec_total > max_int) + this->set(ACE_Numeric_Limits<time_t>::max(), ACE_ONE_SECOND_IN_USECS-1); + else if (sec_total < min_int) + this->set(ACE_Numeric_Limits<time_t>::min(), -ACE_ONE_SECOND_IN_USECS+1); + else + { + time_t time_sec = static_cast<time_t> (sec_total); + + float_type usec_total = this->usec(); + usec_total *= d; + + // adding usec resulting from tv_sec mult + usec_total += (sec_total-time_sec) * ACE_ONE_SECOND_IN_USECS; + + // extract seconds component of the usec mult + sec_total = usec_total / ACE_ONE_SECOND_IN_USECS; + // keep remaining usec + if (sec_total > 0) + usec_total = (sec_total - ACE_OS::floor(sec_total)); + else + usec_total = (sec_total - ACE_OS::ceil(sec_total)); + + sec_total -= usec_total; + usec_total *= ACE_ONE_SECOND_IN_USECS; + + // add the seconds component of the usec mult with the tv_sec mult prod. + sec_total += time_sec; + + // recheck for saturation + if (sec_total > max_int) + this->set (ACE_Numeric_Limits<time_t>::max(), ACE_ONE_SECOND_IN_USECS - 1); + else if (sec_total < min_int) + this->set (ACE_Numeric_Limits<time_t>::min(), -ACE_ONE_SECOND_IN_USECS + 1); + else + { + time_sec = static_cast<time_t> (sec_total); + suseconds_t time_usec = static_cast<suseconds_t> (usec_total); - suseconds_t time_usec = static_cast<suseconds_t> (time_total); + // round up the result to save the last usec + if (time_usec > 0 && (usec_total - time_usec) >= 0.5) + ++time_usec; + else if (time_usec < 0 && (usec_total - time_usec) <= -0.5) + --time_usec; - // round up the result to save the last usec - if (time_usec > 0 && (time_total - time_usec) >= 0.5) - ++time_usec; - else if (time_usec < 0 && (time_total - time_usec) <= -0.5) - --time_usec; + this->set (time_sec, time_usec); + } + } + return *this; +} - this->set (time_sec, time_usec); +#ifdef ACE_HAS_CPP98_IOSTREAMS +ostream &operator<<(ostream &o, const ACE_Time_Value &v) +{ + char oldFiller = o.fill (); + o.fill ('0'); + const timeval *tv = v; + if (tv->tv_sec) + { + o << tv->tv_sec; + if (tv->tv_usec) + o << '.' << std::setw (6) << abs (tv->tv_usec); + } + else if (tv->tv_usec < 0) + o << "-0." << std::setw (6) << -tv->tv_usec; + else + { + o << '0'; + if (tv->tv_usec > 0) + o << '.'<< std::setw (6) << tv->tv_usec; + } - return *this; + o.fill (oldFiller); + return o; } +#endif /* ACE_HAS_CPP98_IOSTREAMS */ ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Time_Value.h b/ace/Time_Value.h index eb8bf13492d..5943094ef75 100644 --- a/ace/Time_Value.h +++ b/ace/Time_Value.h @@ -32,6 +32,9 @@ suseconds_t const ACE_ONE_SECOND_IN_USECS = 1000000; // needed for ACE_UINT64 #include "ace/Basic_Types.h" +// needed to determine if iostreams are present +#include "ace/iosfwd.h" + // This forward declaration is needed by the set() and FILETIME() functions #if defined (ACE_LACKS_LONGLONG_T) ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -324,7 +327,7 @@ public: private: /// Put the timevalue into a canonical form. - void normalize (void); + void normalize (bool saturate = false); /// Store the values as a timeval. #if defined (ACE_HAS_TIME_T_LONG_MISMATCH) @@ -346,6 +349,10 @@ private: #endif /* ACE_HAS_TIME_T_LONG_MISMATCH */ }; +#ifdef ACE_HAS_CPP98_IOSTREAMS +extern ACE_Export ostream &operator<<( ostream &o, const ACE_Time_Value &v ); +#endif + ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) diff --git a/ace/Time_Value.inl b/ace/Time_Value.inl index 5c09dec5f11..73f9285ff2d 100644 --- a/ace/Time_Value.inl +++ b/ace/Time_Value.inl @@ -211,7 +211,7 @@ ACE_Time_Value::to_usec (ACE_UINT64 & usec) const usec = ACE_U_LongLong (this->tv_.tv_sec); #else usec = static_cast<ACE_UINT64> (this->tv_.tv_sec); -#endif /* ACE_LACKS_LONG_LONG_T */ +#endif /* ACE_LACKS_LONGLONG_T */ usec *= 1000000; usec += this->tv_.tv_usec; } diff --git a/ace/Tokenizer_T.cpp b/ace/Tokenizer_T.cpp index a0af46e9ec0..d913a92049b 100644 --- a/ace/Tokenizer_T.cpp +++ b/ace/Tokenizer_T.cpp @@ -11,8 +11,8 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <class CHAR> -ACE_Tokenizer_T<CHAR>::ACE_Tokenizer_T (CHAR *buffer) +template <class ACE_CHAR_T> +ACE_Tokenizer_T<ACE_CHAR_T>::ACE_Tokenizer_T (ACE_CHAR_T *buffer) : buffer_ (buffer), index_ (0), preserves_index_ (0), @@ -20,9 +20,9 @@ ACE_Tokenizer_T<CHAR>::ACE_Tokenizer_T (CHAR *buffer) { } -template <class CHAR> +template <class ACE_CHAR_T> int -ACE_Tokenizer_T<CHAR>::delimiter (CHAR d) +ACE_Tokenizer_T<ACE_CHAR_T>::delimiter (ACE_CHAR_T d) { if (delimiter_index_ == MAX_DELIMITERS) return -1; @@ -33,10 +33,10 @@ ACE_Tokenizer_T<CHAR>::delimiter (CHAR d) return 0; } -template <class CHAR> +template <class ACE_CHAR_T> int -ACE_Tokenizer_T<CHAR>::delimiter_replace (CHAR d, - CHAR replacement) +ACE_Tokenizer_T<ACE_CHAR_T>::delimiter_replace (ACE_CHAR_T d, + ACE_CHAR_T replacement) { // Make it possible to replace delimiters on-the-fly, e.g., parse // string until certain token count and then copy rest of the @@ -59,10 +59,10 @@ ACE_Tokenizer_T<CHAR>::delimiter_replace (CHAR d, return 0; } -template <class CHAR> +template <class ACE_CHAR_T> int -ACE_Tokenizer_T<CHAR>::preserve_designators (CHAR start, - CHAR stop, +ACE_Tokenizer_T<ACE_CHAR_T>::preserve_designators (ACE_CHAR_T start, + ACE_CHAR_T stop, int strip) { if (preserves_index_ == MAX_PRESERVES) @@ -75,11 +75,11 @@ ACE_Tokenizer_T<CHAR>::preserve_designators (CHAR start, return 0; } -template <class CHAR> +template <class ACE_CHAR_T> int -ACE_Tokenizer_T<CHAR>::is_delimiter (CHAR d, +ACE_Tokenizer_T<ACE_CHAR_T>::is_delimiter (ACE_CHAR_T d, int &replace, - CHAR &r) + ACE_CHAR_T &r) { replace = 0; @@ -97,10 +97,10 @@ ACE_Tokenizer_T<CHAR>::is_delimiter (CHAR d, return 0; } -template <class CHAR> +template <class ACE_CHAR_T> int -ACE_Tokenizer_T<CHAR>::is_preserve_designator (CHAR start, - CHAR &stop, +ACE_Tokenizer_T<ACE_CHAR_T>::is_preserve_designator (ACE_CHAR_T start, + ACE_CHAR_T &stop, int &strip) { for (int x = 0; x < preserves_index_; x++) @@ -114,9 +114,9 @@ ACE_Tokenizer_T<CHAR>::is_preserve_designator (CHAR start, return 0; } -template <class CHAR> -CHAR * -ACE_Tokenizer_T<CHAR>::next (void) +template <class ACE_CHAR_T> +ACE_CHAR_T * +ACE_Tokenizer_T<ACE_CHAR_T>::next (void) { // Check if the previous pass was the last one in the buffer. if (index_ == -1) @@ -124,16 +124,16 @@ ACE_Tokenizer_T<CHAR>::next (void) index_ = 0; return 0; } - + // Check if a buffer has been passed if (!buffer_) { return 0; } - CHAR replacement = 0; + ACE_CHAR_T replacement = 0; int replace; - CHAR *next_token = 0; + ACE_CHAR_T *next_token = 0; // Skip all leading delimiters. for (;;) @@ -159,7 +159,7 @@ ACE_Tokenizer_T<CHAR>::next (void) next_token = buffer_ + index_; // A preserved region is it's own token. - CHAR stop; + ACE_CHAR_T stop; int strip; if (this->is_preserve_designator (buffer_[index_], stop, diff --git a/ace/Tokenizer_T.h b/ace/Tokenizer_T.h index 0d5455d14c4..097f9cc3965 100644 --- a/ace/Tokenizer_T.h +++ b/ace/Tokenizer_T.h @@ -33,7 +33,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * preserve designators. Does not allow special characters, yet * (e.g., printf ("\"like a quoted string\"")). */ -template <class CHAR> +template <class ACE_CHAR_T> class ACE_Tokenizer_T { public: @@ -47,7 +47,7 @@ public: * \sa preserve_designators * \sa preserve_designators */ - ACE_Tokenizer_T (CHAR *buffer); + ACE_Tokenizer_T (ACE_CHAR_T *buffer); /** * \a d is a delimiter. @@ -70,7 +70,7 @@ public: Joseph/Hagins Hagins \endverbatim */ - int delimiter (CHAR d); + int delimiter (ACE_CHAR_T d); /** * \a d is a delimiter and, when found, will be replaced by @@ -94,7 +94,7 @@ public: Joseph Hagins \endverbatim */ - int delimiter_replace (CHAR d, CHAR replacement); + int delimiter_replace (ACE_CHAR_T d, ACE_CHAR_T replacement); /** * Extract string between a pair of designator characters. @@ -139,10 +139,10 @@ public: Joseph Hagins \endverbatim */ - int preserve_designators (CHAR start, CHAR stop, int strip=1); + int preserve_designators (ACE_CHAR_T start, ACE_CHAR_T stop, int strip=1); /// Returns the next token. - CHAR *next (void); + ACE_CHAR_T *next (void); enum { MAX_DELIMITERS=16, @@ -152,16 +152,16 @@ public: protected: /// Returns 1 if @a d is a delimiter, 0 otherwise. If @a d should be /// replaced with @a r, @a replace is set to 1, otherwise 0. - int is_delimiter (CHAR d, int &replace, CHAR &r); + int is_delimiter (ACE_CHAR_T d, int &replace, ACE_CHAR_T &r); /** * If @a start is a start preserve designator, returns 1 and sets * @a stop to the stop designator. Returns 0 if @a start is not a * preserve designator. */ - int is_preserve_designator (CHAR start, CHAR &stop, int &strip); + int is_preserve_designator (ACE_CHAR_T start, ACE_CHAR_T &stop, int &strip); - CHAR *buffer_; + ACE_CHAR_T *buffer_; int index_; /** @@ -184,8 +184,8 @@ protected: * E.g., ")". * Whether the designators should be removed from the token. */ - CHAR start_; - CHAR stop_; + ACE_CHAR_T start_; + ACE_CHAR_T stop_; int strip_; }; @@ -212,8 +212,8 @@ protected: * with a technique that sets replacement_ = delimiter by * default. I'll do that next iteration. */ - CHAR delimiter_; - CHAR replacement_; + ACE_CHAR_T delimiter_; + ACE_CHAR_T replacement_; int replace_; }; diff --git a/ace/UUID.cpp b/ace/UUID.cpp index 1690bfcd41f..c39121a1f39 100644 --- a/ace/UUID.cpp +++ b/ace/UUID.cpp @@ -36,24 +36,24 @@ namespace ACE_Utils const UUID & UUID::operator = (const UUID & rhs) { - if (this == &rhs) - return *this; - - // Reset the string version of the UUID a string version - // exist, and the UUID is not equal to the old UUID. - if (0 != this->as_string_.get ()) + if (this != &rhs) { - if (0 == rhs.as_string_.get () || *this != rhs) - this->as_string_.reset (); - } + // Reset the string version of the UUID a string version + // exist, and the UUID is not equal to the old UUID. + if (0 != this->as_string_.get ()) + { + if (0 == rhs.as_string_.get () || *this != rhs) + this->as_string_.reset (); + } - // Copy the contents of the UUID. - ACE_OS::memcpy (&this->uuid_, &rhs.uuid_, BINARY_SIZE); + // Copy the contents of the UUID. + ACE_OS::memcpy (&this->uuid_, &rhs.uuid_, BINARY_SIZE); - /// @todo We should create an UUID_Ex class for UUIDs that - /// contain the thread id and process id. - this->thr_id_ = rhs.thr_id_; - this->pid_ = rhs.pid_; + /// @todo We should create an UUID_Ex class for UUIDs that + /// contain the thread id and process id. + this->thr_id_ = rhs.thr_id_; + this->pid_ = rhs.pid_; + } return *this; } @@ -315,7 +315,7 @@ namespace ACE_Utils return; ACE_OS::macaddr_node_t macaddress; - int result = ACE_OS::getmacaddress (&macaddress); + int const result = ACE_OS::getmacaddress (&macaddress); UUID_Node::Node_ID node_id; @@ -393,7 +393,7 @@ namespace ACE_Utils UUID* UUID_Generator::generate_UUID (ACE_UINT16 version, u_char variant) { - UUID* uuid; + UUID* uuid = 0; ACE_NEW_RETURN (uuid, UUID, 0); diff --git a/ace/UUID.h b/ace/UUID.h index 755f3e84a1d..f357ab8a70e 100644 --- a/ace/UUID.h +++ b/ace/UUID.h @@ -21,6 +21,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Auto_Ptr.h" #include "ace/SString.h" #include "ace/Singleton.h" #include "ace/Synch_Traits.h" diff --git a/ace/Unbounded_Set_Ex.h b/ace/Unbounded_Set_Ex.h index 31f92e3009d..acf54ebd426 100644 --- a/ace/Unbounded_Set_Ex.h +++ b/ace/Unbounded_Set_Ex.h @@ -16,6 +16,7 @@ #include "ace/Node.h" #include "ace/os_include/os_stddef.h" +#include <iterator> #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -43,6 +44,16 @@ template <class T, class C> class ACE_Unbounded_Set_Ex_Iterator { public: + /// Type definition of the container type. + typedef ACE_Unbounded_Set_Ex<T, C> container_type; + + // = std::iterator_traits typedefs/traits. + typedef std::forward_iterator_tag iterator_category; + typedef typename container_type::value_type value_type; + typedef typename container_type::reference reference; + typedef typename container_type::pointer pointer; + typedef typename container_type::difference_type difference_type; + // = Initialization method. ACE_Unbounded_Set_Ex_Iterator (ACE_Unbounded_Set_Ex<T, C> &s, bool end = false); @@ -102,6 +113,15 @@ template <class T, class C> class ACE_Unbounded_Set_Ex_Const_Iterator { public: + typedef ACE_Unbounded_Set_Ex<T, C> container_type; + + // = std::iterator_traits typedefs/traits. + typedef std::forward_iterator_tag iterator_category; + typedef typename container_type::const_value_type value_type; + typedef typename container_type::const_reference reference; + typedef typename container_type::const_pointer pointer; + typedef typename container_type::difference_type difference_type; + // = Initialization method. ACE_Unbounded_Set_Ex_Const_Iterator (const ACE_Unbounded_Set_Ex<T, C> &s, bool end = false); @@ -206,6 +226,15 @@ public: typedef C COMP; typedef ACE_Node<T, C> NODE; + // = STL typedefs/traits. + typedef T value_type; + typedef T const const_value_type; + typedef value_type & reference; + typedef const_value_type & const_reference; + typedef value_type * pointer; + typedef const_value_type * const_pointer; + typedef ptrdiff_t difference_type; + // = Initialization and termination methods. /// Constructor. Use user specified allocation strategy /// if specified. diff --git a/ace/Version.h b/ace/Version.h index 070198a3daa..20da455881b 100644 --- a/ace/Version.h +++ b/ace/Version.h @@ -5,5 +5,5 @@ #define ACE_MAJOR_VERSION 5 #define ACE_MINOR_VERSION 7 -#define ACE_BETA_VERSION 5 -#define ACE_VERSION "5.7.5" +#define ACE_BETA_VERSION 6 +#define ACE_VERSION "5.7.6" diff --git a/ace/XtReactor/XtReactor.cpp b/ace/XtReactor/XtReactor.cpp index 8159b24bf4d..f7cbb5bbdd5 100644 --- a/ace/XtReactor/XtReactor.cpp +++ b/ace/XtReactor/XtReactor.cpp @@ -203,74 +203,18 @@ ACE_XtReactor::register_handler_i (ACE_HANDLE handle, // Make sure we have a valid context ACE_ASSERT (this->context_ != 0); +#if defined ACE_WIN32 + // Let's handle this special case before we do any real work. + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) + ACE_NOTSUP_RETURN(-1); +#endif /* ACE_WIN32 */ + int result = ACE_Select_Reactor::register_handler_i (handle, handler, mask); if (result == -1) return -1; - int condition = 0; - -#if !defined ACE_WIN32 - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) - ACE_SET_BITS (condition, XtInputReadMask); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) - ACE_SET_BITS (condition, XtInputWriteMask); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) - ACE_SET_BITS (condition, XtInputExceptMask); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) - ACE_SET_BITS (condition, XtInputReadMask); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){ - ACE_SET_BITS (condition, XtInputWriteMask); // connected, you may write - ACE_SET_BITS (condition, XtInputReadMask); // connected, you have data/err - } -#else - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) - ACE_SET_BITS (condition, XtInputReadWinsock); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) - ACE_SET_BITS (condition, XtInputWriteWinsock); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) - ACE_NOTSUP_RETURN(-1); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::ACCEPT_MASK)) - ACE_SET_BITS (condition, XtInputReadWinsock); - if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::CONNECT_MASK)){ - ACE_SET_BITS (condition, XtInputWriteWinsock); // connected, you may write - ACE_SET_BITS (condition, XtInputReadWinsock); // connected, you have data/err - } -#endif /* !ACE_WIN32 */ - - if (condition != 0) - { - ACE_XtReactorID *XtID = this->ids_; - - while(XtID) - { - if (XtID->handle_ == handle) - { - ::XtRemoveInput (XtID->id_); - - XtID->id_ = ::XtAppAddInput (this->context_, - (int) handle, - (XtPointer) condition, - InputCallbackProc, - (XtPointer) this); - return 0; - } - else - XtID = XtID->next_; - } - - ACE_NEW_RETURN (XtID, - ACE_XtReactorID, - -1); - XtID->next_ = this->ids_; - XtID->handle_ = handle; - XtID->id_ = ::XtAppAddInput (this->context_, - (int) handle, - (XtPointer) condition, - InputCallbackProc, - (XtPointer) this); - this->ids_ = XtID; - } + synchronize_XtInput (handle); return 0; } @@ -290,61 +234,137 @@ ACE_XtReactor::remove_handler_i (ACE_HANDLE handle, { ACE_TRACE ("ACE_XtReactor::remove_handler_i"); - // In the registration phase we registered first with - // ACE_Select_Reactor and then with X. Now we are now doing things - // in reverse order. + int result = ACE_Select_Reactor::remove_handler_i (handle, + mask); + if (result == -1) + return -1; - // First clean up the corresponding X11Input. - this->remove_XtInput (handle); + synchronize_XtInput (handle); + return 0; +} - // Now let the reactor do its work. - return ACE_Select_Reactor::remove_handler_i (handle, +int +ACE_XtReactor::remove_handler_i (const ACE_Handle_Set &handles, + ACE_Reactor_Mask mask) +{ + return ACE_Select_Reactor::remove_handler_i (handles, mask); } +int +ACE_XtReactor::suspend_i (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_XtReactor::suspend_i"); + + int result = ACE_Select_Reactor::suspend_i (handle); + + if (result == -1) + return -1; + + synchronize_XtInput (handle); + return 0; +} + +int +ACE_XtReactor::resume_i (ACE_HANDLE handle) +{ + ACE_TRACE ("ACE_XtReactor::resume_i"); + + int result = ACE_Select_Reactor::resume_i (handle); + + if (result == -1) + return -1; + + synchronize_XtInput (handle); + return 0; +} + void -ACE_XtReactor::remove_XtInput (ACE_HANDLE handle) +ACE_XtReactor::synchronize_XtInput(ACE_HANDLE handle) { - ACE_TRACE ("ACE_XtReactor::remove_XtInput"); + ACE_TRACE ("ACE_XtReactor::synchronize_XtInput"); - ACE_XtReactorID *XtID = this->ids_; + // The idea here is to call this function after the base class has + // processed the register/remove/suspend/resume_handler request. The + // resulting mask is used to find out which XtInput mask we need. - if (XtID) - { - if (XtID->handle_ == handle) - { - ::XtRemoveInput (XtID->id_); - this->ids_ = XtID->next_; - delete XtID; - return; - } + // Find existing handler in linked list. + ACE_XtReactorID **XtID = &(this->ids_); - ACE_XtReactorID *NextID = XtID->next_; + while (*XtID && (*XtID)->handle_ != handle) + XtID = &((*XtID)->next_); - while (NextID) + // Remove existing input handler. + if (*XtID) + ::XtRemoveInput ((*XtID)->id_); + + int condition = compute_Xt_condition (handle); + + if (condition == 0) // No input handler needed. + { + if (*XtID) { - if (NextID->handle_ == handle) - { - ::XtRemoveInput(NextID->id_); - XtID->next_ = NextID->next_; - delete NextID; - return; - } - else - { - XtID = NextID; - NextID = NextID->next_; - } + // Remove linked list entry. + ACE_XtReactorID *toDelete = *XtID; + *XtID = (*XtID)->next_; + delete toDelete; } + return; } + + if (*XtID == 0) + { + // Create new node. + ACE_XtReactorID *tmp = new ACE_XtReactorID; + tmp->next_ = this->ids_; + tmp->handle_ = handle; + this->ids_ = tmp; + XtID = &(this->ids_); + } + + // Finally, add input handler. + (*XtID)->id_ = ::XtAppAddInput (this->context_, + (int) handle, + (XtPointer) condition, + InputCallbackProc, + (XtPointer) this); } int -ACE_XtReactor::remove_handler_i (const ACE_Handle_Set &handles, - ACE_Reactor_Mask mask) +ACE_XtReactor::compute_Xt_condition(ACE_HANDLE handle) { - return ACE_Select_Reactor::remove_handler_i (handles, - mask); + ACE_TRACE ("ACE_XtReactor::compute_Xt_condition"); + + // Retrieve current wait mask from base class. + // The returned value is either a combination of READ/WRITE/EXCEPT_MASK + // or -1. + int mask =this->bit_ops(handle, + 0, + this->wait_set_, + ACE_Reactor::GET_MASK); + + if (mask == -1) // No active mask. + return 0; + + int condition = 0; + +#if !defined ACE_WIN32 + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) + ACE_SET_BITS (condition, XtInputReadMask); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) + ACE_SET_BITS (condition, XtInputWriteMask); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::EXCEPT_MASK)) + ACE_SET_BITS (condition, XtInputExceptMask); +#else + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::READ_MASK)) + ACE_SET_BITS (condition, XtInputReadWinsock); + if (ACE_BIT_ENABLED (mask, ACE_Event_Handler::WRITE_MASK)) + ACE_SET_BITS (condition, XtInputWriteWinsock); + // EXCEPT_MASK is not supported for WIN32. As this was + // already handled in register_handler_i, no check here. +#endif /* !ACE_WIN32 */ + + return condition; } // The following functions ensure that there is an Xt timeout for the diff --git a/ace/XtReactor/XtReactor.h b/ace/XtReactor/XtReactor.h index f3483fcd35a..cf578ab55cd 100644 --- a/ace/XtReactor/XtReactor.h +++ b/ace/XtReactor/XtReactor.h @@ -101,8 +101,17 @@ protected: virtual int remove_handler_i (const ACE_Handle_Set &handles, ACE_Reactor_Mask); - /// Removes an Xt handle. - virtual void remove_XtInput (ACE_HANDLE handle); + /// Suspend the <Event_Handler> associated with @a handle + virtual int suspend_i (ACE_HANDLE handle); + + /// Resume the <Event_Handler> associated with @a handle + virtual int resume_i (ACE_HANDLE handle); + + /// Synchronize XtInputHandler for @a handle + virtual void synchronize_XtInput(ACE_HANDLE handle); + + /// Compute needed Xt condition by looking at base class wait set. + virtual int compute_Xt_condition(ACE_HANDLE handle); /// Wait for events to occur. virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &, diff --git a/ace/ace_for_tao.mpc b/ace/ace_for_tao.mpc index 821c500cd8b..436f8afe7ff 100644 --- a/ace/ace_for_tao.mpc +++ b/ace/ace_for_tao.mpc @@ -84,6 +84,7 @@ project(ACE_FOR_TAO) : acedefaults, install, svcconf, uuid, versioned_namespace, Mem_Map.cpp Message_Block.cpp Message_Queue.cpp + Message_Queue_NT.cpp MMAP_Memory_Pool.cpp Monitor_Admin.cpp Monitor_Admin_Manager.cpp diff --git a/ace/config-WinCE.h b/ace/config-WinCE.h index 3bd3620e2f8..0fe7fe7100b 100644 --- a/ace/config-WinCE.h +++ b/ace/config-WinCE.h @@ -73,6 +73,8 @@ #define ACE_LACKS_TZSET #define ACE_LACKS_RAISE #define ACE_LACKS_BSEARCH +#define ACE_LACKS_CEILL +#define ACE_LACKS_FLOORL #define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 diff --git a/ace/config-g++-common.h b/ace/config-g++-common.h index 86ee5673c84..c49752b72db 100644 --- a/ace/config-g++-common.h +++ b/ace/config-g++-common.h @@ -149,6 +149,19 @@ # endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ #endif /* __GNU__ >= 4 */ +// GCC >= 4.1 provides __sync_XXXX builtins for use in atomic operations +// although the builtins are provided globally they are not supported on all platforms +#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) +# if defined (__powerpc__) +// the builtins seem to be provided for all powerpc platforms +# define ACE_HAS_GCC_ATOMIC_BUILTINS 1 +# endif +# if defined (__ia64) +// the builtins seem to be provided for the IA64 platforms +# define ACE_HAS_GCC_ATOMIC_BUILTINS 1 +# endif +#endif + #if defined (ACE_HAS_GNU_REPO) // -frepo causes unresolved symbols of basic_string left- and // right-shift operators with ACE_HAS_STRING_CLASS. diff --git a/ace/config-hpux-11.00.h b/ace/config-hpux-11.00.h index 8be52fe880a..6093b4f98bc 100644 --- a/ace/config-hpux-11.00.h +++ b/ace/config-hpux-11.00.h @@ -343,6 +343,11 @@ #define ACE_LACKS_SETENV #define ACE_LACKS_UNSETENV +#if !defined (__ia64) +# define ACE_LACKS_CEILL +# define ACE_LACKS_FLOORL +#endif + // Shared library name/path components #if defined (__ia64) # define ACE_DLL_SUFFIX ACE_TEXT (".so") diff --git a/ace/config-integritySCA.h b/ace/config-integritySCA.h index b1ed54248f2..7103e9c8b2b 100644 --- a/ace/config-integritySCA.h +++ b/ace/config-integritySCA.h @@ -103,12 +103,9 @@ #define ACE_LACKS_RWLOCK_T #define ACE_LACKS_SEMBUF_T #define ACE_LACKS_UNIX_DOMAIN_SOCKETS -#define ACE_LACKS_USER -#define ACE_LACKS_FILE_FCNTL #define ACE_LACKS_FCNTL #define ACE_LACKS_UMASK #define ACE_LACKS_SEEK -#define ACE_LACKS_SHARED_MEMORY #define ACE_LACKS_MSYNC #define ACE_LACKS_PID_STUFF #define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS diff --git a/ace/config-linux-common.h b/ace/config-linux-common.h index f268ed3ab2e..f8f764fc207 100644 --- a/ace/config-linux-common.h +++ b/ace/config-linux-common.h @@ -383,6 +383,11 @@ #define ACE_SIZEOF_WCHAR 4 +#if defined (__powerpc__) && !defined (ACE_SIZEOF_LONG_DOUBLE) +// 32bit PowerPC Linux uses 128bit long double +# define ACE_SIZEOF_LONG_DOUBLE 16 +#endif + #define ACE_LACKS_GETIPNODEBYADDR #define ACE_LACKS_GETIPNODEBYNAME diff --git a/ace/config-lynxos.h b/ace/config-lynxos.h index 5ae03fe1df6..2e2f481d9e9 100644 --- a/ace/config-lynxos.h +++ b/ace/config-lynxos.h @@ -7,6 +7,13 @@ #define ACE_CONFIG_H #include /**/ "ace/pre.h" +// System include files are not in sys/, this gets rid of warning. +#define __NO_INCLUDE_WARN__ + +#define __FREEBSDCODE__ +#include <param.h> +#undef __FREEBSDCODE__ + #if ! defined (__ACE_INLINE__) # define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ @@ -69,7 +76,6 @@ #define ACE_HAS_POSIX_NONBLOCK #define ACE_HAS_POSIX_TIME #define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS -//#define ACE_HAS_REENTRANT_FUNCTIONS #define ACE_HAS_SCANDIR #define ACE_HAS_SIGACTION_CONSTP2 #define ACE_HAS_SIGINFO_T @@ -81,6 +87,7 @@ #define ACE_HAS_SOCKADDR_IN6_SIN6_LEN #define ACE_HAS_SOCKADDR_IN_SIN_LEN #define ACE_HAS_SOCKADDR_MSG_NAME +#define ACE_HAS_SOCKLEN_T #define ACE_HAS_SSIZE_T #define ACE_HAS_STREAMS #define ACE_HAS_STRINGS @@ -92,7 +99,9 @@ #define ACE_HAS_TIMEZONE_GETTIMEOFDAY #define ACE_LACKS_ALPHASORT_PROTOTYPE +#define ACE_LACKS_CEILL #define ACE_LACKS_CONST_TIMESPEC_PTR +#define ACE_LACKS_FLOORL #define ACE_LACKS_GETPGID #define ACE_LACKS_ISCTYPE #define ACE_LACKS_MADVISE @@ -144,15 +153,6 @@ # define ACE_USE_RCSID 0 #endif /* ! ACE_USE_RCSID */ -// System include files are not in sys/, this gets rid of warning. -#define __NO_INCLUDE_WARN__ - -// "changes signedness" error (OS.i and many other files) -#define ACE_HAS_SOCKLEN_T -// LSOCK.cpp uses a macro from param.h, not included -#define ALIGNBYTES (sizeof(int) - 1) -#define ALIGN(p) (((unsigned)p + ALIGNBYTES) & ~ALIGNBYTES) - #if ACE_LYNXOS_MAJOR == 4 && ACE_LYNXOS_MINOR == 0 # define ACE_LACKS_GETOPT_PROTOTYPE # define ACE_LACKS_INET_ATON_PROTOTYPE diff --git a/ace/config-macosx-iphone-hardware.h b/ace/config-macosx-iphone-hardware.h new file mode 100644 index 00000000000..087146899ac --- /dev/null +++ b/ace/config-macosx-iphone-hardware.h @@ -0,0 +1,15 @@ +// $Id$ +#ifndef ACE_CONFIG_MACOSX_IPHONE_HARDWARE_H +#define ACE_CONFIG_MACOSX_IPHONE_HARDWARE_H + +#define ACE_HAS_IPHONE +#define ACE_SIZEOF_LONG_DOUBLE 8 + +#include "ace/config-macosx-snowleopard.h" + +#ifdef ACE_HAS_SYSV_IPC +#undef ACE_HAS_SYSV_IPC +#endif + +#endif ACE_CONFIG_MACOSX_IPHONE_HARDWARE_H + diff --git a/ace/config-macosx-iphone-simulator.h b/ace/config-macosx-iphone-simulator.h new file mode 100644 index 00000000000..86ca00538fc --- /dev/null +++ b/ace/config-macosx-iphone-simulator.h @@ -0,0 +1,9 @@ +// $Id$ +#ifndef ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H +#define ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H + +#define ACE_HAS_IPHONE +#include "ace/config-macosx-snowleopard.h" + +#endif ACE_CONFIG_MACOSX_IPHONE_SIMULATOR_H + diff --git a/ace/config-macosx-leopard.h b/ace/config-macosx-leopard.h index 8c82e559e63..54149d39421 100644 --- a/ace/config-macosx-leopard.h +++ b/ace/config-macosx-leopard.h @@ -6,6 +6,9 @@ #ifndef ACE_CONFIG_MACOSX_LEOPARD_H #define ACE_CONFIG_MACOSX_LEOPARD_H +#define ACE_HAS_MAC_OSX +#define ACE_HAS_NET_IF_DL_H + #if ! defined (__ACE_INLINE__) #define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ diff --git a/ace/config-macros.h b/ace/config-macros.h index c02cd1b1942..175fb171e5a 100644 --- a/ace/config-macros.h +++ b/ace/config-macros.h @@ -455,7 +455,8 @@ #if defined (ACE_WIN32) # define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \ do { \ - TYPE ace_result_ = (TYPE) X; \ + TYPE ace_result_; \ + ace_result_ = (TYPE) X; \ if (ace_result_ == FAILVALUE) \ ACE_OS::set_errno_to_last_error (); \ return ace_result_; \ diff --git a/ace/config-mvs.h b/ace/config-mvs.h index 739d984fbd8..f5f7be3c110 100644 --- a/ace/config-mvs.h +++ b/ace/config-mvs.h @@ -82,7 +82,6 @@ #define ACE_LACKS_CONDATTR_PSHARED #define ACE_LACKS_INET_ATON -#define ACE_LACKS_MSGBUF_T #define ACE_LACKS_MUTEXATTR_PSHARED #define ACE_LACKS_IOSTREAM_FX #define ACE_LACKS_LINEBUFFERED_STREAMBUF @@ -99,7 +98,6 @@ #define ACE_LACKS_SEMAPHORE_H #define ACE_LACKS_SIGINFO_H #define ACE_LACKS_STDINT_H -#define ACE_LACKS_SYS_NERR #define ACE_LACKS_SYS_SELECT_H #define ACE_LACKS_SYS_SYSCTL_H #define ACE_LACKS_SYSTIME_H diff --git a/ace/config-netbsd.h b/ace/config-netbsd.h index 0f514b2544f..dd3c79d6f0a 100644 --- a/ace/config-netbsd.h +++ b/ace/config-netbsd.h @@ -120,9 +120,9 @@ #define ACE_LACKS_WCSICMP 1 #define ACE_LACKS_WCSNICMP 1 #define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR 1 -#define ACE_LACKS_WSCANF -#define ACE_LACKS_SWSCANF #define ACE_LACKS_ISCTYPE +#define ACE_LACKS_CEILL +#define ACE_LACKS_FLOORL #if defined(__x86_64__) #define ACE_SIZEOF_DOUBLE 8 diff --git a/ace/config-openbsd.h b/ace/config-openbsd.h index bbbf462a730..ea5e77e3ded 100644 --- a/ace/config-openbsd.h +++ b/ace/config-openbsd.h @@ -139,7 +139,6 @@ #define ACE_HAS_XPG4_MULTIBYTE_CHAR #define ACE_LACKS_CONDATTR_PSHARED -#define ACE_LACKS_EXECINFO_H #define ACE_LACKS_GETIPNODEBYADDR #define ACE_LACKS_GETIPNODEBYNAME #define ACE_LACKS_GETPGID @@ -165,7 +164,6 @@ #define ACE_LACKS_SETSCHED #define ACE_LACKS_SIGINFO_H #define ACE_LACKS_STDINT_H -#define ACE_LACKS_STRFTIME #define ACE_LACKS_STROPTS_H #define ACE_LACKS_STRRECVFD #define ACE_LACKS_TERMIO_H @@ -180,6 +178,8 @@ #define ACE_LACKS_WCSDUP #define ACE_LACKS_WCSNCASECMP #define ACE_LACKS_WCSNICMP +#define ACE_LACKS_CEILL +#define ACE_LACKS_FLOORL #define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS #define ACE_PAGE_SIZE 4096 diff --git a/ace/config-sunos5.5.h b/ace/config-sunos5.5.h index 592567c8803..4b24d32047e 100644 --- a/ace/config-sunos5.5.h +++ b/ace/config-sunos5.5.h @@ -130,6 +130,8 @@ // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so // this must appear before its #include. # define ACE_HAS_STRING_CLASS +# define ACE_LACKS_CEILL +# define ACE_LACKS_FLOORL # include "ace/config-g++-common.h" diff --git a/ace/config-vxworks6.4.h b/ace/config-vxworks6.4.h index dae90277785..1758eb61066 100644 --- a/ace/config-vxworks6.4.h +++ b/ace/config-vxworks6.4.h @@ -116,7 +116,9 @@ #define ACE_HAS_THREADS #define ACE_HAS_SYSCTL #define ACE_LACKS_ALPHASORT +#define ACE_LACKS_CEILL #define ACE_LACKS_EXEC +#define ACE_LACKS_FLOORL #define ACE_LACKS_RLIMIT #define ACE_LACKS_FILELOCKS #define ACE_LACKS_FORK diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index 81f24c9da62..fde0ad9d025 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -159,8 +159,6 @@ // using static object managers. #if !defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) # define ACE_HAS_NONSTATIC_OBJECT_MANAGER -#elif (ACE_HAS_NONSTATIC_OBJECT_MANAGER == 0) -# undef ACE_HAS_NONSTATIC_OBJECT_MANAGER #endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER */ #define ACE_HAS_GPERF diff --git a/ace/iosfwd.h b/ace/iosfwd.h index d255a75241c..fa959f6c021 100644 --- a/ace/iosfwd.h +++ b/ace/iosfwd.h @@ -44,6 +44,7 @@ # if !defined (ACE_USES_OLD_IOSTREAMS) # include /**/ <iosfwd> +#define ACE_HAS_CPP98_IOSTREAMS 1 # else // @note If these forward declarations don't work (e.g. aren't // portable), we may have to include "ace/streams.h" as a last diff --git a/ace/os_include/net/os_if.h b/ace/os_include/net/os_if.h index 03a4186389f..43ee7bff76c 100644 --- a/ace/os_include/net/os_if.h +++ b/ace/os_include/net/os_if.h @@ -26,6 +26,9 @@ #if !defined (ACE_LACKS_NET_IF_H) # include /**/ <net/if.h> +# if defined (ACE_HAS_NET_IF_DL_H) +# include /**/ <net/if_dl.h> +# endif /* ACE_HAS_NET_IF_DL_H */ # if defined (HPUX) && defined (IOR) /* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h and we don't want that definition. See IOP_IORC.h. diff --git a/ace/os_include/netinet/os_tcp.h b/ace/os_include/netinet/os_tcp.h index e0d6c4124d6..9ec1a3bb256 100644 --- a/ace/os_include/netinet/os_tcp.h +++ b/ace/os_include/netinet/os_tcp.h @@ -26,7 +26,7 @@ #if !defined (ACE_LACKS_NETINET_TCP_H) # include /**/ <netinet/tcp.h> -#endif /* !ACE_LACKS_NETIINET_TCP_H */ +#endif /* !ACE_LACKS_NETINET_TCP_H */ // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus diff --git a/ace/os_include/sys/os_types.h b/ace/os_include/sys/os_types.h index 81a0c273661..c21b5bb6c84 100644 --- a/ace/os_include/sys/os_types.h +++ b/ace/os_include/sys/os_types.h @@ -80,7 +80,7 @@ typedef double ACE_timer_t; typedef offset_t ACE_LOFF_T; #elif defined (WIN32) typedef __int64 ACE_LOFF_T; -#elif (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x670)) || \ +#elif (defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x680)) || \ defined (ACE_LYNXOS_MAJOR) || \ (defined (ACE_OPENVMS) && !defined (_LARGEFILE)) || \ defined (__TANDEM) diff --git a/ace/svcconf.mpb b/ace/svcconf.mpb index ec333fb26eb..aec4ab5113c 100644 --- a/ace/svcconf.mpb +++ b/ace/svcconf.mpb @@ -25,34 +25,5 @@ feature(ace_svcconf) { UTF32_Encoding_Converter.cpp XML_Svc_Conf.cpp } - - verbatim(gnuace, local) { - "Svc_Conf_y.cpp: Svc_Conf.y" - "ifeq ($(notdir $(YACC)), bison)" - " $(YACC) -l -d Svc_Conf.y" - " sed -e 's/fprintf/ACE_OS::fprintf/g' \\" // Use ACE's fprintf, not library's - " -e 's/\\t/ /g' \\" // Eliminate tabs (replace with 2 spaces) - " -e 's/yy/ace_yy/g' \\" - " -e 's/->ace_yyerrno/->yyerrno/g' \\" // This reverses the ace_ prefix where it - " -e 's/->ace_yylineno/->yylineno/g' \\" // should not have been added by the substitution, above. - " -e 's/ NULL/ 0/g' \\" - " -e 's/ace_yyerror[ ]*([ ]*\"/ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, \"/g' \\" - " -e 's/ace_yyerror[ ]*([ ]*ace_yymsg/ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, ace_yymsg/g' \\" - " -e 's/ace_yyerror[ ]*([ ]*YY_/ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, YY_/g' \\" - " -e 's@#include <stdio\.h>@@' \\" - " -e 's/Svc_Conf\\.tab\\.c/Svc_Conf_y.cpp/g' <Svc_Conf.tab.c >$@" - " $(RM) -f Svc_Conf.tab.c Svc_Conf_y.cpp.orig" - "else" - " @echo 'ERROR: You must use bison 1.35 or higher to process this file'" - " @/bin/false" - "endif" - - "Svc_Conf_Token_Table.h: Svc_Conf.y Svc_Conf_y.cpp" - "ifeq ($(notdir $(YACC)), bison)" - " mv Svc_Conf.tab.h Svc_Conf_Token_Table.h" - "else" - " @echo 'ERROR: You must use bison 1.35 or higher to process this file'" - " @/bin/false" - "endif" - } } + diff --git a/ace/svcconfgen.mpc b/ace/svcconfgen.mpc new file mode 100644 index 00000000000..5e4e8baab98 --- /dev/null +++ b/ace/svcconfgen.mpc @@ -0,0 +1,35 @@ +// -*- MPC -*- +// $Id$ + +project(ace_svcconf_gen) { + requires += ace_svcconf_gen + verbatim(gnuace, local) { + "Svc_Conf_y.cpp: Svc_Conf.y" + "ifeq ($(notdir $(YACC)), bison)" + " $(YACC) -l -d Svc_Conf.y" + " sed -e 's/fprintf/ACE_OS::fprintf/g' \\" // Use ACE's fprintf, not library's + " -e 's/\\t/ /g' \\" // Eliminate tabs (replace with 2 spaces) + " -e 's/yy/ace_yy/g' \\" + " -e 's/->ace_yyerrno/->yyerrno/g' \\" // This reverses the ace_ prefix where it + " -e 's/->ace_yylineno/->yylineno/g' \\" // should not have been added by the substitution, above. + " -e 's/ NULL/ 0/g' \\" + " -e 's/ace_yyerror[ ]*([ ]*\"/ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, \"/g' \\" + " -e 's/ace_yyerror[ ]*([ ]*ace_yymsg/ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, ace_yymsg/g' \\" + " -e 's/ace_yyerror[ ]*([ ]*YY_/ace_yyerror (ACE_SVC_CONF_PARAM->yyerrno, ACE_SVC_CONF_PARAM->yylineno, YY_/g' \\" + " -e 's@#include <stdio\.h>@@' \\" + " -e 's/Svc_Conf\\.tab\\.c/Svc_Conf_y.cpp/g' <Svc_Conf.tab.c >$@" + " $(RM) -f Svc_Conf.tab.c Svc_Conf_y.cpp.orig" + "else" + " @echo 'ERROR: You must use bison 1.35 or higher to process this file'" + " @/bin/false" + "endif" + + "Svc_Conf_Token_Table.h: Svc_Conf.y Svc_Conf_y.cpp" + "ifeq ($(notdir $(YACC)), bison)" + " mv Svc_Conf.tab.h Svc_Conf_Token_Table.h" + "else" + " @echo 'ERROR: You must use bison 1.35 or higher to process this file'" + " @/bin/false" + "endif" + } +} diff --git a/m4/tao.m4 b/m4/tao.m4 deleted file mode 100644 index 1441e8b5316..00000000000 --- a/m4/tao.m4 +++ /dev/null @@ -1,88 +0,0 @@ -dnl ------------------------------------------------------------------------- -dnl $Id$ -dnl -dnl tao.m4 -dnl -dnl ACE M4 include file which contains TAO specific M4 macros -dnl for enabling/disabling certain TAO features. -dnl -dnl ------------------------------------------------------------------------- - -dnl Copyright (C) 1998, 1999, 2000, 2002 Ossama Othman -dnl -dnl All Rights Reserved -dnl -dnl This library is free software; you can redistribute it and/or -dnl modify it under the current ACE distribution terms. -dnl -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - - -AC_DEFUN([TAO_ENABLE_MINIMUM_CORBA], -[AC_ARG_ENABLE([minimum-corba], - AS_HELP_STRING([--enable-minimum-corba], - [build TAO with minimum corba support [[[no]]]]), -[ -case "${enableval}" in - yes) - tao_user_enable_minimum_corba=yes - ;; - no) - tao_user_enable_minimum_corba=no - ;; - *) - AC_MSG_ERROR([bad value ${enableval} for --enable-minimum-corba]) - ;; -esac -],[ -tao_user_enable_minimum_corba=no -]) -AM_CONDITIONAL([BUILD_MINIMUM_CORBA], - [test X$tao_user_enable_minimum_corba = Xyes]) -]) - -AC_DEFUN([TAO_ENABLE_EXAMPLES], -[AC_ARG_ENABLE([tao-examples], - AS_HELP_STRING([--enable-tao-examples], - [build TAO examples [[[yes]]]]), -[ -case "${enableval}" in - yes) - tao_build_examples=yes - ;; - no) - tao_build_examples=no - ;; - *) - AC_MSG_ERROR([bad value ${enableval} for --enable-tao-examples]) - ;; -esac -],[ -tao_build_examples=yes -]) -AM_CONDITIONAL([BUILD_EXAMPLES], [test X$tao_build_examples = Xyes]) -]) - -AC_DEFUN([TAO_ENABLE_TESTS], -[AC_ARG_ENABLE([tao-tests], - AS_HELP_STRING([--enable-tao-tests], - [build TAO tests [[[yes]]]]), -[ -case "${enableval}" in - yes) - tao_build_tests=yes - ;; - no) - tao_build_tests=no - ;; - *) - AC_MSG_ERROR([bad value ${enableval} for --enable-tao-tests]) - ;; -esac -],[ -tao_build_tests=yes -]) -AM_CONDITIONAL([BUILD_TESTS], [test X$tao_build_tests = Xyes]) -]) diff --git a/tests/Message_Queue_Test.cpp b/tests/Message_Queue_Test.cpp index ac8a7135a8b..fbf029bc5eb 100644 --- a/tests/Message_Queue_Test.cpp +++ b/tests/Message_Queue_Test.cpp @@ -123,7 +123,7 @@ Counting_Test_Producer::svc (void) // correct. // Also, to be sure there's not just 1 producer and 1 consumer pinging // back and forth, make the producers randomly delay between blocks. - ACE_OS::srand ((u_int) ACE_OS::time ()); + ACE_OS::srand (static_cast<ACE_RANDR_TYPE> (ACE_OS::time ())); int multiple = ACE_OS::rand () % 10; int delay_ms = (ACE_OS::rand () % 10) / 2; // The delay usually causes the test to time out in the automated @@ -213,8 +213,7 @@ Counting_Test_Consumer::svc (void) // a calculated number of blocks then stop; the test checker will determine // if the number consumed plus the number remaining is correct for the // number produced. - - ACE_RANDR_TYPE seed = ACE_OS::time (); + ACE_RANDR_TYPE seed = static_cast<ACE_RANDR_TYPE> (ACE_OS::time ()); int multiple = ACE_OS::rand_r (seed) % 10; int delay_ms = ACE_OS::rand_r (seed) % 10; |