summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Huston <shuston@riverace.com>2002-07-15 22:48:15 +0000
committerSteve Huston <shuston@riverace.com>2002-07-15 22:48:15 +0000
commite5dec8c647da42034d05d199aa8734663f6fd4b5 (patch)
tree74036a365982b1ae4c02180d39c211b1c4352096
parent7c26cae2449e842373d7682e48522e807e0b2a75 (diff)
downloadATCD-e5dec8c647da42034d05d199aa8734663f6fd4b5.tar.gz
ChangeLogTag:Mon Jul 15 15:18:33 2002 Steve Huston <shuston@riverace.com>
-rw-r--r--ChangeLog40
-rw-r--r--ChangeLogs/ChangeLog-03a40
-rw-r--r--ace/Configuration.cpp18
-rw-r--r--ace/Configuration.h11
-rw-r--r--ace/Memory_Pool.cpp2
-rw-r--r--ace/Naming_Context.cpp3
-rw-r--r--ace/OS.cpp6
-rw-r--r--ace/OS.h6
-rw-r--r--ace/OS.i40
-rw-r--r--ace/SOCK_Dgram.cpp30
-rw-r--r--ace/SOCK_IO.cpp10
-rw-r--r--ace/SV_Semaphore_Simple.cpp8
-rw-r--r--ace/WIN32_Proactor.cpp17
13 files changed, 203 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index a1662918d9f..38e9a596f5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,43 @@
+Mon Jul 15 15:18:33 2002 Steve Huston <shuston@riverace.com>
+
+ * ace/Configuration.{h cpp}: Changed ACE_Configuration_Value_IntId
+ data_ member to be a union with both pointer and u_int members.
+ Also, the length_ member is now size_t, not u_int.
+
+ * ace/Memory_Pool.cpp (ACE_Pagefile_Memory_Pool::map): Use
+ INVALID_HANDLE_VALUE instead of a literal 0xFFFFFFFF for call to
+ CreateFileMapping.
+
+ * ace/OS.{h i}: New method, void *atop(const char *s) converts a
+ string to void *.
+
+ * ace/OS.i (fdopen): Don't cast arg to _open_osfhandle - Microsoft
+ changed the type to something sensible.
+ (isatty): open a C run-time handle for the ACE_HANDLE.
+
+ * ace/OS.cpp (fopen): Don't cast arg to _open_osfhandle - Microsoft
+ changed the type to something sensible.
+ (unique_name): Use sprintf %p for pointer rather than casting
+ to an int.
+
+ * ace/Naming_Context.cpp (ACE_Name_Options::parse_args): Use
+ ACE_OS::atop instead of ACE_OS::atoi for converting an argument
+ to a pointer.
+
+ * ace/SOCK_Dgram.cpp (recv, send):
+ * ace/SOCK_IO.cpp (recvv): Use an int select_width
+ to pass width to select() so it can be ignored on ACE_WIN64.
+
+ * ace/SV_Semaphore_Simple.cpp (name_2_key): Disable the type cast
+ conversion warning casting ACE::crc32() to key_t... it's fine.
+
+ * ace/WIN32_Proactor.cpp (register_handle, post_completion): The
+ I/O completion port's completionKey argument is a ULONG in
+ "older" compiler/SDK versions, but was changed to a
+ ULONG_PTR (new type in newer SDK/compiler) for 64-bit
+ transition. The new type is used conditionally based on whether or
+ not we're building a 64-bit version.
+
Mon Jul 15 09:26:17 2002 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
* ace/SString.cpp (substring): Changed "nil" to "nill" to
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index a1662918d9f..38e9a596f5a 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,43 @@
+Mon Jul 15 15:18:33 2002 Steve Huston <shuston@riverace.com>
+
+ * ace/Configuration.{h cpp}: Changed ACE_Configuration_Value_IntId
+ data_ member to be a union with both pointer and u_int members.
+ Also, the length_ member is now size_t, not u_int.
+
+ * ace/Memory_Pool.cpp (ACE_Pagefile_Memory_Pool::map): Use
+ INVALID_HANDLE_VALUE instead of a literal 0xFFFFFFFF for call to
+ CreateFileMapping.
+
+ * ace/OS.{h i}: New method, void *atop(const char *s) converts a
+ string to void *.
+
+ * ace/OS.i (fdopen): Don't cast arg to _open_osfhandle - Microsoft
+ changed the type to something sensible.
+ (isatty): open a C run-time handle for the ACE_HANDLE.
+
+ * ace/OS.cpp (fopen): Don't cast arg to _open_osfhandle - Microsoft
+ changed the type to something sensible.
+ (unique_name): Use sprintf %p for pointer rather than casting
+ to an int.
+
+ * ace/Naming_Context.cpp (ACE_Name_Options::parse_args): Use
+ ACE_OS::atop instead of ACE_OS::atoi for converting an argument
+ to a pointer.
+
+ * ace/SOCK_Dgram.cpp (recv, send):
+ * ace/SOCK_IO.cpp (recvv): Use an int select_width
+ to pass width to select() so it can be ignored on ACE_WIN64.
+
+ * ace/SV_Semaphore_Simple.cpp (name_2_key): Disable the type cast
+ conversion warning casting ACE::crc32() to key_t... it's fine.
+
+ * ace/WIN32_Proactor.cpp (register_handle, post_completion): The
+ I/O completion port's completionKey argument is a ULONG in
+ "older" compiler/SDK versions, but was changed to a
+ ULONG_PTR (new type in newer SDK/compiler) for 64-bit
+ transition. The new type is used conditionally based on whether or
+ not we're building a 64-bit version.
+
Mon Jul 15 09:26:17 2002 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
* ace/SString.cpp (substring): Changed "nil" to "nill" to
diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp
index 98f48a0735f..def401e6ac2 100644
--- a/ace/Configuration.cpp
+++ b/ace/Configuration.cpp
@@ -1051,30 +1051,30 @@ ACE_Configuration_Win32Registry::resolve_key (HKEY hKey,
ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void)
: type_ (ACE_Configuration::INVALID),
- data_ (0),
length_ (0)
{
+ this->data_.ptr_ = 0;
}
ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (ACE_TCHAR* string)
: type_ (ACE_Configuration::STRING),
- data_ (string),
length_ (0)
{
+ this->data_.ptr_ = string;
}
ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (u_int integer)
: type_ (ACE_Configuration::INTEGER),
- data_ (ACE_reinterpret_cast (void*, integer)),
length_ (0)
{
+ this->data_.int_ = integer;
}
-ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void* data, u_int length)
+ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (void* data, size_t length)
: type_ (ACE_Configuration::BINARY),
- data_ (data),
length_ (length)
{
+ this->data_.ptr_ = data;
}
ACE_Configuration_Value_IntId::ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId& rhs)
@@ -1104,7 +1104,7 @@ ACE_Configuration_Value_IntId::free (ACE_Allocator *alloc)
{
if (this->type_ == ACE_Configuration::STRING
|| this->type_ == ACE_Configuration::BINARY)
- alloc->free ((void *) (data_));
+ alloc->free (data_.ptr_);
// Do nothing in other cases...
}
@@ -1985,7 +1985,7 @@ ACE_Configuration_Heap::get_string_value (const ACE_Configuration_Section_Key& k
return -4;
// everythings ok, return the data
- value = (ACE_TCHAR*)VIntId.data_;
+ value = ACE_static_cast (ACE_TCHAR*, VIntId.data_.ptr_);
return 0;
}
@@ -2021,7 +2021,7 @@ ACE_Configuration_Heap::get_integer_value (const ACE_Configuration_Section_Key&
return -4;
// Everythings ok, return the data
- value = (u_int) ((long)VIntId.data_);
+ value = VIntId.data_.int_;
return 0;
}
@@ -2058,7 +2058,7 @@ ACE_Configuration_Heap::get_binary_value (const ACE_Configuration_Section_Key& k
// Make a copy
ACE_NEW_RETURN (data, char[VIntId.length_], -5);
- ACE_OS::memcpy (data, VIntId.data_, VIntId.length_);
+ ACE_OS::memcpy (data, VIntId.data_.ptr_, VIntId.length_);
length = VIntId.length_;
return 0;
}
diff --git a/ace/Configuration.h b/ace/Configuration.h
index ce8fe03a74d..21ef9c67d2c 100644
--- a/ace/Configuration.h
+++ b/ace/Configuration.h
@@ -519,7 +519,7 @@ public:
ACE_EXPLICIT ACE_Configuration_Value_IntId (u_int integer);
/// Binary constructor, takes ownership of data
- ACE_Configuration_Value_IntId (void* data, u_int length);
+ ACE_Configuration_Value_IntId (void* data, size_t length);
/// Copy ctor
ACE_Configuration_Value_IntId (const ACE_Configuration_Value_IntId& rhs);
@@ -541,9 +541,12 @@ public:
* not the same accross different platforms)
* Length is only used when type_ == BINARY
*/
- ACE_Configuration::VALUETYPE type_;
- void* data_;
- u_int length_;
+ ACE_Configuration::VALUETYPE type_;
+ union {
+ void * ptr_;
+ u_int int_;
+ } data_;
+ size_t length_;
};
typedef ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId,
diff --git a/ace/Memory_Pool.cpp b/ace/Memory_Pool.cpp
index 7120767bed8..a4607fef320 100644
--- a/ace/Memory_Pool.cpp
+++ b/ace/Memory_Pool.cpp
@@ -1204,7 +1204,7 @@ ACE_Pagefile_Memory_Pool::map (int &first_time,
// Get an object handle to the named reserved memory object.
object_handle_ =
- ACE_TEXT_CreateFileMapping ((HANDLE) 0xffffffff,
+ ACE_TEXT_CreateFileMapping (INVALID_HANDLE_VALUE,
#if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0))
&sa,
#else
diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp
index ccfe614ea8b..0bc5e27ea63 100644
--- a/ace/Naming_Context.cpp
+++ b/ace/Naming_Context.cpp
@@ -640,7 +640,8 @@ ACE_Name_Options::parse_args (int argc, ACE_TCHAR *argv[])
this->database (get_opt.opt_arg ());
break;
case 'b':
- this->base_address (ACE_reinterpret_cast (char *, ACE_OS::atoi (get_opt.opt_arg ())));
+ this->base_address
+ (ACE_static_cast (char *, ACE_OS::atop (get_opt.opt_arg ())));
break;
case 'T':
if (ACE_OS::strcasecmp (get_opt.opt_arg (), ACE_LIB_TEXT ("ON")) == 0)
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 9643d536fdf..74e3aebe359 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -902,7 +902,7 @@ ACE_OS::fopen (const ACE_TCHAR *filename,
}
# else
hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
- int fd = _open_osfhandle ((long) handle, hmode);
+ int fd = _open_osfhandle (intptr_t (handle), hmode);
if (fd != -1)
{
# if defined (__BORLANDC__) && !defined (ACE_USES_WCHAR)
@@ -4082,8 +4082,8 @@ ACE_OS::unique_name (const void *object,
// <object>.
ACE_TCHAR temp_name[ACE_UNIQUE_NAME_LEN];
ACE_OS::sprintf (temp_name,
- ACE_LIB_TEXT ("%lx%d"),
- ACE_reinterpret_cast (long, object),
+ ACE_LIB_TEXT ("%p%d"),
+ object,
ACE_static_cast (int, ACE_OS::getpid ()));
ACE_OS::strsncpy (name,
temp_name,
diff --git a/ace/OS.h b/ace/OS.h
index 0104b1e81ab..a327d5baab6 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -4646,6 +4646,12 @@ public:
static int atoi (const wchar_t *s);
# endif /* ACE_HAS_WCHAR */
+ static void *atop (const char *s);
+
+# if defined (ACE_HAS_WCHAR)
+ static void *atop (const wchar_t *s);
+# endif /* ACE_HAS_WCHAR */
+
/// This method computes the largest integral value not greater than x.
static double floor (double x);
diff --git a/ace/OS.i b/ace/OS.i
index 369768f77f4..00474a0b40d 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -5629,6 +5629,38 @@ ACE_OS::atoi (const wchar_t *s)
}
#endif /* ACE_HAS_WCHAR */
+
+ACE_INLINE void *
+ACE_OS::atop (const char *s)
+{
+ ACE_TRACE ("ACE_OS::atop");
+ // It would be nice to make use of Basic_Types.h here, but that
+ // file relies on OS.h. Fortunately, most platforms have int
+ // the same as pointer size (IA32, IA64), with Win64 being the
+ // exception.
+#if defined (ACE_WIN64)
+ __int64 ip = ::_atoi64 (s);
+#else
+ int ip = ::atoi (s);
+#endif /* ACE_WIN64 */
+ void *p = ACE_reinterpret_cast (void *, ip);
+ return p;
+}
+
+#if defined (ACE_HAS_WCHAR)
+ACE_INLINE void *
+ACE_OS::atop (const wchar_t *s)
+{
+# if defined (ACE_WIN64)
+ __int64 ip = ::_wtoi64 (s);
+# else
+ int ip = ACE_OS::atoi (s);
+# endif /* ACE_WIN64 */
+ void *p = ACE_reinterpret_cast (void *, ip);
+ return p;
+}
+#endif /* ACE_HAS_WCHAR */
+
ACE_INLINE double
ACE_OS::floor (double x)
{
@@ -9580,7 +9612,7 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
FILE *file = 0;
- int crt_handle = ::_open_osfhandle ((long) handle, 0);
+ int crt_handle = ::_open_osfhandle (intptr_t (handle), 0);
if (crt_handle != -1)
{
@@ -11233,8 +11265,10 @@ ACE_OS::isatty (ACE_HANDLE handle)
ACE_UNUSED_ARG (handle);
return 0;
#else
- int fd = ::_open_osfhandle ((long) handle, 0);
- return ::_isatty (fd);
+ int fd = ::_open_osfhandle (intptr_t (handle), 0);
+ int status = ::_isatty (fd);
+ ::_close (fd);
+ return status;
#endif /* ACE_LACKS_ISATTY */
}
diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp
index 23f24b46dd8..661e546df96 100644
--- a/ace/SOCK_Dgram.cpp
+++ b/ace/SOCK_Dgram.cpp
@@ -40,7 +40,15 @@ ACE_SOCK_Dgram::recv (iovec io_vec[],
// Check the status of the current socket to make sure there's data
// to recv (or time out).
- switch (ACE_OS::select (int (this->get_handle ()) + 1,
+ int select_width;
+# if defined (ACE_WIN64)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ select_width = 0;
+# else
+ select_width = int (this->get_handle ()) + 1;
+# endif /* ACE_WIN64 */
+ switch (ACE_OS::select (select_width,
handle_set,
0, 0,
timeout))
@@ -419,7 +427,15 @@ ACE_SOCK_Dgram::recv (void *buf,
handle_set.set_bit (this->get_handle ());
// Check the status of the current socket.
- switch (ACE_OS::select (int (this->get_handle ()) + 1,
+ int select_width;
+#if defined (ACE_WIN64)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ select_width = 0;
+#else
+ select_width = int (this->get_handle ()) + 1;
+#endif /* ACE_WIN64 */
+ switch (ACE_OS::select (select_width,
handle_set,
0,
0,
@@ -450,7 +466,15 @@ ACE_SOCK_Dgram::send (const void *buf,
handle_set.set_bit (this->get_handle ());
// Check the status of the current socket.
- switch (ACE_OS::select (int (this->get_handle ()) + 1,
+ int select_width;
+#if defined (ACE_WIN64)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ select_width = 0;
+#else
+ select_width = int (this->get_handle ()) + 1;
+#endif /* ACE_WIN64 */
+ switch (ACE_OS::select (select_width,
0,
handle_set,
0,
diff --git a/ace/SOCK_IO.cpp b/ace/SOCK_IO.cpp
index 1f233aa88db..ec153ed48d2 100644
--- a/ace/SOCK_IO.cpp
+++ b/ace/SOCK_IO.cpp
@@ -36,7 +36,15 @@ ACE_SOCK_IO::recvv (iovec *io_vec,
io_vec->iov_base = 0;
// Check the status of the current socket.
- switch (ACE_OS::select (int (this->get_handle ()) + 1,
+ int select_width;
+# if defined (ACE_WIN64)
+ // This arg is ignored on Windows and causes pointer truncation
+ // warnings on 64-bit compiles.
+ select_width = 0;
+# else
+ select_width = int (this->get_handle ()) + 1;
+# endif /* ACE_WIN64 */
+ switch (ACE_OS::select (select_width,
handle_set,
0, 0,
timeout))
diff --git a/ace/SV_Semaphore_Simple.cpp b/ace/SV_Semaphore_Simple.cpp
index 91740f54038..b6bd6ca7386 100644
--- a/ace/SV_Semaphore_Simple.cpp
+++ b/ace/SV_Semaphore_Simple.cpp
@@ -134,7 +134,15 @@ ACE_SV_Semaphore_Simple::name_2_key (const char *name)
// Basically "hash" the values in the <name>. This won't
// necessarily guarantee uniqueness of all keys.
// But (IMHO) CRC32 is good enough for most purposes (Carlos)
+#if defined (ACE_WIN64)
+ // The cast below is legit...
+# pragma warning(push)
+# pragma warning(disable : 4312)
+#endif /* ACE_WIN64 */
return (key_t) ACE::crc32 (name);
+#if defined (ACE_WIN64)
+# pragma warning(pop)
+#endif /* ACE_WIN64 */
}
// Open or create a ACE_SV_Semaphore. We return 1 if all is OK, else
diff --git a/ace/WIN32_Proactor.cpp b/ace/WIN32_Proactor.cpp
index 1ba58165d94..7d11a365bd2 100644
--- a/ace/WIN32_Proactor.cpp
+++ b/ace/WIN32_Proactor.cpp
@@ -118,10 +118,16 @@ int
ACE_WIN32_Proactor::register_handle (ACE_HANDLE handle,
const void *completion_key)
{
+#if defined (ACE_WIN64)
+ ULONG_PTR comp_key (ACE_static_cast (ULONG_PTR, completion_key));
+#else
+ ULONG comp_key (ACE_static_cast (ULONG, completion_key));
+#endif /* ACE_WIN64 */
+
// No locking is needed here as no state changes.
ACE_HANDLE cp = ::CreateIoCompletionPort (handle,
this->completion_port_,
- (u_long) completion_key,
+ comp_key,
this->number_of_threads_);
if (cp == 0)
{
@@ -671,11 +677,16 @@ ACE_WIN32_Proactor::post_completion (ACE_WIN32_Asynch_Result *result)
bytes_transferred = result->bytes_transferred ();
completion_key = result->completion_key();
}
+#if defined (ACE_WIN64)
+ ULONG_PTR comp_key (ACE_static_cast (ULONG_PTR, completion_key));
+#else
+ ULONG comp_key (ACE_static_cast (ULONG, completion_key));
+#endif /* ACE_WIN64 */
// Post a completion
if (::PostQueuedCompletionStatus (this->completion_port_, // completion port
- bytes_transferred, // number of bytes transferred
- (ULONG) completion_key, // completion key
+ bytes_transferred, // xfer count
+ comp_key, // completion key
result // overlapped
) == FALSE)
{