diff options
author | Steve Huston <shuston@riverace.com> | 2007-03-09 01:07:44 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2007-03-09 01:07:44 +0000 |
commit | a61714cf83a43552d74232bec6bf2965868142de (patch) | |
tree | 6553cb506c511a771a9aac20cc6ff91643494aaf | |
parent | acc13c6e0ae9f31dd5895864c7fe76bbc2a6f2f6 (diff) | |
download | ATCD-a61714cf83a43552d74232bec6bf2965868142de.tar.gz |
ChangeLogTag:Fri Mar 9 00:53:43 UTC 2007 Steve Huston <shuston@riverace.com>
49 files changed, 470 insertions, 127 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 85917b75809..52cab02edf0 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,157 @@ +Fri Mar 9 00:53:43 UTC 2007 Steve Huston <shuston@riverace.com> + + Changes to resolve or quiet warnings from Visual Studio .NET 2005: + + * bin/MakeProjectCreator/config/acedefaults.mpb: + * bin/MakeProjectCreator/config/vc8_warnings.mpb: Removed the + default addition of _CRT_SECURE_NO_DEPRECATE from the MPC VC8 + project templates. Many of the places where the changes recommended + by Microsoft could be made have been made (see further below). There + are still a number of places where the warnings are generated, + mostly because ACE wraps "unsafe" methods such as strcpy(), printf(), + etc. These can't legitimately be changed. So most of what can (and + should) be changed in ACE has been. To keep the warnings quiet + without removing them from any user application that includes ACE + headers, the acedefaults.mpb base project now inherits from + vc8_warnings - vc8_warnings will, by default, silence the warnings + we don't really need to see, but users of ACE will still get the + warnings when building their apps, unless they take similar steps + to silence them (or if they generate projects using the acedefaults + base project with MPC). + We can still elect to enable all the warnings by setting MPC features + to 0 (see vc8_warnings.mpb for features). And this is a good thing + to do still since we can improve the security situation by reviewing + things flagged as warnings and repair what's needed (not everything + flagged will be in need of a fix). + + * ace/config-win32-msvc-8.h: Removed most of the pragmas that silenced + legit warnings from VC8. Added ACE_HAS_TR24731_2005_CRT indicating + that there's a C Run-Time implementing C99 draft TR 24731 dated + October 2005 detailing security improvements to the C run-time. + This macros indicates that the more secure versions of the calls + can be used where desireable. + Also added a macro, ACE_WIN32_VC8, to easily tell where we need to + selectively disable a warning that we can tell by inspection is + irrelevant. Such as use of 'this' in an initializer list and we can + tell by inspecting the code in question to be sure that the passed + pointer isn't used to call a method on an object that's not fully + constructed yet. + + * ace/config-macros.h: When ACE_HAS_TR24731_2005_CRT is defined, + define ACE_SECURECRTCALL to make a call and adjust the returned + error value to the ACE return value convention. + + * ace/README: Describe ACE_HAS_TR24731_2005_CRT. + + * NEWS: Described the removing of the warning preventers and that + user code may trigger warnings that weren't showing up in previous + ACE versions. + + * ace/Global_Macros.h: For VC8 with ACE_HAS_EXCEPTIONS, define + ACE_THROW_SPEC as throw(...) always. VC8 always treats any throw + spec as throw(...) and issues a warning to this effect. This change + silences the warnings. The #if intends to set this for VC8 only, + guessing that any VC9 will be _MSC_VER 1500. + + * ace/os_includes/sys/os_types.h: For non-Borland, non-Mingw ACE_WIN32 + change mode_t from u_short to int. Matches CRT docs. + + * ace/Local_Tokens.cpp: + * ace/Select_Reactor_Base.inl: + * ace/WFMO_Reactor.cpp: + * apps/Gateway/Gateway/Event_Channel.cpp: + Disable VC8's C4355 warning that 'this' is used in an initializer + list; we know, and it's ok. + + * ace/Select_Reactor_T.cpp (ctor): Rather than pass a reference to + 'this' incompletely constructed object to token_, call token_'s + reactor() method to set the reactor impl pointer. + + * ace/Registry.{h cpp}: Rearranged setting of Binding_Iterator in the + inherited Iteration_State object. Instead of passing a reference to + an object that's not yet fully constructed, call a new iterator() + method to set that pointer. + + * ace/Service_Config.cpp (ctor): Rather than set the TSS pointer in + the initializer list before it's complete, call ts_object() to set + it within the constructor body. We could also catch a setup error + here and throw an exception if ACE ever goes that way. + + * ace/OS_NS_time.h (ace_timezone): Use the GetTimeZoneInformation() + system call to get timezone bias for all Windows platforms and + compilers. Much easier and faster than going through the C run-time + and will work with new US daylight savings changes automatically. + + * ace/OS_NS_sys_stat.inl: (umask): + * ace/OS_NS_stdio.inl (vsnprintf): + * ace/OS_NS_stdio.cpp (sprintf, snprintf): + * ace/OS_NS_string.inl (strtok_r, strncat): + * ace/OS_NS_string.cpp (strerror): + Use "safer" functions when ACE_HAS_TR24731_2005_CRT. + + * ace/OS_NS_time.{inl cpp}: (asctime_r, ctime_r, gmtime_r, + localtime_r): Use new functions when ACE_HAS_TR24731_2005_CRT. + NOTE - I purposely did not substitute the secure version for the + non _r methods (asctime, ctime, etc.) since that would have to use + a local static variable. That defeats the purpose of being able to + use a caller-supplied destination. Thus, the places that can + substitute a secure function are, and those that can't don't. This + will notify users of code that's potentially unsafe and allow them to + switch to the safer _r version. We can set the + _CRT_SECURE_NO_WARNINGS macro for non-inline builds (where the unsafe + versions will be compiled in) and leave the warning in place for + inlined builds to put the user on notice that a potentially unsafe + method is being used. + + * ace/UUID.cpp (from_string_i): Use sscanf_s for VC8. + + * ace/Atomic_Op_T.{cpp inl}: + * ace/INET_Addr.cpp: + * ace/Filecache.cpp: + * ace/Future.cpp: + * ace/Map_Manager.inl: + * ace/Message_Queue_T.cpp: + * ace/Process_Mutex.cpp: + * ace/RW_Process_Mutex.cpp: + * ace/Stream.cpp: Don't use 'this' in initializer list. Quiets + VC8's warnings. + + * protocols/ace/TMCast/Group.{hpp cpp}: Change 'throw' to + ACE_THROW_SPEC to quiet the VC8 warnings. + + * tests/unload_libace.mpb: Add _CRT_SECURE_NO_WARNINGS for VC8. Else + VC8 warns about fopen() and we don't care. + + * ace/README: Added ACE_LACKS_WIN32_GETPROCESSTIMES. + + * ace/config-WinCE.h: Added ACE_LACKS_WIN32_SECURITY_DESCRIPTORS and + ACE_LACKS_WIN32_GETPROCESSTIMES. + + * ace/OS_NS_dirent.cpp (opendir_emulation): WinCE offers + GetFileAttributes() but documents a failing return value as + 0xFFFFFFFF whereas on desktop/server Windows a failed call returns + INVALID_FILE_ATTRIBUTES. So on WinCE, define INVALID_FILE_ATTRIBUTES. + + * ace/OS_NS_sys_resource.inl (getrusage): Don't try GetProcessTimes() + on Win32 if ACE_LACKS_WIN32_GETPROCESSTIMES is set. + + * ace/OS_NS_stdio.inl (cuserid): WinCE returns ENOTSUP for these. + + * ace/OS_NS_unistd.inl (chdir): If ACE_HAS_WINCE, return ENOTSUP. + + * ace/Log_Record.cpp (operator<<): Truncate the message data length + down to 32 bits (ACE_CDR::ULong) size since that's all the + CDR ops and header field can handle. + + * ace/Log_Msg_Backend.h: + * ace/Log_msg_UNIX_Syslog.{h cpp}: + * ace/Log_Msg_IPC.h: + * ace/Log_Msg_IPC.cpp (log): Changed the return type of log() from int + to ssize_t to match what it's returning (byte count or error). + Corrected the max_payload_size calculation + to match the header that operator<< (above) writes. The MAXLOGMSGLEN + isn't always enough now that ACE_Log_Record's data can be extended. + Fri Mar 9 00:57:26 UTC 2007 Carlos O'Ryan <coryan@atdesk.com> * ace/Event_Handler.cpp: @@ -1022,7 +1176,8 @@ Wed Feb 21 21:46:18 UTC 2007 Steve Huston <shuston@riverace.com> * ace/config-pharlap.h: * ace/config-WinCE.h: - * ace/OS_NS_stdio.inl: Changed ACE_LACKS_SETFILEPOINTEREX to + * ace/OS_NS_stdio.inl: + * ace/OS_NS_unistd.inl: Changed ACE_LACKS_SETFILEPOINTEREX to ACE_LACKS_WIN32_SETFILEPOINTEREX to be consistent with the other ACE_*_WIN32_*things. @@ -15,6 +15,31 @@ PLANNED CHANGES FOR "ACE-5.5.7" USER VISIBLE CHANGES BETWEEN ACE-5.5.6 and ACE-5.5.7 ==================================================== +. ACE 5.5 contained a set of pragmas which prevented Visual Studio 2005 (VC8) + from issuing warnings where C run-time functions are used but a more + secure alternative is available. For more information on the C run-time + issues and Microsoft's response, please see the following MSDN page: + http://msdn2.microsoft.com/en-us/library/8ef0s5kh(VS.80).aspx. + In this beta, the pragmas which prevented the warnings have been removed. + The ACE library has been reviewed and most of the use of "unsafe" functions + has been fixed where possible. Since not all of the warnings emanating from + ACE are situations that can or should be fixed, the ACE VC8 projects will + prevent the warnings while building the ACE kit and its contained examples, + tests, etc. The warnings are disabled by adding Microsoft-specified macros + to the compile line via MPC. If desired, the warnings can be re-enabled by + regenerating the project files with different MPC features. Note, however, + that while ACE without warnings caused by the new C run-time functions, your + application builds may trigger these warnings either by use of the "unsafe" + C run-time functions or via use of an inlined ACE_OS method which uses it. + If the warning is caused by an ACE_OS method, there is a more safe alternate + available, probably located by appending _r to the method name (e.g., + instead of using ACE_OS::ctime(), use ACE_OS::ctime_r()). + There are other cases where the compiler may have issued warnings and ACE + prevented this via a #pragma. These #pragmas have been removed as well. + This may cause your application builds to trigger more warnings from VC8 + than past ACE versions. You should review your code and either correct + the code or disable the warnings locally, as appropriate. + . The "release" argument to a number of ACE_String_Base<> methods was changed from int to bool to more accurately reflect its purpose. The following methods were changed: diff --git a/ACE/ace/Atomic_Op_T.cpp b/ACE/ace/Atomic_Op_T.cpp index d31e49e081a..2fffdd0b060 100644 --- a/ACE/ace/Atomic_Op_T.cpp +++ b/ACE/ace/Atomic_Op_T.cpp @@ -67,7 +67,7 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (void) template <class ACE_LOCK, class TYPE> ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (const TYPE &c) - : impl_ (this->own_mutex_, c) + : impl_ (own_mutex_, c) { // ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); } diff --git a/ACE/ace/Atomic_Op_T.inl b/ACE/ace/Atomic_Op_T.inl index 41b7ccd2af0..d41be1cbd15 100644 --- a/ACE/ace/Atomic_Op_T.inl +++ b/ACE/ace/Atomic_Op_T.inl @@ -161,7 +161,7 @@ ACE_Atomic_Op_Ex<ACE_LOCK, TYPE>::operator= (const TYPE &rhs) template <class ACE_LOCK, class TYPE> ACE_INLINE ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (const ACE_Atomic_Op<ACE_LOCK, TYPE> &rhs) - : impl_ (this->own_mutex_, rhs.value ()) + : impl_ (own_mutex_, rhs.value ()) { // ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); } diff --git a/ACE/ace/Filecache.cpp b/ACE/ace/Filecache.cpp index f196910962c..f00d34b888f 100644 --- a/ACE/ace/Filecache.cpp +++ b/ACE/ace/Filecache.cpp @@ -229,7 +229,7 @@ ACE_Filecache::instance (void) ACE_Filecache::ACE_Filecache (void) : size_ (ACE_DEFAULT_VIRTUAL_FILESYSTEM_TABLE_SIZE), - hash_ (this->size_) + hash_ (size_) { } diff --git a/ACE/ace/Future.cpp b/ACE/ace/Future.cpp index ae8bdeed457..730d17ebf9d 100644 --- a/ACE/ace/Future.cpp +++ b/ACE/ace/Future.cpp @@ -146,7 +146,7 @@ template <class T> ACE_Future_Rep<T>::ACE_Future_Rep (void) : value_ (0), ref_count_ (0), - value_ready_ (this->value_ready_mutex_) + value_ready_ (value_ready_mutex_) { } diff --git a/ACE/ace/Global_Macros.h b/ACE/ace/Global_Macros.h index 18f57d9ace5..dace42b36c3 100644 --- a/ACE/ace/Global_Macros.h +++ b/ACE/ace/Global_Macros.h @@ -120,7 +120,12 @@ ACE_END_VERSIONED_NAMESPACE_DECL # define ACE_THROW_SPEC(X) #else # if defined (ACE_HAS_EXCEPTIONS) -# define ACE_THROW_SPEC(X) throw X +# if defined (ACE_WIN32) && defined (_MSC_VER) && \ + (_MSC_VER >= 1400) && (_MSC_VER < 1500) +# define ACE_THROW_SPEC(X) throw(...) +# else +# define ACE_THROW_SPEC(X) throw X +# endif /* ACE_WIN32 && VC8 */ # else /* ! ACE_HAS_EXCEPTIONS */ # define ACE_THROW_SPEC(X) # endif /* ! ACE_HAS_EXCEPTIONS */ diff --git a/ACE/ace/INET_Addr.cpp b/ACE/ace/INET_Addr.cpp index c3d36cef6b8..07cc938a888 100644 --- a/ACE/ace/INET_Addr.cpp +++ b/ACE/ace/INET_Addr.cpp @@ -124,7 +124,7 @@ ACE_INET_Addr::hash (void) const } ACE_INET_Addr::ACE_INET_Addr (void) - : ACE_Addr (this->determine_type (), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { // ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); this->reset (); @@ -223,7 +223,7 @@ ACE_INET_Addr::set (const char address[]) } ACE_INET_Addr::ACE_INET_Addr (const char address[]) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); this->reset (); @@ -232,7 +232,7 @@ ACE_INET_Addr::ACE_INET_Addr (const char address[]) #if defined (ACE_HAS_WCHAR) ACE_INET_Addr::ACE_INET_Addr (const wchar_t address[]) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); this->reset (); @@ -456,7 +456,7 @@ ACE_INET_Addr::set (const char port_name[], ACE_INET_Addr::ACE_INET_Addr (u_short port_number, const char host_name[], int address_family) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); ACE_OS::memset (&this->inet_addr_, 0, sizeof (this->inet_addr_)); @@ -474,7 +474,7 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number, ACE_INET_Addr::ACE_INET_Addr (u_short port_number, const wchar_t host_name[], int address_family) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); ACE_OS::memset (&this->inet_addr_, 0, sizeof (this->inet_addr_)); @@ -573,7 +573,7 @@ ACE_INET_Addr::set_addr (void *addr, int /* len */, int map) // Creates a ACE_INET_Addr from a sockaddr_in structure. ACE_INET_Addr::ACE_INET_Addr (const sockaddr_in *addr, int len) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); this->reset (); @@ -584,7 +584,7 @@ ACE_INET_Addr::ACE_INET_Addr (const sockaddr_in *addr, int len) ACE_INET_Addr::ACE_INET_Addr (u_short port_number, ACE_UINT32 inet_address) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); this->reset (); @@ -600,7 +600,7 @@ ACE_INET_Addr::ACE_INET_Addr (u_short port_number, ACE_INET_Addr::ACE_INET_Addr (const char port_name[], const char host_name[], const char protocol[]) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); this->reset (); @@ -615,7 +615,7 @@ ACE_INET_Addr::ACE_INET_Addr (const char port_name[], ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], const wchar_t host_name[], const wchar_t protocol[]) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); this->reset (); @@ -632,7 +632,7 @@ ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], ACE_INET_Addr::ACE_INET_Addr (const char port_name[], ACE_UINT32 inet_address, const char protocol[]) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); #if !defined (ACE_LACKS_HTONL) @@ -653,7 +653,7 @@ ACE_INET_Addr::ACE_INET_Addr (const char port_name[], ACE_INET_Addr::ACE_INET_Addr (const wchar_t port_name[], ACE_UINT32 inet_address, const wchar_t protocol[]) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (determine_type (), sizeof (inet_addr_)) { ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); #if !defined (ACE_LACKS_HTONL) diff --git a/ACE/ace/Local_Tokens.cpp b/ACE/ace/Local_Tokens.cpp index dc8dec8d85f..d8317df464c 100644 --- a/ACE/ace/Local_Tokens.cpp +++ b/ACE/ace/Local_Tokens.cpp @@ -1141,6 +1141,10 @@ ACE_Token_Proxy::name (void) const return this->token_->name (); } +#if defined (ACE_WIN32_VC8) +# pragma warning (push) +# pragma warning (disable:4355) /* Use of 'this' in initializer list */ +#endif ACE_Token_Proxy::ACE_Token_Proxy (void) : token_ (0), waiter_ (this, 0) @@ -1158,6 +1162,9 @@ ACE_Token_Proxy::ACE_Token_Proxy (const ACE_Token_Proxy &) { ACE_TRACE ("ACE_Token_Proxy::ACE_Token_Proxy"); } +#if defined (ACE_WIN32_VC8) +# pragma warning (pop) +#endif // @@ should I do a mutex_->release ()? ACE_Token_Proxy::~ACE_Token_Proxy (void) diff --git a/ACE/ace/Log_Msg_Backend.h b/ACE/ace/Log_Msg_Backend.h index 9e872305705..58e6089d8af 100644 --- a/ACE/ace/Log_Msg_Backend.h +++ b/ACE/ace/Log_Msg_Backend.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/os_include/sys/os_types.h" + ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Log_Record; @@ -57,9 +59,9 @@ public: virtual int close (void) = 0; /// Backend routine. This is called when we want to log a message. - /// Since this routine is pure virtual, it must be overwritten by the + /// Since this routine is pure virtual, it must be implemented by the /// subclass. - virtual int log (ACE_Log_Record &log_record) = 0; + virtual ssize_t log (ACE_Log_Record &log_record) = 0; }; ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ACE/ace/Log_Msg_IPC.cpp b/ACE/ace/Log_Msg_IPC.cpp index ca213f1580b..6c80dce2297 100644 --- a/ACE/ace/Log_Msg_IPC.cpp +++ b/ACE/ace/Log_Msg_IPC.cpp @@ -43,18 +43,19 @@ ACE_Log_Msg_IPC::close (void) return this->message_queue_.close (); } -int +ssize_t ACE_Log_Msg_IPC::log (ACE_Log_Record &log_record) { // Serialize the log record using a CDR stream, allocate enough // space for the complete <ACE_Log_Record>. - const size_t max_payload_size = - 4 // type() - + 8 // timestamp - + 4 // process id - + 4 // data length - + ACE_Log_Record::MAXLOGMSGLEN // data - + ACE_CDR::MAX_ALIGNMENT; // padding; + size_t max_payload_size = + 4 // type + + 4 // pid + + 12 // timestamp + + 4 // process id + + 4 // data length + + log_record.msg_data_len () // message + + ACE_CDR::MAX_ALIGNMENT; // padding; // Insert contents of <log_record> into payload stream. ACE_OutputCDR payload (max_payload_size); diff --git a/ACE/ace/Log_Msg_IPC.h b/ACE/ace/Log_Msg_IPC.h index b50b04c05ce..80865ccda02 100644 --- a/ACE/ace/Log_Msg_IPC.h +++ b/ACE/ace/Log_Msg_IPC.h @@ -59,7 +59,7 @@ public: virtual int open (const ACE_TCHAR *logger_key); virtual int reset (void); virtual int close (void); - virtual int log (ACE_Log_Record &log_record); + virtual ssize_t log (ACE_Log_Record &log_record); private: ACE_LOG_MSG_IPC_STREAM message_queue_; diff --git a/ACE/ace/Log_Msg_UNIX_Syslog.cpp b/ACE/ace/Log_Msg_UNIX_Syslog.cpp index 23b90ef3c34..265c24db71e 100644 --- a/ACE/ace/Log_Msg_UNIX_Syslog.cpp +++ b/ACE/ace/Log_Msg_UNIX_Syslog.cpp @@ -79,7 +79,7 @@ ACE_Log_Msg_UNIX_Syslog::close (void) return 0; } -int +ssize_t ACE_Log_Msg_UNIX_Syslog::log (ACE_Log_Record &log_record) { int syslog_priority = this->convert_log_priority (log_record.type ()); diff --git a/ACE/ace/Log_Msg_UNIX_Syslog.h b/ACE/ace/Log_Msg_UNIX_Syslog.h index f6ce18af310..01d5476360d 100644 --- a/ACE/ace/Log_Msg_UNIX_Syslog.h +++ b/ACE/ace/Log_Msg_UNIX_Syslog.h @@ -58,7 +58,7 @@ public: virtual int close (void); /// This is called when we want to log a message. - virtual int log (ACE_Log_Record &log_record); + virtual ssize_t log (ACE_Log_Record &log_record); private: /// Convert an ACE_Log_Priority value to the corresponding syslog priority. diff --git a/ACE/ace/Log_Record.cpp b/ACE/ace/Log_Record.cpp index fac5ab8a9bf..1d6aea09359 100644 --- a/ACE/ace/Log_Record.cpp +++ b/ACE/ace/Log_Record.cpp @@ -324,17 +324,21 @@ int operator<< (ACE_OutputCDR &cdr, const ACE_Log_Record &log_record) { - size_t msglen = log_record.msg_data_len (); + // The written message length can't be more than 32 bits (ACE_CDR::ULong) + // so reduce it here if needed. + ACE_CDR::ULong u_msglen = + ACE_Utils::truncate_cast<ACE_CDR::ULong> (log_record.msg_data_len ()); + // Insert each field from <log_record> into the output CDR stream. cdr << ACE_CDR::Long (log_record.type ()); cdr << ACE_CDR::Long (log_record.pid ()); cdr << ACE_CDR::LongLong (log_record.time_stamp ().sec ()); cdr << ACE_CDR::Long (log_record.time_stamp ().usec ()); - cdr << ACE_CDR::ULong (msglen); + cdr << u_msglen; #if defined (ACE_USES_WCHAR) - cdr.write_wchar_array (log_record.msg_data (), msglen); + cdr.write_wchar_array (log_record.msg_data (), u_msglen); #else - cdr.write_char_array (log_record.msg_data (), msglen); + cdr.write_char_array (log_record.msg_data (), u_msglen); #endif /* ACE_USES_WCHAR */ return cdr.good_bit (); } diff --git a/ACE/ace/Map_Manager.inl b/ACE/ace/Map_Manager.inl index a3718734763..bf9a19c4949 100644 --- a/ACE/ace/Map_Manager.inl +++ b/ACE/ace/Map_Manager.inl @@ -281,7 +281,7 @@ ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK>::rend (void) template <class EXT_ID, class INT_ID, class ACE_LOCK> ACE_INLINE ACE_Map_Iterator_Base<EXT_ID, INT_ID, ACE_LOCK>::ACE_Map_Iterator_Base (ACE_Map_Manager<EXT_ID, INT_ID, ACE_LOCK> &mm) : map_man_ (&mm), - next_ (this->map_man_->occupied_list_id ()) + next_ (map_man_->occupied_list_id ()) { } diff --git a/ACE/ace/Message_Queue_T.cpp b/ACE/ace/Message_Queue_T.cpp index 4c52157c4ba..1c083767fe9 100644 --- a/ACE/ace/Message_Queue_T.cpp +++ b/ACE/ace/Message_Queue_T.cpp @@ -923,8 +923,8 @@ template <ACE_SYNCH_DECL> ACE_Message_Queue<ACE_SYNCH_USE>::ACE_Message_Queue (size_t hwm, size_t lwm, ACE_Notification_Strategy *ns) - : not_empty_cond_ (this->lock_), - not_full_cond_ (this->lock_) + : not_empty_cond_ (lock_), + not_full_cond_ (lock_) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::ACE_Message_Queue"); diff --git a/ACE/ace/OS_NS_dirent.cpp b/ACE/ace/OS_NS_dirent.cpp index b18ddc6928a..0743ef58fa2 100644 --- a/ACE/ace/OS_NS_dirent.cpp +++ b/ACE/ace/OS_NS_dirent.cpp @@ -41,6 +41,10 @@ ACE_DIR * ACE_OS::opendir_emulation (const ACE_TCHAR *filename) { #if defined (ACE_WIN32) +# if defined (ACE_HAS_WINCE) && !defined (INVALID_FILE_ATTRIBUTES) +# define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF +# endif + ACE_DIR *dir; ACE_TCHAR extra[3] = {0,0,0}; diff --git a/ACE/ace/OS_NS_stdio.cpp b/ACE/ace/OS_NS_stdio.cpp index cc84ed14df7..78013967dba 100644 --- a/ACE/ace/OS_NS_stdio.cpp +++ b/ACE/ace/OS_NS_stdio.cpp @@ -332,7 +332,9 @@ ACE_OS::snprintf (wchar_t *buf, size_t maxlen, const wchar_t *format, ...) int result; va_list ap; va_start (ap, format); -# if defined (ACE_WIN32) +# if defined (ACE_HAS_TR24731_2005_CRT) + result = _vsnwprintf_s (buf, maxlen, _TRUNCATE, format, ap); +# elif defined (ACE_WIN32) // Microsoft's vswprintf() doesn't have the maxlen argument that // XPG4/UNIX98 define. They do, however, recommend use of _vsnwprintf() // as a substitute, which does have the same signature as the UNIX98 one. @@ -388,7 +390,7 @@ ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...) # if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) || \ (defined (sun) && !defined (_XPG4) || defined(_XPG5)) || \ (defined ACE_HAS_DINKUM_STL) || defined (__DMC__) || \ - defined ACE_HAS_VSWPRINTF + defined ACE_HAS_VSWPRINTF || defined (ACE_WIN32_VC8) // The XPG4/UNIX98/C99 signature of the wide-char sprintf has a // maxlen argument. Since this method doesn't supply one, pass in @@ -403,7 +405,7 @@ ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...) return result; # elif defined (ACE_WIN32) - // Windows has vswprintf, but the signature is from the older ISO C + // Pre-VC8 Windows has vswprintf, but the signature is from the older ISO C // standard. Also see ACE_OS::snprintf() for more info on this. int result; diff --git a/ACE/ace/OS_NS_stdio.inl b/ACE/ace/OS_NS_stdio.inl index 8c36b8397d5..283eee418b3 100644 --- a/ACE/ace/OS_NS_stdio.inl +++ b/ACE/ace/OS_NS_stdio.inl @@ -413,6 +413,10 @@ ACE_OS::cuserid (char *user, size_t maxlen) ACE_UNUSED_ARG (user); ACE_UNUSED_ARG (maxlen); ACE_NOTSUP_RETURN (0); +#elif defined (ACE_HAS_WINCE) + ACE_UNUSED_ARG (user); + ACE_UNUSED_ARG (maxlen); + ACE_NOTSUP_RETURN (0); #elif defined (ACE_WIN32) BOOL result = GetUserNameA (user, (u_long *) &maxlen); if (result == FALSE) @@ -500,7 +504,11 @@ ACE_OS::cuserid (char *user, size_t maxlen) ACE_INLINE wchar_t * ACE_OS::cuserid (wchar_t *user, size_t maxlen) { -# if defined (ACE_WIN32) +# if defined (ACE_HAS_WINCE) + ACE_UNUSED_ARG (user); + ACE_UNUSED_ARG (maxlen); + ACE_NOTSUP_RETURN (0); +# elif defined (ACE_WIN32) BOOL result = GetUserNameW (user, (u_long *) &maxlen); if (result == FALSE) ACE_FAIL_RETURN (0); @@ -941,7 +949,9 @@ ACE_OS::vsnprintf (char *buffer, size_t maxlen, const char *format, va_list ap) { #if !defined (ACE_LACKS_VSNPRINTF) int result; -# if !defined (ACE_WIN32) +# if defined (ACE_HAS_TR24731_2005_CRT) + result = _vsnprintf_s (buffer, maxlen, _TRUNCATE, format, ap); +# elif !defined (ACE_WIN32) result = ::vsnprintf (buffer, maxlen, format, ap); # else result = ::_vsnprintf (buffer, maxlen, format, ap); @@ -983,7 +993,7 @@ ACE_OS::vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr) # if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) || \ (defined (sun) && !(defined(_XOPEN_SOURCE) && (_XOPEN_VERSION-0==4))) || \ (defined (ACE_HAS_DINKUM_STL) || defined (__DMC__)) || \ - defined (ACE_HAS_VSWPRINTF) + defined (ACE_HAS_VSWPRINTF) || defined (ACE_WIN32_VC8) // The XPG4/UNIX98/C99 signature of the wide-char sprintf has a // maxlen argument. Since this method doesn't supply one, pass in @@ -993,8 +1003,8 @@ ACE_OS::vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr) return vswprintf (buffer, 4096, format, argptr); # elif defined (ACE_WIN32) - // Windows has vswprintf, but the signature is from the older ISO C - // standard. Also see ACE_OS::snprintf() for more info on this. + // Windows has vswprintf, but the pre-VC8 signature is from the older + // ISO C standard. Also see ACE_OS::snprintf() for more info on this. return vswprintf (buffer, format, argptr); @@ -1019,12 +1029,16 @@ ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_lis return vswprintf (buffer, maxlen, format, ap); +# elif defined (ACE_HAS_TR24731_2005_CRT) + + return _vsnwprintf_s (buffer, maxlen, _TRUNCATE, format, ap); + # elif defined (ACE_WIN32) int result = ::_vsnwprintf (buffer, maxlen, format, ap); // Win32 doesn't regard a full buffer with no 0-terminate as an - // overrun. +// overrun. if (result == static_cast<int> (maxlen)) result = -1; diff --git a/ACE/ace/OS_NS_string.cpp b/ACE/ace/OS_NS_string.cpp index 0dd7d0880ba..a5f7248fff8 100644 --- a/ACE/ace/OS_NS_string.cpp +++ b/ACE/ace/OS_NS_string.cpp @@ -121,12 +121,17 @@ ACE_OS::strerror (int errnum) errno = 0; char *errmsg; -#if defined (ACE_WIN32) - if (errnum < 0 || errnum >= _sys_nerr) - errno = EINVAL; +#if defined (ACE_HAS_TR24731_2005_CRT) + errmsg = ret_errortext; + ACE_SECURECRTCALL (strerror_s (ret_errortext, sizeof (ret_errortext), errno), + char *, 0, errmsg); + return errmsg; +#elif defined (ACE_WIN32) + if (errnum < 0 || errnum >= _sys_nerr) + errno = EINVAL; #endif /* ACE_WIN32 */ - errmsg = ::strerror (errnum); - + errmsg = ::strerror (errnum); + if (errno == EINVAL || errmsg == 0 || errmsg[0] == 0) { ACE_OS::sprintf (ret_errortext, "Unknown error %d", errnum); @@ -323,7 +328,8 @@ ACE_OS::strsncpy (ACE_WCHAR_T *dst, const ACE_WCHAR_T *src, size_t maxlen) return dst; } -#if !defined (ACE_HAS_REENTRANT_FUNCTIONS) || defined (ACE_LACKS_STRTOK_R) +#if (!defined (ACE_HAS_REENTRANT_FUNCTIONS) || defined (ACE_LACKS_STRTOK_R)) \ + && !defined (ACE_HAS_TR24731_2005_CRT) char * ACE_OS::strtok_r_emulation (char *s, const char *tokens, char **lasts) { diff --git a/ACE/ace/OS_NS_string.inl b/ACE/ace/OS_NS_string.inl index 8f25a46615c..74cb06668ca 100644 --- a/ACE/ace/OS_NS_string.inl +++ b/ACE/ace/OS_NS_string.inl @@ -259,7 +259,12 @@ ACE_OS::strlen (const ACE_WCHAR_T *s) ACE_INLINE char * ACE_OS::strncat (char *s, const char *t, size_t len) { +#if defined (ACE_HAS_TR24731_2005_CRT) + strncat_s (s, len, t, _TRUNCATE); + return s; +#else return ::strncat (s, t, len); +#endif /* ACE_HAS_TR24731_2005_CRT */ } ACE_INLINE ACE_WCHAR_T * @@ -267,6 +272,9 @@ ACE_OS::strncat (ACE_WCHAR_T *s, const ACE_WCHAR_T *t, size_t len) { # if !defined (ACE_HAS_WCHAR) || defined (ACE_LACKS_WCSNCAT) return ACE_OS::wcsncat_emulation (s, t, len); +# elif defined (ACE_HAS_TR24731_2005_CRT) + wcsncat_s (s, len, t, _TRUNCATE); + return s; # else /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCAT */ return ::wcsncat (s, t, len); # endif /* !ACE_HAS_WCHAR || ACE_LACKS_WCSNCAT */ @@ -521,7 +529,9 @@ ACE_OS::strtok (wchar_t *s, const wchar_t *tokens) ACE_INLINE char * ACE_OS::strtok_r (char *s, const char *tokens, char **lasts) { -#if defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (ACE_LACKS_STRTOK_R) +#if defined (ACE_HAS_TR24731_2005_CRT) + return strtok_s (s, tokens, lasts); +#elif defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (ACE_LACKS_STRTOK_R) return ::strtok_r (s, tokens, lasts); #else return ACE_OS::strtok_r_emulation (s, tokens, lasts); @@ -532,14 +542,16 @@ ACE_OS::strtok_r (char *s, const char *tokens, char **lasts) ACE_INLINE wchar_t* ACE_OS::strtok_r (ACE_WCHAR_T *s, const ACE_WCHAR_T *tokens, ACE_WCHAR_T **lasts) { -#if defined (ACE_LACKS_WCSTOK) - return ACE_OS::strtok_r_emulation (s, tokens, lasts); +#if defined (ACE_HAS_TR24731_2005_CRT) + return wcstok_s (s, tokens, lasts); +#elif defined (ACE_LACKS_WCSTOK) + return ACE_OS::strtok_r_emulation (s, tokens, lasts); #else # if defined (ACE_HAS_3_PARAM_WCSTOK) - return ::wcstok (s, tokens, lasts); + return ::wcstok (s, tokens, lasts); # else /* ACE_HAS_3_PARAM_WCSTOK */ - *lasts = ::wcstok (s, tokens); - return *lasts; + *lasts = ::wcstok (s, tokens); + return *lasts; # endif /* ACE_HAS_3_PARAM_WCSTOK */ #endif /* ACE_LACKS_WCSTOK */ } diff --git a/ACE/ace/OS_NS_sys_resource.inl b/ACE/ace/OS_NS_sys_resource.inl index 50d696b2059..b106d97efc1 100644 --- a/ACE/ace/OS_NS_sys_resource.inl +++ b/ACE/ace/OS_NS_sys_resource.inl @@ -38,6 +38,10 @@ ACE_OS::getrusage (int who, struct rusage *ru) # if defined (ACE_WIN32) ACE_UNUSED_ARG (who); +# if defined (ACE_LACKS_WIN32_GETPROCESSTIMES) + ACE_UNUSED_ARG (ru); + ACE_NOTSUP_RETURN (-1); +# else FILETIME dummy_1; FILETIME dummy_2; ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::GetProcessTimes (::GetCurrentProcess(), @@ -47,6 +51,7 @@ ACE_OS::getrusage (int who, struct rusage *ru) &ru->ru_utime), ace_result_), int, -1); +# endif /* ACE_LACKS_WIN32_GETPROCESSTIMES */ # else # if defined (ACE_HAS_RUSAGE_WHO_ENUM) ACE_OSCALL_RETURN (::getrusage ((ACE_HAS_RUSAGE_WHO_ENUM) who, ru), int, -1); diff --git a/ACE/ace/OS_NS_sys_stat.inl b/ACE/ace/OS_NS_sys_stat.inl index 321f2caf7ae..b8757e5bb8b 100644 --- a/ACE/ace/OS_NS_sys_stat.inl +++ b/ACE/ace/OS_NS_sys_stat.inl @@ -301,6 +301,10 @@ namespace ACE_OS # if defined (ACE_LACKS_UMASK) ACE_UNUSED_ARG (cmask); ACE_NOTSUP_RETURN ((mode_t)-1); +# elif defined (ACE_HAS_TR24731_2005_CRT) + mode_t old_mode; + ACE_SECURECRTCALL (_umask_s (cmask, &old_mode), mode_t, -1, old_mode); + return old_mode; # elif defined (ACE_WIN32) && !defined (__BORLANDC__) ACE_OSCALL_RETURN (::_umask (cmask), mode_t, -1); # else diff --git a/ACE/ace/OS_NS_time.cpp b/ACE/ace/OS_NS_time.cpp index ad12f69eaee..a7abc3a1b4f 100644 --- a/ACE/ace/OS_NS_time.cpp +++ b/ACE/ace/OS_NS_time.cpp @@ -231,6 +231,9 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res) # else ACE_OSCALL_RETURN (::localtime_r (t, res), struct tm *, 0); # endif /* DIGITAL_UNIX */ +#elif defined (ACE_HAS_TR24731_2005_CRT) + ACE_SECURECRTCALL (localtime_s (res, t), struct tm *, 0, res); + return res; #elif !defined (ACE_HAS_WINCE) ACE_OS_GUARD diff --git a/ACE/ace/OS_NS_time.h b/ACE/ace/OS_NS_time.h index 747fdccbaa5..b29c636d1f8 100644 --- a/ACE/ace/OS_NS_time.h +++ b/ACE/ace/OS_NS_time.h @@ -77,17 +77,10 @@ struct tm { */ inline long ace_timezone() { -#if defined (ACE_HAS_WINCE) +#if defined (ACE_HAS_WIN32) TIME_ZONE_INFORMATION tz; GetTimeZoneInformation (&tz); return tz.Bias * 60; -#elif defined (ACE_WIN32) && !defined (ACE_HAS_DINKUM_STL) - return _timezone; // For Win32. -#elif defined (ACE_WIN32) && defined (ACE_HAS_DINKUM_STL) - time_t tod = time(0); // get current time - time_t t1 = mktime(gmtime(&tod)); // convert without timezone - time_t t2 = mktime(localtime(&tod)); // convert with timezone - return difftime(t1, t2); // compute difference in seconds #elif defined (ACE_HAS_TIMEZONE) // The XPG/POSIX specification requires that tzset() be called to // set the global variable <timezone>. diff --git a/ACE/ace/OS_NS_time.inl b/ACE/ace/OS_NS_time.inl index f8a8af92b86..a22ae73bbcd 100644 --- a/ACE/ace/OS_NS_time.inl +++ b/ACE/ace/OS_NS_time.inl @@ -48,6 +48,11 @@ ACE_OS::asctime_r (const struct tm *t, char *buf, int buflen) ACE_UNUSED_ARG (buf); ACE_UNUSED_ARG (buflen); ACE_NOTSUP_RETURN (0); +#elif defined (ACE_HAS_TR24731_2005_CRT) + char *result = buf; + ACE_SECURECRTCALL (asctime_s (buf, static_cast<size_t> (buflen), t), \ + char*, 0, result); + return result; #else char *result = 0; ACE_OSCALL (ACE_STD_NAMESPACE::asctime (t), char *, 0, result); @@ -170,6 +175,20 @@ ACE_OS::ctime_r (const time_t *t, ACE_TCHAR *buf, int buflen) return bufp; # endif /* ACE_USES_WCHAR */ +#elif defined (ACE_HAS_TR24731_2005_CRT) + if (buflen < ctime_buf_size) + { + errno = ERANGE; + return 0; + } + ACE_TCHAR *result = buf; +# if defined (ACE_USES_WCHAR) + ACE_SECURECRTCALL (_wctime_s (buf, buflen, t), wchar_t *, 0, result); +# else + ACE_SECURECRTCALL (ctime_s (buf, buflen, t), char *, 0, result); +# endif + return result; + #else /* ACE_HAS_REENTRANT_FUNCTIONS */ if (buflen < ctime_buf_size) { @@ -349,6 +368,10 @@ ACE_OS::gmtime_r (const time_t *t, struct tm *res) # else ACE_OSCALL_RETURN (::gmtime_r (t, res), struct tm *, 0); # endif /* DIGITAL_UNIX */ +#elif defined (ACE_HAS_TR24731_2005_CRT) + struct tm *tm_p = res; + ACE_SECURECRTCALL (gmtime_s (res, t), struct tm *, 0, tm_p); + return tm_p; #elif defined (ACE_LACKS_GMTIME_R) ACE_UNUSED_ARG (t); ACE_UNUSED_ARG (res); diff --git a/ACE/ace/Process_Mutex.cpp b/ACE/ace/Process_Mutex.cpp index 9aba33a7894..b6ac8b51e16 100644 --- a/ACE/ace/Process_Mutex.cpp +++ b/ACE/ace/Process_Mutex.cpp @@ -48,7 +48,7 @@ ACE_Process_Mutex::ACE_Process_Mutex (const char *name, void *arg, mode_t mode) #else : lock_ (USYNC_PROCESS, name ? - ACE_TEXT_CHAR_TO_TCHAR (name) : this->unique_name (), + ACE_TEXT_CHAR_TO_TCHAR (name) : unique_name (), (ACE_mutexattr_t *) arg, mode) #endif /* _ACE_USE_SV_SEM */ @@ -73,7 +73,7 @@ ACE_Process_Mutex::ACE_Process_Mutex (const wchar_t *name, #else : lock_ (USYNC_PROCESS, name ? - ACE_TEXT_WCHAR_TO_TCHAR (name) : this->unique_name (), + ACE_TEXT_WCHAR_TO_TCHAR (name) : unique_name (), (ACE_mutexattr_t *) arg, mode) #endif /* _ACE_USE_SV_SEM */ diff --git a/ACE/ace/README b/ACE/ace/README index c973ff2df66..78fbc3a25dd 100644 --- a/ACE/ace/README +++ b/ACE/ace/README @@ -714,6 +714,9 @@ ACE_HAS_TLI Platform supports TLI. Also instead of this. ACE_HAS_TLI_PROTOTYPES Platform provides TLI function prototypes +ACE_HAS_TR24731_2005_CRT The platform provides an implementation + of C99 draft TR24731 (October 2005), + C run-time with more secure parameters. ACE_HAS_TSS_EMULATION ACE provides TSS emulation. See also ACE_DEFAULT_THREAD_KEYS. @@ -1166,7 +1169,9 @@ ACE_LACKS_UNAME Platform lacks uname calls ACE_LACKS_WAIT The platform lacks wait ACE_LACKS_WILDCARD_BIND The bind() call will not select the port if it's 0. -ACE_LACKS_WIN32_MOVEFILEEX The Windows platforms doesn't have +ACE_LACKS_WIN32_GETPROCESSTIMES The Windows platform doesn't have + GetProcessTimes(). +ACE_LACKS_WIN32_MOVEFILEEX The Windows platform doesn't have MoveFileEx(). ACE_LACKS_WIN32_SECURITY_DESCRIPTORS The Windows platform doesn't have security descriptor support. diff --git a/ACE/ace/RW_Process_Mutex.cpp b/ACE/ace/RW_Process_Mutex.cpp index f16bf535182..b30e176b8ed 100644 --- a/ACE/ace/RW_Process_Mutex.cpp +++ b/ACE/ace/RW_Process_Mutex.cpp @@ -30,7 +30,7 @@ ACE_RW_Process_Mutex::unique_name (void) ACE_RW_Process_Mutex::ACE_RW_Process_Mutex (const ACE_TCHAR *name, int flags, mode_t mode ) - : lock_ (name ? name : this->unique_name (), flags, mode) + : lock_ (name ? name : unique_name (), flags, mode) { // ACE_TRACE ("ACE_RW_Process_Mutex::ACE_RW_Process_Mutex"); } diff --git a/ACE/ace/Registry.cpp b/ACE/ace/Registry.cpp index c2a824918f0..b6907ebec18 100644 --- a/ACE/ace/Registry.cpp +++ b/ACE/ace/Registry.cpp @@ -814,10 +814,10 @@ ACE_Registry::Naming_Context::list (Binding_List &list) // Default constructor ACE_Registry::Binding_Iterator::Binding_Iterator () - : object_iteration_ (*this), - context_iteration_ (*this), - iteration_complete_ (*this) { + this->object_iteration_.iterator (this); + this->context_iteration_.iterator (this); + this->iteration_complete_.iterator (this); this->reset (); } @@ -839,27 +839,15 @@ ACE_Registry::Binding_Iterator::Iteration_State::reset () } -ACE_Registry::Binding_Iterator::Iteration_State::Iteration_State (Binding_Iterator &iter) - : parent_ (&iter), - index_ (0) -{ -} - - -ACE_Registry::Binding_Iterator::Object_Iteration::Object_Iteration (Binding_Iterator &iter) - : Iteration_State (iter) -{ -} - - -ACE_Registry::Binding_Iterator::Context_Iteration::Context_Iteration (Binding_Iterator &iter) - : Iteration_State (iter) +void +ACE_Registry::Binding_Iterator::Iteration_State::iterator (Binding_Iterator *iter) { + this->parent_ = iter; } -ACE_Registry::Binding_Iterator::Iteration_Complete::Iteration_Complete (Binding_Iterator &iter) - : Iteration_State (iter) +ACE_Registry::Binding_Iterator::Iteration_State::Iteration_State () + : index_ (0) { } diff --git a/ACE/ace/Registry.h b/ACE/ace/Registry.h index c677a2fe6c7..88ffd807d49 100644 --- a/ACE/ace/Registry.h +++ b/ACE/ace/Registry.h @@ -460,7 +460,10 @@ public: { public: /// Constructor - Iteration_State (Binding_Iterator &iterator); + Iteration_State (); + + /// Set the iterator reference. + void iterator (Binding_Iterator *iterator); /// Next <how_many> entries virtual int next_n (u_long how_many, @@ -479,9 +482,6 @@ public: private: class ACE_Export Object_Iteration : public Iteration_State { - public: - Object_Iteration (Binding_Iterator &iterator); - /// Next <how_many> entries int next_n (u_long how_many, Binding_List &list); @@ -490,8 +490,6 @@ public: class ACE_Export Context_Iteration : public Iteration_State { public: - Context_Iteration (Binding_Iterator &iterator); - /// Next @a how_many entries int next_n (u_long how_many, Binding_List &list); @@ -500,8 +498,6 @@ public: class ACE_Export Iteration_Complete : public Iteration_State { public: - Iteration_Complete (Binding_Iterator &iterator); - /// Next @a how_many entries int next_n (u_long how_many, Binding_List &list); diff --git a/ACE/ace/Select_Reactor_Base.inl b/ACE/ace/Select_Reactor_Base.inl index 88890778b70..cfcb5349404 100644 --- a/ACE/ace/Select_Reactor_Base.inl +++ b/ACE/ace/Select_Reactor_Base.inl @@ -112,6 +112,10 @@ ACE_Event_Tuple::operator!= (const ACE_Event_Tuple &rhs) const return !(*this == rhs); } +#if defined (ACE_WIN32_VC8) +# pragma warning (push) +# pragma warning (disable:4355) /* Use of 'this' in initializer list */ +#endif ACE_INLINE ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl (bool ms) : handler_rep_ (*this) @@ -129,6 +133,9 @@ ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl (bool ms) , supress_renew_ (0) { } +#if defined (ACE_WIN32_VC8) +# pragma warning (pop) +#endif ACE_INLINE int ACE_Select_Reactor_Impl::supress_notify_renew (void) diff --git a/ACE/ace/Select_Reactor_T.cpp b/ACE/ace/Select_Reactor_T.cpp index c7cde626b0a..013497dc5f4 100644 --- a/ACE/ace/Select_Reactor_T.cpp +++ b/ACE/ace/Select_Reactor_T.cpp @@ -482,12 +482,13 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::ACE_Select_Reactor_T int mask_signals, int s_queue) : ACE_Select_Reactor_Impl (mask_signals) - , token_ (*this, s_queue) + , token_ (s_queue) , lock_adapter_ (token_) , deactivated_ (0) { ACE_TRACE ("ACE_Select_Reactor_T::ACE_Select_Reactor_T"); + this->token_.reactor (*this); // First try to open the Reactor with the hard-coded default. if (this->open (ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::DEFAULT_SIZE, 0, @@ -534,12 +535,13 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::ACE_Select_Reactor_T int mask_signals, int s_queue) : ACE_Select_Reactor_Impl (mask_signals) - , token_ (*this, s_queue) + , token_ (s_queue) , lock_adapter_ (token_) , deactivated_ (0) { ACE_TRACE ("ACE_Select_Reactor_T::ACE_Select_Reactor_T"); + this->token_.reactor (*this); if (this->open (size, rs, sh, diff --git a/ACE/ace/Service_Config.cpp b/ACE/ace/Service_Config.cpp index 040ebc59b01..5fb9e4adf63 100644 --- a/ACE/ace/Service_Config.cpp +++ b/ACE/ace/Service_Config.cpp @@ -374,10 +374,9 @@ ACE_Service_Config::ACE_Service_Config (int ignore_static_svcs, size_t size, int signum) : ACE_Service_Gestalt (size, false, ignore_static_svcs) - , tss_ (this) { ACE_TRACE ("ACE_Service_Config::ACE_Service_Config"); - + this->tss_.ts_object (this); ACE_Service_Config::signum_ = signum; } @@ -442,10 +441,10 @@ ACE_Service_Config::create_service_type_impl (const ACE_TCHAR *name, ACE_Service_Config::ACE_Service_Config (const ACE_TCHAR program_name[], const ACE_TCHAR *logger_key) : ACE_Service_Gestalt (ACE_Service_Repository::DEFAULT_SIZE, false) - , tss_ (this) { ACE_TRACE ("ACE_Service_Config::ACE_Service_Config"); + this->tss_.ts_object (this); if (this->open (program_name, logger_key) == -1 && errno != ENOENT) { diff --git a/ACE/ace/Stream.cpp b/ACE/ace/Stream.cpp index b44b04ddacc..56fa5a91aeb 100644 --- a/ACE/ace/Stream.cpp +++ b/ACE/ace/Stream.cpp @@ -589,7 +589,7 @@ ACE_Stream<ACE_SYNCH_USE>::ACE_Stream (void * a, ACE_Module<ACE_SYNCH_USE> *head, ACE_Module<ACE_SYNCH_USE> *tail) : linked_us_ (0), - final_close_ (this->lock_) + final_close_ (lock_) { ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::ACE_Stream"); if (this->open (a, head, tail) == -1) diff --git a/ACE/ace/UUID.cpp b/ACE/ace/UUID.cpp index 91cc9484496..bcb876424b1 100644 --- a/ACE/ace/UUID.cpp +++ b/ACE/ace/UUID.cpp @@ -217,7 +217,12 @@ namespace ACE_Utils // MSVC. It appears that most platforms support sscanf though // so we need to use it directly. const int nScanned = - ::sscanf(uuid_string.c_str(), +#if defined (ACE_HAS_TR24731_2005_CRT) + sscanf_s ( +#else + ::sscanf( +#endif + uuid_string.c_str(), "%8x-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x", &timeLow, &timeMid, @@ -243,6 +248,24 @@ namespace ACE_Utils else { const int nScanned = +#if defined (ACE_HAS_TR24731_2005_CRT) + sscanf_s (uuid_string.c_str(), + "%8x-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x-%s", + &timeLow, + &timeMid, + &timeHiAndVersion, + &clockSeqHiAndReserved, + &clockSeqLow, + &node[0], + &node[1], + &node[2], + &node[3], + &node[4], + &node[5], + thr_pid_buf, + BUFSIZ + ); +#else ::sscanf (uuid_string.c_str(), "%8x-%4x-%4x-%2x%2x-%2x%2x%2x%2x%2x%2x-%s", &timeLow, @@ -258,6 +281,7 @@ namespace ACE_Utils &node[5], thr_pid_buf ); +#endif /* ACE_HAS_TR24731_2005_CRT */ if (nScanned != 12) { diff --git a/ACE/ace/WFMO_Reactor.cpp b/ACE/ace/WFMO_Reactor.cpp index a519c607108..506f211095e 100644 --- a/ACE/ace/WFMO_Reactor.cpp +++ b/ACE/ace/WFMO_Reactor.cpp @@ -1064,6 +1064,10 @@ ACE_WFMO_Reactor::work_pending (const ACE_Time_Value &) ACE_NOTSUP_RETURN (-1); } +#if defined (ACE_WIN32_VC8) +# pragma warning (push) +# pragma warning (disable:4355) /* Use of 'this' in initializer list */ +# endif ACE_WFMO_Reactor::ACE_WFMO_Reactor (ACE_Sig_Handler *sh, ACE_Timer_Queue *tq, ACE_Reactor_Notify *notify) @@ -1129,6 +1133,9 @@ ACE_WFMO_Reactor::ACE_WFMO_Reactor (size_t size, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("WFMO_Reactor"))); } +#if defined (ACE_WIN32_VC8) +# pragma warning (pop) +#endif int ACE_WFMO_Reactor::current_info (ACE_HANDLE, size_t &) diff --git a/ACE/ace/WFMO_Reactor.h b/ACE/ace/WFMO_Reactor.h index c06306cb7c1..4700720df81 100644 --- a/ACE/ace/WFMO_Reactor.h +++ b/ACE/ace/WFMO_Reactor.h @@ -97,6 +97,8 @@ public: /** * @class ACE_WFMO_Reactor_Handler_Repository * + * @internal This class is for internal ACE use only. + * * @brief Used to map ACE_HANDLEs onto the appropriate * ACE_Event_Handler * and other information. */ diff --git a/ACE/ace/config-WinCE.h b/ACE/ace/config-WinCE.h index 26e5ab55201..8c3fd2ca1d1 100644 --- a/ACE/ace/config-WinCE.h +++ b/ACE/ace/config-WinCE.h @@ -66,6 +66,8 @@ #define ACE_LACKS_STRFTIME #define ACE_LACKS_WIN32_SETFILEPOINTEREX #define ACE_LACKS_WIN32_SERVICES +#define ACE_LACKS_WIN32_SECURITY_DESCRIPTORS +#define ACE_LACKS_WIN32_GETPROCESSTIMES #define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 @@ -178,8 +180,8 @@ #define ACE_LACKS_SIGACTION #define ACE_LACKS_PIPE -#define ACE_LACKS_CUSERID -#define ACE_LACKS_CHDIR +//#define ACE_LACKS_CUSERID +//#define ACE_LACKS_CHDIR #define ACE_LACKS_ENV #define ACE_LACKS_HOSTNAME #define ACE_LACKS_REALPATH diff --git a/ACE/ace/config-macros.h b/ACE/ace/config-macros.h index c2fcaafa03b..b7e244e4789 100644 --- a/ACE/ace/config-macros.h +++ b/ACE/ace/config-macros.h @@ -486,8 +486,19 @@ if (RESULT == FAILVALUE) \ ACE_OS::set_errno_to_last_error (); \ } while (0) + #endif /* ACE_WIN32 */ +// The C99 security-improved run-time returns an error value on failure; +// 0 on success. +#if defined (ACE_HAS_TR24731_2005_CRT) +# define ACE_SECURECRTCALL(X,TYPE,FAILVALUE,RESULT) \ + do { \ + errno_t ___ = X; \ + if (___ != 0) { errno = ___; RESULT = FAILVALUE; } \ + } while (0) +#endif /* ACE_HAS_TR24731_2005_CRT */ + // ============================================================================ // Fundamental types // ============================================================================ diff --git a/ACE/ace/config-win32-msvc-8.h b/ACE/ace/config-win32-msvc-8.h index 82af96ec73e..0405a3e04ee 100644 --- a/ACE/ace/config-win32-msvc-8.h +++ b/ACE/ace/config-win32-msvc-8.h @@ -23,6 +23,10 @@ #error Use config-win32.h in config.h instead of this header #endif /* ACE_CONFIG_WIN32_H */ +#ifndef ACE_WIN32_VC8 +# define ACE_WIN32_VC8 +#endif + // Visual C++ 8.0 (.NET) deprecated the old iostreams #if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) #define ACE_HAS_STANDARD_CPP_LIBRARY 1 @@ -101,21 +105,16 @@ // There are too many instances of this warning to fix it right now. // Maybe in the future. -// C++ Exception Specification ignored -#pragma warning(disable:4290) - // 'this' : used in base member initializer list #pragma warning(disable:4355) -// 'class1' : inherits 'class2::member' via dominance -#pragma warning(disable:4250) - // Disable warning of using Microsoft Extension. # pragma warning(disable:4231) -// Disable deprecation warnings, because setting _CRT_SECURE_NO_DEPRECATE -// did not prevent the warnings. -#pragma warning(disable:4996) +// CE (at least thru Windows Mobile 5) doesn't have the new, secure CRT. +#if !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_TR24731_2005_CRT) +# define ACE_HAS_TR24731_2005_CRT +#endif // On CE w/o MFC config-WinCE.h needs to declare a placement new. This // triggers a warning that there's no placement delete, which can be ignored. diff --git a/ACE/ace/os_include/sys/os_types.h b/ACE/ace/os_include/sys/os_types.h index 2ece5f6d901..ad975aa2f8a 100644 --- a/ACE/ace/os_include/sys/os_types.h +++ b/ACE/ace/os_include/sys/os_types.h @@ -101,7 +101,7 @@ typedef double ACE_timer_t; # if !defined (__BORLANDC__) typedef DWORD nlink_t; # if !defined(__MINGW32__) - typedef u_short mode_t; + typedef int mode_t; # endif /* !__MINGW32__ */ typedef long uid_t; typedef long gid_t; diff --git a/ACE/apps/Gateway/Gateway/Event_Channel.cpp b/ACE/apps/Gateway/Gateway/Event_Channel.cpp index beb35c1856e..2d1a0f84ada 100644 --- a/ACE/apps/Gateway/Gateway/Event_Channel.cpp +++ b/ACE/apps/Gateway/Gateway/Event_Channel.cpp @@ -13,11 +13,18 @@ Event_Channel::~Event_Channel (void) { } +#if defined (ACE_WIN32_VC8) +# pragma warning (push) +# pragma warning (disable:4355) /* Use of 'this' in initializer list */ +# endif Event_Channel::Event_Channel (void) : supplier_acceptor_ (*this, 'S'), consumer_acceptor_ (*this, 'C') { } +#if defined (ACE_WIN32_VC8) +# pragma warning (pop) +#endif int Event_Channel::compute_performance_statistics (void) diff --git a/ACE/bin/MakeProjectCreator/config/acedefaults.mpb b/ACE/bin/MakeProjectCreator/config/acedefaults.mpb index 99cf8d75eec..e7d14465290 100644 --- a/ACE/bin/MakeProjectCreator/config/acedefaults.mpb +++ b/ACE/bin/MakeProjectCreator/config/acedefaults.mpb @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project: ipv6 { +project: ipv6, vc8_warnings { staticflags += ACE_AS_STATIC_LIBS includes += $(ACE_ROOT) libpaths += $(ACE_ROOT)/lib diff --git a/ACE/bin/MakeProjectCreator/config/vc8_warnings.mpb b/ACE/bin/MakeProjectCreator/config/vc8_warnings.mpb new file mode 100644 index 00000000000..30c42c26e58 --- /dev/null +++ b/ACE/bin/MakeProjectCreator/config/vc8_warnings.mpb @@ -0,0 +1,21 @@ +// -*- MPC -*- +// $Id$ + +// This file contains a number of optional features that disable VC8 +// warnings regarding various items that VC8 turned into warnings that were +// not present in earlier versions. Some people may consider these superfluous +// or have already checked code to be sure it causes no trouble. So these +// warnings are disabled by default. To enable them, generate your projects +// with the feature set to 0. + +feature(vc8_avoid_crt_secure_warnings) { + specific(vc8) { + macros += _CRT_SECURE_NO_WARNINGS + } +} + +feature(vc8_avoid_scl_secure_warnings) { + specific(vc8) { + macros += _SCL_SECURE_NO_WARNINGS + } +} diff --git a/ACE/protocols/ace/TMCast/Group.cpp b/ACE/protocols/ace/TMCast/Group.cpp index 1f2b2a60dfd..e153b23c94d 100644 --- a/ACE/protocols/ace/TMCast/Group.cpp +++ b/ACE/protocols/ace/TMCast/Group.cpp @@ -333,7 +333,7 @@ namespace ACE_TMCast } GroupImpl (ACE_INET_Addr const& addr, char const* id) - throw (Group::Failed) + ACE_THROW_SPEC((Group::Failed)) : send_cond_ (mutex_), recv_cond_ (mutex_), failed_ (false), @@ -356,7 +356,7 @@ namespace ACE_TMCast void send (void const* msg, size_t size) - throw (Group::InvalidArg, Group::Failed, Group::Aborted) + ACE_THROW_SPEC((Group::InvalidArg, Group::Failed, Group::Aborted)) { if (size > Protocol::MAX_PAYLOAD_SIZE) throw InvalidArg (); @@ -410,7 +410,8 @@ namespace ACE_TMCast size_t - recv (void* msg, size_t size) throw (Group::Failed, Group::InsufficienSpace) + recv (void* msg, size_t size) + ACE_THROW_SPEC((Group::Failed, Group::InsufficienSpace)) { AutoLock lock (mutex_); @@ -481,7 +482,7 @@ namespace ACE_TMCast // Group:: Group (ACE_INET_Addr const& addr, char const* id) - throw (Group::Failed) + ACE_THROW_SPEC((Group::Failed)) : pimpl_ (new GroupImpl (addr, id)) { } @@ -492,13 +493,15 @@ namespace ACE_TMCast } void - Group::send (void const* msg, size_t size) throw (Group::InvalidArg, Group::Failed, Group::Aborted) + Group::send (void const* msg, size_t size) + ACE_THROW_SPEC((Group::InvalidArg, Group::Failed, Group::Aborted)) { pimpl_->send (msg, size); } size_t - Group::recv (void* msg, size_t size) throw (Group::Failed, Group::InsufficienSpace) + Group::recv (void* msg, size_t size) + ACE_THROW_SPEC((Group::Failed, Group::InsufficienSpace)) { return pimpl_->recv (msg, size); } diff --git a/ACE/protocols/ace/TMCast/Group.hpp b/ACE/protocols/ace/TMCast/Group.hpp index 13c49f210bb..d2e4746deee 100644 --- a/ACE/protocols/ace/TMCast/Group.hpp +++ b/ACE/protocols/ace/TMCast/Group.hpp @@ -23,14 +23,16 @@ namespace ACE_TMCast public: ~Group (); - Group (ACE_INET_Addr const& addr, char const* id) throw (Failed); + Group (ACE_INET_Addr const& addr, char const* id) ACE_THROW_SPEC((Failed)); public: void - send (void const* msg, size_t size) throw (InvalidArg, Failed, Aborted); + send (void const* msg, size_t size) + ACE_THROW_SPEC((InvalidArg, Failed, Aborted)); size_t - recv (void* msg, size_t size) throw (Failed, InsufficienSpace); + recv (void* msg, size_t size) + ACE_THROW_SPEC((Failed, InsufficienSpace)); private: bool diff --git a/ACE/tests/unload_libace.mpb b/ACE/tests/unload_libace.mpb index 7fe13bae305..333da61beff 100644 --- a/ACE/tests/unload_libace.mpb +++ b/ACE/tests/unload_libace.mpb @@ -3,4 +3,7 @@ feature(ace_for_tao) { macros += ACE_LIB_NAME=\\"ACE_FOR_TAO\\" + specific(vc8) { + macros += _CRT_SECURE_NO_WARNINGS + } }
\ No newline at end of file |