summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2007-02-21 22:29:49 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2007-02-21 22:29:49 +0000
commite2fb931d4056ac6a25aa30f3f9784ea5087ebad0 (patch)
tree63afe56dbcdb765415669eeb73315cf45b03b9ca
parentcbfb23f42fd1c1505b6859e4822eb55fc6f57bd1 (diff)
downloadATCD-e2fb931d4056ac6a25aa30f3f9784ea5087ebad0.tar.gz
ChangeLogTag:Wed Feb 21 19:27:14 UTC 2007 Ossama Othman <ossama_othman at symantec dot com>
-rw-r--r--ACE/ace/Array_Base.cpp9
-rw-r--r--ACE/ace/Asynch_IO.cpp4
-rw-r--r--ACE/ace/Auto_Ptr.h4
-rw-r--r--ACE/ace/Caching_Strategies_T.inl47
-rw-r--r--ACE/ace/Configuration_Import_Export.cpp10
-rw-r--r--ACE/ace/DLL_Manager.cpp12
-rw-r--r--ACE/ace/FILE_IO.cpp4
-rw-r--r--ACE/ace/Filecache.cpp2
-rw-r--r--ACE/ace/Functor.inl2
-rw-r--r--ACE/ace/High_Res_Timer.cpp2
-rw-r--r--ACE/ace/Log_Msg.cpp4
-rw-r--r--ACE/ace/Log_Msg.h2
-rw-r--r--ACE/ace/Log_Record.cpp2
-rw-r--r--ACE/ace/MMAP_Memory_Pool.cpp10
-rw-r--r--ACE/ace/Mem_Map.cpp2
-rw-r--r--ACE/ace/Message_Queue.cpp4
-rw-r--r--ACE/ace/Message_Queue_T.cpp14
-rw-r--r--ACE/ace/Name_Request_Reply.cpp2
-rw-r--r--ACE/ace/Naming_Context.cpp6
-rw-r--r--ACE/ace/Null_Semaphore.h1
-rw-r--r--ACE/ace/OS_NS_stdio.inl6
-rw-r--r--ACE/ace/OS_NS_unistd.h8
-rw-r--r--ACE/ace/OS_NS_unistd.inl4
-rw-r--r--ACE/ace/Parse_Node.cpp35
-rw-r--r--ACE/ace/Process.cpp14
-rw-r--r--ACE/ace/Process.inl4
-rw-r--r--ACE/ace/RB_Tree.cpp3
-rw-r--r--ACE/ace/Recursive_Thread_Mutex.cpp15
-rw-r--r--ACE/ace/Registry_Name_Space.cpp6
-rw-r--r--ACE/ace/Registry_Name_Space.h6
-rw-r--r--ACE/ace/SOCK_Connector.cpp31
-rw-r--r--ACE/ace/SOCK_Dgram.cpp4
-rw-r--r--ACE/ace/SOCK_IO.cpp4
-rw-r--r--ACE/ace/Service_Manager.cpp2
-rw-r--r--ACE/ace/String_Base_Const.cpp9
-rw-r--r--ACE/ace/Svc_Conf_Lexer.cpp13
-rw-r--r--ACE/ace/Svc_Handler.cpp5
-rw-r--r--ACE/ace/Time_Value.inl10
-rw-r--r--ACE/ace/Timer_Hash_T.cpp6
-rw-r--r--ACE/ace/Token_Request_Reply.inl2
-rw-r--r--ACE/ace/Truncate.h14
-rw-r--r--ACE/ace/UNIX_Addr.inl4
-rw-r--r--ACE/ace/Unbounded_Set.cpp72
-rw-r--r--ACE/ace/Unbounded_Set.h21
-rw-r--r--ACE/ace/Unbounded_Set.inl4
-rw-r--r--ACE/ace/ace_wchar.h8
-rw-r--r--ACE/ace/config-cxx-common.h2
-rw-r--r--ACE/ace/config-linux-common.h8
-rw-r--r--ACE/ace/config-linux.h10
-rw-r--r--ACE/ace/os_include/os_dlfcn.h2
-rw-r--r--ACE/ace/os_include/os_unistd.h7
51 files changed, 296 insertions, 186 deletions
diff --git a/ACE/ace/Array_Base.cpp b/ACE/ace/Array_Base.cpp
index 4e3253483bf..280a12d8e17 100644
--- a/ACE/ace/Array_Base.cpp
+++ b/ACE/ace/Array_Base.cpp
@@ -194,10 +194,11 @@ template<class T> int
ACE_Array_Base<T>::size (typename ACE_Array_Base<T>::size_type new_size)
{
int const r = this->max_size (new_size);
- if (r != 0)
- return r;
- this->cur_size_ = new_size;
- return 0;
+
+ if (r == 0)
+ this->cur_size_ = new_size;
+
+ return r;
}
template<class T>
diff --git a/ACE/ace/Asynch_IO.cpp b/ACE/ace/Asynch_IO.cpp
index 07027962100..1e5bf2a70e6 100644
--- a/ACE/ace/Asynch_IO.cpp
+++ b/ACE/ace/Asynch_IO.cpp
@@ -1330,6 +1330,6 @@ ACE_Asynch_Write_Dgram::Result::~Result (void)
{
}
-#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
-
ACE_END_VERSIONED_NAMESPACE_DECL
+
+#endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */
diff --git a/ACE/ace/Auto_Ptr.h b/ACE/ace/Auto_Ptr.h
index 7360ab22234..ec955d30b21 100644
--- a/ACE/ace/Auto_Ptr.h
+++ b/ACE/ace/Auto_Ptr.h
@@ -181,9 +181,7 @@ public:
/**
- * @function
- *
- * @brief
+ * @brief Reset given @c auto_ptr element to new element.
*
* Some platforms have an older version of auto_ptr support, which
* lacks reset, and cannot be disabled easily. Portability to these
diff --git a/ACE/ace/Caching_Strategies_T.inl b/ACE/ace/Caching_Strategies_T.inl
index cbe5f9c35ff..d846b66b13a 100644
--- a/ACE/ace/Caching_Strategies_T.inl
+++ b/ACE/ace/Caching_Strategies_T.inl
@@ -135,11 +135,10 @@ ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double per
}
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
-ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
- const ATTRIBUTES &attr)
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (
+ int result,
+ const ATTRIBUTES & /* attr */)
{
- ACE_UNUSED_ARG (attr);
-
if (result == 0)
++this->timer_;
@@ -147,8 +146,9 @@ ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
}
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
-ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
- ATTRIBUTES &attr)
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (
+ int result,
+ ATTRIBUTES &attr)
{
if (result == 0)
{
@@ -160,28 +160,26 @@ ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
}
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
-ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
- const ATTRIBUTES &attr)
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (
+ int result,
+ const ATTRIBUTES & /* attr */)
{
- ACE_UNUSED_ARG (attr);
return result;
}
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
-ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
- ATTRIBUTES &attr)
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (
+ int result,
+ ATTRIBUTES & /* attr */)
{
- ACE_UNUSED_ARG (attr);
-
return result;
}
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
-ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
- const ATTRIBUTES &attr)
+ACE_LRU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (
+ int result,
+ const ATTRIBUTES & /* attr */)
{
- ACE_UNUSED_ARG (attr);
-
if (result == 0)
++this->timer_;
@@ -228,9 +226,8 @@ ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::purge_percent (double per
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_bind (int result,
- const ATTRIBUTES &attr)
+ const ATTRIBUTES & /* attr */)
{
- ACE_UNUSED_ARG (attr);
return result;
}
@@ -247,28 +244,22 @@ ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_find (int result,
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_trybind (int result,
- ATTRIBUTES &attr)
+ ATTRIBUTES & /* attr */)
{
- ACE_UNUSED_ARG (attr);
-
return result;
}
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_rebind (int result,
- const ATTRIBUTES &attr)
+ const ATTRIBUTES & /* attr */)
{
- ACE_UNUSED_ARG (attr);
-
return result;
}
template<class ATTRIBUTES, class CACHING_UTILITY> ACE_INLINE int
ACE_LFU_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::notify_unbind (int result,
- const ATTRIBUTES &attr)
+ const ATTRIBUTES & /* attr */)
{
- ACE_UNUSED_ARG (attr);
-
return result;
}
diff --git a/ACE/ace/Configuration_Import_Export.cpp b/ACE/ace/Configuration_Import_Export.cpp
index 335be965247..d0440f6182e 100644
--- a/ACE/ace/Configuration_Import_Export.cpp
+++ b/ACE/ace/Configuration_Import_Export.cpp
@@ -230,7 +230,10 @@ ACE_Registry_ImpExp::export_config (const ACE_TCHAR* filename)
result = this->export_section (config_.root_section (),
ACE_LIB_TEXT (""),
out);
- ACE_OS::fclose (out);
+ // The data may have been buffered and will be flush on close,
+ // so we need to check that the close succeeds.
+ if (ACE_OS::fclose (out) < 0)
+ result = -7;
}
return result;
}
@@ -512,7 +515,10 @@ ACE_Ini_ImpExp::export_config (const ACE_TCHAR* filename)
result = this->export_section (config_.root_section (),
ACE_LIB_TEXT (""),
out);
- ACE_OS::fclose (out);
+ // The data may have been buffered and will be flush on close,
+ // so we need to check that the close succeeds.
+ if (ACE_OS::fclose (out) < 0)
+ result = -7;
}
return result;
}
diff --git a/ACE/ace/DLL_Manager.cpp b/ACE/ace/DLL_Manager.cpp
index 4290700b55e..3094096b59d 100644
--- a/ACE/ace/DLL_Manager.cpp
+++ b/ACE/ace/DLL_Manager.cpp
@@ -721,13 +721,15 @@ ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload)
{
// Declare the type of the symbol:
typedef int (*dll_unload_policy)(void);
- dll_unload_policy the_policy = 0;
- void *unload_policy_ptr =
+
+ void * const unload_policy_ptr =
dll_handle->symbol (ACE_LIB_TEXT ("_get_dll_unload_policy"), 1);
- ptrdiff_t temp_p =
- reinterpret_cast<ptrdiff_t> (unload_policy_ptr);
- the_policy =
+ intptr_t const temp_p =
+ reinterpret_cast<intptr_t> (unload_policy_ptr);
+
+ dll_unload_policy const the_policy =
reinterpret_cast<dll_unload_policy> (temp_p);
+
if (the_policy != 0)
unload = ACE_BIT_DISABLED (the_policy (),
ACE_DLL_UNLOAD_POLICY_LAZY);
diff --git a/ACE/ace/FILE_IO.cpp b/ACE/ace/FILE_IO.cpp
index 3197591265e..bf0c41bf418 100644
--- a/ACE/ace/FILE_IO.cpp
+++ b/ACE/ace/FILE_IO.cpp
@@ -46,7 +46,7 @@ ACE_FILE_IO::send (size_t n, ...) const
{
ACE_TRACE ("ACE_FILE_IO::send");
va_list argp;
- int total_tuples = ACE_Utils::Truncate<int> (n / 2);
+ int total_tuples = ACE_Utils::truncate_cast<int> (n / 2);
iovec *iovp = 0;
#if defined (ACE_HAS_ALLOCA)
iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
@@ -85,7 +85,7 @@ ACE_FILE_IO::recv (size_t n, ...) const
{
ACE_TRACE ("ACE_FILE_IO::recv");
va_list argp;
- int total_tuples = ACE_Utils::Truncate<int> (n / 2);
+ int total_tuples = ACE_Utils::truncate_cast<int> (n / 2);
iovec *iovp = 0;
#if defined (ACE_HAS_ALLOCA)
iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
diff --git a/ACE/ace/Filecache.cpp b/ACE/ace/Filecache.cpp
index 39b0478ea65..f196910962c 100644
--- a/ACE/ace/Filecache.cpp
+++ b/ACE/ace/Filecache.cpp
@@ -524,7 +524,7 @@ ACE_Filecache_Object::ACE_Filecache_Object (const ACE_TCHAR *filename,
return;
}
- this->size_ = ACE_Utils::Truncate<ACE_OFF_T> (this->stat_.st_size);
+ this->size_ = ACE_Utils::truncate_cast<ACE_OFF_T> (this->stat_.st_size);
this->tempname_ = this->filename_;
// Can we open the file?
diff --git a/ACE/ace/Functor.inl b/ACE/ace/Functor.inl
index ed5b8c9cc9d..65da8feec6d 100644
--- a/ACE/ace/Functor.inl
+++ b/ACE/ace/Functor.inl
@@ -179,7 +179,7 @@ ACE_Hash<char *>::operator () (const char *t) const
ACE_INLINE unsigned long
ACE_Hash<void *>::operator () (const void *t) const
{
- return (unsigned long)((ptrdiff_t) t);
+ return static_cast<unsigned long> (reinterpret_cast<uintptr_t> (t));
}
/***********************************************************************/
diff --git a/ACE/ace/High_Res_Timer.cpp b/ACE/ace/High_Res_Timer.cpp
index 4f4cacdefea..72dff21750a 100644
--- a/ACE/ace/High_Res_Timer.cpp
+++ b/ACE/ace/High_Res_Timer.cpp
@@ -286,7 +286,7 @@ ACE_High_Res_Timer::calibrate (const ACE_UINT32 usec,
ACE_OS::gettimeofday () - actual_start;
// Store the sample.
- delta_hrtime.sample (ACE_Utils::Truncate<ACE_INT32> (stop - start));
+ delta_hrtime.sample (ACE_Utils::truncate_cast<ACE_INT32> (stop - start));
actual_sleeps.sample (actual_delta.msec () * 100u);
}
diff --git a/ACE/ace/Log_Msg.cpp b/ACE/ace/Log_Msg.cpp
index 98042117a80..68227fd6b41 100644
--- a/ACE/ace/Log_Msg.cpp
+++ b/ACE/ace/Log_Msg.cpp
@@ -439,7 +439,7 @@ u_long ACE_Log_Msg::flags_ = ACE_Log_Msg::STDERR;
pid_t ACE_Log_Msg::pid_ = -1;
/// Current offset of msg_[].
-long ACE_Log_Msg::msg_off_ = 0;
+ptrdiff_t ACE_Log_Msg::msg_off_ = 0;
/// Default per-thread priority mask
/// By default, no priorities are enabled.
@@ -1494,7 +1494,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str,
case 'r': // Run (invoke) this subroutine.
{
- long osave = ACE_Log_Msg::msg_off_;
+ ptrdiff_t const osave = ACE_Log_Msg::msg_off_;
if (ACE_BIT_ENABLED (ACE_Log_Msg::flags_,
ACE_Log_Msg::SILENT) &&
diff --git a/ACE/ace/Log_Msg.h b/ACE/ace/Log_Msg.h
index 7b8a1ecd4b6..4416df98711 100644
--- a/ACE/ace/Log_Msg.h
+++ b/ACE/ace/Log_Msg.h
@@ -647,7 +647,7 @@ private:
static u_long flags_;
/// Offset of msg_[].
- static long msg_off_;
+ static ptrdiff_t msg_off_;
/**
* Number of existing ACE_Log_Msg instances; when 0, delete program/host
diff --git a/ACE/ace/Log_Record.cpp b/ACE/ace/Log_Record.cpp
index f6f6fa6ee0b..b8ef30a58c5 100644
--- a/ACE/ace/Log_Record.cpp
+++ b/ACE/ace/Log_Record.cpp
@@ -358,7 +358,7 @@ operator>> (ACE_InputCDR &cdr,
auto_ptr<ACE_TCHAR> log_msg_p (log_msg);
log_record.type (type);
log_record.pid (pid);
- log_record.time_stamp (ACE_Time_Value (ACE_Utils::Truncate<time_t> (sec),
+ log_record.time_stamp (ACE_Time_Value (ACE_Utils::truncate_cast<time_t> (sec),
usec));
#if defined (ACE_USES_WCHAR)
cdr.read_wchar_array (log_msg, buffer_len);
diff --git a/ACE/ace/MMAP_Memory_Pool.cpp b/ACE/ace/MMAP_Memory_Pool.cpp
index dd72b985e30..020468f0936 100644
--- a/ACE/ace/MMAP_Memory_Pool.cpp
+++ b/ACE/ace/MMAP_Memory_Pool.cpp
@@ -63,7 +63,7 @@ ACE_MMAP_Memory_Pool::sync (int flags)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::sync");
- size_t const len = ACE_Utils::Truncate<size_t> (
+ size_t const len = ACE_Utils::truncate_cast<size_t> (
ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END));
return this->mmap_.sync (len, flags);
@@ -96,7 +96,7 @@ ACE_MMAP_Memory_Pool::protect (int prot)
{
ACE_TRACE ("ACE_MMAP_Memory_Pool::protect");
- size_t const len = ACE_Utils::Truncate<size_t> (
+ size_t const len = ACE_Utils::truncate_cast<size_t> (
ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END));
return this->mmap_.protect (len, prot);
@@ -229,7 +229,7 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes,
cur_block += seek_len)
{
map_size =
- ACE_Utils::Truncate<size_t> (
+ ACE_Utils::truncate_cast<size_t> (
ACE_OS::lseek (this->mmap_.handle (),
static_cast<ACE_OFF_T> (seek_len - 1),
SEEK_END));
@@ -418,7 +418,7 @@ ACE_MMAP_Memory_Pool::remap (void *addr)
ACE_TRACE ("ACE_MMAP_Memory_Pool::remap");
// ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("Remapping with fault address at: %X\n"), addr));
size_t const current_map_size =
- ACE_Utils::Truncate<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
+ ACE_Utils::truncate_cast<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
// ACE_OS::lseek (this->mmap_.handle (), 0, SEEK_END);
if (!(addr < (void *) ((char *) this->mmap_.addr () + current_map_size)
@@ -502,7 +502,7 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t
{
// Check if the current mapping is up to date.
size_t const current_map_size =
- ACE_Utils::Truncate<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
+ ACE_Utils::truncate_cast<size_t> (ACE_OS::filesize (this->mmap_.handle ()));
if (static_cast<size_t> (current_map_size) == this->mmap_.size ())
{
diff --git a/ACE/ace/Mem_Map.cpp b/ACE/ace/Mem_Map.cpp
index 0f8775018c4..ee9f7b9717e 100644
--- a/ACE/ace/Mem_Map.cpp
+++ b/ACE/ace/Mem_Map.cpp
@@ -93,7 +93,7 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle,
// Check <length_request>
if (length_request == static_cast<size_t> (-1))
// Set length to file_request or size_t max.
- this->length_ = ACE_Utils::Truncate<size_t> (current_file_length - offset);
+ this->length_ = ACE_Utils::truncate_cast<size_t> (current_file_length - offset);
else
{
// Make sure that we have not been asked to do the impossible.
diff --git a/ACE/ace/Message_Queue.cpp b/ACE/ace/Message_Queue.cpp
index 4b937e543a4..517ce8e2fcb 100644
--- a/ACE/ace/Message_Queue.cpp
+++ b/ACE/ace/Message_Queue.cpp
@@ -442,7 +442,7 @@ ACE_Message_Queue_NT::enqueue (ACE_Message_Block *new_item,
// Update the states once I succeed.
this->cur_bytes_ += msize;
this->cur_length_ += mlength;
- return ACE_Utils::Truncate<int> (++this->cur_count_);
+ return ACE_Utils::truncate_cast<int> (++this->cur_count_);
}
}
else
@@ -489,7 +489,7 @@ ACE_Message_Queue_NT::dequeue (ACE_Message_Block *&first_item,
--this->cur_count_;
this->cur_bytes_ -= msize;
this->cur_length_ -= first_item->total_length ();
- return ACE_Utils::Truncate<int> (this->cur_count_);
+ return ACE_Utils::truncate_cast<int> (this->cur_count_);
}
else // Woken up by deactivate () or pulse ().
errno = ESHUTDOWN;
diff --git a/ACE/ace/Message_Queue_T.cpp b/ACE/ace/Message_Queue_T.cpp
index 4eabd618369..4c52157c4ba 100644
--- a/ACE/ace/Message_Queue_T.cpp
+++ b/ACE/ace/Message_Queue_T.cpp
@@ -1119,7 +1119,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail_i (ACE_Message_Block *new_item)
if (this->signal_dequeue_waiters () == -1)
return -1;
else
- return ACE_Utils::Truncate<int> (this->cur_count_);
+ return ACE_Utils::truncate_cast<int> (this->cur_count_);
}
// Actually put the node(s) at the head (no locking)
@@ -1163,7 +1163,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head_i (ACE_Message_Block *new_item)
if (this->signal_dequeue_waiters () == -1)
return -1;
else
- return ACE_Utils::Truncate<int> (this->cur_count_);
+ return ACE_Utils::truncate_cast<int> (this->cur_count_);
}
// Actually put the node at its proper position relative to its
@@ -1234,7 +1234,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_i (ACE_Message_Block *new_item)
if (this->signal_dequeue_waiters () == -1)
return -1;
else
- return ACE_Utils::Truncate<int> (this->cur_count_);
+ return ACE_Utils::truncate_cast<int> (this->cur_count_);
}
// Actually put the node at its proper position relative to its
@@ -1350,7 +1350,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_head_i (ACE_Message_Block *&first_item
&& this->signal_enqueue_waiters () == -1)
return -1;
else
- return ACE_Utils::Truncate<int> (this->cur_count_);
+ return ACE_Utils::truncate_cast<int> (this->cur_count_);
}
// Get the earliest (i.e., FIFO) ACE_Message_Block with the lowest
@@ -1426,7 +1426,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_prio_i (ACE_Message_Block *&dequeued)
&& this->signal_enqueue_waiters () == -1)
return -1;
else
- return ACE_Utils::Truncate<int> (this->cur_count_);
+ return ACE_Utils::truncate_cast<int> (this->cur_count_);
}
// Actually get the last ACE_Message_Block (no locking, so must be
@@ -1475,7 +1475,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_tail_i (ACE_Message_Block *&dequeued)
&& this->signal_enqueue_waiters () == -1)
return -1;
else
- return ACE_Utils::Truncate<int> (this->cur_count_);
+ return ACE_Utils::truncate_cast<int> (this->cur_count_);
}
// Actually get the ACE_Message_Block with the lowest deadline time
@@ -1571,7 +1571,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::peek_dequeue_head (ACE_Message_Block *&first_i
return -1;
first_item = this->head_;
- return ACE_Utils::Truncate<int> (this->cur_count_);
+ return ACE_Utils::truncate_cast<int> (this->cur_count_);
}
template <ACE_SYNCH_DECL> int
diff --git a/ACE/ace/Name_Request_Reply.cpp b/ACE/ace/Name_Request_Reply.cpp
index 6bd42fc6b67..21424a42d4b 100644
--- a/ACE/ace/Name_Request_Reply.cpp
+++ b/ACE/ace/Name_Request_Reply.cpp
@@ -188,7 +188,7 @@ ACE_Time_Value
ACE_Name_Request::timeout (void) const
{
ACE_TRACE ("ACE_Name_Request::timeout");
- time_t sec = ACE_Utils::Truncate<time_t> (this->transfer_.sec_timeout_);
+ time_t sec = ACE_Utils::truncate_cast<time_t> (this->transfer_.sec_timeout_);
return ACE_Time_Value (sec, this->transfer_.usec_timeout_);
}
diff --git a/ACE/ace/Naming_Context.cpp b/ACE/ace/Naming_Context.cpp
index 596d4aa3aed..8d0c03c2ef0 100644
--- a/ACE/ace/Naming_Context.cpp
+++ b/ACE/ace/Naming_Context.cpp
@@ -71,15 +71,15 @@ ACE_Naming_Context::open (Context_Scope_Type scope_in, int lite)
// Perform factory operation to select appropriate type of
// Name_Space subclass.
-#if (defined (ACE_WIN32) && defined (UNICODE))
-// This only works on Win32 platforms when UNICODE is turned on
+#if (defined (ACE_WIN32) && defined (ACE_USES_WCHAR))
+// This only works on Win32 platforms when ACE_USES_WCHAR is turned on
if (this->name_options_->use_registry ())
// Use ACE_Registry
ACE_NEW_RETURN (this->name_space_,
ACE_Registry_Name_Space (this->name_options_),
-1);
-#endif /* ACE_WIN32 && UNICODE */
+#endif /* ACE_WIN32 && ACE_USES_WCHAR */
if (!this->name_options_->use_registry ())
if (scope_in == ACE_Naming_Context::NET_LOCAL && this->local () == 0)
{
diff --git a/ACE/ace/Null_Semaphore.h b/ACE/ace/Null_Semaphore.h
index 9124f46cf73..5a3597b805c 100644
--- a/ACE/ace/Null_Semaphore.h
+++ b/ACE/ace/Null_Semaphore.h
@@ -19,6 +19,7 @@
// All methods in this class are inline, so there is no
// need to import or export on Windows. -- CAE 12/18/2003
#include "ace/os_include/os_errno.h"
+#include "ace/os_include/sys/os_types.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
diff --git a/ACE/ace/OS_NS_stdio.inl b/ACE/ace/OS_NS_stdio.inl
index 17b6f3c2243..eb0382d8986 100644
--- a/ACE/ace/OS_NS_stdio.inl
+++ b/ACE/ace/OS_NS_stdio.inl
@@ -447,6 +447,12 @@ ACE_OS::cuserid (char *user, size_t maxlen)
// Make sure the password file is closed.
::endpwent ();
+
+ if (pw == 0)
+ {
+ errno = ENOENT;
+ return 0;
+ }
size_t max_length = 0;
char *userid = 0;
diff --git a/ACE/ace/OS_NS_unistd.h b/ACE/ace/OS_NS_unistd.h
index 9df370a1c1c..ba92d248f5d 100644
--- a/ACE/ace/OS_NS_unistd.h
+++ b/ACE/ace/OS_NS_unistd.h
@@ -25,10 +25,12 @@
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "ace/os_include/os_unistd.h"
+#include /**/ "ace/ACE_export.h"
#include "ace/Time_Value.h"
+#include "ace/Basic_Types.h"
+#include "ace/os_include/os_unistd.h"
#include "ace/os_include/os_stdio.h"
-#include /**/ "ace/ACE_export.h"
+
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
@@ -264,7 +266,7 @@ namespace ACE_OS
size_t bufsiz);
ACE_NAMESPACE_INLINE_FUNCTION
- void *sbrk (ptrdiff_t brk);
+ void *sbrk (intptr_t brk);
ACE_NAMESPACE_INLINE_FUNCTION
int setgid (gid_t);
diff --git a/ACE/ace/OS_NS_unistd.inl b/ACE/ace/OS_NS_unistd.inl
index 109acfab208..97251657815 100644
--- a/ACE/ace/OS_NS_unistd.inl
+++ b/ACE/ace/OS_NS_unistd.inl
@@ -530,7 +530,7 @@ ACE_OS::hostname (char name[], size_t maxnamelen)
#elif defined (ACE_VXWORKS) || defined (ACE_HAS_WINCE)
ACE_OSCALL_RETURN (::gethostname (name, maxnamelen), int, -1);
#elif defined (ACE_WIN32)
- if (::gethostname (name, ACE_Utils::Truncate<int> (maxnamelen)) == 0)
+ if (::gethostname (name, ACE_Utils::truncate_cast<int> (maxnamelen)) == 0)
{
return 0;
}
@@ -785,7 +785,7 @@ ACE_OS::pipe (ACE_HANDLE fds[])
}
ACE_INLINE void *
-ACE_OS::sbrk (ptrdiff_t brk)
+ACE_OS::sbrk (intptr_t brk)
{
#if defined (ACE_LACKS_SBRK)
ACE_UNUSED_ARG (brk);
diff --git a/ACE/ace/Parse_Node.cpp b/ACE/ace/Parse_Node.cpp
index 110e52f4673..a74d070dd3b 100644
--- a/ACE/ace/Parse_Node.cpp
+++ b/ACE/ace/Parse_Node.cpp
@@ -587,36 +587,35 @@ ACE_Function_Node::symbol (ACE_Service_Gestalt *,
ACE_TRACE ("ACE_Function_Node::symbol");
if (this->open_dll (yyerrno) == 0)
{
- ACE_Service_Factory_Ptr func = 0;
this->symbol_ = 0;
// Locate the factory function <function_name> in the shared
// object.
- ACE_TCHAR *function_name = const_cast<ACE_TCHAR *> (this->function_name_);
- void *func_p = this->dll_.symbol (function_name);
+ ACE_TCHAR * const function_name =
+ const_cast<ACE_TCHAR *> (this->function_name_);
+
+ void * const func_p = this->dll_.symbol (function_name);
if (func_p == 0)
{
++yyerrno;
- if (this->symbol_ == 0)
- {
- ++yyerrno;
-
#ifndef ACE_NLOGGING
- ACE_TCHAR *errmsg = this->dll_.error ();
- ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("DLL::symbol failed for function %s: ")
- ACE_LIB_TEXT ("%s\n"),
- function_name,
- errmsg ? errmsg :
- ACE_LIB_TEXT ("no error reported")));
+ ACE_TCHAR * const errmsg = this->dll_.error ();
+ ACE_ERROR ((LM_ERROR,
+ ACE_LIB_TEXT ("DLL::symbol failed for function %s: ")
+ ACE_LIB_TEXT ("%s\n"),
+ function_name,
+ errmsg ? errmsg : ACE_LIB_TEXT ("no error reported")));
#endif /* ACE_NLOGGING */
- return 0;
- }
+ return 0;
}
- ptrdiff_t temp_p = reinterpret_cast<ptrdiff_t> (func_p);
- func = reinterpret_cast<ACE_Service_Factory_Ptr> (temp_p);
+
+ intptr_t const temp_p = reinterpret_cast<intptr_t> (func_p);
+
+ ACE_Service_Factory_Ptr func =
+ reinterpret_cast<ACE_Service_Factory_Ptr> (temp_p);
+
// Invoke the factory function and record it's return value.
this->symbol_ = (*func) (gobbler);
diff --git a/ACE/ace/Process.cpp b/ACE/ace/Process.cpp
index b79fbcbd0f9..8bc756ceb22 100644
--- a/ACE/ace/Process.cpp
+++ b/ACE/ace/Process.cpp
@@ -112,15 +112,21 @@ ACE_Process::spawn (ACE_Process_Options &options)
h != ACE_INVALID_HANDLE && curr_len + 20 < max_len;
h = h_iter ())
{
-#if defined (ACE_WIN64)
+#if defined (ACE_WIN32)
+# if defined (ACE_WIN64)
curr_len += ACE_OS::sprintf (&cmd_line_buf[curr_len],
- ACE_LIB_TEXT (" +H %I64d"),
+ ACE_LIB_TEXT (" +H %I64p"),
h);
+# else
+ curr_len += ACE_OS::sprintf (&cmd_line_buf[curr_len],
+ ACE_LIB_TEXT (" +H %p"),
+ h);
+# endif /* ACE_WIN64 */
#else
curr_len += ACE_OS::sprintf (&cmd_line_buf[curr_len],
ACE_LIB_TEXT (" +H %d"),
h);
-#endif /* ACE_WIN64 */
+#endif /* ACE_WIN32 */
}
}
@@ -871,7 +877,7 @@ ACE_Process_Options::setenv (const ACE_TCHAR *variable_name,
do
{
retval = ACE_OS::vsnprintf (safe_stack_buf.get (), tmp_buflen, safe_newformat.get (), argp);
- if (retval > ACE_Utils::Truncate<int> (tmp_buflen))
+ if (retval > ACE_Utils::truncate_cast<int> (tmp_buflen))
{
tmp_buflen *= 2;
ACE_NEW_RETURN (stack_buf, ACE_TCHAR[tmp_buflen], -1);
diff --git a/ACE/ace/Process.inl b/ACE/ace/Process.inl
index 3b9b18f6429..87dfc3994ee 100644
--- a/ACE/ace/Process.inl
+++ b/ACE/ace/Process.inl
@@ -101,11 +101,11 @@ ACE_Process::exit_code (ACE_exitcode code)
ACE_INLINE u_long
ACE_Process_Options::creation_flags (void) const
{
-#if defined (UNICODE) && defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
+#if defined (ACE_USES_WCHAR) && defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
return creation_flags_ | CREATE_UNICODE_ENVIRONMENT;
#else
return creation_flags_;
-#endif /* UNICODE */
+#endif /* ACE_USES_WCHAR */
}
ACE_INLINE void
diff --git a/ACE/ace/RB_Tree.cpp b/ACE/ace/RB_Tree.cpp
index a93b6967145..a60190300a8 100644
--- a/ACE/ace/RB_Tree.cpp
+++ b/ACE/ace/RB_Tree.cpp
@@ -1004,6 +1004,9 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::remove_i (ACE_RB_Tree_Node<
else
y = z;
+ if (!y)
+ return -1;
+
if (y->left ())
x = y->left ();
else
diff --git a/ACE/ace/Recursive_Thread_Mutex.cpp b/ACE/ace/Recursive_Thread_Mutex.cpp
index 880513a483a..daf28c8a9ab 100644
--- a/ACE/ace/Recursive_Thread_Mutex.cpp
+++ b/ACE/ace/Recursive_Thread_Mutex.cpp
@@ -85,20 +85,17 @@ ACE_Recursive_Thread_Mutex::get_nesting_level (void)
#if defined (ACE_HAS_WINCE) || defined (ACE_VXWORKS)
ACE_NOTSUP_RETURN (-1);
#elif defined (ACE_HAS_RECURSIVE_MUTEXES)
+# if defined (ACE_WIN32)
+ // This is really a Win32-ism...
// Nothing inside of a CRITICAL_SECTION object should ever be
// accessed directly. It is documented to change at any time.
-# if defined (ACE_WIN64) && !defined(_M_AMD64)
- // Things are different on Windows XP 64-bit. However, as of Feb 2006
- // Windows XP 64-bit edition on Intel EM64T w/ VC8, LockCount is
- // decremented at first acquire and then doesn't change. RecursionCount,
- // however, works the same as Win32, below.
- return this->lock_.LockCount + 1;
-# elif defined (ACE_WIN32)
- // This is really a Win32-ism...
+ //
+ // It has been reported that this this works for all three
+ // architectures. However, this does not work on Win64 before SP1.
return this->lock_.RecursionCount;
# else
ACE_NOTSUP_RETURN (-1);
-# endif /* ACE_HAS_RECURSIVE_MUTEXES */
+# endif /* ACE_WIN32 */
#else
int nesting_level = 0;
ACE_OS::mutex_lock (&this->lock_.nesting_mutex_);
diff --git a/ACE/ace/Registry_Name_Space.cpp b/ACE/ace/Registry_Name_Space.cpp
index e382af8482e..c5c5989b789 100644
--- a/ACE/ace/Registry_Name_Space.cpp
+++ b/ACE/ace/Registry_Name_Space.cpp
@@ -4,8 +4,8 @@
ACE_RCSID(ace, Registry_Name_Space, "$Id$")
-#if (defined (ACE_WIN32) && defined (UNICODE))
-// This only works on Win32 platforms when UNICODE is turned on
+#if (defined (ACE_WIN32) && defined (ACE_USES_WCHAR))
+// This only works on Win32 platforms when ACE_USES_WCHAR is turned on
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -290,4 +290,4 @@ ACE_Registry_Name_Space::dump (void) const
ACE_END_VERSIONED_NAMESPACE_DECL
-#endif /* ACE_WIN32 && UNICODE */
+#endif /* ACE_WIN32 && ACE_USES_WCHAR */
diff --git a/ACE/ace/Registry_Name_Space.h b/ACE/ace/Registry_Name_Space.h
index 52b9158d625..b54f99dc3af 100644
--- a/ACE/ace/Registry_Name_Space.h
+++ b/ACE/ace/Registry_Name_Space.h
@@ -21,8 +21,8 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#if (defined (ACE_WIN32) && defined (UNICODE))
-// This only works on Win32 platforms when UNICODE is turned on
+#if (defined (ACE_WIN32) && defined (ACE_USES_WCHAR))
+// This only works on Win32 platforms when ACE_USES_WCHAR is turned on
#include "ace/Registry.h"
#include "ace/Naming_Context.h"
@@ -133,7 +133,7 @@ private:
ACE_END_VERSIONED_NAMESPACE_DECL
-#endif /* ACE_WIN32 && UNICODE */
+#endif /* ACE_WIN32 && ACE_USES_WCHAR */
#include /**/ "ace/post.h"
diff --git a/ACE/ace/SOCK_Connector.cpp b/ACE/ace/SOCK_Connector.cpp
index dbbe3cb539c..7a0f5b9ec95 100644
--- a/ACE/ace/SOCK_Connector.cpp
+++ b/ACE/ace/SOCK_Connector.cpp
@@ -121,7 +121,36 @@ ACE_SOCK_Connector::shared_connect_finish (ACE_SOCK_Stream &new_stream,
// This expression checks if we were polling.
if (timeout->sec () == 0
&& timeout->usec () == 0)
- error = EWOULDBLOCK;
+ {
+#if defined(ACE_WIN32)
+ // In order to detect when the socket that has been
+ // bound to is in TIME_WAIT we need to do the connect
+ // (which will always return EWOULDBLOCK) and then do an
+ // ACE::handle_timed_complete() (with timeout==0,
+ // i.e. poll). This will do a select() on the handle
+ // which will immediately return with the handle in an
+ // error state. The error code is then retrieved with
+ // getsockopt(). Good sockets however will return from
+ // the select() with ETIME - in this case return
+ // EWOULDBLOCK so the wait strategy can complete the
+ // connection.
+ if(ACE::handle_timed_complete (new_stream.get_handle (),
+ timeout) == ACE_INVALID_HANDLE)
+ {
+ int const tmp = errno;
+ if (tmp != ETIME)
+ {
+ error = tmp;
+ }
+ else
+ error = EWOULDBLOCK;
+ }
+ else
+ result = 0;
+#else /* ACE_WIN32 */
+ error = EWOULDBLOCK;
+#endif /* ACE_WIN32 */
+ }
// Wait synchronously using timeout.
else if (this->complete (new_stream,
0,
diff --git a/ACE/ace/SOCK_Dgram.cpp b/ACE/ace/SOCK_Dgram.cpp
index cd4bdd8e686..08c844cea08 100644
--- a/ACE/ace/SOCK_Dgram.cpp
+++ b/ACE/ace/SOCK_Dgram.cpp
@@ -111,7 +111,7 @@ ACE_SOCK_Dgram::recv (iovec *io_vec,
}
else
{
- io_vec->iov_len = ACE_Utils::Truncate<size_t> (rcv_len);
+ io_vec->iov_len = ACE_Utils::truncate_cast<size_t> (rcv_len);
addr.set_size (addr_len);
}
return rcv_len;
@@ -729,6 +729,8 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq,
delete[] buf; // clean up
}
else
+#else /* ACE_WIN32 */
+ ACE_UNUSED_ARG(net_if);
#endif /* ACE_WIN32 */
lmreq.ipv6mr_interface = 0;
diff --git a/ACE/ace/SOCK_IO.cpp b/ACE/ace/SOCK_IO.cpp
index b3a1d5de90b..f7530aaf9f0 100644
--- a/ACE/ace/SOCK_IO.cpp
+++ b/ACE/ace/SOCK_IO.cpp
@@ -110,7 +110,7 @@ ACE_SOCK_IO::send (size_t n, ...) const
ACE_TRACE ("ACE_SOCK_IO::send");
va_list argp;
- int total_tuples = ACE_Utils::Truncate<size_t> (n / 2);
+ int total_tuples = ACE_Utils::truncate_cast<size_t> (n / 2);
iovec *iovp = 0;
#if defined (ACE_HAS_ALLOCA)
iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
@@ -150,7 +150,7 @@ ACE_SOCK_IO::recv (size_t n, ...) const
ACE_TRACE ("ACE_SOCK_IO::recv");
va_list argp;
- int total_tuples = ACE_Utils::Truncate<size_t> (n / 2);
+ int total_tuples = ACE_Utils::truncate_cast<size_t> (n / 2);
iovec *iovp;
#if defined (ACE_HAS_ALLOCA)
iovp = (iovec *) alloca (total_tuples * sizeof (iovec));
diff --git a/ACE/ace/Service_Manager.cpp b/ACE/ace/Service_Manager.cpp
index 200e505e76e..cf99c39b7aa 100644
--- a/ACE/ace/Service_Manager.cpp
+++ b/ACE/ace/Service_Manager.cpp
@@ -179,7 +179,7 @@ ACE_Service_Manager::list_services (void)
sri.next (sr) != 0;
sri.advance ())
{
- size_t len = ACE_OS::strlen (sr->name ()) + 11;
+ ssize_t len = static_cast<ssize_t> (ACE_OS::strlen (sr->name ())) + 11;
ACE_TCHAR buf[BUFSIZ];
ACE_TCHAR *p = buf + len;
diff --git a/ACE/ace/String_Base_Const.cpp b/ACE/ace/String_Base_Const.cpp
index 77dff6db428..7e431a7cb8a 100644
--- a/ACE/ace/String_Base_Const.cpp
+++ b/ACE/ace/String_Base_Const.cpp
@@ -6,6 +6,15 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_String_Base_Const::size_type const ACE_String_Base_Const::npos =
+#if defined (AIX) //&& (defined (__xlC__) || defined (__IBMCPP__))
+ // Under some mixed shared/static linking conditions, this constant
+ // will not be initialized at run-time if the
+ // std::numeric_limits<>::max() trait is used on AIX/XLC++.
+ // Workaround that problem by making it easier for the compiler to
+ // realize it can set the constant at compile-time.
+ static_cast<ACE_String_Base_Const::size_type> (-1);
+#else
ACE_Numeric_Limits<ACE_String_Base_Const::size_type>::max ();
+#endif /* AIX */
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/ace/Svc_Conf_Lexer.cpp b/ACE/ace/Svc_Conf_Lexer.cpp
index 2f8ced577f2..3bcd8d6d559 100644
--- a/ACE/ace/Svc_Conf_Lexer.cpp
+++ b/ACE/ace/Svc_Conf_Lexer.cpp
@@ -329,13 +329,16 @@ ACE_Svc_Conf_Lexer::scan (ACE_YYSTYPE* ace_yylval,
// Now, we need to move back in the string until we find the
// same character that started the string
bool string_end_found = false;
- for(ssize_t i = (current - 1) - buffer->index_; i >= 0; i--)
+ if (current > buffer->index_)
{
- if (source[i] == buffer->string_start_)
+ for (size_t i = current - buffer->index_; i-- != 0; )
{
- current = buffer->index_ + i + 1;
- string_end_found = true;
- break;
+ if (source[i] == buffer->string_start_)
+ {
+ current = buffer->index_ + i + 1;
+ string_end_found = true;
+ break;
+ }
}
}
diff --git a/ACE/ace/Svc_Handler.cpp b/ACE/ace/Svc_Handler.cpp
index bb8ce2bd077..241ed643a06 100644
--- a/ACE/ace/Svc_Handler.cpp
+++ b/ACE/ace/Svc_Handler.cpp
@@ -324,11 +324,10 @@ ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::close (u_long)
}
template <PR_ST_1, ACE_SYNCH_DECL> int
-ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::init (int argc, ACE_TCHAR *argv[])
+ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::init (int /* argc */,
+ ACE_TCHAR * /* argv */[])
{
ACE_TRACE ("ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::init");
- ACE_UNUSED_ARG (argc);
- ACE_UNUSED_ARG (argv);
return -1;
}
diff --git a/ACE/ace/Time_Value.inl b/ACE/ace/Time_Value.inl
index e2c068bf217..28ac34fa9f1 100644
--- a/ACE/ace/Time_Value.inl
+++ b/ACE/ace/Time_Value.inl
@@ -25,8 +25,8 @@ ACE_Time_Value::operator timeval () const
#if defined (ACE_HAS_TIME_T_LONG_MISMATCH)
// Recall that on some Windows we substitute another type for timeval in tv_
ACE_Time_Value *me = const_cast<ACE_Time_Value*> (this);
- me->ext_tv_.tv_sec = ACE_Utils::Truncate<long> (this->tv_.tv_sec);
- me->ext_tv_.tv_usec = ACE_Utils::Truncate<long> (this->tv_.tv_usec);
+ me->ext_tv_.tv_sec = ACE_Utils::truncate_cast<long> (this->tv_.tv_sec);
+ me->ext_tv_.tv_usec = ACE_Utils::truncate_cast<long> (this->tv_.tv_usec);
return this->ext_tv_;
#else
return this->tv_;
@@ -58,8 +58,8 @@ ACE_Time_Value::operator const timeval * () const
#if defined (ACE_HAS_TIME_T_LONG_MISMATCH)
// Recall that on some Windows we substitute another type for timeval in tv_
ACE_Time_Value *me = const_cast<ACE_Time_Value*> (this);
- me->ext_tv_.tv_sec = ACE_Utils::Truncate<long> (this->tv_.tv_sec);
- me->ext_tv_.tv_usec = ACE_Utils::Truncate<long> (this->tv_.tv_usec);
+ me->ext_tv_.tv_sec = ACE_Utils::truncate_cast<long> (this->tv_.tv_sec);
+ me->ext_tv_.tv_usec = ACE_Utils::truncate_cast<long> (this->tv_.tv_usec);
return (const timeval *) &this->ext_tv_;
#else
return (const timeval *) &this->tv_;
@@ -148,7 +148,7 @@ ACE_Time_Value::msec (void) const
// called out in the user documentation for this with a recommendation to
// use msec(ACE_UINT64&) instead, so just go ahead and truncate.
time_t secs = this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000;
- return ACE_Utils::Truncate<unsigned long> (secs);
+ return ACE_Utils::truncate_cast<unsigned long> (secs);
}
#if !defined (ACE_LACKS_LONGLONG_T)
diff --git a/ACE/ace/Timer_Hash_T.cpp b/ACE/ace/Timer_Hash_T.cpp
index 303628be91b..45c1fe5c4b2 100644
--- a/ACE/ace/Timer_Hash_T.cpp
+++ b/ACE/ace/Timer_Hash_T.cpp
@@ -376,7 +376,7 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::reschedule (ACE_Timer_Node_T<
const_cast<void *> (expired->get_act ()));
size_t secs_hash_input =
- ACE_Utils::Truncate<size_t> (expired->get_timer_value ().sec ());
+ ACE_Utils::truncate_cast<size_t> (expired->get_timer_value ().sec ());
h->pos_ = secs_hash_input % this->table_size_;
h->orig_id_ =
@@ -411,7 +411,7 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::schedule_i (const TYPE &type,
{
ACE_TRACE ("ACE_Timer_Hash_T::schedule_i");
- size_t secs_hash_input = ACE_Utils::Truncate<size_t> (future_time.sec ());
+ size_t secs_hash_input = ACE_Utils::truncate_cast<size_t> (future_time.sec ());
size_t position = secs_hash_input % this->table_size_;
Hash_Token<TYPE> *h = 0;
@@ -454,7 +454,7 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::schedule_i (const TYPE &type,
// size of a pointer is 64 bits, but a long is 32. Since this class
// is not much used, I'm hacking this, at least for now. If it becomes
// an issue, I'll look at it again then.
- ptrdiff_t hi = reinterpret_cast<ptrdiff_t> (h);
+ intptr_t hi = reinterpret_cast<intptr_t> (h);
if (this->pointer_base_ == 0)
this->pointer_base_ = hi & 0xffffffff00000000;
return static_cast<long> (hi & 0xffffffff);
diff --git a/ACE/ace/Token_Request_Reply.inl b/ACE/ace/Token_Request_Reply.inl
index 99a6b367a1a..7a62c92d7c1 100644
--- a/ACE/ace/Token_Request_Reply.inl
+++ b/ACE/ace/Token_Request_Reply.inl
@@ -147,7 +147,7 @@ ACE_Token_Request::token_name (const ACE_TCHAR *token_name,
// ... then add in the amount of the variable-sized portion.
len += token_name_length + client_id_length + 1;
- this->length (ACE_Utils::Truncate<ACE_UINT32> (len));
+ this->length (ACE_Utils::truncate_cast<ACE_UINT32> (len));
}
// = Set/get the id of the client.
diff --git a/ACE/ace/Truncate.h b/ACE/ace/Truncate.h
index a303f49c7fa..f59bc0dfbed 100644
--- a/ACE/ace/Truncate.h
+++ b/ACE/ace/Truncate.h
@@ -452,7 +452,7 @@ namespace ACE_Utils
// -----------------------------------------------------
/**
- * @class Truncate
+ * @class truncate_cast
*
* @brief Helper function to truncate an integral value to the
* maximum value of the given type.
@@ -465,7 +465,7 @@ namespace ACE_Utils
* @internal Internal use only.
*/
template<typename TO, typename FROM>
- inline TO Truncate (FROM val)
+ inline TO truncate_cast (FROM val)
{
// If the size of FROM is less than the size of TO, "val" will
// never be greater than the maximum "TO" value, so there is no
@@ -919,6 +919,16 @@ namespace ACE_Utils
#endif /* !__BORLANDC__ || __BORLANDC__ > 0x590 */
+ /**
+ * @deprecated @c Truncate<> is left in place for backward
+ * compatibility. Use @c truncate_cast<> instead.
+ */
+ template<typename TO, typename FROM>
+ inline TO Truncate (FROM val)
+ {
+ return truncate_cast<TO, FROM> (val);
+ }
+
} // namespace ACE_Utils
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/ace/UNIX_Addr.inl b/ACE/ace/UNIX_Addr.inl
index 34fa002ef34..48f9fd123ab 100644
--- a/ACE/ace/UNIX_Addr.inl
+++ b/ACE/ace/UNIX_Addr.inl
@@ -15,14 +15,14 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
ACE_UNIX_Addr::ACE_UNIX_Addr (const wchar_t rendezvous_point[])
{
- this->set (ACE_TEXT_ALWAYS_CHAR (rendezvous_point));
+ this->set (ACE_Wide_To_Ascii (rendezvous_point).char_rep ());
}
/// Creates an ACE_UNIX_Addr from a string.
ACE_INLINE int
ACE_UNIX_Addr::set (const wchar_t rendezvous_point[])
{
- return this->set (ACE_TEXT_ALWAYS_CHAR (rendezvous_point));
+ return this->set (ACE_Wide_To_Ascii (rendezvous_point).char_rep ());
}
#endif /* ACE_HAS_WCHAR */
diff --git a/ACE/ace/Unbounded_Set.cpp b/ACE/ace/Unbounded_Set.cpp
index 480fd404407..0b3318456d2 100644
--- a/ACE/ace/Unbounded_Set.cpp
+++ b/ACE/ace/Unbounded_Set.cpp
@@ -74,10 +74,11 @@ ACE_Unbounded_Set<T>::dump (void) const
size_t count = 1;
#endif /* ! ACE_NLOGGING */
- for (ACE_Unbounded_Set_Iterator<T> iter (*(ACE_Unbounded_Set<T> *) this);
- iter.next (item) != 0;
- iter.advance ())
- ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("count = %d\n"), count++));
+ const_iterator const the_end = this->end ();
+ for (const_iterator i (this->begin ());
+ i != end;
+ ++i)
+ ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("count = %u\n"), count++));
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
@@ -183,18 +184,12 @@ template <class T> int
ACE_Unbounded_Set<T>::find (const T &item) const
{
// ACE_TRACE ("ACE_Unbounded_Set<T>::find");
- // Set <item> into the dummy node.
- this->head_->item_ = item;
-
- ACE_Node<T> *temp = this->head_->next_;
-
- // Keep looping until we find the item.
- while (!(temp->item_ == item))
- temp = temp->next_;
+ const_iterator const the_end = this->end ();
+ for (const_iterator i = this->begin (); i != the_end; ++i)
+ if ((*i) == item)
+ return 0;
- // If we found the dummy node then it's not really there, otherwise,
- // it is there.
- return temp == this->head_ ? -1 : 0;
+ return -1;
}
template <class T> int
@@ -236,20 +231,33 @@ ACE_Unbounded_Set<T>::remove (const T &item)
}
}
-template <class T> ACE_Unbounded_Set_Iterator<T>
+template <class T> typename ACE_Unbounded_Set<T>::iterator
ACE_Unbounded_Set<T>::begin (void)
{
// ACE_TRACE ("ACE_Unbounded_Set<T>::begin");
- return ACE_Unbounded_Set_Iterator<T> (*this);
+ return iterator (*this);
}
-template <class T> ACE_Unbounded_Set_Iterator<T>
+template <class T> typename ACE_Unbounded_Set<T>::iterator
ACE_Unbounded_Set<T>::end (void)
{
// ACE_TRACE ("ACE_Unbounded_Set<T>::end");
- return ACE_Unbounded_Set_Iterator<T> (*this, 1);
+ return iterator (*this, 1);
}
+template <class T> typename ACE_Unbounded_Set<T>::const_iterator
+ACE_Unbounded_Set<T>::begin (void) const
+{
+ // ACE_TRACE ("ACE_Unbounded_Set<T>::begin");
+ return const_iterator (*this);
+}
+
+template <class T> typename ACE_Unbounded_Set<T>::const_iterator
+ACE_Unbounded_Set<T>::end (void) const
+{
+ // ACE_TRACE ("ACE_Unbounded_Set<T>::end");
+ return const_iterator (*this, 1);
+}
ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set_Iterator)
@@ -262,8 +270,10 @@ ACE_Unbounded_Set_Iterator<T>::dump (void) const
}
template <class T>
-ACE_Unbounded_Set_Iterator<T>::ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set<T> &s, int end)
- : current_ (end == 0 ? s.head_->next_ : s.head_ ),
+ACE_Unbounded_Set_Iterator<T>::ACE_Unbounded_Set_Iterator (
+ ACE_Unbounded_Set<T> &s,
+ bool end)
+ : current_ (!end ? s.head_->next_ : s.head_ ),
set_ (&s)
{
// ACE_TRACE ("ACE_Unbounded_Set_Iterator<T>::ACE_Unbounded_Set_Iterator");
@@ -367,8 +377,10 @@ ACE_Unbounded_Set_Const_Iterator<T>::dump (void) const
}
template <class T>
-ACE_Unbounded_Set_Const_Iterator<T>::ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set<T> &s, int end)
- : current_ (end == 0 ? s.head_->next_ : s.head_ ),
+ACE_Unbounded_Set_Const_Iterator<T>::ACE_Unbounded_Set_Const_Iterator (
+ const ACE_Unbounded_Set<T> &s,
+ bool end)
+ : current_ (!end ? s.head_->next_ : s.head_ ),
set_ (&s)
{
// ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::ACE_Unbounded_Set_Const_Iterator");
@@ -447,6 +459,20 @@ ACE_Unbounded_Set_Const_Iterator<T>::operator* (void)
return *retv;
}
+template <class T> bool
+ACE_Unbounded_Set_Const_Iterator<T>::operator== (const ACE_Unbounded_Set_Const_Iterator<T> &rhs) const
+{
+ //ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::operator==");
+ return (this->set_ == rhs.set_ && this->current_ == rhs.current_);
+}
+
+template <class T> bool
+ACE_Unbounded_Set_Const_Iterator<T>::operator!= (const ACE_Unbounded_Set_Const_Iterator<T> &rhs) const
+{
+ //ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::operator!=");
+ return (this->set_ != rhs.set_ || this->current_ != rhs.current_);
+}
+
ACE_END_VERSIONED_NAMESPACE_DECL
#endif /* ACE_UNBOUNDED_SET_CPP */
diff --git a/ACE/ace/Unbounded_Set.h b/ACE/ace/Unbounded_Set.h
index 8cddab86f12..5746a887d5f 100644
--- a/ACE/ace/Unbounded_Set.h
+++ b/ACE/ace/Unbounded_Set.h
@@ -35,7 +35,7 @@ class ACE_Unbounded_Set_Iterator
{
public:
// = Initialization method.
- ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set<T> &s, int end = 0);
+ ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set<T> &s, bool end = false);
// = Iteration methods.
@@ -94,7 +94,8 @@ class ACE_Unbounded_Set_Const_Iterator
{
public:
// = Initialization method.
- ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set<T> &s, int end = 0);
+ ACE_Unbounded_Set_Const_Iterator (const ACE_Unbounded_Set<T> &s,
+ bool end = false);
// = Iteration methods.
@@ -218,17 +219,17 @@ public:
// = Check boundary conditions.
- /// Returns 1 if the container is empty, otherwise returns 0.
+ /// Returns @c true if the container is empty, otherwise returns @c false.
/**
* Constant time is_empty check.
*/
- int is_empty (void) const;
+ bool is_empty (void) const;
- /// Returns 0.
+ /// Returns @c false.
/**
- * Always returns 0 since the set can never fill up.
+ * Always returns @c false since the set can never fill up.
*/
- int is_full (void) const;
+ bool is_full (void) const;
// = Classic unordered set operations.
@@ -278,8 +279,10 @@ public:
void reset (void);
// = STL-styled unidirectional iterator factory.
- ACE_Unbounded_Set_Iterator<T> begin (void);
- ACE_Unbounded_Set_Iterator<T> end (void);
+ iterator begin (void);
+ iterator end (void);
+ const_iterator begin (void) const;
+ const_iterator end (void) const;
/// Declare the dynamic allocation hooks.
ACE_ALLOC_HOOK_DECLARE;
diff --git a/ACE/ace/Unbounded_Set.inl b/ACE/ace/Unbounded_Set.inl
index 363fe6e4a6d..00ba23802ef 100644
--- a/ACE/ace/Unbounded_Set.inl
+++ b/ACE/ace/Unbounded_Set.inl
@@ -6,14 +6,14 @@
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-template <class T> ACE_INLINE int
+template <class T> ACE_INLINE bool
ACE_Unbounded_Set<T>::is_empty (void) const
{
ACE_TRACE ("ACE_Unbounded_Set<T>::is_empty");
return this->head_ == this->head_->next_;
}
-template <class T> ACE_INLINE int
+template <class T> ACE_INLINE bool
ACE_Unbounded_Set<T>::is_full (void) const
{
ACE_TRACE ("ACE_Unbounded_Set<T>::is_full");
diff --git a/ACE/ace/ace_wchar.h b/ACE/ace/ace_wchar.h
index 2d3af93ffb4..b13bcc5923b 100644
--- a/ACE/ace/ace_wchar.h
+++ b/ACE/ace/ace_wchar.h
@@ -248,6 +248,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_TEXT_STARTUPINFO STARTUPINFOW
#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAW
#define ACE_TEXT_OSVERSIONINFO OSVERSIONINFOW
+#define ACE_TEXT_EXPLICIT_ACCESS EXPLICIT_ACCESS_W
#define ACE_TEXT_CreateEvent ::CreateEventW
#define ACE_TEXT_CreateFile ::CreateFileW
@@ -268,6 +269,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_TEXT_GetModuleFileName ::GetModuleFileNameW
#define ACE_TEXT_GetTempPath ::GetTempPathW
#define ACE_TEXT_GetUserName ::GetUserNameW
+#define ACE_TEXT_GetUserNameEx ::GetUserNameExW
#define ACE_TEXT_GetVersionEx ::GetVersionExW
#define ACE_TEXT_LoadLibrary ::LoadLibraryW
#define ACE_TEXT_MoveFileEx ::MoveFileExW
@@ -293,12 +295,15 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_TEXT_SearchPath ::SearchPathW
#define ACE_TEXT_StartService ::StartServiceW
#define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherW
+#define ACE_TEXT_SetFileSecurity ::SetFileSecurityW
+#define ACE_TEXT_SetEntriesInAcl ::SetEntriesInAclW
#else /* ACE_USES_WCHAR */
#define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYA
#define ACE_TEXT_STARTUPINFO STARTUPINFOA
#define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAA
#define ACE_TEXT_OSVERSIONINFO OSVERSIONINFOA
+#define ACE_TEXT_EXPLICIT_ACCESS EXPLICIT_ACCESS_A
#define ACE_TEXT_CreateEvent ::CreateEventA
#define ACE_TEXT_CreateFile ::CreateFileA
@@ -319,6 +324,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_TEXT_GetModuleFileName ::GetModuleFileNameA
#define ACE_TEXT_GetTempPath ::GetTempPathA
#define ACE_TEXT_GetUserName ::GetUserNameA
+#define ACE_TEXT_GetUserNameEx ::GetUserNameExA
#define ACE_TEXT_GetVersionEx ::GetVersionExA
#define ACE_TEXT_LoadLibrary ::LoadLibraryA
#define ACE_TEXT_MoveFileEx ::MoveFileExA
@@ -344,6 +350,8 @@ ACE_END_VERSIONED_NAMESPACE_DECL
#define ACE_TEXT_SearchPath ::SearchPathA
#define ACE_TEXT_StartService ::StartServiceA
#define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherA
+#define ACE_TEXT_SetFileSecurity ::SetFileSecurityA
+#define ACE_TEXT_SetEntriesInAcl ::SetEntriesInAclA
#endif /* ACE_USES_WCHAR */
#endif /* ACE_WIN32 */
diff --git a/ACE/ace/config-cxx-common.h b/ACE/ace/config-cxx-common.h
index 5b5c814e278..4ea2a29c12f 100644
--- a/ACE/ace/config-cxx-common.h
+++ b/ACE/ace/config-cxx-common.h
@@ -60,6 +60,8 @@
# pragma message disable basclsnondto
# pragma message disable boolexprconst
# pragma message disable undpreid
+# pragma message disable notusetmpfunprm
+# pragma message disable bltinclnk
# if (__DECCXX_VER >= 60190029)
// 6.1-029 and later support msg 1136. Disable it because it
diff --git a/ACE/ace/config-linux-common.h b/ACE/ace/config-linux-common.h
index 0232d20cb1c..2a4323dc2e4 100644
--- a/ACE/ace/config-linux-common.h
+++ b/ACE/ace/config-linux-common.h
@@ -29,13 +29,6 @@
# define ACE_HAS_PTHREADS_UNIX98_EXT
#endif /* _XOPEN_SOURCE - 0 >= 500 */
-#if (defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L)
-# if !defined (ACE_HAS_CLOCK_GETTIME)
-# define ACE_HAS_CLOCK_GETTIME
-# define ACE_HAS_CLOCK_SETTIME
-# endif /* !ACE_HAS_CLOCK_GETTIME */
-#endif /* _POSIX_C_SOURCE >= 199309L */
-
#if defined (ACE_HAS_LINUX_NPTL)
# include "ace/config-posix.h"
@@ -198,7 +191,6 @@
# define ACE_HAS_STANDARD_CPP_LIBRARY 1
# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1
# define ACE_LACKS_SWAB
-# undef ACE_HAS_CLOCK_GETTIME
#elif defined (__GNUC__)
/**
* GNU C compiler.
diff --git a/ACE/ace/config-linux.h b/ACE/ace/config-linux.h
index ee3ca24eeeb..ea92fcfa9cc 100644
--- a/ACE/ace/config-linux.h
+++ b/ACE/ace/config-linux.h
@@ -29,6 +29,16 @@
// ... and the final standard even!
#define ACE_HAS_PTHREADS_STD
+// On linux this is part of pthreads
+# if (defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L)
+# if !defined (ACE_HAS_CLOCK_GETTIME)
+# if !defined(__PGI)
+# define ACE_HAS_CLOCK_GETTIME
+# endif /* __PGI */
+# define ACE_HAS_CLOCK_SETTIME
+# endif /* !ACE_HAS_CLOCK_GETTIME */
+# endif /* _POSIX_C_SOURCE >= 199309L */
+
#if !defined (ACE_HAS_PTHREADS_UNIX98_EXT)
# define ACE_LACKS_RWLOCK_T
#else
diff --git a/ACE/ace/os_include/os_dlfcn.h b/ACE/ace/os_include/os_dlfcn.h
index 045d034e149..6f50551a8af 100644
--- a/ACE/ace/os_include/os_dlfcn.h
+++ b/ACE/ace/os_include/os_dlfcn.h
@@ -80,7 +80,7 @@ extern "C"
#elif defined (__hpux)
typedef shl_t ACE_SHLIB_HANDLE;
# define ACE_SHLIB_INVALID_HANDLE 0
-# define ACE_DEFAULT_SHLIB_MODE BIND_DEFERRED
+# define ACE_DEFAULT_SHLIB_MODE BIND_DEFERRED | DYNAMIC_PATH
#else /* !ACE_WIN32 && !ACE_HAS_SVR4_DYNAMIC_LINKING && !__hpux */
typedef void *ACE_SHLIB_HANDLE;
# define ACE_SHLIB_INVALID_HANDLE 0
diff --git a/ACE/ace/os_include/os_unistd.h b/ACE/ace/os_include/os_unistd.h
index d7a93727fd3..dc78271ce82 100644
--- a/ACE/ace/os_include/os_unistd.h
+++ b/ACE/ace/os_include/os_unistd.h
@@ -115,7 +115,12 @@ extern "C"
# endif /* W_OK */
# if !defined (X_OK)
-# define X_OK 01 /* Test for eXecute permission. */
+# if defined (ACE_WIN32)
+ /* Windows has no test for X_OK - use R_OK instead */
+# define X_OK R_OK /* Test for eXecute permission. */
+# else /* ACE_WIN32 */
+# define X_OK 01 /* Test for eXecute permission. */
+# endif /* ACE_WIN32 */
# endif /* X_OK */
# if !defined (F_OK)