diff options
author | cbeaulac <cbeaulac@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-12-13 13:56:21 +0000 |
---|---|---|
committer | cbeaulac <cbeaulac@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-12-13 13:56:21 +0000 |
commit | fad5c147a94d9d35570d9bbb62e7e79f7f882a41 (patch) | |
tree | dc6bd3a6ef7e72ec3b4ea33ece9826f8151d64b7 | |
parent | 6f1d1712af4f502bf20b37caa9de3d885a222f05 (diff) | |
download | ATCD-fad5c147a94d9d35570d9bbb62e7e79f7f882a41.tar.gz |
Sat Dec 13 08:54:41 EST 2008 Chad Beaulac <cabeaulac@gmail.com> Bugzilla 3334 fix. Merged trunk/ACE/ace into branches/bugzilla_fix_3334/ace and retested.
165 files changed, 2435 insertions, 1482 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index 4171ca893d4..7acccf09079 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -167,7 +167,7 @@ bool ACE::debug (void) { static const char* debug = ACE_OS::getenv ("ACE_DEBUG"); - return (ACE::debug_ != 0) ? ACE::debug_ : (debug != 0 ? (*debug != '0'): false); + return (ACE::debug_ != 0) ? ACE::debug_ : (debug != 0 ? (*debug != '0') : false); } void @@ -373,7 +373,6 @@ ACE::hash_pjw (const wchar_t *str) } #endif /* ACE_HAS_WCHAR */ -#if !defined (ACE_HAS_WINCE) ACE_TCHAR * ACE::strenvdup (const ACE_TCHAR *str) { @@ -381,7 +380,6 @@ ACE::strenvdup (const ACE_TCHAR *str) return ACE_OS::strenvdup (str); } -#endif /* ACE_HAS_WINCE */ /* @@ -2330,7 +2328,7 @@ ACE::format_hexdump (const char *buffer, size_t i; - size_t lines = size / 16; + size_t const lines = size / 16; for (i = 0; i < lines; i++) { size_t j; @@ -2538,14 +2536,14 @@ ACE::handle_timed_complete (ACE_HANDLE h, #else ACE_Handle_Set rd_handles; ACE_Handle_Set wr_handles; - rd_handles.set_bit (h); wr_handles.set_bit (h); #endif /* !ACE_WIN32 && ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ #if defined (ACE_WIN32) // Winsock is different - it sets the exception bit for failed connect, - // unlike other platforms, where the read bit is set. + // unlike other platforms, where the write bit is set for both success + // and fail. ACE_Handle_Set ex_handles; ex_handles.set_bit (h); #endif /* ACE_WIN32 */ @@ -2565,11 +2563,19 @@ ACE::handle_timed_complete (ACE_HANDLE h, int n = ACE_OS::poll (&fds, 1, timeout); # else - int n = ACE_OS::select (int (h) + 1, - rd_handles, - wr_handles, - 0, - timeout); + int n = 0; + if (is_tli) + n = ACE_OS::select (int (h) + 1, + rd_handles, + wr_handles, + 0, + timeout); + else + n = ACE_OS::select (int (h) + 1, + 0, + wr_handles, + 0, + timeout); # endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ #endif /* ACE_WIN32 */ @@ -2583,11 +2589,14 @@ ACE::handle_timed_complete (ACE_HANDLE h, return ACE_INVALID_HANDLE; } - // Usually, a ready-for-write handle is successfully connected, and - // ready-for-read (exception on Win32) is a failure. On fails, we - // need to grab the error code via getsockopt. On possible success for - // any platform where we can't tell just from select() (e.g. AIX), - // we also need to check for success/fail. + // On Windows, a ready-for-write handle is successfully connected, and + // ready-for-exception is a failure. On fails, we need to grab the error + // code via getsockopt. + // On BSD sockets using select(), the handle becomes writable on + // completion either success or fail, so if the select() does not time + // out, we need to check for success/fail. + // It is believed that TLI sockets use the readable=fail, writeable=success + // but that hasn't been as well tested. #if defined (ACE_WIN32) ACE_UNUSED_ARG (is_tli); @@ -2599,34 +2608,20 @@ ACE::handle_timed_complete (ACE_HANDLE h, need_to_check = true; known_failure = true; } -#elif defined (ACE_VXWORKS) - ACE_UNUSED_ARG (is_tli); - - // Force the check on VxWorks. The read handle for "h" is not set, - // so "need_to_check" is false at this point. The write handle is - // set, for what it's worth. - need_to_check = true; #else if (is_tli) - # if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) need_to_check = (fds.revents & POLLIN) && !(fds.revents & POLLOUT); # else - need_to_check = rd_handles.is_set (h) && !wr_handles.is_set (h); + need_to_check = rd_handles.is_set (h) && !wr_handles.is_set (h); # endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ else -#if defined(AIX) - // AIX is broken... both success and failed connect will set the - // write handle only, so always check. - need_to_check = true; -#else # if defined (ACE_HAS_POLL) && defined (ACE_HAS_LIMITED_SELECT) - need_to_check = (fds.revents & POLLIN); + need_to_check = (fds.revents & POLLIN); # else - need_to_check = rd_handles.is_set (h); + need_to_check = true; # endif /* ACE_HAS_POLL && ACE_HAS_LIMITED_SELECT */ -#endif /* AIX */ #endif /* ACE_WIN32 */ if (need_to_check) @@ -2733,9 +2728,7 @@ ACE::handle_timed_accept (ACE_HANDLE listener, return -1; /* NOTREACHED */ case 0: - if (timeout != 0 - && timeout->sec () == 0 - && timeout->usec () == 0) + if (timeout != 0 && *timeout == ACE_Time_Value::zero) errno = EWOULDBLOCK; else errno = ETIMEDOUT; @@ -3386,27 +3379,82 @@ ACE::strnew (const wchar_t *s) } #endif /* ACE_HAS_WCHAR */ -inline static bool equal_char(char a, char b, bool case_sensitive) -{ - if (case_sensitive) - return a == b; - return ACE_OS::ace_tolower(a) == ACE_OS::ace_tolower(b); +// helper functions for ACE::wild_match() +namespace +{ + + inline bool equal_char (char a, char b, bool case_sensitive) + { + if (case_sensitive) + return a == b; + return ACE_OS::ace_tolower (a) == ACE_OS::ace_tolower (b); + } + + // precond: *p == '[' start of char class + // postcond: *p == ']' end of the char class + inline bool equal_class (char s, const char *&p, bool case_sensitive) + { + ++p; + bool negate = false; + if (*p == '!') + { + negate = true; + ++p; + } + // ] and - are regular in 1st position + for (bool first = true; *p && (first || *p != ']'); ++p) + { + if (!first && *p == '-' && p[1] != ']') + { + if (!p[1] || p[1] <= p[-1]) // invalid range + { + continue; + } + // Since we are in the POSIX locale, only the basic ASCII + // characters are allowed as the range endpoints. These characters + // are the same values in both signed and unsigned chars so we + // don't have to account for any "pathological cases." + for (char range = p[-1] + 1; range <= p[1]; ++range) + { + if (equal_char (s, range, case_sensitive)) + { + while (*++p != ']') {} + return !negate; + } + } + ++p; // consume the character 1 past the - + } + else if (equal_char (s, *p, case_sensitive)) + { + while (*++p != ']') {} + return !negate; + } + first = false; + } + return negate; + } } bool -ACE::wild_match(const char* str, const char* pat, bool case_sensitive) +ACE::wild_match(const char *str, const char *pat, bool case_sensitive, + bool character_classes) { if (str == pat) return true; if (pat == 0 || str == 0) return false; - bool star = false; - const char* s = str; - const char* p = pat; + bool star = false, escape = false; + const char *s = str; + const char *p = pat; while (*s != '\0') { - if (*p == '*') + if (!escape && *p == '\\') + { + ++p; + escape = true; + } + else if (!escape && *p == '*') { star = true; pat = p; @@ -3416,22 +3464,38 @@ ACE::wild_match(const char* str, const char* pat, bool case_sensitive) return true; p = pat; } - else if (*p == '?') + else if (!escape && *p == '?') { ++s; ++p; } - else if (! equal_char(*s, *p, case_sensitive)) + else if (!escape && character_classes && *p == '[') + { + if (equal_class (*s, p, case_sensitive)) + { + ++p; + } + else + { + if (!star) + return false; + p = pat; + } + ++s; + } + else if (!equal_char (*s, *p, case_sensitive)) { if (!star) return false; - s = ++str; + ++s; p = pat; + escape = false; } else { ++s; ++p; + escape = false; } } if (*p == '*') diff --git a/ace/ACE.h b/ace/ACE.h index 1708cb6a9e1..eaa6915433d 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -90,7 +90,13 @@ namespace ACE /// Simple wildcard matching function supporting '*' and '?' /// return true if string s matches pattern. - extern ACE_Export bool wild_match(const char* s, const char* pattern, bool case_sensitive = true); + /// If character_classes is true, '[' is treated as a wildcard character + /// as described in the fnmatch() POSIX API. The following POSIX "bracket + /// expression" features are not implemented: collating symbols, equivalence + /// class expressions, and character class expressions. The POSIX locale is + /// assumed. + extern ACE_Export bool wild_match(const char* s, const char* pattern, + bool case_sensitive = true, bool character_classes = false); /** * @name I/O operations @@ -384,7 +390,6 @@ namespace ACE extern ACE_Export int max_handles (void); // = String functions -#if !defined (ACE_HAS_WINCE) /** * Return a dynamically allocated duplicate of @a str, substituting * the environment variable if @c str[0] @c == @c '$'. Note that @@ -392,7 +397,6 @@ namespace ACE * by @c ACE_OS::free. */ extern ACE_Export ACE_TCHAR *strenvdup (const ACE_TCHAR *str); -#endif /* ACE_HAS_WINCE */ /// Returns a pointer to the "end" of the string, i.e., the character /// past the '\0'. @@ -427,6 +431,9 @@ namespace ACE #endif /* ACE_HAS_WCHAR */ + /// Determine if a specified pathname is "dot dir" (ie. "." or ".."). + ACE_NAMESPACE_INLINE_FUNCTION bool isdotdir (const char *s); + /** * On Windows, determines if a specified pathname ends with ".exe" * (not case sensitive). If on Windows and there is no ".exe" suffix, diff --git a/ace/ACE.inl b/ace/ACE.inl index 573cae93357..507ec46108e 100644 --- a/ace/ACE.inl +++ b/ace/ACE.inl @@ -284,6 +284,13 @@ ACE::strdelete (wchar_t *s) } #endif /* ACE_HAS_WCHAR */ +ACE_INLINE bool +ACE::isdotdir (const char *s) +{ + return (s[0] == '.' && + ((s[1] == 0) || (s[1] == '.' && s[2] == 0))); +} + ACE_INLINE void ACE::unique_name (const void *object, ACE_TCHAR *name, diff --git a/ace/Acceptor.h b/ace/Acceptor.h index 6a024bca6ff..496512afd6e 100644 --- a/ace/Acceptor.h +++ b/ace/Acceptor.h @@ -89,7 +89,7 @@ public: * @param use_select Affects behavior when called back by the reactor * when a connection can be accepted. If non-zero, * this object will accept all pending connections, - * intead of just the one that triggered the reactor + * instead of just the one that triggered the reactor * callback. Uses ACE_OS::select() internally to * detect any remaining acceptable connections. * The default is 1. @@ -128,7 +128,7 @@ public: * @param use_select Affects behavior when called back by the reactor * when a connection can be accepted. If non-zero, * this object will accept all pending connections, - * intead of just the one that triggered the reactor + * instead of just the one that triggered the reactor * callback. Uses ACE_OS::select() internally to * detect any remaining acceptable connections. * The default is 1. @@ -341,7 +341,7 @@ public: * @param use_select Affects behavior when called back by the reactor * when a connection can be accepted. If non-zero, * this object will accept all pending connections, - * intead of just the one that triggered the reactor + * instead of just the one that triggered the reactor * callback. Uses ACE_OS::select() internally to * detect any remaining acceptable connections. * The default is 1. diff --git a/ace/Active_Map_Manager.h b/ace/Active_Map_Manager.h index 1281302fdf8..c9cc0349958 100644 --- a/ace/Active_Map_Manager.h +++ b/ace/Active_Map_Manager.h @@ -78,7 +78,7 @@ public: // = This really should be protected but because of template // friends, they are not. - /// Increment the <slot_generation> number. + /// Increment the slot_generation number. void increment_slot_generation_count (void); private: diff --git a/ace/Arg_Shifter.cpp b/ace/Arg_Shifter.cpp index 36c265c6d5a..8c98daf2946 100644 --- a/ace/Arg_Shifter.cpp +++ b/ace/Arg_Shifter.cpp @@ -133,8 +133,7 @@ ACE_Arg_Shifter_T<CHAR_TYPE>::cur_arg_strncasecmp (const CHAR_TYPE *flag) flag, flag_length) == 0) { - if (ACE_OS::strlen(temp_[current_index_]) == - flag_length) + if (ACE_OS::strlen(temp_[current_index_]) == flag_length) { // match and lengths are equal return 0; diff --git a/ace/Arg_Shifter.h b/ace/Arg_Shifter.h index 409ffa03a88..8439e92ef51 100644 --- a/ace/Arg_Shifter.h +++ b/ace/Arg_Shifter.h @@ -106,7 +106,7 @@ public: * If the current argument does not match flag * If there is no parameter found after a 'matched' flag * - * If the flag is matched and the flag and paramter DO NOT RUN + * If the flag is matched and the flag and parameter DO NOT RUN * together, the flag is consumed, the parameter is returned, * and the new current argument is the parameter value. * ie '-foobarflag VALUE' leaves the new cur arg == "VALUE" @@ -118,7 +118,7 @@ public: const CHAR_TYPE *get_the_parameter (const CHAR_TYPE* flag); /** - * Check if the current argument matches (case insensitive) <flag> + * Check if the current argument matches (case insensitive) @a flag * * ------------------------------------------------------------ * diff --git a/ace/Argv_Type_Converter.h b/ace/Argv_Type_Converter.h index 205fa10c983..6d01c05faee 100644 --- a/ace/Argv_Type_Converter.h +++ b/ace/Argv_Type_Converter.h @@ -29,7 +29,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * * @brief To convert 'char' input/command line parameter to 'wchar_t'. * - * This class is to convert 'char' type command line paramter to + * This class is to convert 'char' type command line parameter to * wide-character (wchar_t) format and stores the copy of it. * This is useful for all classes that use 'char**' argv but cannot * be converted into 'ACE_TCHAR**' version. @@ -54,7 +54,7 @@ public: /// Returns the pointer of ASCII (char) command line. char** get_ASCII_argv (void); - /// Returns the number of sub paramters (argc). + /// Returns the number of sub parameters (argc). int& get_argc (void); private: @@ -83,7 +83,7 @@ private: #endif // ACE_USES_WCHAR private: - /// Original number of input paramter, same as 'argc'. + /// Original number of input parameter, same as 'argc'. int &saved_argc_; /// Data member pointer that contains converted argv in ACE_ANTI_TCHAR. diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h index b30d68a56be..0643cac467e 100644 --- a/ace/Basic_Types.h +++ b/ace/Basic_Types.h @@ -707,94 +707,166 @@ ACE_END_VERSIONED_NAMESPACE_DECL # define ACE_INT64_LITERAL(n) n ## ll # endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ +#if !defined (ACE_INT8_FORMAT_SPECIFIER_ASCII) +# if defined (PRId8) +# define ACE_INT8_FORMAT_SPECIFIER_ASCII "%" PRId8 +# else +# define ACE_INT8_FORMAT_SPECIFIER_ASCII "%d" +# endif /* defined (PRId8) */ +#endif /* ACE_INT8_FORMAT_SPECIFIER_ASCII */ + #if !defined (ACE_INT8_FORMAT_SPECIFIER) # if defined (PRId8) # define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId8) # else -# define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT ("%d") +# define ACE_INT8_FORMAT_SPECIFIER ACE_TEXT (ACE_INT8_FORMAT_SPECIFIER) # endif /* defined (PRId8) */ #endif /* ACE_INT8_FORMAT_SPECIFIER */ +#if !defined (ACE_UINT8_FORMAT_SPECIFIER_ASCII) +# if defined (PRIu8) +# define ACE_UINT8_FORMAT_SPECIFIER_ASCII "%" PRIu8 +# else +# define ACE_UINT8_FORMAT_SPECIFIER_ASCII "%u" +# endif /* defined (PRIu8) */ +#endif /* ACE_UINT8_FORMAT_SPECIFIER */ + #if !defined (ACE_UINT8_FORMAT_SPECIFIER) # if defined (PRIu8) # define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu8) # else -# define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT ("%u") +# define ACE_UINT8_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT8_FORMAT_SPECIFIER_ASCII) # endif /* defined (PRIu8) */ #endif /* ACE_UINT8_FORMAT_SPECIFIER */ +#if !defined (ACE_INT16_FORMAT_SPECIFIER_ASCII) +# if defined (PRId16) +# define ACE_INT16_FORMAT_SPECIFIER_ASCII "%" PRId16 +# else +# define ACE_INT16_FORMAT_SPECIFIER_ASCII "%d" +# endif /* defined (PRId16) */ +#endif /* ACE_INT16_FORMAT_SPECIFIER */ + #if !defined (ACE_INT16_FORMAT_SPECIFIER) # if defined (PRId16) # define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId16) # else -# define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT ("%d") +# define ACE_INT16_FORMAT_SPECIFIER ACE_TEXT (ACE_INT16_FORMAT_SPECIFIER_ASCII) # endif /* defined (PRId16) */ #endif /* ACE_INT16_FORMAT_SPECIFIER */ +#if !defined (ACE_UINT16_FORMAT_SPECIFIER_ASCII) +# if defined (PRIu16) +# define ACE_UINT16_FORMAT_SPECIFIER_ASCII "%" PRIu16 +# else +# define ACE_UINT16_FORMAT_SPECIFIER_ASCII "%u" +# endif /* defined (PRIu16) */ +#endif /* ACE_UINT16_FORMAT_SPECIFIER */ + #if !defined (ACE_UINT16_FORMAT_SPECIFIER) # if defined (PRIu16) # define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu16) # else -# define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT ("%u") +# define ACE_UINT16_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT16_FORMAT_SPECIFIER_ASCII) # endif /* defined (PRIu16) */ #endif /* ACE_UINT16_FORMAT_SPECIFIER */ +#if !defined (ACE_INT32_FORMAT_SPECIFIER_ASCII) +# if defined (PRId32) +# define ACE_INT32_FORMAT_SPECIFIER_ASCII "%" PRId32 +# elif ACE_SIZEOF_INT == 4 +# define ACE_INT32_FORMAT_SPECIFIER_ASCII "%d" +# else +# define ACE_INT32_FORMAT_SPECIFIER_ASCII "%ld" +# endif /* defined (PRId32) */ +#endif /* ACE_INT32_FORMAT_SPECIFIER */ + #if !defined (ACE_INT32_FORMAT_SPECIFIER) # if defined (PRId32) # define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId32) -# elif ACE_SIZEOF_INT == 4 -# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%d") # else -# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT ("%ld") +# define ACE_INT32_FORMAT_SPECIFIER ACE_TEXT (ACE_INT32_FORMAT_SPECIFIER_ASCII) # endif /* defined (PRId32) */ #endif /* ACE_INT32_FORMAT_SPECIFIER */ +#if !defined (ACE_UINT32_FORMAT_SPECIFIER_ASCII) +# if defined (PRIu32) +# define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%" PRIu32 +# elif ACE_SIZEOF_INT == 4 +# define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%u" +# else +# define ACE_UINT32_FORMAT_SPECIFIER_ASCII "%lu" +# endif /* defined (PRIu32) */ +#endif /* ACE_UINT32_FORMAT_SPECIFIER */ + #if !defined (ACE_UINT32_FORMAT_SPECIFIER) # if defined (PRIu32) # define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu32) -# elif ACE_SIZEOF_INT == 4 -# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%u") # else -# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT ("%lu") +# define ACE_UINT32_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT32_FORMAT_SPECIFIER_ASCII) # endif /* defined (PRIu32) */ #endif /* ACE_UINT32_FORMAT_SPECIFIER */ +#if !defined (ACE_INT64_FORMAT_SPECIFIER_ASCII) +# if defined (PRId64) +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%" PRId64 +# elif ACE_SIZEOF_LONG == 8 +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%ld" +# else +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%lld" +# endif /* defined (PRId64) */ +#endif /* ACE_INT64_FORMAT_SPECIFIER */ + #if !defined (ACE_INT64_FORMAT_SPECIFIER) # if defined (PRId64) # define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRId64) -# elif ACE_SIZEOF_LONG == 8 -# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%ld") # else -# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%lld") +# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT (ACE_INT64_FORMAT_SPECIFIER_ASCII) # endif /* defined (PRId64) */ #endif /* ACE_INT64_FORMAT_SPECIFIER */ +#if !defined (ACE_UINT64_FORMAT_SPECIFIER_ASCII) +# if defined (PRIu64) +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%" PRIu64 +# elif ACE_SIZEOF_LONG == 8 +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu" +# else +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%llu" +# endif /* defined (PRIu64) */ +#endif /* ACE_UINT64_FORMAT_SPECIFIER_ASCII */ + #if !defined (ACE_UINT64_FORMAT_SPECIFIER) # if defined (PRIu64) # define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%") ACE_TEXT (PRIu64) -# elif ACE_SIZEOF_LONG == 8 -# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%lu") # else -# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%llu") +# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT (ACE_UINT64_FORMAT_SPECIFIER_ASCII) # endif /* defined (PRIu64) */ #endif /* ACE_UINT64_FORMAT_SPECIFIER */ -#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER) +#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII) # if defined (ACE_WIN64) -# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%I64d") +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%I64d" # else -# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%d") +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%d" # endif /* ACE_WIN64 */ #endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */ -#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER) +#if !defined (ACE_SSIZE_T_FORMAT_SPECIFIER) +#define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII) +#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */ + +#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII) # if defined (ACE_WIN64) -# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%I64u") +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%I64u" # else -# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%u") +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%u" # endif /* ACE_WIN64 */ #endif /* ACE_SIZE_T_FORMAT_SPECIFIER */ +#if !defined (ACE_SIZE_T_FORMAT_SPECIFIER) +#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII) +#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */ + // Cast from UINT64 to a double requires an intermediate cast to INT64 // on some platforms. # if defined (ACE_LACKS_LONGLONG_T) diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp index d88168724a8..f5f4e582a10 100644 --- a/ace/CDR_Stream.cpp +++ b/ace/CDR_Stream.cpp @@ -379,7 +379,7 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len, this->write_ulong ( ACE_Utils::truncate_cast<ACE_CDR::ULong> ( ACE_OutputCDR::wchar_maxbytes_ * len)); - + if (good_ulong) { return this->write_wchar_array (x, len); @@ -703,7 +703,6 @@ ACE_OutputCDR::write_boolean_array (const ACE_CDR::Boolean* x, return this->good_bit (); } - char * ACE_OutputCDR::write_long_placeholder (void) { @@ -715,7 +714,6 @@ ACE_OutputCDR::write_long_placeholder (void) return buf; } - char * ACE_OutputCDR::write_short_placeholder (void) { @@ -727,7 +725,6 @@ ACE_OutputCDR::write_short_placeholder (void) return buf; } - ACE_CDR::Boolean ACE_OutputCDR::replace (ACE_CDR::Long x, char* loc) { @@ -1371,7 +1368,7 @@ ACE_InputCDR::read_wstring (ACE_CDR::WChar*& x) } ACE_CDR::ULong len = 0; - + if (!this->read_ulong (len)) { return false; diff --git a/ace/Cleanup.cpp b/ace/Cleanup.cpp index a6fc5de6a78..2c8ba21d8f1 100644 --- a/ace/Cleanup.cpp +++ b/ace/Cleanup.cpp @@ -20,7 +20,6 @@ ACE_Cleanup::cleanup (void *) delete this; } - ACE_Cleanup::~ACE_Cleanup (void) { } @@ -35,92 +34,50 @@ ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *object, void *param) /*****************************************************************************/ -ACE_Cleanup_Info::ACE_Cleanup_Info (void) +ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (void) : object_ (0), cleanup_hook_ (0), param_ (0) { } -bool -ACE_Cleanup_Info::operator== (const ACE_Cleanup_Info &o) const +ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (void *object, + ACE_CLEANUP_FUNC cleanup_hook, + void *param) + : object_ (object), + cleanup_hook_ (cleanup_hook), + param_ (param) { - return o.object_ == this->object_ - && o.cleanup_hook_ == this->cleanup_hook_ - && o.param_ == this->param_; } -bool -ACE_Cleanup_Info::operator!= (const ACE_Cleanup_Info &o) const -{ - return !(*this == o); -} - -/*****************************************************************************/ -/** - * @class ACE_Cleanup_Info_Node - * - * @brief For maintaining a list of ACE_Cleanup_Info items. - * - * For internal use by ACE_Object_Manager. - */ -class ACE_Cleanup_Info_Node -{ -public: - ACE_Cleanup_Info_Node (void); - ACE_Cleanup_Info_Node (const ACE_Cleanup_Info &new_info, - ACE_Cleanup_Info_Node *next); - ~ACE_Cleanup_Info_Node (void); - ACE_Cleanup_Info_Node *insert (const ACE_Cleanup_Info &); -private: - ACE_Cleanup_Info cleanup_info_; - ACE_Cleanup_Info_Node *next_; - - friend class ACE_OS_Exit_Info; -}; - -ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (void) - : cleanup_info_ (), - next_ (0) +ACE_Cleanup_Info_Node::~ACE_Cleanup_Info_Node (void) { } -ACE_Cleanup_Info_Node::ACE_Cleanup_Info_Node (const ACE_Cleanup_Info &new_info, - ACE_Cleanup_Info_Node *next) - : cleanup_info_ (new_info), - next_ (next) +bool +ACE_Cleanup_Info_Node::operator== (const ACE_Cleanup_Info_Node &o) const { + return o.object_ == this->object_ + && o.cleanup_hook_ == this->cleanup_hook_ + && o.param_ == this->param_; } -ACE_Cleanup_Info_Node::~ACE_Cleanup_Info_Node (void) +bool +ACE_Cleanup_Info_Node::operator!= (const ACE_Cleanup_Info_Node &o) const { - delete next_; + return !(*this == o); } -ACE_Cleanup_Info_Node * -ACE_Cleanup_Info_Node::insert (const ACE_Cleanup_Info &new_info) -{ - ACE_Cleanup_Info_Node *new_node = 0; - - ACE_NEW_RETURN (new_node, - ACE_Cleanup_Info_Node (new_info, this), - 0); - - return new_node; -} /*****************************************************************************/ ACE_OS_Exit_Info::ACE_OS_Exit_Info (void) { - ACE_NEW (registered_objects_, ACE_Cleanup_Info_Node); } ACE_OS_Exit_Info::~ACE_OS_Exit_Info (void) { - delete registered_objects_; - registered_objects_ = 0; } int @@ -128,64 +85,89 @@ ACE_OS_Exit_Info::at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param) { - ACE_Cleanup_Info new_info; - new_info.object_ = object; - new_info.cleanup_hook_ = cleanup_hook; - new_info.param_ = param; - // Return -1 and sets errno if unable to allocate storage. Enqueue // at the head and dequeue from the head to get LIFO ordering. - ACE_Cleanup_Info_Node *new_node = 0; - if ((new_node = registered_objects_->insert (new_info)) == 0) - return -1; - else - { - registered_objects_ = new_node; - return 0; - } + ACE_NEW_RETURN (new_node, + ACE_Cleanup_Info_Node (object, cleanup_hook, param), + -1); + + registered_objects_.push_front (new_node); + + return 0; } -int +bool ACE_OS_Exit_Info::find (void *object) { - // Check for already in queue, and return 1 if so. - for (ACE_Cleanup_Info_Node *iter = registered_objects_; - iter && iter->next_ != 0; - iter = iter->next_) + for (ACE_Cleanup_Info_Node *iter = registered_objects_.head (); + iter != 0; + iter = iter->next ()) { - if (iter->cleanup_info_.object_ == object) + if (iter->object () == object) { // The object has already been registered. - return 1; + return true; } } - return 0; + return false; } +bool +ACE_OS_Exit_Info::remove (void *object) +{ + ACE_Cleanup_Info_Node *node = 0; + for (ACE_Cleanup_Info_Node *iter = registered_objects_.head (); + iter != 0; + iter = iter->next ()) + { + if (iter->object () == object) + { + node = iter; + break; + } + } + + if (node) + { + registered_objects_.remove (node); + delete node; + return true; + } + + return false; +} + + void ACE_OS_Exit_Info::call_hooks (void) { // Call all registered cleanup hooks, in reverse order of // registration. - for (ACE_Cleanup_Info_Node *iter = registered_objects_; - iter && iter->next_ != 0; - iter = iter->next_) + for (ACE_Cleanup_Info_Node *iter = registered_objects_.pop_front (); + iter != 0; + iter = registered_objects_.pop_front ()) { - ACE_Cleanup_Info &info = iter->cleanup_info_; - if (info.cleanup_hook_ == reinterpret_cast<ACE_CLEANUP_FUNC> ( + if (iter->cleanup_hook () == reinterpret_cast<ACE_CLEANUP_FUNC> ( ACE_CLEANUP_DESTROYER_NAME)) - // The object is an ACE_Cleanup. - ACE_CLEANUP_DESTROYER_NAME ( - reinterpret_cast<ACE_Cleanup *> (info.object_), - info.param_); - else if (info.object_ == &ace_exit_hook_marker) - // The hook is an ACE_EXIT_HOOK. - (* reinterpret_cast<ACE_EXIT_HOOK> (info.cleanup_hook_)) (); + { + // The object is an ACE_Cleanup. + ACE_CLEANUP_DESTROYER_NAME ( + reinterpret_cast<ACE_Cleanup *> (iter->object ()), + iter->param ()); + } + else if (iter->object () == &ace_exit_hook_marker) + { + // The hook is an ACE_EXIT_HOOK. + (* reinterpret_cast<ACE_EXIT_HOOK> (iter->cleanup_hook ())) (); + } else - (*info.cleanup_hook_) (info.object_, info.param_); + { + (*iter->cleanup_hook ()) (iter->object (), iter->param ()); + } + delete iter; } } diff --git a/ace/Cleanup.h b/ace/Cleanup.h index 7acff23ab79..0a158973729 100644 --- a/ace/Cleanup.h +++ b/ace/Cleanup.h @@ -27,6 +27,9 @@ #include /**/ "ace/ACE_export.h" +# include "ace/Intrusive_List.h" +# include "ace/Intrusive_List_Node.h" + #if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) # include "ace/Global_Macros.h" # define ACE_CLEANUP_DESTROYER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_cleanup_destroyer) @@ -59,22 +62,33 @@ extern "C" ACE_Export void ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *, void *param = 0); /** - * @class ACE_Cleanup_Info + * @class ACE_Cleanup_Info_Node + * + * @brief For maintaining a list of ACE_Cleanup_Info items. * - * @brief Hold cleanup information for thread/process + * For internal use by ACE_Object_Manager. */ -class ACE_Export ACE_Cleanup_Info +class ACE_Cleanup_Info_Node : public ACE_Intrusive_List_Node<ACE_Cleanup_Info_Node> { public: - /// Default constructor. - ACE_Cleanup_Info (void); + ACE_Cleanup_Info_Node (void); + ACE_Cleanup_Info_Node (void *object, + ACE_CLEANUP_FUNC cleanup_hook, + void *param); + ~ACE_Cleanup_Info_Node (void); /// Equality operator. - bool operator== (const ACE_Cleanup_Info &o) const; + bool operator== (const ACE_Cleanup_Info_Node &o) const; /// Inequality operator. - bool operator!= (const ACE_Cleanup_Info &o) const; + bool operator!= (const ACE_Cleanup_Info_Node &o) const; + + void* object(void); + + ACE_CLEANUP_FUNC cleanup_hook (void); + void *param (void); +private: /// Point to object that gets passed into the <cleanup_hook_>. void *object_; @@ -85,13 +99,15 @@ public: void *param_; }; -class ACE_Cleanup_Info_Node; +typedef ACE_Intrusive_List<ACE_Cleanup_Info_Node> ACE_Cleanup_Info_Node_List; /** * @class ACE_OS_Exit_Info * * @brief Hold Object Manager cleanup (exit) information. * + * @internal + * * For internal use by the ACE library, only. */ class ACE_Export ACE_OS_Exit_Info @@ -106,9 +122,13 @@ public: /// Use to register a cleanup hook. int at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param); - /// Look for a registered cleanup hook object. Returns 1 if already - /// registered, 0 if not. - int find (void *object); + /// Look for a registered cleanup hook object. Returns true if already + /// registered, false if not. + bool find (void *object); + + /// Remove a registered cleanup hook object. Returns true if removed + /// false if not. + bool remove (void *object); /// Call all registered cleanup hooks, in reverse order of /// registration. @@ -116,13 +136,12 @@ public: private: /** - * Keeps track of all registered objects. The last node is only - * used to terminate the list (it doesn't contain a valid - * ACE_Cleanup_Info). + * Keeps track of all registered objects. */ - ACE_Cleanup_Info_Node *registered_objects_; + ACE_Cleanup_Info_Node_List registered_objects_; }; + ACE_END_VERSIONED_NAMESPACE_DECL # if defined (ACE_HAS_INLINED_OSCALLS) diff --git a/ace/Cleanup.inl b/ace/Cleanup.inl index 02d3c223f8d..2f3410a1ebb 100644 --- a/ace/Cleanup.inl +++ b/ace/Cleanup.inl @@ -9,4 +9,22 @@ ACE_Cleanup::ACE_Cleanup (void) { } +ACE_INLINE void* +ACE_Cleanup_Info_Node::object(void) +{ + return this->object_; +} + +ACE_INLINE ACE_CLEANUP_FUNC +ACE_Cleanup_Info_Node::cleanup_hook (void) +{ + return this->cleanup_hook_; +} + +ACE_INLINE void * +ACE_Cleanup_Info_Node::param (void) +{ + return this->param_; +} + ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DLL_Manager.cpp b/ace/DLL_Manager.cpp index 83c07cd125d..276646b6abb 100644 --- a/ace/DLL_Manager.cpp +++ b/ace/DLL_Manager.cpp @@ -437,7 +437,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name, try_names.size (0); if ((try_names.max_size () - try_names.size ()) < 5) try_names.max_size (try_names.max_size () + 5); -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) +#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) ACE_TString decorator (ACE_LD_DECORATOR_STR); #endif ACE_TString suffix (ACE_DLL_SUFFIX); @@ -446,7 +446,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name, for (size_t i = 0; i < 5 && try_names.size () < try_names.max_size (); ++i) { ACE_TString try_this; - size_t j = try_names.size (); + size_t const j = try_names.size (); switch (i) { case 0: // Name + decorator + suffix @@ -455,7 +455,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name, case 3: // Prefix + name + suffix if ( base_suffix.length () > 0 -#if !(defined(ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)) +#if !(defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK)) || (i == 1 || i == 3) // No decorator desired; skip #endif ) @@ -468,7 +468,7 @@ ACE_DLL_Handle::get_dll_names (const ACE_TCHAR *dll_name, try_this += base_suffix; else { -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) +#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) try_this += decorator; #endif try_this += suffix; diff --git a/ace/Event_Handler.cpp b/ace/Event_Handler.cpp index d4542b61349..42c8b36cd8e 100644 --- a/ace/Event_Handler.cpp +++ b/ace/Event_Handler.cpp @@ -244,8 +244,6 @@ ACE_Event_Handler::reference_counting_policy (void) return this->reference_counting_policy_; } -//#if !defined (ACE_HAS_WINCE) - ACE_THR_FUNC_RETURN ACE_Event_Handler::read_adapter (void *args) { @@ -299,8 +297,6 @@ ACE_Event_Handler::remove_stdin_handler (ACE_Reactor *reactor, #endif /* ACE_WIN32 */ } -//#endif /* ACE_HAS_WINCE */ - // --------------------------------------------------------------------- ACE_Event_Handler_var::ACE_Event_Handler_var (void) diff --git a/ace/Event_Handler_T.h b/ace/Event_Handler_T.h index 71c97bcf4a8..ff91cd4480d 100644 --- a/ace/Event_Handler_T.h +++ b/ace/Event_Handler_T.h @@ -37,7 +37,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * inheritance hierarchy but also would like to integrate with * the ACE_Reactor. Rather than adopt a "mixin" approach, it is * often cleaner to define a template as a subclass of - * ACE_Event_Handler and paramterize it with an operation + * ACE_Event_Handler and parameterize it with an operation * dispatcher type. * When constructing an instantiation of the ACE_Event_Handler_T * object, a set of pointers to member functions must be diff --git a/ace/Filecache.cpp b/ace/Filecache.cpp index 5122cb6fdc8..72601d8d1d3 100644 --- a/ace/Filecache.cpp +++ b/ace/Filecache.cpp @@ -738,15 +738,7 @@ ACE_Filecache_Object::update (void) const if (ACE_OS::stat (this->filename_, &statbuf) == -1) result = 1; else - // non-portable code may follow -#if defined (ACE_HAS_WINCE) - // Yup, non-portable... there's probably a way to safely implement - // difftime() on WinCE, but for now, this will have to do. It flags - // every file as having changed since cached. - result = 1; -#else result = ACE_OS::difftime (this->stat_.st_mtime, statbuf.st_mtime) < 0; -#endif /* ACE_HAS_WINCE */ return result; } diff --git a/ace/Guard_T.h b/ace/Guard_T.h index 3c0870e1562..1780f8fd1bf 100644 --- a/ace/Guard_T.h +++ b/ace/Guard_T.h @@ -32,7 +32,7 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * * @brief This data structure is meant to be used within a method or * function... It performs automatic aquisition and release of - * a parameterized synchronization object <ACE_LOCK>. + * a parameterized synchronization object ACE_LOCK. * * The <ACE_LOCK> class given as an actual parameter must provide at * the very least the <acquire>, <tryacquire>, <release>, and diff --git a/ace/Handle_Set.cpp b/ace/Handle_Set.cpp index 05a85cb338a..6bf09c355ee 100644 --- a/ace/Handle_Set.cpp +++ b/ace/Handle_Set.cpp @@ -24,11 +24,6 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set) # define ACE_MSB_MASK (~((fd_mask) 1 << (NFDBITS - 1))) #endif /* ! ACE_WIN32 */ -#if defined (__BORLANDC__) && !defined (ACE_WIN32) -// The Borland C++ compiler on Linux also doesn't have fds_bits, but has __fds_bits. -#define fds_bits __fds_bits -#endif - #if defined (linux) && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 1 && !defined (_XOPEN_SOURCE) // XPG4.2 requires the fds_bits member name, so it is not enabled by // default on Linux/glibc-2.1.x systems. Instead use "__fds_bits." diff --git a/ace/High_Res_Timer.cpp b/ace/High_Res_Timer.cpp index 838120bb7b7..accab008d36 100644 --- a/ace/High_Res_Timer.cpp +++ b/ace/High_Res_Timer.cpp @@ -193,7 +193,7 @@ ACE_High_Res_Timer::global_scale_factor (void) #if (defined (ACE_WIN32) || defined (ACE_HAS_POWERPC_TIMER) || \ defined (ACE_HAS_PENTIUM) || defined (ACE_HAS_ALPHA_TIMER)) && \ !defined (ACE_HAS_HI_RES_TIMER) && \ - ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || \ + (defined (ACE_WIN32) || \ defined (ghs) || defined (__GNUG__) || \ defined (__INTEL_COMPILER)) // Check if the global scale factor needs to be set, and do if so. @@ -422,7 +422,6 @@ ACE_High_Res_Timer::elapsed_time_incr (ACE_hrtime_t &nanoseconds) const nanoseconds = nanoseconds >> 10; } -#if !defined (ACE_HAS_WINCE) void ACE_High_Res_Timer::print_ave (const ACE_TCHAR *str, const int count, @@ -507,12 +506,10 @@ ACE_High_Res_Timer::print_total (const ACE_TCHAR *str, buf, ACE_OS::strlen (buf)); } -#endif /* !ACE_HAS_WINCE */ int ACE_High_Res_Timer::get_env_global_scale_factor (const ACE_TCHAR *env) { -#if !defined (ACE_HAS_WINCE) if (env != 0) { const char *env_value = ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (env)); @@ -526,9 +523,7 @@ ACE_High_Res_Timer::get_env_global_scale_factor (const ACE_TCHAR *env) } } } -#else - ACE_UNUSED_ARG (env); -#endif /* !ACE_HAS_WINCE */ + return -1; } diff --git a/ace/High_Res_Timer.h b/ace/High_Res_Timer.h index 642ffc796c5..2bb9730280a 100644 --- a/ace/High_Res_Timer.h +++ b/ace/High_Res_Timer.h @@ -204,12 +204,8 @@ public: /// to start_incr and stop_incr. void elapsed_time_incr (ACE_hrtime_t &nanoseconds) const; -#if !defined (ACE_HAS_WINCE) - // @@ WINCE These two functions are currently not supported on Windows CE. - // However, we should probably use the handle and ACE_Log_Msg to - // print out the result. /// Print total time. - /// @note only use <print_total> if incremental timings had been used! + /// @note only use @c print_total if incremental timings had been used! void print_total (const ACE_TCHAR *message, const int iterations = 1, ACE_HANDLE handle = ACE_STDOUT) const; @@ -218,7 +214,6 @@ public: void print_ave (const ACE_TCHAR *message, const int iterations = 1, ACE_HANDLE handle = ACE_STDOUT) const; -#endif /* !ACE_HAS_WINCE */ /// Dump the state of an object. void dump (void) const; diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp index 44cd5a57c8a..a40c84a5807 100644 --- a/ace/INET_Addr.cpp +++ b/ace/INET_Addr.cpp @@ -36,7 +36,7 @@ ACE_INET_Addr::addr_to_string (ACE_TCHAR s[], ACE_TRACE ("ACE_INET_Addr::addr_to_string"); // XXX Can we (should we) include the scope id for IPv6 addresses? - char hoststr[MAXHOSTNAMELEN+1]; + char hoststr[MAXHOSTNAMELEN+1]; bool result = false; if (ipaddr_format == 0) @@ -489,7 +489,7 @@ ACE_INET_Addr::set (const char port_name[], int address_family = PF_UNSPEC; # if defined (ACE_HAS_IPV6) - if (ACE_OS::strcmp (ACE_TEXT_CHAR_TO_TCHAR(protocol), ACE_TEXT ("tcp6")) == 0) + if (ACE_OS::strcmp (protocol, "tcp6") == 0) address_family = AF_INET6; # endif /* ACE_HAS_IPV6 */ diff --git a/ace/Intrusive_List.h b/ace/Intrusive_List.h index 59d0c9054a8..a7952e367dc 100644 --- a/ace/Intrusive_List.h +++ b/ace/Intrusive_List.h @@ -14,7 +14,7 @@ #define ACE_INTRUSIVE_LIST_H #include /**/ "ace/pre.h" -#include /**/ "ace/config-all.h" +#include /**/ "ace/config-lite.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -68,12 +68,12 @@ public: // = Check boundary conditions. - /// Returns 1 if the container is empty, otherwise returns 0. - int is_empty (void) const; + /// Returns true if the container is empty, otherwise returns false. + bool is_empty (void) const; - /// Returns 1 if the container is empty, otherwise returns 0. + /// Returns true if the container is empty, otherwise returns false. /// @deprecated Use is_empty() instead. - int empty (void) const; + bool empty (void) const; /// Insert an element at the beginning of the list void push_front (T *node); diff --git a/ace/Intrusive_List.inl b/ace/Intrusive_List.inl index f76370917e9..23d0095a948 100644 --- a/ace/Intrusive_List.inl +++ b/ace/Intrusive_List.inl @@ -6,13 +6,13 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template<class T> ACE_INLINE int +template<class T> ACE_INLINE bool ACE_Intrusive_List<T>::is_empty (void) const { return this->head_ == 0; } -template<class T> ACE_INLINE int +template<class T> ACE_INLINE bool ACE_Intrusive_List<T>::empty (void) const { return this->is_empty (); diff --git a/ace/Intrusive_List_Node.h b/ace/Intrusive_List_Node.h index b62d681a047..f39a2833d14 100644 --- a/ace/Intrusive_List_Node.h +++ b/ace/Intrusive_List_Node.h @@ -14,7 +14,7 @@ #define ACE_INTRUSIVE_LIST_NODE_H #include /**/ "ace/pre.h" -#include /**/ "ace/config-all.h" +#include /**/ "ace/config-lite.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -37,7 +37,6 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL * confused using such templates, the class is provided as a helper * for our lucky users that only need portability to modern C++ * compilers. - * */ template <class T> class ACE_Intrusive_List_Node diff --git a/ace/Lib_Find.cpp b/ace/Lib_Find.cpp index 6db6d78973b..3caa58bf19e 100644 --- a/ace/Lib_Find.cpp +++ b/ace/Lib_Find.cpp @@ -26,29 +26,30 @@ extern "C" int LIB$FIND_IMAGE_SYMBOL(...); +/** + * @internal + * + * Implements a class to register symbols and addresses for use with DLL + * symbol retrieval. + * + * OpenVMS restricts symbol length to 31 characters encoding any symbols + * longer than that. In these cases dlsym() only works with the encoded + * names. + * This creates serious problems for the service configurator framework + * where the factory method names often exceed 31 chars and where loading + * is based on retrieval of method pointers using the *full* name. + * For OpenVMS we therefor added this singleton class and the + * ACE_Dynamic_Svc_Registrar class which registers full names and function + * pointers with this singleton at the time the static ACE_Dynamic_Svc_Registrar + * object is created in a (service) DLL. + * By forcing the DLL to load using a common symbol ("NULL") we trigger static + * object creation *before* the full names are referenced. + * Symbol references will be resolved as follows on OpenVMS: + * - first try directly from DLL using the RTL dlsym() function and if that fails; + * - try to find symbol in singleton registry. + */ class ACE_LD_Symbol_Registry { - // @internal - // = TITLE - // Implements a class to register symbols and addresses for use with DLL - // symbol retrieval. - // - // = DESCRIPTION - // OpenVMS restricts symbol length to 31 characters encoding any symbols - // longer than that. In these cases dlsym() only works with the encoded - // names. - // This creates serious problems for the service configurator framework - // where the factory method names often exceed 31 chars and where loading - // is based on retrieval of method pointers using the *full* name. - // For OpenVMS we therefor added this singleton class and the - // ACE_Dynamic_Svc_Registrar class which registers full names and function - // pointers with this singleton at the time the static ACE_Dynamic_Svc_Registrar - // object is created in a (service) DLL. - // By forcing the DLL to load using a common symbol ("NULL") we trigger static - // object creation *before* the full names are referenced. - // Symbol references will be resolved as follows on OpenVMS: - // - first try directly from DLL using the RTL dlsym() function and if that fails; - // - try to find symbol in singleton registry. public: typedef ACE_RB_Tree<const ACE_TCHAR*, @@ -202,12 +203,12 @@ ACE::ldfind (const ACE_TCHAR* filename, ACE_TCHAR tempcopy[MAXPATHLEN + 1]; ACE_TCHAR searchpathname[MAXPATHLEN + 1]; -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) +#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) ACE_TCHAR decorator[] = ACE_LD_DECORATOR_STR; ACE_TCHAR searchfilename[MAXPATHLEN + sizeof(decorator) / sizeof (ACE_TCHAR)]; #else ACE_TCHAR searchfilename[MAXPATHLEN + 1]; -#endif /* ACE_WIN32 && ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ +#endif /* ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ // Create a copy of filename to work with. if (ACE_OS::strlen (filename) + 1 @@ -284,18 +285,17 @@ ACE::ldfind (const ACE_TCHAR* filename, return -1; } -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) - size_t len_searchfilename = ACE_OS::strlen (searchfilename); - if (! has_suffix) - ACE_OS::strcpy (searchfilename + len_searchfilename, - decorator); +#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) + size_t const len_searchfilename = ACE_OS::strlen (searchfilename); + if (!has_suffix) + ACE_OS::strcpy (searchfilename + len_searchfilename, decorator); for (int tag = 1; tag >= 0; tag --) { if (tag == 0) searchfilename [len_searchfilename] = 0; -#endif /* ACE_WIN32 && ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ +#endif /* ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ // Use absolute pathname if there is one. if (ACE_OS::strlen (searchpathname) > 0) { @@ -498,17 +498,16 @@ ACE::ldfind (const ACE_TCHAR* filename, ACE_OS::free (ld_path_temp); #endif /* ACE_HAS_WINCE */ ACE_OS::free ((void *) ld_path); -#if defined (ACE_HAS_WINCE) && defined (ACE_LD_DECORATOR_STR) && \ - !defined (ACE_DISABLE_DEBUG_DLL_CHECK) +#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) if (result == 0 || tag == 0) -#endif /* ACE_HAS_WINCE && ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ +#endif /* ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ return result; } #endif /* ACE_WIN32 && !ACE_HAS_WINCE */ } -#if defined (ACE_WIN32) && defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) +#if defined (ACE_LD_DECORATOR_STR) && !defined (ACE_DISABLE_DEBUG_DLL_CHECK) } -#endif /* ACE_WIN32 && ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ +#endif /* ACE_LD_DECORATOR_STR && !ACE_DISABLE_DEBUG_DLL_CHECK */ errno = ENOENT; return -1; diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp index e59756dcb80..cfe9c762e12 100644 --- a/ace/Local_Name_Space_T.cpp +++ b/ace/Local_Name_Space_T.cpp @@ -813,8 +813,8 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::dump_i (void) const const char *type = map_entry->int_id_.type (); #endif /* ! ACE_NLOGGING */ - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("key=%s\nvalue=%s\ntype=%s\n"), - ACE_TEXT_CHAR_TO_TCHAR (key), ACE_TEXT_CHAR_TO_TCHAR (value), ACE_TEXT_CHAR_TO_TCHAR (type))); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("key=%C\nvalue=%C\ntype=%C\n"), + key, value, type)); // We need to delete key and value since char_rep allocates // memory for them delete [] key; diff --git a/ace/Local_Tokens.h b/ace/Local_Tokens.h index cea51db5894..90c9e400132 100644 --- a/ace/Local_Tokens.h +++ b/ace/Local_Tokens.h @@ -223,7 +223,7 @@ public: /// Allows us to pass args to the construction of the TSS object. virtual ACE_TPQ_Entry *make_TSS_TYPE (void) const; - /// Operator overloading and inheritence don't mix. + /// Operator overloading and inheritance don't mix. operator ACE_TPQ_Entry *(void); /// Dump the state of the class. diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index 99ebb619cc9..719b2a97141 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -650,11 +650,11 @@ ACE_Log_Msg::ACE_Log_Msg (void) msg_ (0), restart_ (1), // Restart by default... ostream_ (0), + ostream_refcount_ (0), msg_callback_ (0), trace_depth_ (0), trace_active_ (false), tracing_enabled_ (true), // On by default? - delete_ostream_(false), thr_desc_ (0), priority_mask_ (default_priority_mask_), timestamp_ (0) @@ -743,22 +743,28 @@ ACE_Log_Msg::~ACE_Log_Msg (void) } } - // - // do we need to close and clean up? - // - if (this->delete_ostream_) -#if defined (ACE_LACKS_IOSTREAM_TOTALLY) + this->cleanup_ostream (); + + delete[] this->msg_; +} + +void +ACE_Log_Msg::cleanup_ostream () +{ + if (this->ostream_refcount_) { - ACE_OS::fclose (this->ostream_); - } + if (--*this->ostream_refcount_ == 0) + { + delete this->ostream_refcount_; +#if defined (ACE_LACKS_IOSTREAM_TOTALLY) + ACE_OS::fclose (this->ostream_); #else - { - delete ostream_; - ostream_ = 0; - } + delete this->ostream_; + this->ostream_ = 0; #endif - - delete[] this->msg_; + } + this->ostream_refcount_ = 0; + } } // Open the sender-side of the message queue. @@ -2412,18 +2418,32 @@ void ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m, bool delete_ostream) { if (this->ostream_ == m) - return; + { + // Same stream, allow user to change the delete_ostream "flag" + if (delete_ostream && !this->ostream_refcount_) + { + ACE_NEW (this->ostream_refcount_, Atomic_ULong (1)); + } + else if (!delete_ostream && this->ostream_refcount_) + { + if (--*this->ostream_refcount_ == 0) + { + delete this->ostream_refcount_; + } + this->ostream_refcount_ = 0; + } + // The other two cases are no-ops, the user has requested the same + // state that's already present. + return; + } - if (this->delete_ostream_) + this->cleanup_ostream (); + + if (delete_ostream) { -#if defined (ACE_LACKS_IOSTREAM_TOTALLY) - ACE_OS::fclose (this->ostream_); -#else - delete this->ostream_; -#endif + ACE_NEW (this->ostream_refcount_, Atomic_ULong (1)); } - this->delete_ostream_ = delete_ostream; this->ostream_ = m; } @@ -2477,6 +2497,15 @@ ACE_Log_Msg::init_hook (ACE_OS_Log_Msg_Attributes &attributes { ACE_Log_Msg *inherit_log = ACE_LOG_MSG; attributes.ostream_ = inherit_log->msg_ostream (); + if (attributes.ostream_ && inherit_log->ostream_refcount_) + { + ++*inherit_log->ostream_refcount_; + attributes.ostream_refcount_ = inherit_log->ostream_refcount_; + } + else + { + attributes.ostream_refcount_ = 0; + } attributes.priority_mask_ = inherit_log->priority_mask (); attributes.tracing_enabled_ = inherit_log->tracing_enabled (); attributes.restart_ = inherit_log->restart (); @@ -2501,7 +2530,10 @@ ACE_Log_Msg::inherit_hook (ACE_OS_Thread_Descriptor *thr_desc, if (attributes.ostream_) { - new_log->msg_ostream (attributes.ostream_); + new_log->ostream_ = attributes.ostream_; + new_log->ostream_refcount_ = + static_cast<Atomic_ULong *> (attributes.ostream_refcount_); + new_log->priority_mask (attributes.priority_mask_); if (attributes.tracing_enabled_) diff --git a/ace/Log_Msg.h b/ace/Log_Msg.h index 1c28ee30815..81817028517 100644 --- a/ace/Log_Msg.h +++ b/ace/Log_Msg.h @@ -24,6 +24,8 @@ #include "ace/Default_Constants.h" #include "ace/Log_Priority.h" #include "ace/os_include/os_limits.h" +#include "ace/Atomic_Op.h" +#include "ace/Synch_Traits.h" // The ACE_ASSERT macro used to be defined here, include ace/Assert.h // for backwards compatibility. @@ -583,6 +585,8 @@ public: ACE_ALLOC_HOOK_DECLARE; private: + void cleanup_ostream (); + /// Status of operation (-1 means failure, >= 0 means success). int status_; @@ -607,6 +611,15 @@ private: /// The ostream where logging messages can be written. ACE_OSTREAM_TYPE *ostream_; + /// This pointer is 0 if we are not reference counting (the user has not + /// passed "true" for the delete_ostream argument to msg_ostream). + /// If we are reference counting, this points to a shared count that will + /// be deleted when it reaches zero. Since we want optional but shared + /// ownership neither std::auto_ptr nor ACE_Strong_Bound_Ptr have the right + /// semantics. *Bound_Ptr also doesn't take advantage of Atomic_Op. + typedef ACE_Atomic_Op<ACE_SYNCH_MUTEX, unsigned long> Atomic_ULong; + Atomic_ULong *ostream_refcount_; + /// The callback object. ACE_Log_Msg_Callback *msg_callback_; @@ -619,9 +632,6 @@ private: /// Are we allowing tracing in this thread? bool tracing_enabled_; - /// Are we deleting this ostream? - bool delete_ostream_; - /** * If we're running in the context of an ACE_Thread_Manager this * will point to the thread descriptor adapter which holds the diff --git a/ace/Log_Record.h b/ace/Log_Record.h index d03faeb8680..a48b9a322bf 100644 --- a/ace/Log_Record.h +++ b/ace/Log_Record.h @@ -72,7 +72,7 @@ public: /// Write the contents of the logging record to the appropriate - /// <FILE> iff the corresponding type is enabled. + /// <FILE> if the corresponding type is enabled. int print (const ACE_TCHAR host_name[], u_long verbose_flag, #if !defined (ACE_HAS_WINCE) @@ -83,7 +83,7 @@ public: #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) /// Write the contents of the logging record to the appropriate - /// <ostream> iff the corresponding type is enabled. + /// <ostream> if the corresponding type is enabled. int print (const ACE_TCHAR host_name[], u_long verbose_flag, ACE_OSTREAM_TYPE &stream); @@ -95,23 +95,23 @@ public: /** * Returns a character array with the string form of the - * <ACE_Log_Priority> parameter. This is used for the verbose + * ACE_Log_Priority parameter. This is used for the verbose * printing format. */ static const ACE_TCHAR *priority_name (ACE_Log_Priority p); - // IMPORTANT: @a name must be a statically allocated const ACE_TCHAR* + /// IMPORTANT: @a name must be a statically allocated const ACE_TCHAR* static void priority_name (ACE_Log_Priority p, const ACE_TCHAR *name); // = Marshall/demarshall - /// Encode the <Log_Record> for transmission on the network. + /// Encode the @c Log_Record for transmission on the network. /// @deprecated The encode() and decode() metods are deprecated; please use /// the CDR insertion and extraction operators to properly encode and decode /// ACE_Log_Record objects. void encode (void); - /// Decode the <Log_Record> received from the network. + /// Decode the @c Log_Record received from the network. /// @deprecated The encode() and decode() metods are deprecated; please use /// the CDR insertion and extraction operators to properly encode and decode /// ACE_Log_Record objects. @@ -198,7 +198,9 @@ private: /// Logging record data ACE_TCHAR *msg_data_; // Heap-allocated text message area - size_t msg_data_size_; // Allocated size of msg_data_ in ACE_TCHARs + + /// Allocated size of msg_data_ in ACE_TCHARs + size_t msg_data_size_; /// disallow copying... ACE_Log_Record (const ACE_Log_Record& rhs); diff --git a/ace/MEM_Connector.cpp b/ace/MEM_Connector.cpp index 5be1f3985a8..6c0a8da9f88 100644 --- a/ace/MEM_Connector.cpp +++ b/ace/MEM_Connector.cpp @@ -71,11 +71,11 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream, if (!this->address_.same_host (remote_sap)) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) MEM_Connector can't connect ") - ACE_TEXT ("to %s:%d which is not a local endpoint ") - ACE_TEXT ("(local address is %s:%d)\n"), - ACE_TEXT_CHAR_TO_TCHAR (remote_sap.get_host_name ()), + ACE_TEXT ("to %C:%d which is not a local endpoint ") + ACE_TEXT ("(local address is %C:%d)\n"), + remote_sap.get_host_name (), remote_sap.get_port_number (), - ACE_TEXT_CHAR_TO_TCHAR (this->address_.get_host_name ()), + this->address_.get_host_name (), this->address_.get_port_number ()), -1); else diff --git a/ace/Makefile.am b/ace/Makefile.am index cd5105593cf..1166523fa42 100644 --- a/ace/Makefile.am +++ b/ace/Makefile.am @@ -213,6 +213,7 @@ libACE_la_SOURCES = \ OS_NS_time.cpp \ OS_NS_unistd.cpp \ OS_NS_wchar.cpp \ + OS_NS_wctype.cpp \ OS_QoS.cpp \ OS_TLI.cpp \ OS_Thread_Adapter.cpp \ @@ -808,6 +809,8 @@ nobase_include_HEADERS += \ OS_NS_unistd.h \ OS_NS_unistd.inl \ OS_NS_wchar.h \ + OS_NS_wctype.h \ + OS_NS_wctype.inl \ OS_NS_wchar.inl \ OS_QoS.h \ OS_String.h \ diff --git a/ace/Metrics_Cache_T.inl b/ace/Metrics_Cache_T.inl index e0f542ab366..778132f8b13 100644 --- a/ace/Metrics_Cache_T.inl +++ b/ace/Metrics_Cache_T.inl @@ -27,7 +27,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_start (u_long i) this->interval_initialized_ = 1; ACE_hrtime_t hrtime_now = ACE_OS::gethrtime (); ACE_High_Res_Timer::hrtime_to_tv (this->interval_start_, - hrtime_now); + hrtime_now); this->interval_end_.set (this->interval_start_.sec(), this->interval_start_.usec()); } diff --git a/ace/Monitor_Control/Monitor_Control.mpc b/ace/Monitor_Control/Monitor_Control.mpc index 9bbafab4e0b..3efb0bae9a6 100644 --- a/ace/Monitor_Control/Monitor_Control.mpc +++ b/ace/Monitor_Control/Monitor_Control.mpc @@ -33,7 +33,12 @@ project(Monitor_Control) : acelib, ace_etcl_parser, ace_output, install { Monitor_Control_utils.h } - specific (vc6, vc7, vc71, vc8, vc9, nmake) { + specific (vc6, vc7, vc71, vc8, vc9, vc10, nmake) { lit_libs += pdh } + verbatim (gnuace, local) { + "ifeq (1,$(winnt))" + " ACE_SHLIBS += pdh.lib" + "endif" + } } diff --git a/ace/Monitor_Control_Types.h b/ace/Monitor_Control_Types.h index b304363fcb2..792db456e5e 100644 --- a/ace/Monitor_Control_Types.h +++ b/ace/Monitor_Control_Types.h @@ -88,13 +88,6 @@ namespace ACE Control_Action* control_action; }; -#if defined (__BORLANDC__) && (__BORLANDC__ <= 0x570) - // Borland C++ Builder 6 and earlier don't handle the second template - // argument correctly. We have to pass it explicitly - typedef ACE_Vector<Data, ACE_VECTOR_DEFAULT_SIZE> DataList; - typedef ACE_Vector<ACE_CString, ACE_VECTOR_DEFAULT_SIZE> NameList; - typedef ACE_Array_Map<long, Constraint, std::equal_to<long> > ConstraintList; -#else /** * @brief Used by the admin class as a container for the data from * a group of monitor points. @@ -110,7 +103,6 @@ namespace ACE * @brief Holder for a monitor point's constraints. */ typedef ACE_Array_Map<long, Constraint> ConstraintList; -#endif }; } } diff --git a/ace/Multihomed_INET_Addr.cpp b/ace/Multihomed_INET_Addr.cpp index 131adbe070e..cc51f19a094 100644 --- a/ace/Multihomed_INET_Addr.cpp +++ b/ace/Multihomed_INET_Addr.cpp @@ -54,8 +54,8 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number, address_family); if (ret) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Invalid INET addr (%s:%u) will be ignored\n"), - ACE_TEXT_CHAR_TO_TCHAR (secondary_host_names[i]), port_number)); + ACE_TEXT ("Invalid INET addr (%C:%u) will be ignored\n"), + secondary_host_names[i], port_number)); this->secondaries_.size(this->secondaries_.size() - 1); } else diff --git a/ace/OS_Errno.h b/ace/OS_Errno.h index 2827a162b93..03feaa24f59 100644 --- a/ace/OS_Errno.h +++ b/ace/OS_Errno.h @@ -46,20 +46,19 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_Errno_Guard { public: - /// Stash the value of <error> into <error_> and initialize the - /// <errno_ptr_> to the address of <errno_ref>. + /// Stash the value of @a error into @c error_ and initialize the + /// @c errno_ptr_ to the address of @a errno_ref. ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref, int error); - /// Stash the value of @c errno into <error_> and initialize the - /// <errno_ptr_> to the address of <errno_ref>. + /// Initialize the @c errno_ptr_ to the address of @a errno_ref. ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref); /// Reset the value of @c errno to <error>. ~ACE_Errno_Guard (void); #if defined (ACE_HAS_WINCE_BROKEN_ERRNO) - /// Assign <errno_ref> to <error_>. + /// Assign @a errno_ref to <error_>. int operator= (const ACE_ERRNO_TYPE &errno_ref); #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */ diff --git a/ace/OS_Log_Msg_Attributes.h b/ace/OS_Log_Msg_Attributes.h index 107280f5ffd..0360ee4ec56 100644 --- a/ace/OS_Log_Msg_Attributes.h +++ b/ace/OS_Log_Msg_Attributes.h @@ -50,6 +50,7 @@ protected: /// Ostream where the new TSS Log_Msg will use. ACE_OSTREAM_TYPE *ostream_; + void *ostream_refcount_; /// Priority_mask to be used in new TSS Log_Msg. unsigned long priority_mask_; diff --git a/ace/OS_Memory.h b/ace/OS_Memory.h index 0fda7fbb376..365c1d2446f 100644 --- a/ace/OS_Memory.h +++ b/ace/OS_Memory.h @@ -231,9 +231,15 @@ ACE_END_VERSIONED_NAMESPACE_DECL if (POINTER == 0) { errno = ENOMEM; } \ } while (0) -# define ACE_throw_bad_alloc \ - void* gcc_will_complain_if_literal_0_is_returned = 0; \ - return gcc_will_complain_if_literal_0_is_returned +# if !defined (ACE_bad_alloc) + class ACE_bad_alloc_class {}; +# define ACE_bad_alloc ACE_bad_alloc_class +# endif +# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC == 1) +# define ACE_throw_bad_alloc AfxThrowMemoryException () +# else +# define ACE_throw_bad_alloc throw ACE_bad_alloc () +# endif #endif /* ACE_NEW_THROWS_EXCEPTIONS */ diff --git a/ace/OS_NS_Thread.cpp b/ace/OS_NS_Thread.cpp index f550c5fd7e6..e2ce61c53ee 100644 --- a/ace/OS_NS_Thread.cpp +++ b/ace/OS_NS_Thread.cpp @@ -1446,7 +1446,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, ACE_Errno_Guard error (errno, 0); int msec_timeout; - if (timeout->sec () == 0 && timeout->usec () == 0) + if (*timeout == ACE_Time_Value::zero) msec_timeout = 0; // Do a "poll." else { @@ -1609,7 +1609,7 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, int error = 0; int msec_timeout; - if (timeout->sec () == 0 && timeout->usec () == 0) + if (*timeout == ACE_Time_Value::zero) msec_timeout = 0; // Do a "poll." else { @@ -2968,7 +2968,7 @@ ACE_OS::event_timedwait (ACE_event_t *event, #if defined (ACE_WIN32) DWORD result; - if (timeout->sec () == 0 && timeout->usec () == 0) + if (*timeout == ACE_Time_Value::zero) // Do a "poll". result = ::WaitForSingleObject (*event, 0); else @@ -4318,10 +4318,15 @@ ACE_OS::thr_create (ACE_THR_FUNC func, // Set the priority of the new thread and then let it // continue, but only if the user didn't start it suspended // in the first place! - ACE_OS::thr_setprio (*thr_handle, priority); + if (ACE_OS::thr_setprio (*thr_handle, priority) != 0) + { + return -1; + } if (start_suspended == 0) - ACE_OS::thr_continue (*thr_handle); + { + ACE_OS::thr_continue (*thr_handle); + } } } # if 0 diff --git a/ace/OS_NS_Thread.inl b/ace/OS_NS_Thread.inl index d4bba743c56..fca22852c23 100644 --- a/ace/OS_NS_Thread.inl +++ b/ace/OS_NS_Thread.inl @@ -1642,11 +1642,11 @@ ACE_OS::sema_init (ACE_sema_t *s, // its maximum value initialized to <max>. SECURITY_ATTRIBUTES sa_buffer; SECURITY_DESCRIPTOR sd_buffer; - *s = ::CreateSemaphoreA + *s = ACE_TEXT_CreateSemaphore (ACE_OS::default_win32_security_attributes_r (sa, &sa_buffer, &sd_buffer), count, max, - name); + ACE_TEXT_CHAR_TO_TCHAR (name)); if (*s == 0) ACE_FAIL_RETURN (-1); @@ -2259,7 +2259,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) # if !defined (ACE_USES_WINCE_SEMA_SIMULATION) int msec_timeout; - if (tv.sec () == 0 && tv.usec () == 0) + if (tv == ACE_Time_Value::zero) msec_timeout = 0; // Do a "poll." else { @@ -2674,10 +2674,13 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy) # elif defined (ACE_HAS_STHREADS) int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::thr_getprio (ht_id, &priority), result), int, -1); -# elif defined (ACE_HAS_WTHREADS) && !defined (ACE_HAS_WINCE) +# elif defined (ACE_HAS_WTHREADS) ACE_Errno_Guard error (errno); - +# if !defined (ACE_HAS_WINCE) priority = ::GetThreadPriority (ht_id); +# else + priority = ::CeGetThreadPriority (ht_id); +# endif # if defined (ACE_HAS_PHARLAP) # if defined (ACE_PHARLAP_LABVIEW_RT) @@ -2686,7 +2689,7 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy) DWORD timeslice = ::EtsGetTimeSlice (); policy = timeslice == 0 ? ACE_SCHED_OTHER : ACE_SCHED_FIFO; # endif /* ACE_PHARLAP_LABVIEW_RT */ -# else +# elif !defined (ACE_HAS_WINCE) DWORD priority_class = ::GetPriorityClass (::GetCurrentProcess ()); if (priority_class == 0 && (error = ::GetLastError ()) != NO_ERROR) ACE_FAIL_RETURN (-1); @@ -3104,9 +3107,15 @@ ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy) result), int, -1); # elif defined (ACE_HAS_WTHREADS) +# if !defined (ACE_HAS_WINCE) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::SetThreadPriority (ht_id, priority), ace_result_), int, -1); +# else + ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CeSetThreadPriority (ht_id, priority), + ace_result_), + int, -1); +# endif /* ACE_HAS_WINCE */ # elif defined (ACE_HAS_VXTHREADS) ACE_OSCALL_RETURN (::taskPrioritySet (ht_id, priority), int, -1); # else diff --git a/ace/OS_NS_ctype.h b/ace/OS_NS_ctype.h index 98f69623ba2..dc36987038c 100644 --- a/ace/OS_NS_ctype.h +++ b/ace/OS_NS_ctype.h @@ -32,6 +32,11 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +#include "ace/os_include/os_ctype.h" +#if defined ACE_HAS_WCHAR +# include "ace/os_include/os_wctype.h" +#endif /* ACE_HAS_WCHAR */ + ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_OS { @@ -58,6 +63,14 @@ namespace ACE_OS { /// Returns true if the character is a control character. ACE_NAMESPACE_INLINE_FUNCTION + int ace_isblank (ACE_TCHAR c); + + /// Returns true if the character is a control character. + ACE_NAMESPACE_INLINE_FUNCTION + int ace_isascii (ACE_TCHAR c); + + /// Returns true if the character is a control character. + ACE_NAMESPACE_INLINE_FUNCTION int ace_iscntrl (ACE_TCHAR c); /// Returns true if the character is a decimal-digit character. @@ -112,6 +125,9 @@ namespace ACE_OS { wint_t ace_towupper (wint_t c); #endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWUPPER */ + /// Tests @a c for the property specified by the @a desc argument + ACE_NAMESPACE_INLINE_FUNCTION + int ace_isctype (int c, ctype_t desc); //@} } /* namespace ACE_OS */ diff --git a/ace/OS_NS_ctype.inl b/ace/OS_NS_ctype.inl index 5d2177d102a..c780d89f3b0 100644 --- a/ace/OS_NS_ctype.inl +++ b/ace/OS_NS_ctype.inl @@ -2,10 +2,13 @@ // // $Id$ -#include "ace/os_include/os_ctype.h" -#if defined ACE_HAS_WCHAR -# include "ace/os_include/os_wctype.h" -#endif /* ACE_HAS_WCHAR */ +#if defined (ACE_LACKS_ISCTYPE) +#include "ace/OS_NS_errno.h" +#endif + +#if defined (ACE_USES_WCHAR) && defined (ACE_LACKS_ISWBLANK) && !defined (ACE_LACKS_ISWCTYPE) +#include "ace/OS_NS_wctype.h" +#endif ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -16,7 +19,7 @@ ACE_OS::ace_isalnum (ACE_TCHAR c) # if defined (_MSC_VER) && (_MSC_VER >= 1300) // For MSVC 7.x, we need to prevent "illegal" character getting into // isalnum, otherwise, it will crash the program. - return c > 0 && c < 256 && iswalnum (c); + return c > 0 && c < 0xFF && iswalnum (c); # else return iswalnum (c); # endif /* _MSC_VER && _MSC_VER >= 1300 */ @@ -26,6 +29,47 @@ ACE_OS::ace_isalnum (ACE_TCHAR c) } ACE_INLINE int +ACE_OS::ace_isascii (ACE_TCHAR c) +{ +#if defined (ACE_USES_WCHAR) +# if defined (ACE_LACKS_ISWASCII) + if (c < 256) + return isascii (static_cast<int> (c)); + else + return c; +# else + return iswascii (c); +# endif +#else /* ACE_USES_WCHAR */ +# if defined (ACE_LACKS_ISASCII) + return (static_cast<unsigned char>(c) <= 0x7F); +#else + return isascii ((unsigned char) c); +#endif /* ACE_LACKS_ISASCII */ +#endif /* ACE_USES_WCHAR */ +} + +ACE_INLINE int +ACE_OS::ace_isblank (ACE_TCHAR c) +{ +#if defined (ACE_USES_WCHAR) +# if defined (ACE_LACKS_ISWBLANK) +# if !defined (ACE_LACKS_ISWCTYPE) + return ace_iswctype (c, _BLANK); +# else + return (c == 0x9) || (c == 0x20); +# endif /* !ACE_LACKS_ISWCTYPE */ +# else + return iswblank (c); +# endif /* ACE_LACKS_ISWBLANK */ +#elif defined (ACE_LACKS_ISBLANK) + return (c == 0x9) || (c == 0x20); +#else /* ACE_USES_WCHAR */ + return isblank ((unsigned char) c); +#endif /* ACE_USES_WCHAR */ +} + +ACE_INLINE int ACE_OS::ace_isalpha (ACE_TCHAR c) { #if defined (ACE_USES_WCHAR) @@ -79,6 +123,15 @@ ACE_INLINE int ACE_OS::ace_isprint (ACE_TCHAR c) { #if defined (ACE_USES_WCHAR) +# if defined (_WIN32_WCE) && (_WIN32_WCE <= 0x600) + /* WinCE 6 and earlier have the bug that for tab (\t) the + * iswprint returns true instead of false + */ + if (c == 0x9) + { + return 0; + } +# endif return iswprint (c); #else /* ACE_USES_WCHAR */ return isprint ((unsigned char) c); @@ -160,4 +213,18 @@ ACE_OS::ace_towupper (wint_t c) } #endif /* ACE_HAS_WCHAR && !ACE_LACKS_TOWUPPER */ +ACE_INLINE int +ACE_OS::ace_isctype(int c, ctype_t desc) +{ +#if defined (ACE_ISCTYPE_EQUIVALENT) + return ACE_ISCTYPE_EQUIVALENT (c, desc); +#elif !defined (ACE_LACKS_ISCTYPE) + return isctype (c, desc); +#else + ACE_UNUSED_ARG (c); + ACE_UNUSED_ARG (desc); + ACE_NOTSUP_RETURN (-1); +#endif +} + ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_errno.h b/ace/OS_NS_errno.h index 5dcb0f3aa59..c4ea9d57a8f 100644 --- a/ace/OS_NS_errno.h +++ b/ace/OS_NS_errno.h @@ -58,7 +58,7 @@ namespace ACE_OS { * Some versions of CE don't support @c errno and some versions' * implementations are busted. So we implement our own. * Our implementation takes up one Tls key, however, it does not - * allocate memory fromt the heap so there's no problem with cleanin + * allocate memory from the heap so there's no problem with cleaning * up the errno when a thread exit. */ class ACE_Export ACE_CE_Errno diff --git a/ace/OS_NS_signal.h b/ace/OS_NS_signal.h index bb5b03b1c0d..40c0e47a88c 100644 --- a/ace/OS_NS_signal.h +++ b/ace/OS_NS_signal.h @@ -135,6 +135,8 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int sigsuspend (const sigset_t *set); + ACE_NAMESPACE_INLINE_FUNCTION + int raise (const int signum); //@} } /* namespace ACE_OS */ diff --git a/ace/OS_NS_signal.inl b/ace/OS_NS_signal.inl index 98f02459494..03a6bb18a56 100644 --- a/ace/OS_NS_signal.inl +++ b/ace/OS_NS_signal.inl @@ -227,6 +227,17 @@ sigsuspend (const sigset_t *sigset) #endif /* ACE_HAS_SIGSUSPEND */ } +ACE_INLINE int +raise (const int signum) +{ +#if defined (ACE_LACKS_RAISE) + ACE_UNUSED_ARG (signum); + ACE_NOTSUP_RETURN (-1); +#else + ACE_OSCALL_RETURN (::raise (signum), int, -1); +#endif /* ACE_LACKS_RAISE */ +} + } /* end namespace ACE_OS */ ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_stdio.h b/ace/OS_NS_stdio.h index b4699bbb634..3133628d5dc 100644 --- a/ace/OS_NS_stdio.h +++ b/ace/OS_NS_stdio.h @@ -516,7 +516,7 @@ namespace ACE_OS { #if !defined (ACE_HAS_VASPRINTF) extern ACE_Export - int vasprintf_emulation (char **bufp, const char *format, va_list argptr); + int vasprintf_emulation (char **bufp, const char *format, va_list argptr); #endif /* !ACE_HAS_VASPRINTF */ #if defined (ACE_HAS_WCHAR) diff --git a/ace/OS_NS_stdio.inl b/ace/OS_NS_stdio.inl index 87d74dcb543..3c610552f88 100644 --- a/ace/OS_NS_stdio.inl +++ b/ace/OS_NS_stdio.inl @@ -135,11 +135,11 @@ ACE_OS::flock_unlock (ACE_OS::ace_flock_t *lock, DWORD low_len = ACE_LOW_PART (len); DWORD high_len = ACE_HIGH_PART (len); ACE_WIN32CALL_RETURN ( - ACE_ADAPT_RETVAL (::UnlockFile (lock->handle_, - lock->overlapped_.Offset, - lock->overlapped_.OffsetHigh, - low_len, - high_len), + ACE_ADAPT_RETVAL (::UnlockFileEx (lock->handle_, + 0, + low_len, + high_len, + &lock->overlapped_), ace_result_), int, -1); #else lock->lock_.l_whence = whence; @@ -511,15 +511,11 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode) if (crt_handle != -1) { -# if defined(ACE_HAS_NONCONST_FDOPEN) && !defined (ACE_USES_WCHAR) - file = ::_fdopen (crt_handle, const_cast<ACE_TCHAR *> (mode)); -# elif defined (ACE_HAS_NONCONST_FDOPEN) && defined (ACE_USES_WCHAR) - file = ::_wfdopen (crt_handle, const_cast<ACE_TCHAR *> (mode)); -# elif defined (ACE_USES_WCHAR) +# if defined (ACE_USES_WCHAR) file = ::_wfdopen (crt_handle, mode); # else file = ::_fdopen (crt_handle, mode); -# endif /* ACE_HAS_NONCONST_FDOPEN */ +# endif /* ACE_USES_WCHAR */ if (!file) { @@ -772,7 +768,7 @@ ACE_OS::perror (const wchar_t *s) #else ACE_Wide_To_Ascii n_s (s); ::perror (n_s.char_rep ()); -#endif /* ACE_HAS_WINCE */ +#endif /* ACE_LACKS_PERROR */ } #endif /* ACE_HAS_WCHAR */ @@ -811,8 +807,8 @@ ACE_OS::rename (const char *old_name, # elif defined (ACE_HAS_WINCE) // Win CE is always wide-char. ACE_UNUSED_ARG (flags); - if (0 != MoveFile (ACE_TEXT_CHAR_TO_TCHAR (old_name), - ACE_TEXT_CHAR_TO_TCHAR (new_name))) + if (0 == ::MoveFile (ACE_TEXT_CHAR_TO_TCHAR (old_name), + ACE_TEXT_CHAR_TO_TCHAR (new_name))) ACE_FAIL_RETURN (-1); return 0; # elif defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_MOVEFILEEX) @@ -844,7 +840,7 @@ ACE_OS::rename (const wchar_t *old_name, ACE_NOTSUP_RETURN (-1); # elif defined (ACE_HAS_WINCE) ACE_UNUSED_ARG (flags); - if (MoveFileW (old_name, new_name) != 0) + if (::MoveFileW (old_name, new_name) == 0) ACE_FAIL_RETURN (-1); return 0; # elif defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_MOVEFILEEX) @@ -910,7 +906,7 @@ ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx) ACE_OSCALL_RETURN (::_wtempnam (const_cast <wchar_t*> (dir), const_cast <wchar_t*> (pfx)), wchar_t *, 0); # else ACE_OSCALL_RETURN (::_wtempnam (dir, pfx), wchar_t *, 0); -# endif /* __BORLANDC__ */ +# endif /* ACE_HAS_NONCONST_TEMPNAM */ #else /* ACE_LACKS_TEMPNAM */ // No native wide-char support; convert to narrow and call the char* variant. char *ndir = ACE_Wide_To_Ascii (dir).char_rep (); diff --git a/ace/OS_NS_stdlib.cpp b/ace/OS_NS_stdlib.cpp index 9bc2b2fa4a4..66ebde8c3d1 100644 --- a/ace/OS_NS_stdlib.cpp +++ b/ace/OS_NS_stdlib.cpp @@ -343,7 +343,7 @@ ACE_OS::realloc (void *ptr, size_t nbytes) return ACE_REALLOC_FUNC (ACE_MALLOC_T (ptr), nbytes); } -#if defined (ACE_LACKS_REALPATH) && !defined (ACE_HAS_WINCE) +#if defined (ACE_LACKS_REALPATH) char * ACE_OS::realpath (const char *file_name, char *resolved_name) @@ -514,7 +514,7 @@ ACE_OS::realpath (const char *file_name, return rpath; } -#endif /* ACE_LACKS_REALPATH && !ACE_HAS_WINCE */ +#endif /* ACE_LACKS_REALPATH */ #if defined (ACE_LACKS_STRTOL) long @@ -596,6 +596,74 @@ ACE_OS::strtol_emulation (const char *nptr, char **endptr, int base) } #endif /* ACE_LACKS_STRTOL */ +#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSTOL) +long +ACE_OS::wcstol_emulation (const wchar_t *nptr, + wchar_t **endptr, + int base) +{ + register const wchar_t *s = nptr; + register unsigned long acc; + register int c; + register unsigned long cutoff; + register int neg = 0, any, cutlim; + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + do { + c = *s++; + } while (ACE_OS::ace_isspace(c)); + if (c == L'-') { + neg = 1; + c = *s++; + } else if (c == L'+') + c = *s++; + if ((base == 0 || base == 16) && + c == '0' && (*s == L'x' || *s == L'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == L'0' ? 8 : 10; + + /* + * See strtol for comments as to the logic used. + */ + cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; + cutlim = cutoff % (unsigned long)base; + cutoff /= (unsigned long)base; + for (acc = 0, any = 0;; c = *s++) { + if (ACE_OS::ace_isdigit(c)) + c -= L'0'; + else if (ACE_OS::ace_isalpha(c)) + c -= ACE_OS::ace_isupper(c) ? L'A' - 10 : L'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = neg ? LONG_MIN : LONG_MAX; + errno = ERANGE; + } else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = any ? (wchar_t *)s - 1 : (wchar_t *)nptr; + return (acc); +} +#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSTOL */ + #if defined (ACE_LACKS_STRTOUL) unsigned long ACE_OS::strtoul_emulation (const char *nptr, @@ -665,6 +733,213 @@ ACE_OS::strtoul_emulation (const char *nptr, } #endif /* ACE_LACKS_STRTOUL */ + +#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSTOUL) +unsigned long +ACE_OS::wcstoul_emulation (const wchar_t *nptr, + wchar_t **endptr, + int base) +{ + register const wchar_t *s = nptr; + register unsigned long acc; + register int c; + register unsigned long cutoff; + register int neg = 0, any, cutlim; + + /* + * See strtol for comments as to the logic used. + */ + do + c = *s++; + while (ACE_OS::ace_isspace(c)); + if (c == L'-') + { + neg = 1; + c = *s++; + } + else if (c == L'+') + c = *s++; + if ((base == 0 || base == 16) && + c == L'0' && (*s == L'x' || *s == L'X')) + { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == L'0' ? 8 : 10; + cutoff = (unsigned long) ULONG_MAX / (unsigned long) base; + cutlim = (unsigned long) ULONG_MAX % (unsigned long) base; + + for (acc = 0, any = 0;; c = *s++) + { + if (ACE_OS::ace_isdigit(c)) + c -= L'0'; + else if (ACE_OS::ace_isalpha(c)) + c -= ACE_OS::ace_isupper(c) ? L'A' - 10 : L'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + any = -1; + else + { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) + { + acc = ULONG_MAX; + errno = ERANGE; + } + else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = any ? (wchar_t *) s - 1 : (wchar_t *) nptr; + return (acc); +} +#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSTOUL */ + +#if defined (ACE_LACKS_STRTOLL) +ACE_INT64 +ACE_OS::strtoll_emulation (const char *nptr, + char **endptr, + register int base) +{ + register const char *s = nptr; + register ACE_UINT64 acc; + register int c; + register ACE_UINT64 cutoff; + register int neg = 0, any, cutlim; + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + do { + c = *s++; + } while (ACE_OS::ace_isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else if (c == '+') + c = *s++; + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == '0' ? 8 : 10; + + /* + * See strtol for comments as to the logic used. + */ + cutoff = neg ? -(ACE_UINT64)ACE_INT64_MIN : ACE_INT64_MAX; + cutlim = cutoff % (ACE_UINT64)base; + cutoff /= (ACE_UINT64)base; + for (acc = 0, any = 0;; c = *s++) { + if (ACE_OS::ace_isdigit(c)) + c -= '0'; + else if (ACE_OS::ace_isalpha(c)) + c -= ACE_OS::ace_isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = neg ? ACE_INT64_MIN : ACE_INT64_MAX; + errno = ERANGE; + } else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = any ? (char *)s - 1 : (char *)nptr; + return (acc); +} +#endif /* ACE_LACKS_STRTOLL */ + +#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSTOLL) +ACE_INT64 +ACE_OS::wcstoll_emulation (const wchar_t *nptr, + wchar_t **endptr, + int base) +{ + register const wchar_t *s = nptr; + register ACE_UINT64 acc; + register int c; + register ACE_UINT64 cutoff; + register int neg = 0, any, cutlim; + + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + do { + c = *s++; + } while (ACE_OS::ace_isspace(c)); + if (c == L'-') { + neg = 1; + c = *s++; + } else if (c == L'+') + c = *s++; + if ((base == 0 || base == 16) && + c == L'0' && (*s == L'x' || *s == L'X')) { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == L'0' ? 8 : 10; + + /* + * See strtol for comments as to the logic used. + */ + cutoff = neg ? -(ACE_UINT64)ACE_INT64_MIN : ACE_INT64_MAX; + cutlim = cutoff % (ACE_UINT64)base; + cutoff /= (ACE_UINT64)base; + for (acc = 0, any = 0;; c = *s++) { + if (ACE_OS::ace_isdigit(c)) + c -= L'0'; + else if (ACE_OS::ace_isalpha(c)) + c -= ACE_OS::ace_isupper(c) ? L'A' - 10 : L'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + any = -1; + else { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) { + acc = neg ? ACE_INT64_MIN : ACE_INT64_MAX; + errno = ERANGE; + } else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = any ? (wchar_t *)s - 1 : (wchar_t *)nptr; + return (acc); +} +#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSTOLL */ + + #if defined (ACE_LACKS_STRTOULL) ACE_UINT64 ACE_OS::strtoull_emulation (const char *nptr, @@ -735,6 +1010,76 @@ ACE_OS::strtoull_emulation (const char *nptr, } #endif /* ACE_LACKS_STRTOULL */ +#if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_WCSTOULL) +ACE_UINT64 +ACE_OS::wcstoull_emulation (const wchar_t *nptr, + wchar_t **endptr, + int base) +{ + register const wchar_t *s = nptr; + register ACE_UINT64 acc; + register int c; + register ACE_UINT64 cutoff; + register int neg = 0, any, cutlim; + + /* + * See strtol for comments as to the logic used. + */ + do + c = *s++; + while (ACE_OS::ace_isspace(c)); + if (c == L'-') + { + neg = 1; + c = *s++; + } + else if (c == L'+') + c = *s++; + if ((base == 0 || base == 16) && + c == L'0' && (*s == L'x' || *s == L'X')) + { + c = s[1]; + s += 2; + base = 16; + } + if (base == 0) + base = c == L'0' ? 8 : 10; + + cutoff = (ACE_UINT64) ACE_UINT64_MAX / (ACE_UINT64) base; + cutlim = (ACE_UINT64) ACE_UINT64_MAX % (ACE_UINT64) base; + + for (acc = 0, any = 0;; c = *s++) + { + if (ACE_OS::ace_isdigit(c)) + c -= L'0'; + else if (ACE_OS::ace_isalpha(c)) + c -= ACE_OS::ace_isupper(c) ? L'A' - 10 : L'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + any = -1; + else + { + any = 1; + acc *= base; + acc += c; + } + } + if (any < 0) + { + acc = ACE_UINT64_MAX; + errno = ERANGE; + } + else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = any ? (wchar_t *) s - 1 : (wchar_t *) nptr; + return (acc); +} +#endif /* ACE_HAS_WCHAR && ACE_LACKS_WCSTOULL */ + #if defined (ACE_LACKS_MKSTEMP) ACE_HANDLE ACE_OS::mkstemp_emulation (ACE_TCHAR * s) diff --git a/ace/OS_NS_stdlib.h b/ace/OS_NS_stdlib.h index ba9894c8ca9..0ff3fea27a2 100644 --- a/ace/OS_NS_stdlib.h +++ b/ace/OS_NS_stdlib.h @@ -81,6 +81,22 @@ namespace ACE_OS { int atoi (const wchar_t *s); # endif /* ACE_HAS_WCHAR */ + ACE_NAMESPACE_INLINE_FUNCTION + long atol (const char *s); + +# if defined (ACE_HAS_WCHAR) + ACE_NAMESPACE_INLINE_FUNCTION + long atol (const wchar_t *s); +# endif /* ACE_HAS_WCHAR */ + + ACE_NAMESPACE_INLINE_FUNCTION + double atof (const char *s); + +# if defined (ACE_HAS_WCHAR) + ACE_NAMESPACE_INLINE_FUNCTION + double atof (const wchar_t *s); +# endif /* ACE_HAS_WCHAR */ + // atop not in spec # if defined (atop) # undef atop @@ -201,7 +217,6 @@ namespace ACE_OS { extern ACE_Export void *realloc (void *, size_t); -#if !defined (ACE_HAS_WINCE) # if !defined (ACE_LACKS_REALPATH) ACE_NAMESPACE_INLINE_FUNCTION # else @@ -213,7 +228,6 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION wchar_t *realpath (const wchar_t *file_name, wchar_t *resolved_name); # endif /* ACE_HAS_WCHAR */ -#endif /* ACE_HAS_WINCE */ // exit_hook and set_exit_hook not in spec /// Function that is called by <ACE_OS::exit>, if non-null. @@ -246,27 +260,27 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION long strtol (const char *s, char **ptr, int base); -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOL) +#if defined (ACE_LACKS_STRTOL) + extern ACE_Export + long strtol_emulation (const char *nptr, char **endptr, int base); +#endif /* ACE_LACKS_STRTOL */ + +#if defined (ACE_HAS_WCHAR) /// Converts a string to a long value (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION long strtol (const wchar_t *s, wchar_t **ptr, int base); -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */ -#if defined (ACE_LACKS_STRTOL) +#if defined (ACE_LACKS_WCSTOL) extern ACE_Export - long strtol_emulation (const char *nptr, char **endptr, int base); -#endif /* ACE_LACKS_STRTOL */ + long wcstol_emulation (const wchar_t *nptr, wchar_t **endptr, int base); +#endif /* ACE_LACKS_WCSTOL */ + +#endif /* ACE_HAS_WCHAR */ /// Converts a string to an unsigned long value (char version). ACE_NAMESPACE_INLINE_FUNCTION unsigned long strtoul (const char *s, char **ptr, int base); -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOUL) - /// Converts a string to an unsigned long value (wchar_t version). - ACE_NAMESPACE_INLINE_FUNCTION - unsigned long strtoul (const wchar_t *s, wchar_t **ptr, int base); -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */ - #if defined (ACE_LACKS_STRTOUL) extern ACE_Export unsigned long strtoul_emulation (const char *nptr, @@ -274,15 +288,48 @@ namespace ACE_OS { int base); #endif /* ACE_LACKS_STRTOUL */ - /// Converts a string to a 64 bit int value (char version). +#if defined (ACE_HAS_WCHAR) + /// Converts a string to an unsigned long value (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION - ACE_UINT64 strtoull (const char *s, char **ptr, int base); + unsigned long strtoul (const wchar_t *s, wchar_t **ptr, int base); + +#if defined (ACE_LACKS_WCSTOUL) + extern ACE_Export + unsigned long wcstoul_emulation (const wchar_t *nptr, + wchar_t **endptr, + int base); +#endif /* ACE_LACKS_WCSTOUL */ + +#endif /* ACE_HAS_WCHAR */ -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOULL) - /// Converts a string to a 64 bit int value (wchar_t version). + /// Converts a string to a signed 64 bit int value (char version). ACE_NAMESPACE_INLINE_FUNCTION - ACE_UINT64 strtoull (const wchar_t *s, wchar_t **ptr, int base); -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */ + ACE_INT64 strtoll (const char *s, char **ptr, int base); + +#if defined (ACE_LACKS_STRTOLL) + extern ACE_Export + ACE_INT64 strtoll_emulation (const char *nptr, + char **endptr, + int base); +#endif /* ACE_LACKS_STRTOLL */ + +#if defined (ACE_HAS_WCHAR) + /// Converts a string to a signed 64 bit int value (wchar_t version). + ACE_NAMESPACE_INLINE_FUNCTION + ACE_INT64 strtoll (const wchar_t *s, wchar_t **ptr, int base); + +#if defined (ACE_LACKS_WCSTOLL) + extern ACE_Export + ACE_INT64 wcstoll_emulation (const wchar_t *nptr, + wchar_t **endptr, + int base); +#endif /* ACE_LACKS_WCSTOLL */ + +#endif /* ACE_HAS_WCHAR */ + + /// Converts a string to a unsigned 64 bit int value (char version). + ACE_NAMESPACE_INLINE_FUNCTION + ACE_UINT64 strtoull (const char *s, char **ptr, int base); #if defined (ACE_LACKS_STRTOULL) extern ACE_Export @@ -291,6 +338,20 @@ namespace ACE_OS { int base); #endif /* ACE_LACKS_STRTOULL */ +#if defined (ACE_HAS_WCHAR) + /// Converts a string to a unsigned 64 bit int value (wchar_t version). + ACE_NAMESPACE_INLINE_FUNCTION + ACE_UINT64 strtoull (const wchar_t *s, wchar_t **ptr, int base); + +#if defined (ACE_LACKS_WCSTOULL) + extern ACE_Export + ACE_UINT64 wcstoull_emulation (const wchar_t *nptr, + wchar_t **endptr, + int base); +#endif /* ACE_LACKS_WCSTOULL */ + +#endif /* ACE_HAS_WCHAR */ + ACE_NAMESPACE_INLINE_FUNCTION int system (const ACE_TCHAR *s); diff --git a/ace/OS_NS_stdlib.inl b/ace/OS_NS_stdlib.inl index fd416e5b00f..94dfe2272b8 100644 --- a/ace/OS_NS_stdlib.inl +++ b/ace/OS_NS_stdlib.inl @@ -67,6 +67,44 @@ ACE_OS::atoi (const wchar_t *s) } #endif /* ACE_HAS_WCHAR */ +ACE_INLINE long +ACE_OS::atol (const char *s) +{ + ACE_OSCALL_RETURN (::atol (s), long, -1); +} + +#if defined (ACE_HAS_WCHAR) +ACE_INLINE long +ACE_OS::atol (const wchar_t *s) +{ +#if defined (ACE_WIN32) + ACE_OSCALL_RETURN (::_wtol (s), long, -1); +#else /* ACE_WIN32 */ + return ACE_OS::atol (ACE_Wide_To_Ascii (s).char_rep ()); +#endif /* ACE_WIN32 */ +} +#endif /* ACE_HAS_WCHAR */ + +ACE_INLINE double +ACE_OS::atof (const char *s) +{ + ACE_OSCALL_RETURN (::atof (s), double, -1); +} + +#if defined (ACE_HAS_WCHAR) +ACE_INLINE double +ACE_OS::atof (const wchar_t *s) +{ +#if !defined (ACE_HAS_WTOF) + return ACE_OS::atof (ACE_Wide_To_Ascii (s).char_rep ()); +#elif defined (ACE_WTOF_EQUIVALENT) + ACE_OSCALL_RETURN (ACE_WTOF_EQUIVALENT (s), double, -1); +#else /* ACE_HAS__WTOF */ + ACE_OSCALL_RETURN (::wtof (s), double, -1); +#endif /* ACE_HAS_WTOF */ +} +#endif /* ACE_HAS_WCHAR */ + #if defined (atop) # undef atop #endif /* atop */ @@ -390,7 +428,6 @@ ACE_OS::rand_r (ACE_RANDR_TYPE& seed) #endif /* !ACE_WIN32 */ -#if !defined (ACE_HAS_WINCE) # if !defined (ACE_LACKS_REALPATH) ACE_INLINE char * ACE_OS::realpath (const char *file_name, @@ -402,7 +439,6 @@ ACE_OS::realpath (const char *file_name, return ::realpath (file_name, resolved_name); # endif /* ! ACE_WIN32 */ } -# endif /* !ACE_LACKS_REALPATH */ # if defined (ACE_HAS_WCHAR) ACE_INLINE wchar_t * @@ -467,13 +503,17 @@ ACE_OS::strtol (const char *s, char **ptr, int base) #endif /* ACE_LACKS_STRTOL */ } -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOL) +#if defined (ACE_HAS_WCHAR) ACE_INLINE long ACE_OS::strtol (const wchar_t *s, wchar_t **ptr, int base) { +#if defined (ACE_LACKS_WCSTOL) + return ACE_OS::wcstol_emulation (s, ptr, base); +#else return ACE_WCHAR_STD_NAMESPACE::wcstol (s, ptr, base); +#endif /* ACE_LACKS_WCSTOL */ } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */ +#endif /* ACE_HAS_WCHAR */ ACE_INLINE unsigned long ACE_OS::strtoul (const char *s, char **ptr, int base) @@ -485,13 +525,43 @@ ACE_OS::strtoul (const char *s, char **ptr, int base) #endif /* ACE_LACKS_STRTOUL */ } -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOUL) +#if defined (ACE_HAS_WCHAR) ACE_INLINE unsigned long ACE_OS::strtoul (const wchar_t *s, wchar_t **ptr, int base) { +#if defined (ACE_LACKS_WCSTOUL) + return ACE_OS::wcstoul_emulation (s, ptr, base); +#else return ACE_WCHAR_STD_NAMESPACE::wcstoul (s, ptr, base); +#endif /* ACE_LACKS_WCSTOUL */ } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */ +#endif /* ACE_HAS_WCHAR */ + +ACE_INLINE ACE_INT64 +ACE_OS::strtoll (const char *s, char **ptr, int base) +{ +#if defined (ACE_LACKS_STRTOLL) + return ACE_OS::strtoll_emulation (s, ptr, base); +#elif defined (ACE_STRTOLL_EQUIVALENT) + return ACE_STRTOLL_EQUIVALENT (s, ptr, base); +#else + return ::strtoll (s, ptr, base); +#endif /* ACE_LACKS_STRTOLL */ +} + +#if defined (ACE_HAS_WCHAR) +ACE_INLINE ACE_INT64 +ACE_OS::strtoll (const wchar_t *s, wchar_t **ptr, int base) +{ +#if defined (ACE_LACKS_WCSTOLL) + return ACE_OS::wcstoll_emulation (s, ptr, base); +#elif defined (ACE_WCSTOLL_EQUIVALENT) + return ACE_WCSTOLL_EQUIVALENT (s, ptr, base); +#else + return ACE_WCHAR_STD_NAMESPACE::wcstoll (s, ptr, base); +#endif /* ACE_LACKS_WCSTOLL */ +} +#endif /* ACE_HAS_WCHAR */ ACE_INLINE ACE_UINT64 ACE_OS::strtoull (const char *s, char **ptr, int base) @@ -505,17 +575,19 @@ ACE_OS::strtoull (const char *s, char **ptr, int base) #endif /* ACE_LACKS_STRTOULL */ } -#if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_WCSTOULL) +#if defined (ACE_HAS_WCHAR) ACE_INLINE ACE_UINT64 ACE_OS::strtoull (const wchar_t *s, wchar_t **ptr, int base) { -#if defined (ACE_WCSTOOULL_EQUIVALENT) - return ACE_WCSTOOULL_EQUIVALENT (s, ptr, base); +#if defined (ACE_LACKS_WCSTOULL) + return ACE_OS::wcstoull_emulation (s, ptr, base); +#elif defined (ACE_WCSTOULL_EQUIVALENT) + return ACE_WCSTOULL_EQUIVALENT (s, ptr, base); #else return ACE_WCHAR_STD_NAMESPACE::wcstoull (s, ptr, base); -#endif /* ACE_WIN32 */ +#endif /* ACE_LACKS_WCSTOULL */ } -#endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOULL */ +#endif /* ACE_HAS_WCHAR */ ACE_INLINE int ACE_OS::system (const ACE_TCHAR *s) diff --git a/ace/OS_NS_stropts.h b/ace/OS_NS_stropts.h index 5edbab0f5f5..762d0c1fbc2 100644 --- a/ace/OS_NS_stropts.h +++ b/ace/OS_NS_stropts.h @@ -108,13 +108,13 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int fdetach (const char *file); - /// UNIX-style <ioctl>. + /// UNIX-style @c ioctl ACE_NAMESPACE_INLINE_FUNCTION int ioctl (ACE_HANDLE handle, ACE_IOCTL_TYPE_ARG2 cmd, void * = 0); - /// QoS-enabled <ioctl>. + /// QoS-enabled @c ioctl extern ACE_Export int ioctl (ACE_HANDLE socket, unsigned long io_control_code, diff --git a/ace/OS_NS_sys_mman.inl b/ace/OS_NS_sys_mman.inl index 528ae7040f9..03306ad018a 100644 --- a/ace/OS_NS_sys_mman.inl +++ b/ace/OS_NS_sys_mman.inl @@ -102,7 +102,7 @@ ACE_OS::mmap (void *addr, attr, prot, 0, - 0, + (file_handle == ACE_INVALID_HANDLE) ? len : 0, file_mapping_name); } diff --git a/ace/OS_NS_sys_stat.inl b/ace/OS_NS_sys_stat.inl index aaf27b4301d..af93d2e2fa2 100644 --- a/ace/OS_NS_sys_stat.inl +++ b/ace/OS_NS_sys_stat.inl @@ -214,10 +214,11 @@ namespace ACE_OS } else { - stp->st_mode = static_cast<unsigned short>(fdata.dwFileAttributes); + stp->st_mode = static_cast<mode_t>(fdata.dwFileAttributes); stp->st_size = fdata.nFileSizeLow; - stp->st_atime = ACE_Time_Value (fdata.ftLastAccessTime); - stp->st_mtime = ACE_Time_Value (fdata.ftLastWriteTime); + stp->st_atime = ACE_Time_Value (fdata.ftLastAccessTime).sec (); + stp->st_mtime = ACE_Time_Value (fdata.ftLastWriteTime).sec (); + stp->st_ctime = ACE_Time_Value (fdata.ftCreationTime).sec (); } return 0; #elif defined (ACE_HAS_X86_STAT_MACROS) @@ -252,10 +253,11 @@ namespace ACE_OS } else { - stp->st_mode = static_cast<unsigned short>(fdata.dwFileAttributes); + stp->st_mode = static_cast<mode_t>(fdata.dwFileAttributes); stp->st_size = fdata.nFileSizeLow; - stp->st_atime = ACE_Time_Value (fdata.ftLastAccessTime); - stp->st_mtime = ACE_Time_Value (fdata.ftLastWriteTime); + stp->st_atime = ACE_Time_Value (fdata.ftLastAccessTime).sec (); + stp->st_mtime = ACE_Time_Value (fdata.ftLastWriteTime).sec (); + stp->st_ctime = ACE_Time_Value (fdata.ftCreationTime).sec (); } return 0; #elif defined (__BORLANDC__) \ diff --git a/ace/OS_NS_sys_time.inl b/ace/OS_NS_sys_time.inl index 9300e4ac011..604df97926d 100644 --- a/ace/OS_NS_sys_time.inl +++ b/ace/OS_NS_sys_time.inl @@ -26,10 +26,10 @@ ACE_OS::gettimeofday (void) { // ACE_OS_TRACE ("ACE_OS::gettimeofday"); -#if !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32) +#if !defined (ACE_WIN32) timeval tv; int result = 0; -#endif // !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32) +#endif // !defined (ACE_WIN32) #if (0) struct timespec ts; @@ -38,7 +38,7 @@ ACE_OS::gettimeofday (void) tv.tv_sec = ts.tv_sec; tv.tv_usec = ts.tv_nsec / 1000L; // timespec has nsec, but timeval has usec -#elif defined (ACE_HAS_WINCE) +#elif defined (ACE_WIN32) && defined (ACE_LACKS_GETSYSTEMTIMEASFILETIME) SYSTEMTIME tsys; FILETIME tfile; ::GetSystemTime (&tsys); @@ -81,12 +81,12 @@ ACE_OS::gettimeofday (void) ACE_OSCALL (::gettimeofday (&tv), int, -1, result); # endif /* ACE_HAS_SVR4_GETTIMEOFDAY */ #endif /* 0 */ -#if !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32) +#if !defined (ACE_WIN32) if (result == -1) return ACE_Time_Value ((time_t)-1); else return ACE_Time_Value (tv); -#endif // !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32) +#endif // !defined (ACE_WIN32) } #if defined (ACE_WIN32) && defined (_WIN32_WCE) diff --git a/ace/OS_NS_sys_utsname.cpp b/ace/OS_NS_sys_utsname.cpp index f8ec8043fc3..77fbf50faf8 100644 --- a/ace/OS_NS_sys_utsname.cpp +++ b/ace/OS_NS_sys_utsname.cpp @@ -58,7 +58,7 @@ ACE_OS::uname (ACE_utsname *name) ) { // Get information from the two structures - const char *os; + const char *os = 0; if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) os = "Windows NT %d.%d"; else @@ -77,7 +77,7 @@ ACE_OS::uname (ACE_utsname *name) // half the space to the processor and half the space to // subtype. The -1 is necessary for because of the space // between processor and subtype in the machine name. - const int bufsize = (sizeof (name->machine) / 2) - 1; + int const bufsize = (sizeof (name->machine) / 2) - 1; char processor[bufsize] = "Unknown"; char subtype[bufsize] = "Unknown"; diff --git a/ace/OS_NS_sys_wait.h b/ace/OS_NS_sys_wait.h index 59628474ad6..0b172763efa 100644 --- a/ace/OS_NS_sys_wait.h +++ b/ace/OS_NS_sys_wait.h @@ -59,7 +59,7 @@ namespace ACE_OS ACE_HANDLE handle = 0); /** - * Calls @c ::waitpid on UNIX/POSIX platforms Does not work on Vxworks 5.5.x. + * Calls @c ::waitpid on UNIX/POSIX platforms Does not work on VxWorks 5.5.x. * On Win32, @a pid is ignored if the @a handle is not equal to 0. * Passing the process @a handle is prefer on Win32 because using * @a pid to wait on the project doesn't always work correctly diff --git a/ace/OS_NS_time.h b/ace/OS_NS_time.h index c72c8b8fc86..5e927229c38 100644 --- a/ace/OS_NS_time.h +++ b/ace/OS_NS_time.h @@ -25,9 +25,10 @@ # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/OS_NS_errno.h" #include "ace/Basic_Types.h" #include "ace/os_include/os_time.h" +#include "ace/OS_NS_errno.h" + #include /**/ "ace/ACE_export.h" #if defined (ACE_EXPORT_MACRO) @@ -98,6 +99,15 @@ inline long ace_timezone() #if !defined (ACE_LACKS_DIFFTIME) +# if defined (_WIN32_WCE) && (_WIN32_WCE == 0x600) && !defined (_USE_32BIT_TIME_T) + // The WinCE 6.0 SDK ships with a diff_time that uses __time32_t as type + // not time_t. This resolves in compilation warnings because time_t + // can be 64bit. Disable at this momemt the warning for just this method + // else we get two compile warnings on each source file that includes + // this file. +# pragma warning (push) +# pragma warning (disable: 4244) +# endif /// Helper for the ACE_OS::difftime() function /** * We moved the difftime code that used to be in ACE_OS::difftime() @@ -111,6 +121,9 @@ inline double ace_difftime(time_t t1, time_t t0) { return difftime (t1, t0); } +# if defined (_WIN32_WCE) && (_WIN32_WCE == 0x600) && !defined (_USE_32BIT_TIME_T) +# pragma warning (pop) +# endif #endif /* !ACE_LACKS_DIFFTIME */ # if defined (ACE_WIN32) diff --git a/ace/OS_NS_unistd.cpp b/ace/OS_NS_unistd.cpp index 115c7987bec..059d2799dea 100644 --- a/ace/OS_NS_unistd.cpp +++ b/ace/OS_NS_unistd.cpp @@ -486,7 +486,10 @@ ACE_OS::pread (ACE_HANDLE handle, if (original_low_position == INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR) - return -1; + { + ACE_OS::set_errno_to_last_error (); + return -1; + } // Go to the correct position LONG low_offset = ACE_LOW_PART (offset); @@ -497,7 +500,10 @@ ACE_OS::pread (ACE_HANDLE handle, FILE_BEGIN); if (altered_position == INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR) - return -1; + { + ACE_OS::set_errno_to_last_error (); + return -1; + } DWORD bytes_read; @@ -550,7 +556,10 @@ ACE_OS::pread (ACE_HANDLE handle, &original_high_position, FILE_BEGIN) == INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR) - return -1; + { + ACE_OS::set_errno_to_last_error (); + return -1; + } return (ssize_t) bytes_read; @@ -605,27 +614,30 @@ ACE_OS::pwrite (ACE_HANDLE handle, ACE_OS_GUARD // Remember the original file pointer position - LARGE_INTEGER orig_position; - orig_position.QuadPart = 0; - orig_position.LowPart = ::SetFilePointer (handle, - 0, - &orig_position.HighPart, - FILE_CURRENT); - if (orig_position.LowPart == INVALID_SET_FILE_POINTER + LONG original_high_position = 0; + DWORD original_low_position = ::SetFilePointer (handle, + 0, + &original_high_position, + FILE_CURRENT); + + if (original_low_position == INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR) - return -1; + { + ACE_OS::set_errno_to_last_error (); + return -1; + } DWORD bytes_written; - LARGE_INTEGER loffset; - loffset.QuadPart = offset; + LONG low_offset = ACE_LOW_PART (offset); + LONG high_offset = ACE_HIGH_PART (offset); # if defined (ACE_HAS_WIN32_OVERLAPPED_IO) OVERLAPPED overlapped; overlapped.Internal = 0; overlapped.InternalHigh = 0; - overlapped.Offset = loffset.LowPart; - overlapped.OffsetHigh = loffset.HighPart; + overlapped.Offset = low_offset; + overlapped.OffsetHigh = high_offset; overlapped.hEvent = 0; BOOL result = ::WriteFile (handle, @@ -637,35 +649,27 @@ ACE_OS::pwrite (ACE_HANDLE handle, if (result == FALSE) { if (::GetLastError () != ERROR_IO_PENDING) - return -1; - - result = ::GetOverlappedResult (handle, - &overlapped, - &bytes_written, - TRUE); - if (result == FALSE) - return -1; + { + return -1; + } + else + { + result = ::GetOverlappedResult (handle, + &overlapped, + &bytes_written, + TRUE); + if (result == FALSE) + return -1; + } } # else /* ACE_HAS_WIN32_OVERLAPPED_IO */ - // Go to the correct position; if this is a Windows variant without - // overlapped I/O, it probably doesn't have SetFilePointerEx either, - // so manage this with SetFilePointer, changing calls based on the use - // of 64 bit offsets. - DWORD newpos; -# if defined (_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 - newpos = ::SetFilePointer (handle, - loffset.LowPart, - &loffset.HighPart, - FILE_BEGIN); -# else - newpos = ::SetFilePointer (handle, - loffset.LowPart, - 0, - FILE_BEGIN); -# endif /* 64-bit file offsets */ - if (newpos == 0xFFFFFFFF && ::GetLastError () != NO_ERROR) + if (::SetFilePointer (handle, + low_offset, + &high_offset, + FILE_BEGIN) == INVALID_SET_FILE_POINTER + && ::GetLastError () != NO_ERROR) { ACE_OS::set_errno_to_last_error (); return -1; @@ -683,11 +687,14 @@ ACE_OS::pwrite (ACE_HANDLE handle, // Reset the original file pointer position if (::SetFilePointer (handle, - orig_position.LowPart, - &orig_position.HighPart, + original_low_position, + &original_high_position, FILE_BEGIN) == INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR) - return -1; + { + ACE_OS::set_errno_to_last_error (); + return -1; + } return (ssize_t) bytes_written; @@ -851,7 +858,7 @@ ACE_OS::string_to_argv (ACE_TCHAR *buf, { delete [] argp; } - + errno = ENOMEM; return -1; } diff --git a/ace/OS_NS_unistd.h b/ace/OS_NS_unistd.h index ff9ba5a1cc5..b44188cb45a 100644 --- a/ace/OS_NS_unistd.h +++ b/ace/OS_NS_unistd.h @@ -62,7 +62,7 @@ namespace ACE_OS ACE_NAMESPACE_INLINE_FUNCTION long allocation_granularity (void); - // used by ARGV::argv_to_string() and ACE_OS::fork_exec() + /// used by ARGV::argv_to_string() and ACE_OS::fork_exec() extern ACE_Export int argv_to_string (int argc, ACE_TCHAR **argv, @@ -139,7 +139,6 @@ namespace ACE_OS extern ACE_Export pid_t fork_exec (ACE_TCHAR *argv[]); - //@} ACE_NAMESPACE_INLINE_FUNCTION @@ -255,7 +254,7 @@ namespace ACE_OS * <ACE_OS::read> call, which uses the <read> system call on UNIX * and the <ReadFile> call on Win32). If errors occur, -1 is * returned. If EOF occurs, 0 is returned. Whatever data has been - * read will be returned to the caller through<bytes_transferred>. + * read will be returned to the caller through @a bytes_transferred. * */ extern ACE_Export @@ -356,7 +355,7 @@ namespace ACE_OS * calls, which is uses the <write> system call on UNIX and the * <WriteFile> call on Win32). If errors occur, -1 is returned. If * EOF occurs, 0 is returned. Whatever data has been transmitted - * will be returned to the caller through <bytes_transferred>. + * will be returned to the caller through @a bytes_transferred. */ extern ACE_Export ssize_t write_n (ACE_HANDLE handle, diff --git a/ace/OS_NS_unistd.inl b/ace/OS_NS_unistd.inl index 7abf873fd84..7a9f5471ce8 100644 --- a/ace/OS_NS_unistd.inl +++ b/ace/OS_NS_unistd.inl @@ -195,7 +195,10 @@ ACE_INLINE ACE_HANDLE ACE_OS::dup (ACE_HANDLE handle) { ACE_OS_TRACE ("ACE_OS::dup"); -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) +#if defined (ACE_LACKS_DUP) + ACE_UNUSED_ARG (handle); + ACE_NOTSUP_RETURN (ACE_INVALID_HANDLE); +#elif defined (ACE_WIN32) ACE_HANDLE new_fd; if (::DuplicateHandle(::GetCurrentProcess (), handle, @@ -208,15 +211,9 @@ ACE_OS::dup (ACE_HANDLE handle) else ACE_FAIL_RETURN (ACE_INVALID_HANDLE); /* NOTREACHED */ -#elif defined (ACE_HAS_WINCE) - ACE_UNUSED_ARG (handle); - ACE_NOTSUP_RETURN (0); -#elif defined (ACE_LACKS_DUP) - ACE_UNUSED_ARG (handle); - ACE_NOTSUP_RETURN (-1); #else ACE_OSCALL_RETURN (::dup (handle), ACE_HANDLE, ACE_INVALID_HANDLE); -#endif /* ACE_WIN32 && !ACE_HAS_WINCE */ +#endif /* ACE_LACKS_DUP */ } ACE_INLINE int @@ -558,11 +555,10 @@ ACE_OS::hostname (wchar_t name[], size_t maxnamelen) #else /* ACE_WIN32 && !ACE_HAS_WINCE */ // Emulate using the char version char *char_name = 0; - int result = 0; ACE_NEW_RETURN (char_name, char[maxnamelen], -1); - result = ACE_OS::hostname(char_name, maxnamelen); + int result = ACE_OS::hostname(char_name, maxnamelen); ACE_OS::strcpy (name, ACE_Ascii_To_Wide (char_name).wchar_rep ()); delete [] char_name; diff --git a/ace/OS_NS_wctype.cpp b/ace/OS_NS_wctype.cpp new file mode 100644 index 00000000000..4a25bfd79e3 --- /dev/null +++ b/ace/OS_NS_wctype.cpp @@ -0,0 +1,11 @@ +// -*- C++ -*- +// $Id$ + +#include "ace/OS_NS_wctype.h" + +ACE_RCSID(ace, OS_NS_wctype, "$Id$") + +#if !defined (ACE_HAS_INLINED_OSCALLS) +# include "ace/OS_NS_wctype.inl" +#endif /* ACE_HAS_INLINED_OSCALLS */ + diff --git a/ace/OS_NS_wctype.h b/ace/OS_NS_wctype.h new file mode 100644 index 00000000000..58b740001a4 --- /dev/null +++ b/ace/OS_NS_wctype.h @@ -0,0 +1,71 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file OS_NS_wctype.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +//============================================================================= + +#ifndef ACE_OS_NS_WCTYPE_H +# define ACE_OS_NS_WCTYPE_H + +# include /**/ "ace/pre.h" + +# include "ace/config-all.h" + +# if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +# endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include /**/ "ace/ACE_export.h" + +#if defined (ACE_EXPORT_MACRO) +# undef ACE_EXPORT_MACRO +#endif +#define ACE_EXPORT_MACRO ACE_Export + +#include "ace/os_include/os_ctype.h" +#if defined ACE_HAS_WCHAR +# include "ace/os_include/os_wctype.h" +#endif /* ACE_HAS_WCHAR */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS { + + // these are non-standard names... + + /** @name Functions from <cctype> + * + * Included are the functions defined in <cctype> and their <cwctype> + * equivalents. + * + * Since they are often implemented as macros, we don't use the same name + * here. Instead, we change by prepending "ace_". + */ + //@{ +#if defined (ACE_HAS_WCHAR) + /// Tests @a c for the property specified by the @a desc argument + ACE_NAMESPACE_INLINE_FUNCTION + int ace_iswctype(wint_t c, wctype_t desc); +#endif /* ACE_HAS_WCHAR */ + //@} + +} /* namespace ACE_OS */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +# if defined (ACE_HAS_INLINED_OSCALLS) +# if defined (ACE_INLINE) +# undef ACE_INLINE +# endif /* ACE_INLINE */ +# define ACE_INLINE inline +# include "ace/OS_NS_wctype.inl" +# endif /* ACE_HAS_INLINED_OSCALLS */ + +# include /**/ "ace/post.h" +#endif /* ACE_OS_NS_WCTYPE_H */ diff --git a/ace/OS_NS_wctype.inl b/ace/OS_NS_wctype.inl new file mode 100644 index 00000000000..9fc6321e64a --- /dev/null +++ b/ace/OS_NS_wctype.inl @@ -0,0 +1,25 @@ +// -*- C++ -*- +// +// $Id$ + +#if defined (ACE_LACKS_ISWCTYPE) +#include "ace/OS_NS_errno.h" +#endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_HAS_WCHAR) +ACE_INLINE int +ACE_OS::ace_iswctype(wint_t c, wctype_t desc) +{ +#if !defined (ACE_LACKS_ISWCTYPE) + return iswctype (c, desc); +#else + ACE_UNUSED_ARG (c); + ACE_UNUSED_ARG (desc); + ACE_NOTSUP_RETURN (-1); +#endif +} +#endif /* ACE_HAS_WCHAR */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_main.cpp b/ace/OS_main.cpp index 6d931fbd4b6..47c6992339a 100644 --- a/ace/OS_main.cpp +++ b/ace/OS_main.cpp @@ -4,6 +4,8 @@ ACE_RCSID(ace, OS_main, "$Id$") +#if !defined (ACE_DOESNT_DEFINE_MAIN) + #if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) && !defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER) #include "ace/Init_ACE.h" @@ -111,12 +113,21 @@ int ACE_Main_Base::run (HINSTANCE, int) { ACE_TCHAR cmdline[1024]; - ACE_OS::strcpy (cmdline, ACE_TEXT ("program ")); + ACE_TCHAR msg_file [MAXPATHLEN]; + if (ACE_TEXT_GetModuleFileName (0, msg_file, MAXPATHLEN)) + { + ACE_OS::strcpy (cmdline, msg_file); + ACE_OS::strcat (cmdline, ACE_TEXT (" ")); + } + else + { + ACE_OS::strcpy (cmdline, ACE_TEXT ("program ")); + } ACE_OS::strcat (cmdline, ACE_TEXT_WCHAR_TO_TCHAR (lpCmdLine)); ACE_ARGV ce_argv (cmdline); ACE::init (); ACE_MAIN_OBJECT_MANAGER - int i = this->run_i (ce_argv.argc (), ce_argv.argv ()); + int const i = this->run_i (ce_argv.argc (), ce_argv.argv ()); ACE::fini (); return i; } @@ -124,4 +135,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL # endif /* !ACE_HAS_WINCE */ -# endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_HAS_WINCE && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */ +#endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_HAS_WINCE && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */ + +#endif /* ACE_DOESNT_DEFINE_MAIN */ + diff --git a/ace/OS_main.h b/ace/OS_main.h index aa9cb9916c6..ec7a43945dd 100644 --- a/ace/OS_main.h +++ b/ace/OS_main.h @@ -25,6 +25,8 @@ # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ +# if !defined (ACE_DOESNT_DEFINE_MAIN) + # if defined (ACE_HAS_RTEMS) extern char* rtems_progname; # endif /* ACE_HAS_RTEMS */ @@ -300,6 +302,8 @@ int ace_main_i # endif /* ACE_PSOSIM */ # endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_HAS_WINCE && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */ +#endif /* ACE_DOESNT_DEFINE_MAIN */ + # include /**/ "ace/post.h" #endif /* ACE_OS_MAIN_H */ diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp index 43b74703120..f6986c58c6e 100644 --- a/ace/Object_Manager.cpp +++ b/ace/Object_Manager.cpp @@ -465,6 +465,21 @@ ACE_Object_Manager::at_exit_i (void *object, return exit_info_.at_exit_i (object, cleanup_hook, param); } +int +ACE_Object_Manager::remove_at_exit_i (void *object) +{ + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, + *instance_->internal_lock_, -1)); + + if (shutting_down_i ()) + { + errno = EAGAIN; + return -1; + } + + return exit_info_.remove (object); +} + #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) int @@ -531,7 +546,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_Thread_Mutex *&lock) if (lock == 0) { - ACE_Cleanup_Adapter<ACE_Thread_Mutex> *lock_adapter; + ACE_Cleanup_Adapter<ACE_Thread_Mutex> *lock_adapter = 0; ACE_NEW_RETURN (lock_adapter, ACE_Cleanup_Adapter<ACE_Thread_Mutex>, -1); @@ -579,7 +594,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_Mutex *&lock) if (lock == 0) { - ACE_Cleanup_Adapter<ACE_Mutex> *lock_adapter; + ACE_Cleanup_Adapter<ACE_Mutex> *lock_adapter = 0; ACE_NEW_RETURN (lock_adapter, ACE_Cleanup_Adapter<ACE_Mutex>, -1); @@ -663,7 +678,7 @@ ACE_Object_Manager::get_singleton_lock (ACE_RW_Thread_Mutex *&lock) if (lock == 0) { - ACE_Cleanup_Adapter<ACE_RW_Thread_Mutex> *lock_adapter; + ACE_Cleanup_Adapter<ACE_RW_Thread_Mutex> *lock_adapter = 0; ACE_NEW_RETURN (lock_adapter, ACE_Cleanup_Adapter<ACE_RW_Thread_Mutex>, -1); diff --git a/ace/Object_Manager.h b/ace/Object_Manager.h index 8481aa15e99..bb2d4f83b50 100644 --- a/ace/Object_Manager.h +++ b/ace/Object_Manager.h @@ -256,8 +256,8 @@ public: * that is called for the object or array when it to be destroyed. * It may perform any necessary cleanup specific for that object or * its class. "param" is passed as the second parameter to the - * "cleanup_hook" function; the first parameter is the object (or - * array) to be destroyed. "cleanup_hook", for example, may delete + * @a cleanup_hook function; the first parameter is the object (or + * array) to be destroyed. @a cleanup_hook, for example, may delete * the object (or array). For OS's that do not have processes, this * function is the same as <at_thread_exit>. Returns 0 on success. * On failure, returns -1 and sets errno to: EAGAIN if shutting @@ -268,6 +268,8 @@ public: ACE_CLEANUP_FUNC cleanup_hook, void *param); + static int remove_at_exit (void *object); + #if 0 /* not implemented yet */ /// Similar to <at_exit>, except that the cleanup_hook is called /// when the current thread exits instead of when the program terminates. @@ -345,6 +347,10 @@ private: /// See description of static version above for return values. int at_exit_i (void *object, ACE_CLEANUP_FUNC cleanup_hook, void *param); + /// Remove an object for deletion at program termination. + /// See description of static version above for return values. + int remove_at_exit_i (void *object); + #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) public: // = The <get_singleton_lock> accessors are for internal diff --git a/ace/Object_Manager.inl b/ace/Object_Manager.inl index bb95a485fdc..38f485a90d9 100644 --- a/ace/Object_Manager.inl +++ b/ace/Object_Manager.inl @@ -28,6 +28,13 @@ ACE_Object_Manager::at_exit (void *object, } ACE_INLINE +int +ACE_Object_Manager::remove_at_exit (void *object) +{ + return ACE_Object_Manager::instance ()->remove_at_exit_i (object); +} + +ACE_INLINE ACE_Sig_Set & ACE_Object_Manager::default_mask (void) { diff --git a/ace/Object_Manager_Base.cpp b/ace/Object_Manager_Base.cpp index 866f999871b..4197d0d114d 100644 --- a/ace/Object_Manager_Base.cpp +++ b/ace/Object_Manager_Base.cpp @@ -83,8 +83,8 @@ void *ACE_OS_Object_Manager::preallocated_object[ ACE_OS_Object_Manager::ACE_OS_PREALLOCATED_OBJECTS] = { 0 }; ACE_OS_Object_Manager::ACE_OS_Object_Manager (void) - // default_mask_ isn't initialized, because it's defined by <init>. - : thread_hook_ (0) + : default_mask_ (0) + , thread_hook_ (0) , exit_info_ () #if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) , seh_except_selector_ (ACE_SEH_Default_Exception_Selector) diff --git a/ace/Object_Manager_Base.h b/ace/Object_Manager_Base.h index a67c5ceeec8..77e8c6802c0 100644 --- a/ace/Object_Manager_Base.h +++ b/ace/Object_Manager_Base.h @@ -104,7 +104,7 @@ protected: /** * Flag indicating whether the ACE_Object_Manager was dynamically - * allocated by ACE. (If is was dynamically allocated by the + * allocated by ACE. (If is was dynamically allocated by the * application, then the application is responsible for destroying * it.) */ diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp index fab2580bcc7..bcd9cb7229e 100644 --- a/ace/Parse_Node.cpp +++ b/ace/Parse_Node.cpp @@ -15,15 +15,14 @@ ACE_RCSID (ace, Parse_Node, "$Id$") - - ACE_BEGIN_VERSIONED_NAMESPACE_DECL +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE (ACE_Stream_Node) // Provide the class hierarchy that defines the parse tree of Service // Nodes. - void +void ACE_Stream_Node::dump (void) const { #if defined (ACE_HAS_DUMP) @@ -58,9 +57,12 @@ ACE_Stream_Node::apply (ACE_Service_Gestalt *config, int &yyerrno) if (yyerrno != 0) { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("dynamic initialization failed for Module %s\n"), - module->name ())); + if (ACE::debug ()) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("dynamic initialization failed for Module %s\n"), + module->name ())); + } ++yyerrno; } @@ -71,9 +73,12 @@ ACE_Stream_Node::apply (ACE_Service_Gestalt *config, int &yyerrno) if (st->push (mt) == -1) { - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("dynamic initialization failed for Stream %s\n"), - this->node_->name ())); + if (ACE::debug ()) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("dynamic initialization failed for Stream %s\n"), + this->node_->name ())); + } ++yyerrno; } @@ -465,11 +470,14 @@ ACE_Location_Node::open_dll (int & yyerrno) ++yyerrno; #ifndef ACE_NLOGGING - ACE_TCHAR *errmsg = this->dll_.error (); - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) LN::open_dll - Failed to open %s: %s\n"), - this->pathname (), - errmsg ? errmsg : ACE_TEXT ("no error reported"))); + if (ACE::debug ()) + { + ACE_TCHAR *errmsg = this->dll_.error (); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) LN::open_dll - Failed to open %s: %s\n"), + this->pathname (), + errmsg ? errmsg : ACE_TEXT ("no error reported"))); + } #endif /* ACE_NLOGGING */ return -1; @@ -521,12 +529,15 @@ ACE_Object_Node::symbol (ACE_Service_Gestalt *, ++yyerrno; #ifndef ACE_NLOGGING - ACE_TCHAR *errmsg = this->dll_.error (); - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) DLL::symbol -") - ACE_TEXT (" Failed for object %s: %s\n"), - object_name, - errmsg ? errmsg : ACE_TEXT ("no error reported"))); + if (ACE::debug ()) + { + ACE_TCHAR *errmsg = this->dll_.error (); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) DLL::symbol -") + ACE_TEXT (" Failed for object %s: %s\n"), + object_name, + errmsg ? errmsg : ACE_TEXT ("no error reported"))); + } #endif /* ACE_NLOGGING */ return 0; @@ -647,12 +658,15 @@ ACE_Function_Node::symbol (ACE_Service_Gestalt *, ++yyerrno; #ifndef ACE_NLOGGING - ACE_TCHAR * const errmsg = this->dll_.error (); - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("DLL::symbol failed for function %s: ") - ACE_TEXT ("%s\n"), - function_name, - errmsg ? errmsg : ACE_TEXT ("no error reported"))); + if (ACE::debug ()) + { + ACE_TCHAR * const errmsg = this->dll_.error (); + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("DLL::symbol failed for function %s: ") + ACE_TEXT ("%s\n"), + function_name, + errmsg ? errmsg : ACE_TEXT ("no error reported"))); + } #endif /* ACE_NLOGGING */ return 0; @@ -673,10 +687,13 @@ ACE_Function_Node::symbol (ACE_Service_Gestalt *, if (this->symbol_ == 0) { ++yyerrno; - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - this->function_name_), - 0); + if (ACE::debug ()) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + this->function_name_)); + } + return 0; } } return this->symbol_; @@ -766,11 +783,14 @@ ACE_Static_Function_Node::symbol (ACE_Service_Gestalt *config, if (config->find_static_svc_descriptor (this->function_name_, &ssd) == -1) { ++yyerrno; - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) No static service ") - ACE_TEXT ("registered for function %s\n"), - this->function_name_), - 0); + if (ACE::debug ()) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) No static service ") + ACE_TEXT ("registered for function %s\n"), + this->function_name_)); + } + return 0; } if (ssd->alloc_ == 0) @@ -781,11 +801,14 @@ ACE_Static_Function_Node::symbol (ACE_Service_Gestalt *config, { ++yyerrno; - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("(%P|%t) No static service factory ") - ACE_TEXT ("function registered for function %s\n"), - this->function_name_), - 0); + if (ACE::debug ()) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("(%P|%t) No static service factory ") + ACE_TEXT ("function registered for function %s\n"), + this->function_name_)); + } + return 0; } } @@ -795,10 +818,13 @@ ACE_Static_Function_Node::symbol (ACE_Service_Gestalt *config, if (this->symbol_ == 0) { ++yyerrno; - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%p\n"), - this->function_name_), - 0); + if (ACE::debug ()) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("%p\n"), + this->function_name_)); + } + return 0; } return this->symbol_; @@ -834,7 +860,7 @@ ACE_Service_Type_Factory::make_service_type (ACE_Service_Gestalt *cfg) const { ACE_TRACE ("ACE_Service_Type_Factory::make_service_type"); - u_int flags = ACE_Service_Type::DELETE_THIS + u_int const flags = ACE_Service_Type::DELETE_THIS | (this->location_->dispose () == 0 ? 0 : ACE_Service_Type::DELETE_OBJ); int yyerrno = 0; @@ -864,10 +890,13 @@ ACE_Service_Type_Factory::make_service_type (ACE_Service_Gestalt *cfg) const } #ifndef ACE_NLOGGING - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("ACE (%P|%t) Unable to create ") - ACE_TEXT ("service object for %s\n"), - this->name ())); + if (ACE::debug ()) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ACE (%P|%t) Unable to create ") + ACE_TEXT ("service object for %s\n"), + this->name ())); + } #endif ++yyerrno; return 0; diff --git a/ace/Ping_Socket.cpp b/ace/Ping_Socket.cpp index 91395732de3..573a78451f1 100644 --- a/ace/Ping_Socket.cpp +++ b/ace/Ping_Socket.cpp @@ -9,6 +9,7 @@ #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_sys_socket.h" +# include "ace/OS_NS_unistd.h" #if !defined (__ACE_INLINE__) # include "ace/Ping_Socket.inl" @@ -248,14 +249,15 @@ ACE_Ping_Socket::process_incoming_dgram (char * ptr, ssize_t len) ACE_TEXT ("(%P|%t) ACE_Ping_Socket::process_incoming_dgram") ACE_TEXT (" - ICMP_ECHOREPLY received.\n"))); - if (icmp->icmp_id != getpid ()) + if (icmp->icmp_id != (ACE_OS::getpid () & 0xFFFF)) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("(%P|%t) ACE_Ping_Socket::") ACE_TEXT ("process_incoming_dgram ") - ACE_TEXT ("- The ICMP header received is a reply") - ACE_TEXT (" to request of another process.")), + ACE_TEXT ("- The ICMP header received is a reply to request ") + ACE_TEXT ("of another process (%d; expected %d).\n"), + icmp->icmp_id, ACE_OS::getpid()), -1); } if (icmplen < 16) @@ -329,7 +331,7 @@ ACE_Ping_Socket::send_echo_check (ACE_INET_Addr &remote_addr, _icmp = (struct icmp *) this->icmp_send_buff_; _icmp->icmp_type = ICMP_ECHO; _icmp->icmp_code = 0; - _icmp->icmp_id = getpid (); + _icmp->icmp_id = ACE_OS::getpid () & 0xFFFF; _icmp->icmp_seq = sequence_number_++; #if defined (ACE_WIN32) diff --git a/ace/Process.cpp b/ace/Process.cpp index 0640892ee4f..acd4b7c9ab5 100644 --- a/ace/Process.cpp +++ b/ace/Process.cpp @@ -17,6 +17,7 @@ #include "ace/OS_NS_errno.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_fcntl.h" #include "ace/OS_Memory.h" #include "ace/Countdown_Time.h" #include "ace/Truncate.h" @@ -143,7 +144,7 @@ ACE_Process::spawn (ACE_Process_Options &options) options.command_line_buf(), options.get_process_attributes(), // must be NULL in CE options.get_thread_attributes(), // must be NULL in CE - options.handle_inheritence(), // must be false in CE + options.handle_inheritance(), // must be false in CE options.creation_flags(), // must be NULL in CE options.env_buf(), // environment variables, must be NULL in CE options.working_directory(), // must be NULL in CE @@ -175,7 +176,7 @@ ACE_Process::spawn (ACE_Process_Options &options) options.command_line_buf (), options.get_process_attributes (), options.get_thread_attributes (), - options.handle_inheritence (), + options.handle_inheritance (), flags, env_buf, // environment variables options.working_directory (), @@ -454,6 +455,16 @@ ACE_Process::spawn (ACE_Process_Options &options) ACE_OS::close (options.get_stdin ()); ACE_OS::close (options.get_stdout ()); ACE_OS::close (options.get_stderr ()); + if (!options.handle_inheritance ()) + { + // Set close-on-exec for all FDs except standard handles + for (int i = ACE::max_handles () - 1; i >= 0; i--) + { + if (i == ACE_STDIN || i == ACE_STDOUT || i == ACE_STDERR) + continue; + ACE_OS::fcntl (i, F_SETFD, FD_CLOEXEC); + } + } // If we must, set the working directory for the child // process. @@ -795,7 +806,6 @@ ACE_Process_Options::ACE_Process_Options (bool inherit_environment, #if !defined (ACE_HAS_WINCE) #if defined (ACE_WIN32) environment_inherited_ (0), - handle_inheritence_ (TRUE), process_attributes_ (0), thread_attributes_ (0), #else /* ACE_WIN32 */ @@ -807,6 +817,7 @@ ACE_Process_Options::ACE_Process_Options (bool inherit_environment, rgid_ ((uid_t) -1), egid_ ((uid_t) -1), #endif /* ACE_WIN32 */ + handle_inheritance_ (true), set_handles_called_ (0), environment_buf_index_ (0), environment_argv_index_ (0), @@ -825,6 +836,7 @@ ACE_Process_Options::ACE_Process_Options (bool inherit_environment, ACE_NEW (command_line_buf_, ACE_TCHAR[command_line_buf_len]); command_line_buf_[0] = '\0'; + process_name_[0] = '\0'; #if !defined (ACE_HAS_WINCE) working_directory_[0] = '\0'; @@ -834,7 +846,6 @@ ACE_Process_Options::ACE_Process_Options (bool inherit_environment, ACE_TCHAR *[max_env_args]); environment_buf_[0] = '\0'; environment_argv_[0] = 0; - process_name_[0] = '\0'; #if defined (ACE_WIN32) ACE_OS::memset ((void *) &this->startup_info_, 0, @@ -915,24 +926,6 @@ ACE_Process_Options::env_argv (void) #endif /* ACE_WIN32 */ -void -ACE_Process_Options::enable_unicode_environment (void) -{ - this->use_unicode_environment_ = true; -} - -void -ACE_Process_Options::disable_unicode_environment (void) -{ - this->use_unicode_environment_ = false; -} - -bool -ACE_Process_Options::use_unicode_environment (void) const -{ - return this->use_unicode_environment_; -} - int ACE_Process_Options::setenv (ACE_TCHAR *envp[]) { diff --git a/ace/Process.h b/ace/Process.h index 241f65839d3..0ab94c2f7a7 100644 --- a/ace/Process.h +++ b/ace/Process.h @@ -113,7 +113,7 @@ public: * Set a single environment variable, @a variable_name. Since * different platforms separate each environment variable * differently, you must call this method once for each variable. - * <format> can be any printf format string. So options->setenv + * @a format can be any printf format string. So options->setenv * ("FOO","one + two = %s", "three") will result in "FOO=one + two = * three". */ @@ -220,9 +220,9 @@ public: /// ACE_Process_Manager to manage groups of processes. pid_t setgroup (pid_t pgrp); - /// Allows disabling of handle inheritence, default is TRUE. - int handle_inheritence (void); - void handle_inheritence (int); + /// Allows disabling of handle inheritance, default is TRUE. + int handle_inheritance (void); + void handle_inheritance (int); /// Cause the specified handle to be passed to a child process /// when it runs a new program image. @@ -351,9 +351,6 @@ protected: ACE_TEXT_STARTUPINFO startup_info_; - /// Default TRUE. - BOOL handle_inheritence_; - /// Pointer to security_buf1_. LPSECURITY_ATTRIBUTES process_attributes_; @@ -379,6 +376,9 @@ protected: uid_t egid_; #endif /* ACE_WIN32 */ + /// Default true. + bool handle_inheritance_; + #if !defined (ACE_HAS_WINCE) /// Is 1 if stdhandles was called. int set_handles_called_; @@ -439,7 +439,7 @@ protected: ACE_TCHAR process_name_[MAXPATHLEN + 1]; /// Indicate if a Unicode environment should be used - bool use_unicode_environment_; + bool use_unicode_environment_; }; //class ACE_Process_Manager; diff --git a/ace/Process.inl b/ace/Process.inl index 228874778ce..e77db92f5bc 100644 --- a/ace/Process.inl +++ b/ace/Process.inl @@ -10,6 +10,24 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL +ACE_INLINE void +ACE_Process_Options::enable_unicode_environment (void) +{ + this->use_unicode_environment_ = true; +} + +ACE_INLINE void +ACE_Process_Options::disable_unicode_environment (void) +{ + this->use_unicode_environment_ = false; +} + +ACE_INLINE bool +ACE_Process_Options::use_unicode_environment (void) const +{ + return this->use_unicode_environment_; +} + #if defined (ACE_WIN32) ACE_INLINE PROCESS_INFORMATION @@ -129,24 +147,15 @@ ACE_Process_Options::setgroup (pid_t pgrp) } ACE_INLINE int -ACE_Process_Options::handle_inheritence (void) +ACE_Process_Options::handle_inheritance (void) { -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) - return handle_inheritence_; -#else - ACE_NOTSUP_RETURN (0); // This is a benign error. -#endif /* ACE_WIN32 && ! ACE_HAS_WINCE */ + return handle_inheritance_; } ACE_INLINE void -ACE_Process_Options::handle_inheritence (int hi) +ACE_Process_Options::handle_inheritance (int hi) { -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) - handle_inheritence_ = hi; -#else - ACE_UNUSED_ARG (hi); - ACE_NOTSUP; -#endif /* !ACE_HAS_WINCE */ + handle_inheritance_ = hi; } ACE_INLINE int diff --git a/ace/Process_Manager.cpp b/ace/Process_Manager.cpp index 369584cf4b4..773326da2c9 100644 --- a/ace/Process_Manager.cpp +++ b/ace/Process_Manager.cpp @@ -427,7 +427,7 @@ ACE_Process_Manager::spawn (ACE_Process_Options &options, ACE_Managed_Process, ACE_INVALID_PID); - pid_t const pid = spawn (process, options, event_handler); + pid_t const pid = this->spawn (process, options, event_handler); if (pid == ACE_INVALID_PID || pid == 0) delete process; diff --git a/ace/QoS/qos.mpc b/ace/QoS/qos.mpc index f8f19077285..5e9dc059ac8 100644 --- a/ace/QoS/qos.mpc +++ b/ace/QoS/qos.mpc @@ -7,7 +7,7 @@ project(QoS) : acelib, ace_output, install { dynamicflags = ACE_QoS_BUILD_DLL macros += ACE_HAS_QOS - specific(bmake, nmake, em3, vc6, vc7, vc71, vc8, vc9) { + specific(bmake, nmake, em3, vc6, vc7, vc71, vc8, vc9, vc10) { macros += ACE_HAS_WINSOCK2_GQOS } diff --git a/ace/RW_Mutex.cpp b/ace/RW_Mutex.cpp index bfeac13c30b..319158da641 100644 --- a/ace/RW_Mutex.cpp +++ b/ace/RW_Mutex.cpp @@ -35,7 +35,7 @@ ACE_RW_Mutex::dump (void) const } ACE_RW_Mutex::ACE_RW_Mutex (int type, const ACE_TCHAR *name, void *arg) - : removed_ (0) + : removed_ (false) { // ACE_TRACE ("ACE_RW_Mutex::ACE_RW_Mutex"); if (ACE_OS::rwlock_init (&this->lock_, type, name, arg) != 0) diff --git a/ace/RW_Mutex.h b/ace/RW_Mutex.h index 1bc6b258d2b..1abed623c5f 100644 --- a/ace/RW_Mutex.h +++ b/ace/RW_Mutex.h @@ -120,7 +120,7 @@ protected: /// destructor. This flag isn't protected by a lock, so make sure /// that you don't have multiple threads simultaneously calling /// <remove> on the same object, which is a bad idea anyway... - int removed_; + bool removed_; private: // = Prevent assignment and initialization. diff --git a/ace/RW_Mutex.inl b/ace/RW_Mutex.inl index 47b95a3bb94..947bb409744 100644 --- a/ace/RW_Mutex.inl +++ b/ace/RW_Mutex.inl @@ -16,9 +16,9 @@ ACE_RW_Mutex::remove (void) { // ACE_TRACE ("ACE_RW_Mutex::remove"); int result = 0; - if (this->removed_ == 0) + if (!this->removed_) { - this->removed_ = 1; + this->removed_ = true; result = ACE_OS::rwlock_destroy (&this->lock_); } return result; diff --git a/ace/SOCK_Connector.cpp b/ace/SOCK_Connector.cpp index 2dda434d258..0d737ef7e34 100644 --- a/ace/SOCK_Connector.cpp +++ b/ace/SOCK_Connector.cpp @@ -97,8 +97,7 @@ ACE_SOCK_Connector::shared_connect_start (ACE_SOCK_Stream &new_stream, } // Enable non-blocking, if required. - if (timeout != 0 - && new_stream.enable (ACE_NONBLOCK) == -1) + if (timeout != 0 && new_stream.enable (ACE_NONBLOCK) == -1) return -1; else return 0; @@ -119,8 +118,7 @@ ACE_SOCK_Connector::shared_connect_finish (ACE_SOCK_Stream &new_stream, if (error == EINPROGRESS || error == EWOULDBLOCK) { // This expression checks if we were polling. - if (timeout->sec () == 0 - && timeout->usec () == 0) + if (*timeout == ACE_Time_Value::zero) { #if defined(ACE_WIN32) // In order to detect when the socket that has been @@ -164,10 +162,18 @@ ACE_SOCK_Connector::shared_connect_finish (ACE_SOCK_Stream &new_stream, // EISCONN is treated specially since this routine may be used to // check if we are already connected. if (result != -1 || error == EISCONN) - // Start out with non-blocking disabled on the <new_stream>. - new_stream.disable (ACE_NONBLOCK); + { + // Start out with non-blocking disabled on the new_stream. + result = new_stream.disable (ACE_NONBLOCK); + if (result == -1) + { + new_stream.close (); + } + } else if (!(error == EWOULDBLOCK || error == ETIMEDOUT)) - new_stream.close (); + { + new_stream.close (); + } return result; } diff --git a/ace/SOCK_Dgram_Mcast.h b/ace/SOCK_Dgram_Mcast.h index a7e668b4be0..48f1610ad20 100644 --- a/ace/SOCK_Dgram_Mcast.h +++ b/ace/SOCK_Dgram_Mcast.h @@ -201,7 +201,7 @@ public: /** * This method is optional; if not explicitly invoked, it is invoked by * the first <subscribe>, using the subscribed address/port# and network - * interface paramters. + * interface parameters. * The <mcast_addr> parameter defines the default send address/port# and * also the port# and, if the OPT_BINDADDR_YES option is used, * the multicast address that is bound to this socket. diff --git a/ace/SOCK_SEQPACK_Association.cpp b/ace/SOCK_SEQPACK_Association.cpp index 9a17e0ddb33..bce96750f20 100644 --- a/ace/SOCK_SEQPACK_Association.cpp +++ b/ace/SOCK_SEQPACK_Association.cpp @@ -96,7 +96,11 @@ ACE_SOCK_SEQPACK_Association::get_local_addrs (ACE_INET_Addr *addrs, size_t &siz int err = 0; size_t len = 0; +#ifndef ACE_HAS_VOID_PTR_SCTP_GETLADDRS err = sctp_getladdrs(this->get_handle(), 0, &laddrs); +#else + err = sctp_getladdrs(this->get_handle(), 0, reinterpret_cast<void**>(&laddrs)); +#endif /* ACE_HAS_VOID_PTR_SCTP_GETPADDRS */ if (err > 0) { len = err; @@ -230,7 +234,12 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si int err = 0; size_t len = 0; +#ifndef ACE_HAS_VOID_PTR_SCTP_GETPADDRS err = sctp_getpaddrs(this->get_handle(), 0, &paddrs); +#else + err = sctp_getpaddrs(this->get_handle(), 0, reinterpret_cast<void**>(&paddrs)); +#endif /* ACE_HAS_VOID_PTR_SCTP_GETPADDRS */ + if (err > 0) { len = err; diff --git a/ace/SOCK_SEQPACK_Connector.cpp b/ace/SOCK_SEQPACK_Connector.cpp index 7027b460fe7..e56253b1b6f 100644 --- a/ace/SOCK_SEQPACK_Connector.cpp +++ b/ace/SOCK_SEQPACK_Connector.cpp @@ -243,8 +243,7 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_finish (ACE_SOCK_SEQPACK_Association if (error == EINPROGRESS || error == EWOULDBLOCK) { // This expression checks if we were polling. - if (timeout->sec () == 0 - && timeout->usec () == 0) + if (*timeout == ACE_Time_Value::zero) error = EWOULDBLOCK; // Wait synchronously using timeout. else if (this->complete (new_association, diff --git a/ace/SSL/Makefile.am b/ace/SSL/Makefile.am index 135fa9b937b..3b244c2eab0 100644 --- a/ace/SSL/Makefile.am +++ b/ace/SSL/Makefile.am @@ -47,6 +47,7 @@ libACE_SSL_la_LIBADD = \ nobase_include_HEADERS = \ SSL_Asynch_BIO.h \ SSL_Asynch_Stream.h \ + SSL_Asynch_Stream.inl \ SSL_Context.h \ SSL_Context.inl \ SSL_Export.h \ diff --git a/ace/SSL/SSL_Asynch_Stream.cpp b/ace/SSL/SSL_Asynch_Stream.cpp index 216f6cfd962..c3625fdfce2 100644 --- a/ace/SSL/SSL_Asynch_Stream.cpp +++ b/ace/SSL/SSL_Asynch_Stream.cpp @@ -17,6 +17,10 @@ ACE_RCSID (ACE_SSL, #include "ace/Proactor.h" #include "ace/Truncate.h" +#if !defined(__ACE_INLINE__) +#include "SSL_Asynch_Stream.inl" +#endif /* __ACE_INLINE__ */ + #include <openssl/err.h> ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -100,6 +104,7 @@ ACE_SSL_Asynch_Stream::ACE_SSL_Asynch_Stream ( ext_write_result_(0), flags_ (0), ssl_ (0), + handshake_complete_(false), bio_ (0), bio_istream_ (), bio_inp_msg_ (), @@ -491,7 +496,18 @@ int ACE_SSL_Asynch_Stream::do_SSL_handshake (void) { if (SSL_is_init_finished (this->ssl_)) - return 1; + { + if (!handshake_complete_) + { + handshake_complete_ = true; + + if (!post_handshake_check ()) + { + return -1; + } + } + return 1; + } if (this->flags_ & SF_REQ_SHUTDOWN) return -1; @@ -541,6 +557,13 @@ ACE_SSL_Asynch_Stream::do_SSL_handshake (void) return 1; } + +bool +ACE_SSL_Asynch_Stream::post_handshake_check (void) +{ + return true; +} + // ************************************************************ // Perform SSL_read call if necessary and notify user // ************************************************************ @@ -768,7 +791,7 @@ ACE_SSL_Asynch_Stream::print_error (int err_ssl, const ACE_TCHAR * pText) { ACE_DEBUG ((LM_DEBUG, - "SSL-error:%d %s\n" , + ACE_TEXT("SSL-error:%d %s\n"), err_ssl, pText)); @@ -781,7 +804,7 @@ ACE_SSL_Asynch_Stream::print_error (int err_ssl, { ERR_error_string_n (lerr, buf, sizeof buf); - ACE_DEBUG ((LM_DEBUG, "%s\n", buf)); + ACE_DEBUG ((LM_DEBUG, "%C\n", buf)); } #endif /* OPENSSL_VERSION_NUMBER */ } diff --git a/ace/SSL/SSL_Asynch_Stream.h b/ace/SSL/SSL_Asynch_Stream.h index 671cca46c24..266410851f0 100644 --- a/ace/SSL/SSL_Asynch_Stream.h +++ b/ace/SSL/SSL_Asynch_Stream.h @@ -185,6 +185,9 @@ public: int close (void); + /// Return a pointer to the underlying SSL structure. + SSL *ssl (void) const; + /** * Initializes the factory with information which will be used with * each asynchronous call. @@ -295,6 +298,40 @@ protected: virtual void handle_wakeup (void); /** + * This method will be called after a successful SSL handshake indicating + * that the peer's certificate chain (if any) has been verified and the key + * exchange has completed. When a peer certificate is required, this + * method must be used to perform additional checks beyond the verification + * performed by OpenSSL. + * + * Check 1: + * + * SSL clients that require a peer certificate must specify SSL_VERIFY_PEER + * via ACE_SSL_Context::default_verify_mode. If the peer sends an invalid + * certificate, the SSL handshake will fail; however, if the peer does not + * send a certificate, the SSL handshake will complete successfully which + * may not be acceptable. In this case, you must override this method in a + * subclass and return false if the call to SSL_get_peer_certificate returns + * null. + * + * Check 2: + * + * An additional post handshake check that you should perform is to verify + * the certificate's FQDN against the host address you intended to connect + * to. This check will prevent an attacker from using a certificate signed + * by your CA to usurp your session. For further info on this check, see + * the post_connection_check method in Example 5-8 of 'Network Security with + * OpenSSL' by Viega, et. al. + * + * Return: + * + * false - Terminate the connection. Outstanding IO complete with ERR_CANCELED. + * + * true - Proceed with connection. The default implementation returns true. + */ + virtual bool post_handshake_check (void); + + /** * @name SSL State Machine */ //@{ @@ -377,6 +414,9 @@ protected: /// The SSL session. SSL * ssl_; + /// Flag ensures that post_connection_check() is called at most one time. + bool handshake_complete_; + /// The BIO implementation BIO * bio_; @@ -417,6 +457,10 @@ protected: ACE_END_VERSIONED_NAMESPACE_DECL +#if defined(__ACE_INLINE__) +#include "SSL_Asynch_Stream.inl" +#endif /* __ACE_INLINE__ */ + #endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL && (ACE_WIN32 || ACE_HAS_AIO_CALLS) */ diff --git a/ace/SSL/SSL_Asynch_Stream.inl b/ace/SSL/SSL_Asynch_Stream.inl new file mode 100644 index 00000000000..1fe5cc2ae9d --- /dev/null +++ b/ace/SSL/SSL_Asynch_Stream.inl @@ -0,0 +1,13 @@ +// -*- C++ -*- +// +// $Id$ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE SSL * +ACE_SSL_Asynch_Stream::ssl (void) const +{ + return this->ssl_; +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_Context.cpp b/ace/SSL/SSL_Context.cpp index 42093e90c38..2d71688c3c2 100644 --- a/ace/SSL/SSL_Context.cpp +++ b/ace/SSL/SSL_Context.cpp @@ -112,6 +112,7 @@ ACE_SSL_Context::ACE_SSL_Context (void) : context_ (0), mode_ (-1), default_verify_mode_ (SSL_VERIFY_NONE), + default_verify_callback_ (0), have_ca_ (0) { ACE_SSL_Context::ssl_library_init (); @@ -131,7 +132,7 @@ ACE_SSL_Context::~ACE_SSL_Context (void) ACE_SSL_Context * ACE_SSL_Context::instance (void) { - return ACE_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::instance (); + return ACE_Unmanaged_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::instance (); } void @@ -181,15 +182,15 @@ ACE_SSL_Context::ssl_library_init (void) (void) this->egd_file (egd_socket_file); #endif /* OPENSSL_VERSION_NUMBER */ - const char *rand_file = - ACE_OS::getenv (ACE_SSL_RAND_FILE_ENV); + const char *rand_file = ACE_OS::getenv (ACE_SSL_RAND_FILE_ENV); if (rand_file != 0) - (void) this->seed_file (rand_file); + { + (void) this->seed_file (rand_file); + } // Initialize the mutexes that will be used by the SSL and // crypto library. - } ++ssl_library_init_count; @@ -205,6 +206,9 @@ ACE_SSL_Context::ssl_library_fini (void) --ssl_library_init_count; if (ssl_library_init_count == 0) { + // Explicitly close the singleton + ACE_Unmanaged_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::close(); + ::ERR_free_strings (); ::EVP_cleanup (); @@ -305,16 +309,20 @@ ACE_SSL_Context::load_trusted_ca (const char* ca_file, { // Use the default environment settings. ca_file = ACE_OS::getenv (ACE_SSL_CERT_FILE_ENV); +#ifdef ACE_DEFAULT_SSL_CERT_FILE if (ca_file == 0) ca_file = ACE_DEFAULT_SSL_CERT_FILE; +#endif } if (ca_dir == 0 && use_env_defaults) { // Use the default environment settings. ca_dir = ACE_OS::getenv (ACE_SSL_CERT_DIR_ENV); +#ifdef ACE_DEFAULT_SSL_CERT_DIR if (ca_dir == 0) ca_dir = ACE_DEFAULT_SSL_CERT_DIR; +#endif } // NOTE: SSL_CTX_load_verify_locations() returns 0 on error. @@ -566,7 +574,12 @@ ACE_SSL_Context::report_error (unsigned long error_code) char error_string[256]; +// OpenSSL < 0.9.6a doesn't have ERR_error_string_n() function. +#if OPENSSL_VERSION_NUMBER >= 0x0090601fL + (void) ::ERR_error_string_n (error_code, error_string, sizeof error_string); +#else /* OPENSSL_VERSION_NUMBER >= 0x0090601fL */ (void) ::ERR_error_string (error_code, error_string); +#endif /* OPENSSL_VERSION_NUMBER >= 0x0090601fL */ ACE_ERROR ((LM_ERROR, ACE_TEXT ("ACE_SSL (%P|%t) error code: %u - %C\n"), diff --git a/ace/SSL/SSL_Context.h b/ace/SSL/SSL_Context.h index 1d7067fa204..575e5ca02bd 100644 --- a/ace/SSL/SSL_Context.h +++ b/ace/SSL/SSL_Context.h @@ -264,7 +264,6 @@ public: */ void set_verify_peer (int strict = 0, int once = 1, int depth = 0); - /// TODO: a implementation that will lookup the CTX table for the list /// of files and paths etc. /// Query the location of trusted certification authority @@ -281,6 +280,14 @@ public: int default_verify_mode (void) const; /** + * Set and query the default verify callback for this context, it is + * inherited by all the ACE_SSL objects created using the context. + * It can be overriden on a per-ACE_SSL object. + */ + void default_verify_callback (int (*callback) (int, X509_STORE_CTX *)); + int (*default_verify_callback(void) const) (int,X509_STORE_CTX *); + + /** * @name OpenSSL Random Number Generator Seed Related Methods * * These are methods that can be used to seed OpenSSL's @@ -354,7 +361,7 @@ private: /// Cache the mode so we can answer fast int mode_; - /// The private key, certificate, and Diffie-Hellman paramters files + /// The private key, certificate, and Diffie-Hellman parameters files ACE_SSL_Data_File private_key_; ACE_SSL_Data_File certificate_; ACE_SSL_Data_File dh_params_; @@ -362,6 +369,9 @@ private: /// The default verify mode. int default_verify_mode_; + /// The default verify callback. + int (*default_verify_callback_)(int, X509_STORE_CTX *); + /// count of successful CA load attempts int have_ca_; diff --git a/ace/SSL/SSL_Context.inl b/ace/SSL/SSL_Context.inl index 9962ad09bdc..8bb59b58b41 100644 --- a/ace/SSL/SSL_Context.inl +++ b/ace/SSL/SSL_Context.inl @@ -40,7 +40,8 @@ ACE_SSL_Context::check_context (void) this->set_mode (); } - ::SSL_CTX_set_verify (this->context_, this->default_verify_mode (), 0); + ::SSL_CTX_set_verify (this->context_, this->default_verify_mode (), + this->default_verify_callback ()); } ACE_INLINE SSL_CTX * @@ -98,6 +99,17 @@ ACE_SSL_Context::default_verify_mode (void) const return this->default_verify_mode_; } +ACE_INLINE void +ACE_SSL_Context::default_verify_callback (int (*callback) (int, X509_STORE_CTX*)) +{ + this->default_verify_callback_ = callback; +} + +ACE_INLINE int (*ACE_SSL_Context::default_verify_callback(void) const)(int,X509_STORE_CTX *) +{ + return this->default_verify_callback_; +} + ACE_INLINE int ACE_SSL_Context::get_mode (void) const { diff --git a/ace/SSL/sslconf.h b/ace/SSL/sslconf.h index f456558fce9..ffc545d61ae 100644 --- a/ace/SSL/sslconf.h +++ b/ace/SSL/sslconf.h @@ -19,19 +19,21 @@ #include /**/ "ace/config-all.h" #if !defined (ACE_DEFAULT_SSL_CERT_FILE) -# ifdef WIN32 -# define ACE_DEFAULT_SSL_CERT_FILE "cert.pem" -# else -# define ACE_DEFAULT_SSL_CERT_FILE "/etc/ssl/cert.pem" -# endif /* WIN32 */ +// Define a default CA certificate filename here if required e.g.: +// # ifdef WIN32 +// # define ACE_DEFAULT_SSL_CERT_FILE "cert.pem" +// # else +// # define ACE_DEFAULT_SSL_CERT_FILE "/etc/ssl/cert.pem" +// # endif /* WIN32 */ #endif /* ACE_DEFAULT_SSL_CERT_FILE */ #if !defined (ACE_DEFAULT_SSL_CERT_DIR) -# ifdef WIN32 -# define ACE_DEFAULT_SSL_CERT_DIR "certs" -# else -# define ACE_DEFAULT_SSL_CERT_DIR "/etc/ssl/certs" -# endif /* WIN32 */ +// Define a default CA certificate files directory here if required. e.g.: +// # ifdef WIN32 +// # define ACE_DEFAULT_SSL_CERT_DIR "certs" +// # else +// # define ACE_DEFAULT_SSL_CERT_DIR "/etc/ssl/certs" +// # endif /* WIN32 */ #endif /* ACE_DEFAULT_SSL_CERT_DIR */ #if !defined (ACE_SSL_CERT_FILE_ENV) diff --git a/ace/SString.cpp b/ace/SString.cpp index 6305bee14f8..5ba108655aa 100644 --- a/ace/SString.cpp +++ b/ace/SString.cpp @@ -2,9 +2,6 @@ #include "ace/Malloc_T.h" #include "ace/OS_Memory.h" -#if !defined (ACE_HAS_WINCE) -//# include "ace/Service_Config.h" -#endif /* !ACE_HAS_WINCE */ #include "ace/SString.h" #include "ace/Auto_Ptr.h" #include "ace/OS_NS_string.h" diff --git a/ace/Sample_History.cpp b/ace/Sample_History.cpp index 9bd2ca47852..0cff6a7d624 100644 --- a/ace/Sample_History.cpp +++ b/ace/Sample_History.cpp @@ -46,7 +46,7 @@ ACE_Sample_History::dump_samples (const ACE_TCHAR *msg, #ifndef ACE_NLOGGING for (size_t i = 0; i != this->sample_count_; ++i) { - const ACE_UINT64 val = this->samples_[i] / scale_factor; + ACE_UINT64 const val = this->samples_[i] / scale_factor; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%s: ") ACE_SIZE_T_FORMAT_SPECIFIER diff --git a/ace/Sched_Params.cpp b/ace/Sched_Params.cpp index 9a699c773f9..7241cb14bde 100644 --- a/ace/Sched_Params.cpp +++ b/ace/Sched_Params.cpp @@ -115,10 +115,14 @@ ACE_Sched_Params::priority_min (const Policy policy, } } -#elif defined (ACE_HAS_WTHREADS) +#elif defined (ACE_HAS_WTHREADS) && !defined (ACE_HAS_WINCE) ACE_UNUSED_ARG (policy); ACE_UNUSED_ARG (scope); return THREAD_PRIORITY_IDLE; +#elif defined (ACE_HAS_WTHREADS) && defined (ACE_HAS_WINCE) + ACE_UNUSED_ARG (policy); + ACE_UNUSED_ARG (scope); + return 255; #elif defined (ACE_VXWORKS) ACE_UNUSED_ARG (policy); ACE_UNUSED_ARG (scope); @@ -219,10 +223,14 @@ ACE_Sched_Params::priority_max (const Policy policy, } } -#elif defined (ACE_HAS_WTHREADS) +#elif defined (ACE_HAS_WTHREADS) && !defined (ACE_HAS_WINCE) ACE_UNUSED_ARG (policy); ACE_UNUSED_ARG (scope); return THREAD_PRIORITY_TIME_CRITICAL; +#elif defined (ACE_HAS_WTHREADS) && defined (ACE_HAS_WINCE) + ACE_UNUSED_ARG (policy); + ACE_UNUSED_ARG (scope); + return 0; #elif defined (ACE_VXWORKS) ACE_UNUSED_ARG (policy); ACE_UNUSED_ARG (scope); @@ -243,7 +251,7 @@ ACE_Sched_Params::next_priority (const Policy policy, const int priority, const int scope) { -#if defined (ACE_HAS_WTHREADS) +#if defined (ACE_HAS_WTHREADS) && !defined (ACE_HAS_WINCE) ACE_UNUSED_ARG (policy); ACE_UNUSED_ARG (scope); switch (priority) @@ -271,10 +279,9 @@ ACE_Sched_Params::next_priority (const Policy policy, // including STHREADS, and PTHREADS int const max = priority_max (policy, scope); return priority < max ? priority + 1 : max; -#elif defined (ACE_VXWORKS) - return priority > priority_max (policy, scope) - ? priority - 1 - : priority_max (policy, scope); +#elif defined (ACE_VXWORKS) || defined (ACE_HAS_WINCE) + int const max = priority_max (policy, scope); + return priority > max ? priority - 1 : max; #else ACE_UNUSED_ARG (policy); ACE_UNUSED_ARG (scope); @@ -288,7 +295,7 @@ ACE_Sched_Params::previous_priority (const Policy policy, const int priority, const int scope) { -#if defined (ACE_HAS_WTHREADS) +#if defined (ACE_HAS_WTHREADS) && !defined (ACE_HAS_WINCE) ACE_UNUSED_ARG (policy); ACE_UNUSED_ARG (scope); switch (priority) @@ -315,12 +322,10 @@ ACE_Sched_Params::previous_priority (const Policy policy, defined (ACE_HAS_PTHREAD_SCHEDPARAM)) // including STHREADS and PTHREADS int const min = priority_min (policy, scope); - return priority > min ? priority - 1 : min; -#elif defined (ACE_VXWORKS) - return priority < priority_min (policy, scope) - ? priority + 1 - : priority_min (policy, scope); +#elif defined (ACE_VXWORKS) || defined (ACE_HAS_WINCE) + int const min = priority_min (policy, scope); + return priority < min ? priority + 1 : min; #else ACE_UNUSED_ARG (policy); ACE_UNUSED_ARG (scope); diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp index dd0cea47ce4..d6a2f753c4a 100644 --- a/ace/Service_Config.cpp +++ b/ace/Service_Config.cpp @@ -183,11 +183,6 @@ ACE_Service_Config::parse_args_i (int argc, ACE_TCHAR *argv[]) ACE_Get_Opt::RETURN_IN_ORDER); //FUZZ: enable check_for_lack_ACE_OS - // Keep a list of all unknown arguments, begin with the - // executable's name - ACE_ARGV superargv; - superargv.add (argv[0]); - //FUZZ: disable check_for_lack_ACE_OS for (int c; (c = getopt ()) != -1; ) //FUZZ: enable check_for_lack_ACE_OS @@ -216,19 +211,11 @@ ACE_Service_Config::parse_args_i (int argc, ACE_TCHAR *argv[]) #endif /* ACE_LACKS_UNIX_SIGNALS */ break; } - default: - superargv.add (argv[getopt.opt_ind () - 1], true); - } - - // Collect any argumets that were left - for (int c = getopt.opt_ind (); c < argc; ++c) - superargv.add (argv[c-1], true); + default:; // unknown arguments are benign - bool ignore_default_svc_conf_file = false; - return instance_->parse_args_i (superargv.argc (), - superargv.argv (), - ignore_default_svc_conf_file); + } + return 0; } /* parse_args_i () */ diff --git a/ace/Service_Config.inl b/ace/Service_Config.inl index b4849764874..5703553bcba 100644 --- a/ace/Service_Config.inl +++ b/ace/Service_Config.inl @@ -40,13 +40,17 @@ ACE_Service_Config::open (int argc, bool ignore_debug_flag) { ACE_TRACE ("ACE_Service_Config::open"); + + if (singleton()->parse_args_i(argc, argv) == -1) + return -1; + if (singleton()->open_i (argv[0], logger_key, ignore_static_svcs, ignore_default_svc_conf, ignore_debug_flag) == -1) return -1; - + return current()->open (argc, argv, logger_key, diff --git a/ace/Service_Gestalt.cpp b/ace/Service_Gestalt.cpp index cca8d399602..ad0522b318f 100644 --- a/ace/Service_Gestalt.cpp +++ b/ace/Service_Gestalt.cpp @@ -1147,26 +1147,22 @@ ACE_Service_Gestalt::parse_args_i (int argc, bool &ignore_default_svc_conf_file) { ACE_TRACE ("ACE_Service_Gestalt::parse_args_i"); - //FUZZ: disable check_for_lack_ACE_OS - ACE_Get_Opt getopt (argc, - argv, - ACE_TEXT ("df:k:nyS:"), - 1); // Start at argv[1]. - //FUZZ: enable check_for_lack_ACE_OS + ACE_Get_Opt get_opt (argc, + argv, + ACE_TEXT ("df:k:nyS:"), + 1); // Start at argv[1]. if (this->init_svc_conf_file_queue () == -1) return -1; - //FUZZ: disable check_for_lack_ACE_OS - for (int c; (argc != 0) && ((c = getopt ()) != -1); ) - //FUZZ: enable check_for_lack_ACE_OS + for (int c; (argc != 0) && ((c = get_opt ()) != -1); ) switch (c) { case 'd': ACE::debug (1); break; case 'f': - if (this->svc_conf_file_queue_->enqueue_tail (ACE_TString (getopt.opt_arg ())) == -1) + if (this->svc_conf_file_queue_->enqueue_tail (ACE_TString (get_opt.opt_arg ())) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("enqueue_tail")), @@ -1178,7 +1174,7 @@ ACE_Service_Gestalt::parse_args_i (int argc, * @TODO: Is this always a static storage? Shouldn't we copy * & gain ownership of the value? */ - this->logger_key_ = getopt.opt_arg (); + this->logger_key_ = get_opt.opt_arg (); break; case 'n': this->no_static_svcs_ = 1; @@ -1194,7 +1190,7 @@ ACE_Service_Gestalt::parse_args_i (int argc, -1); } - if (this->svc_queue_->enqueue_tail (ACE_TString (getopt.opt_arg ())) == -1) + if (this->svc_queue_->enqueue_tail (ACE_TString (get_opt.opt_arg ())) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("enqueue_tail")), diff --git a/ace/Service_Gestalt.h b/ace/Service_Gestalt.h index a7c81a8c996..55b9e1c4db5 100644 --- a/ace/Service_Gestalt.h +++ b/ace/Service_Gestalt.h @@ -232,7 +232,7 @@ public: * Please observe the difference between options '-f' that looks * for a list of files and here a list of services. */ - int parse_args (int, ACE_TCHAR *argv[]); + int parse_args (int argc, ACE_TCHAR *argv[]); /** * Process (or re-process) service configuration requests that are diff --git a/ace/Service_Gestalt.inl b/ace/Service_Gestalt.inl index 6b93f5e8bd1..7f6b4754154 100644 --- a/ace/Service_Gestalt.inl +++ b/ace/Service_Gestalt.inl @@ -11,10 +11,10 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_Service_Gestalt::open (const ACE_TCHAR program_name[], - const ACE_TCHAR *logger_key, - bool ignore_static_svcs, - bool ignore_default_svc_conf, - bool ignore_debug_flag) + const ACE_TCHAR *logger_key, + bool ignore_static_svcs, + bool ignore_default_svc_conf, + bool ignore_debug_flag) { ACE_TRACE ("ACE_Service_Gestalt::open"); this->no_static_svcs_ = ignore_static_svcs; diff --git a/ace/Service_Repository.cpp b/ace/Service_Repository.cpp index 0bd7a8d8fba..f64cd553f87 100644 --- a/ace/Service_Repository.cpp +++ b/ace/Service_Repository.cpp @@ -250,7 +250,7 @@ ACE_Service_Repository::close (void) #ifndef ACE_NLOGGING if(ACE::debug ()) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) SR::close - repo=%@, size=%d\n"), + ACE_TEXT ("ACE (%P|%t) SR::close - repo=%@, size=%d\n"), this, this->current_size_)); #endif @@ -268,12 +268,12 @@ ACE_Service_Repository::close (void) { if (s == 0) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) SR::close - repo=%@ [%d] -> 0\n"), + ACE_TEXT ("ACE (%P|%t) SR::close - repo=%@ [%d] -> 0\n"), this, i)); else ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) SR::close - repo=%@ [%d], name=%s, object=%@\n"), + ACE_TEXT ("ACE (%P|%t) SR::close - repo=%@ [%d], name=%s, object=%@\n"), this, i, s->name (), @@ -296,7 +296,7 @@ ACE_Service_Repository::~ACE_Service_Repository (void) ACE_TRACE ("ACE_Service_Repository::~ACE_Service_Repository"); #ifndef ACE_NLOGGING if(ACE::debug ()) - ACE_DEBUG ((LM_DEBUG, "(%P|%t) SR::<dtor>, this=%@\n", this)); + ACE_DEBUG ((LM_DEBUG, "ACE (%P|%t) SR::<dtor>, this=%@\n", this)); #endif this->close (); } @@ -493,7 +493,7 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr) if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE (%P|%t) SR::insert - repo=%@ [%d] (%d),") - ACE_TEXT (" name=%s (%s) (type=%@, object=%@, active=%d)\n"), + ACE_TEXT (" name=%s (%C) (type=%@, object=%@, active=%d)\n"), this, i, this->total_size_, diff --git a/ace/Singleton.h b/ace/Singleton.h index 032f26740f4..33cfc3cdaca 100644 --- a/ace/Singleton.h +++ b/ace/Singleton.h @@ -82,7 +82,7 @@ public: /// Global access point to the Singleton. static TYPE *instance (void); - /// Cleanup method, used by <ace_cleanup_destroyer> to destroy the + /// Cleanup method, used by @c ace_cleanup_destroyer to destroy the /// ACE_Singleton. virtual void cleanup (void *param = 0); diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp index cad9402c1e1..99229c7c3f9 100644 --- a/ace/Sock_Connect.cpp +++ b/ace/Sock_Connect.cpp @@ -59,12 +59,14 @@ const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTER #if defined (ACE_HAS_WINCE) #include /**/ <Iphlpapi.h> +# if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) // The following code is suggested by microsoft as a workaround to the fact // that on Windows CE, these constants are exported as function addresses // rather than simply values. # include /**/ <ws2tcpip.h> const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT; +# endif #endif // ACE_HAS_WINCE #if defined (ACE_WIN32) && defined (ACE_HAS_PHARLAP) @@ -425,8 +427,8 @@ ACE::get_fqdn (ACE_INET_Addr const & addr, if (ACE::debug()) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) - ACE::get_fqdn, ") - ACE_TEXT ("canonical host name is %s\n"), - ACE_TEXT_CHAR_TO_TCHAR (hp->h_name))); + ACE_TEXT ("canonical host name is %C\n"), + hp->h_name)); // check if the canonical name is the FQDN if (!ACE_OS::strchr(hp->h_name, '.')) @@ -458,8 +460,8 @@ ACE::get_fqdn (ACE_INET_Addr const & addr, if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) - ACE::get_fqdn, ") - ACE_TEXT ("found fqdn within alias as %s\n"), - ACE_TEXT_CHAR_TO_TCHAR(*q))); + ACE_TEXT ("found fqdn within alias as %C\n"), + *q)); ACE_OS::strcpy (hostname, *q); return 0; @@ -491,7 +493,7 @@ static int get_ip_interfaces_win32 (size_t &count, ACE_INET_Addr *&addrs) { -# if defined (ACE_HAS_WINCE) +# if defined (ACE_HAS_WINCE) && defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) // moved the ACE_HAS_WINCE impl ahaid of ACE_HAS_WINSOCK2 because // WINCE in fact has winsock2, but doesn't properly support the // WSAIoctl for obtaining IPv6 address info. @@ -603,7 +605,7 @@ get_ip_interfaces_win32 (size_t &count, // kernel says there are no more of that type. const size_t ACE_MAX_ETS_DEVICES = 64; // Arbitrary, but should be enough. DEVHANDLE ip_dev[ACE_MAX_ETS_DEVICES]; - EK_TCPIPCFG *devp; + EK_TCPIPCFG *devp = 0; size_t i, j; ACE_TCHAR dev_name[16]; diff --git a/ace/Stats.cpp b/ace/Stats.cpp index 57f20799cc4..9166bee8ca6 100644 --- a/ace/Stats.cpp +++ b/ace/Stats.cpp @@ -273,15 +273,10 @@ ACE_Stats::print_summary (const u_int precision, } else { -#if !defined (ACE_HAS_WINCE) ACE_OS::fprintf (file, ACE_TEXT ("ACE_Stats::print_summary: OVERFLOW: %s\n"), ACE_OS::strerror (overflow_)); -#else - // WinCE doesn't have strerror ;( - ACE_OS::fprintf (file, - ACE_TEXT ("ACE_Stats::print_summary: OVERFLOW\n")); -#endif /* ACE_HAS_WINCE */ + return -1; } } diff --git a/ace/String_Base.cpp b/ace/String_Base.cpp index fef051a19ed..7000454972f 100644 --- a/ace/String_Base.cpp +++ b/ace/String_Base.cpp @@ -394,8 +394,8 @@ ACE_String_Base<CHAR>::compare (const ACE_String_Base<CHAR> &s) const s.rep_, smaller_length * sizeof (CHAR)); - if (!result) - result = static_cast<int> (this->len_ - s.len_); + if (result == 0 && this->len_ != s.len_) + result = this->len_ > s.len_ ? 1 : -1; return result; } diff --git a/ace/TLI_Connector.cpp b/ace/TLI_Connector.cpp index 9a11d2c880b..eb909aadfaf 100644 --- a/ace/TLI_Connector.cpp +++ b/ace/TLI_Connector.cpp @@ -159,7 +159,7 @@ ACE_TLI_Connector::connect (ACE_TLI_Stream &new_stream, // non-blocking handle or whether there's really an error. if (t_errno == TNODATA) { - if (timeout->sec () == 0 && timeout->usec () == 0) + if (*timeout == ACE_Time_Value::zero) errno = EWOULDBLOCK; else result = this->complete (new_stream, 0, timeout); diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp index af93549cdfc..bf6e309f33f 100644 --- a/ace/Thread_Manager.cpp +++ b/ace/Thread_Manager.cpp @@ -252,7 +252,6 @@ ACE_Thread_Descriptor::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_handle_ = %d"), this->thr_handle_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ngrp_id_ = %d"), this->grp_id_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nthr_state_ = %d"), this->thr_state_)); - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\ncleanup_info_.cleanup_hook_ = %x"), this->cleanup_info_.cleanup_hook_)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nflags_ = %x\n"), this->flags_)); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); @@ -628,9 +627,9 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func, // @@ How are thread handles implemented on AIX? Do they // also need to be duplicated? if (t_handle != 0) -# if defined (ACE_HAS_WINCE) +# if defined (ACE_LACKS_DUPLICATEHANDLE) *t_handle = thr_handle; -# else /* ! ACE_HAS_WINCE */ +# else /* ! ACE_LACKS_DUP */ (void) ::DuplicateHandle (::GetCurrentProcess (), thr_handle, ::GetCurrentProcess (), @@ -638,7 +637,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func, 0, TRUE, DUPLICATE_SAME_ACCESS); -# endif /* ! ACE_HAS_WINCE */ +# endif /* ! ACE_LACKS_DUP */ #else /* ! ACE_HAS_WTHREADS */ if (t_handle != 0) *t_handle = thr_handle; @@ -898,14 +897,17 @@ ACE_Thread_Manager::run_thread_exit_hooks (int i) // generalized to support an arbitrary number of hooks. ACE_Thread_Descriptor *td = this->thread_desc_self (); - if (td != 0 && td->cleanup_info.cleanup_hook_ != 0) + for (ACE_Cleanup_Info_Node *iter = td->cleanup_info_->pop_front (); + iter != 0; + iter = cleanup_info_->pop_front ()) { - (*td->cleanup_info_.cleanup_hook_) - (td->cleanup_info_.object_, - td->cleanup_info_.param_); - - td->cleanup_info_.cleanup_hook_ = 0; + if (iter->cleanup_hook () != 0) + { + (*iter->cleanup_hook ()) (iter->object (), iter->param ()); + } + delete iter; } + ACE_UNUSED_ARG (i); #else ACE_UNUSED_ARG (i); diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h index 9f7f65377c0..58fee2581ea 100644 --- a/ace/Thread_Manager.h +++ b/ace/Thread_Manager.h @@ -328,11 +328,14 @@ private: /// The AT_Thread_Exit list ACE_At_Thread_Exit *at_exit_list_; +#if 0 +/// Currently not used /** * Stores the cleanup info for a thread. * @note This should be generalized to be a stack of ACE_Cleanup_Info's. */ - ACE_Cleanup_Info cleanup_info_; + ACE_Cleanup_Info_Node_List cleanup_info_; +#endif /// Pointer to an ACE_Thread_Manager or NULL if there's no /// ACE_Thread_Manager> diff --git a/ace/Thread_Mutex.inl b/ace/Thread_Mutex.inl index 146521722dd..dbef586fbc3 100644 --- a/ace/Thread_Mutex.inl +++ b/ace/Thread_Mutex.inl @@ -86,7 +86,7 @@ ACE_Thread_Mutex::remove (void) { // ACE_TRACE ("ACE_Thread_Mutex::remove"); int result = 0; - if (this->removed_ == false) + if (!this->removed_) { this->removed_ = true; result = ACE_OS::thread_mutex_destroy (&this->lock_); diff --git a/ace/Time_Value.inl b/ace/Time_Value.inl index b64f1fbd7bc..49788e3fd98 100644 --- a/ace/Time_Value.inl +++ b/ace/Time_Value.inl @@ -69,7 +69,19 @@ ACE_INLINE void ACE_Time_Value::set (time_t sec, suseconds_t usec) { // ACE_OS_TRACE ("ACE_Time_Value::set"); +# if defined (_WIN32_WCE) && (_WIN32_WCE == 0x600) && !defined (_USE_32BIT_TIME_T) + // The WinCE 6.0 SDK ships with a timeval tv_sec member that uses long as type + // not time_t. This resolves in compilation warnings because time_t + // can be 64bit. Disable at this momemt the warning for just this method + // else we get a compile warnings each time this inline file is included + // this file. +# pragma warning (push) +# pragma warning (disable: 4244) +# endif this->tv_.tv_sec = sec; +# if defined (_WIN32_WCE) && (_WIN32_WCE == 0x600) && !defined (_USE_32BIT_TIME_T) +# pragma warning (pop) +# endif this->tv_.tv_usec = usec; #if __GNUC__ if (__builtin_constant_p(sec) && diff --git a/ace/Token.cpp b/ace/Token.cpp index a209b02183d..5018881ff6f 100644 --- a/ace/Token.cpp +++ b/ace/Token.cpp @@ -216,7 +216,7 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), } // Do a quick check for "polling" behavior. - if (timeout != 0 && timeout->sec () == 0 && timeout->usec () == 0) + if (timeout != 0 && *timeout == ACE_Time_Value::zero) { errno = ETIME; return -1; diff --git a/ace/Truncate.h b/ace/Truncate.h index 1935bd6a80d..5e1bb7545da 100644 --- a/ace/Truncate.h +++ b/ace/Truncate.h @@ -27,18 +27,14 @@ #include "ace/If_Then_Else.h" #include "ace/Numeric_Limits.h" -#if defined (ACE_LACKS_LONGLONG_T) \ - || defined (__BORLANDC__) && __BORLANDC__ < 0x590 +#if defined (ACE_LACKS_LONGLONG_T) # include "ace/Basic_Types.h" -#endif /* ACE_LACKS_LONGLONG_T || __BORLANDC__ < 0x590 */ +#endif /* ACE_LACKS_LONGLONG_T */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_Utils { - -#if !defined (__BORLANDC__) || __BORLANDC__ >= 0x590 - template<typename T> struct Sign_Check; // Specialize the unsigned signed cases. @@ -512,540 +508,6 @@ namespace ACE_Utils return truncator() (val); } -#else - - // Borland can't handle the template meta-programming above so - // provide explicit specializations for a few types. More will be - // added if necessary. - - /** - * @deprecated Borland ACE_Utils::Truncator<> specializations should - * be removed. - */ - - template<typename FROM, typename TO> struct Truncator; - - //---------------------------------------------------------- - // sizeof(FROM) > sizeof(TO) - //---------------------------------------------------------- - - template<> - struct Truncator<ACE_INT32, ACE_INT8> - { - ACE_INT8 operator() (ACE_INT32 val) - { - return - (val > ACE_Numeric_Limits<ACE_INT8>::max () - ? ACE_Numeric_Limits<ACE_INT8>::max () - : static_cast<ACE_INT8> (val)); - } - }; - - template<> - struct Truncator<ACE_UINT32, ACE_UINT8> - { - ACE_UINT8 operator() (ACE_UINT32 val) - { - return - (val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_UINT8>::max ()) - ? ACE_Numeric_Limits<ACE_UINT8>::max () - : static_cast<ACE_UINT8> (val)); - } - }; - - template<> - struct Truncator<ACE_INT32, ACE_UINT8> - { - ACE_UINT8 operator() (ACE_INT32 val) - { - return - (val > static_cast<ACE_INT32> (ACE_Numeric_Limits<ACE_UINT8>::max ()) - ? ACE_Numeric_Limits<ACE_UINT8>::max () - : static_cast<ACE_UINT8> (val)); - } - }; - - template<> - struct Truncator<ACE_UINT32, ACE_INT8> - { - ACE_INT8 operator() (ACE_UINT32 val) - { - return - (val > static_cast<ACE_UINT32> (ACE_Numeric_Limits<ACE_INT8>::max ()) - ? ACE_Numeric_Limits<ACE_INT8>::max () - : static_cast<ACE_INT8> (val)); - } - }; - -#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG < 8 - template<> - struct Truncator<ACE_INT64, signed long> - { - signed long operator() (ACE_INT64 val) - { - return - (val > ACE_Numeric_Limits<signed long>::max () - ? ACE_Numeric_Limits<signed long>::max () - : static_cast<signed long> (val)); - } - }; - - template<> - struct Truncator<ACE_INT64, unsigned long> - { - unsigned long operator() (ACE_INT64 val) - { - return - (val > static_cast<ACE_INT64> (ACE_Numeric_Limits<unsigned long>::max ()) - ? ACE_Numeric_Limits<unsigned long>::max () - : static_cast<unsigned long> (val)); - } - }; - - template<> - struct Truncator<ACE_UINT64, unsigned long> - { - unsigned long operator() (ACE_UINT64 val) - { - return - (val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<unsigned long>::max ()) - ? ACE_Numeric_Limits<unsigned long>::max () - : static_cast<unsigned long> (val)); - } - }; - - template<> - struct Truncator<ACE_UINT64, signed long> - { - signed long operator() (ACE_UINT64 val) - { - return - (val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<signed long>::max ()) - ? ACE_Numeric_Limits<signed long>::max () - : static_cast<signed long> (val)); - } - }; - - template<> - struct Truncator<const ACE_UINT64, signed long> - { - signed long operator() (const ACE_UINT64 val) - { - return - (val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<signed long>::max ()) - ? ACE_Numeric_Limits<signed long>::max () - : static_cast<signed long> (val)); - } - }; - -#endif /* ACE_SIZEOF_LONG < 8 */ - -#if defined (ACE_SIZEOF_INT) && ACE_SIZEOF_INT < 8 - template<> - struct Truncator<ACE_INT64, signed int> - { - ACE_INT32 operator() (ACE_INT64 val) - { - return - (val > ACE_Numeric_Limits<signed int>::max () - ? ACE_Numeric_Limits<signed int>::max () - : static_cast<signed int> (val)); - } - }; - - template<> - struct Truncator<ACE_INT64, unsigned int> - { - ACE_UINT32 operator() (ACE_INT64 val) - { - return - (val > static_cast<ACE_INT64> (ACE_Numeric_Limits<unsigned int>::max ()) - ? ACE_Numeric_Limits<unsigned int>::max () - : static_cast<unsigned int> (val)); - } - }; - - template<> - struct Truncator<ACE_UINT64, unsigned int> - { - ACE_UINT32 operator() (ACE_UINT64 val) - { - return - (val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<unsigned int>::max ()) - ? ACE_Numeric_Limits<unsigned int>::max () - : static_cast<unsigned int> (val)); - } - }; - - template<> - struct Truncator<ACE_UINT64, signed int> - { - signed int operator() (ACE_UINT64 val) - { - return - (val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<signed int>::max ()) - ? ACE_Numeric_Limits<signed int>::max () - : static_cast<signed int> (val)); - } - }; - -#endif /* ACE_SIZEOF_INT < 8 */ - - //---------------------------------------------------------- - // sizeof(FROM) == sizeof(TO) - //---------------------------------------------------------- - - template<> - struct Truncator<unsigned int, char> - { - char operator() (unsigned int val) - { - return static_cast<char> (val); - } - }; - - template<> - struct Truncator<unsigned int, wchar_t> - { - wchar_t operator() (unsigned int val) - { - return static_cast<wchar_t> (val); - } - }; - - template<> - struct Truncator<signed int, unsigned int> - { - unsigned int operator() (signed int val) - { - return static_cast<unsigned int> (val); - } - }; - - template<> - struct Truncator<unsigned int, signed int> - { - signed int operator() (unsigned int val) - { - return - (val > static_cast<unsigned int> (ACE_Numeric_Limits<signed int>::max ()) - ? ACE_Numeric_Limits<signed int>::max () - : static_cast<signed int> (val)); - } - }; - - template<> - struct Truncator<const unsigned int, signed int> - { - signed int operator() (const unsigned int val) - { - return - (val > static_cast<unsigned int> (ACE_Numeric_Limits<signed int>::max ()) - ? ACE_Numeric_Limits<signed int>::max () - : static_cast<signed int> (val)); - } - }; - - template<> - struct Truncator<signed long, unsigned long> - { - unsigned long operator() (signed long val) - { - return static_cast<unsigned long> (val); - } - }; - - template<> - struct Truncator<unsigned long, signed long> - { - signed long operator() (unsigned long val) - { - return - (val > static_cast<unsigned long> (ACE_Numeric_Limits<signed long>::max ()) - ? ACE_Numeric_Limits<signed long>::max () - : static_cast<signed long> (val)); - } - }; - -#if defined (ACE_SIZEOF_INT) && defined (ACE_SIZEOF_LONG) \ - && ACE_SIZEOF_INT == ACE_SIZEOF_LONG - - template<> - struct Truncator<signed int, unsigned long> - { - unsigned long operator() (signed int val) - { - return static_cast<unsigned long> (val); - } - }; - - template<> - struct Truncator<signed int, signed long> - { - signed long operator() (signed int val) - { - return static_cast<signed long> (val); - } - }; - - template<> - struct Truncator<unsigned long, signed int> - { - signed int operator() (unsigned long val) - { - return - (val > static_cast<unsigned long> (ACE_Numeric_Limits<signed int>::max ()) - ? ACE_Numeric_Limits<signed int>::max () - : static_cast<signed int> (val)); - } - }; - - template<> - struct Truncator<signed long, signed int> - { - signed int operator() (signed long val) - { - return static_cast<signed int> (val); -// This code causes asserts and compiler crashes with BCB6 Static and -// BCB2007 Static -// return -// (val > static_cast<signed long> (ACE_Numeric_Limits<signed int>::max ()) -// ? ACE_Numeric_Limits<signed int>::max () -// : static_cast<signed int> (val)); - } - }; - - template<> - struct Truncator<signed long, unsigned int> - { - unsigned int operator() (signed long val) - { - return static_cast<unsigned int> (val); - } - }; - - template<> - struct Truncator<const signed long, unsigned int> - { - unsigned int operator() (const signed long val) - { - return static_cast<unsigned int> (val); - } - }; - - - template<> - struct Truncator<unsigned int, signed long> - { - signed long operator() (unsigned int val) - { - return - (val > static_cast<unsigned int> (ACE_Numeric_Limits<signed long>::max ()) - ? ACE_Numeric_Limits<signed long>::max () - : static_cast<signed long> (val)); - } - }; - -#endif /* ACE_SIZEOF_INT == ACE_SIZEOF_LONG */ - - template<> - struct Truncator<ACE_INT64, ACE_UINT64> - { - ACE_UINT64 operator() (ACE_INT64 val) - { - return static_cast<ACE_UINT64> (val); - } - }; - - template<> - struct Truncator<ACE_UINT64, ACE_INT64> - { - ACE_INT64 operator() (ACE_UINT64 val) - { - return - (val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<ACE_INT64>::max ()) - ? ACE_Numeric_Limits<ACE_INT64>::max () - : static_cast<ACE_INT64> (val)); - } - }; - - //---------------------------------------------------------- - // sizeof(FROM) < sizeof(TO) - //---------------------------------------------------------- - - template<> - struct Truncator<ACE_INT8, ACE_INT32> - { - ACE_INT32 operator() (ACE_INT8 val) - { - return static_cast<ACE_INT32> (val); - } - }; - - template<> - struct Truncator<ACE_UINT8, ACE_UINT32> - { - ACE_UINT32 operator() (ACE_UINT8 val) - { - return static_cast<ACE_UINT32> (val); - } - }; - - template<> - struct Truncator<ACE_UINT8, ACE_INT32> - { - ACE_INT32 operator() (ACE_UINT8 val) - { - return static_cast<ACE_INT32> (val); - } - }; - - template<> - struct Truncator<ACE_INT8, ACE_UINT32> - { - ACE_UINT32 operator() (ACE_INT8 val) - { - return static_cast<ACE_UINT32> (val); - } - }; - -#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG < 8 - template<> - struct Truncator<signed long, ACE_INT64> - { - ACE_INT64 operator() (signed long val) - { - return static_cast<ACE_INT64> (val); - } - }; - - template<> - struct Truncator<signed long, ACE_UINT64> - { - ACE_UINT64 operator() (signed long val) - { - return static_cast<ACE_UINT64> (val); - } - }; - - template<> - struct Truncator<const signed long, ACE_UINT64> - { - ACE_UINT64 operator() (const signed long val) - { - return - (val > static_cast<ACE_UINT64> (ACE_Numeric_Limits<signed long>::max ()) - ? ACE_Numeric_Limits<signed long>::max () - : static_cast<signed long> (val)); - } - }; - - template<> - struct Truncator<unsigned long, ACE_UINT64> - { - ACE_UINT64 operator() (unsigned long val) - { - return static_cast<ACE_UINT64> (val); - } - }; - - template<> - struct Truncator<unsigned long, ACE_INT64> - { - ACE_INT64 operator() (unsigned long val) - { - return static_cast<ACE_INT64> (val); - } - }; -#endif /* ACE_SIZEOF_LONG < 8 */ - -#if defined (ACE_SIZEOF_INT) && ACE_SIZEOF_INT < 8 - template<> - struct Truncator<signed int, ACE_INT64> - { - ACE_INT64 operator() (signed int val) - { - return static_cast<ACE_INT64> (val); - } - }; - - template<> - struct Truncator<signed int, ACE_UINT64> - { - ACE_UINT64 operator() (signed int val) - { - return static_cast<ACE_UINT64> (val); - } - }; - - template<> - struct Truncator<unsigned int, ACE_UINT64> - { - ACE_UINT64 operator() (unsigned int val) - { - return static_cast<ACE_UINT64> (val); - } - }; - - template<> - struct Truncator<unsigned int, ACE_INT64> - { - ACE_INT64 operator() (unsigned int val) - { - return static_cast<ACE_INT64> (val); - } - }; -#endif /* ACE_SIZEOF_INT < 8 */ - - template<> - struct Truncator<size_t, unsigned long> - { - unsigned long operator() (size_t val) - { - return - (val > static_cast<unsigned long> (ACE_Numeric_Limits<size_t>::max ()) - ? ACE_Numeric_Limits<size_t>::max () - : static_cast<size_t> (val)); - } - }; - - // Partial specialization for the case where the types are the same. - // No truncation is necessary. - template<typename T> - struct Truncator<T, T> - { - T operator() (T val) - { - return val; - } - }; - - // Partial specialization for the case where the types are the same, - // but the from type is const. No truncation is necessary. - // - // This is only necessary to workaround a problem with the BCB6 - // compiler. - template<typename T> - struct Truncator<T const, T> - { - T operator() (T val) - { - return val; - } - }; - - // ------------------------------------- - - template<typename TO, typename FROM> - inline TO truncate_cast (FROM val) - { - typedef Truncator<FROM, TO> truncator; - - return truncator() (val); - } - -#endif /* !__BORLANDC__ || __BORLANDC__ >= 0x590 */ - } // namespace ACE_Utils ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UTF16_Encoding_Converter.cpp b/ace/UTF16_Encoding_Converter.cpp index d57ab9e5154..f287f058712 100644 --- a/ace/UTF16_Encoding_Converter.cpp +++ b/ace/UTF16_Encoding_Converter.cpp @@ -305,7 +305,7 @@ ACE_UTF16_Encoding_Converter::encoded (const ACE_Byte* source, static const size_t converted = begin * 4; ACE_Byte target[converted]; - ACE_UTF16_Encoding_Converter* converter; + ACE_UTF16_Encoding_Converter* converter = 0; ACE_NEW_RETURN (converter, ACE_UTF16_Encoding_Converter (false), 0); diff --git a/ace/UUID.cpp b/ace/UUID.cpp index cf76579e594..6bd23b5be62 100644 --- a/ace/UUID.cpp +++ b/ace/UUID.cpp @@ -30,12 +30,24 @@ namespace ACE_Utils node_ID_[i] = 0; } - UUID_Node::Node_ID& + UUID_Node::UUID_Node (const UUID_Node & node) + { + for (int i = 0; i < UUID_Node::NODE_ID_SIZE; ++i) + this->node_ID_[i] = node.node_ID_[i]; + } + + UUID_Node::Node_ID & UUID_Node::node_ID (void) { return node_ID_; } + const UUID_Node::Node_ID & + UUID_Node::node_ID (void) const + { + return node_ID_; + } + void UUID_Node::node_ID (Node_ID& node_ID) { @@ -43,6 +55,20 @@ namespace ACE_Utils node_ID_[i] = node_ID[i]; } + const UUID_Node & + UUID_Node::operator = (const UUID_Node & rhs) + { + // Check for self assignment. + if (this == &rhs) + return *this; + + // Copy the content of the node id. + for (int i = 0; i < UUID_Node::NODE_ID_SIZE; ++i) + this->node_ID_[i] = rhs.node_ID_[i]; + + return *this; + } + UUID UUID::NIL_UUID; /// Construct a nil UUID. Such a UUID has every one of it's data @@ -52,13 +78,9 @@ namespace ACE_Utils time_mid_ (0), time_hi_and_version_ (0), clock_seq_hi_and_reserved_ (0), - clock_seq_low_ (0), - node_ (0), - node_release_ (true), - as_string_ (0) + clock_seq_low_ (0) { - ACE_NEW (node_, - UUID_Node); + } /// Construct a UUID from a string representation of an UUID. @@ -67,14 +89,8 @@ namespace ACE_Utils time_mid_ (0), time_hi_and_version_ (0), clock_seq_hi_and_reserved_ (0), - clock_seq_low_ (0), - node_ (0), - node_release_ (true), - as_string_ (0) + clock_seq_low_ (0) { - ACE_NEW (node_, - UUID_Node); - this->from_string_i (uuid_string); } @@ -84,29 +100,44 @@ namespace ACE_Utils time_hi_and_version_ (right.time_hi_and_version_), clock_seq_hi_and_reserved_ (right.clock_seq_hi_and_reserved_), clock_seq_low_ (right.clock_seq_low_), - as_string_ (0) + node_ (right.node_) { - ACE_NEW (node_, - UUID_Node (*right.node_)); + } UUID::~UUID (void) { - if (node_release_) - delete node_; - if (as_string_ != 0) - delete as_string_; + } + + const UUID & + UUID::operator = (const UUID & rhs) + { + if (this == &rhs) + return *this; + + // Copy the values of the UUID. + this->time_low_ = rhs.time_low_; + this->time_mid_ = rhs.time_mid_; + this->time_hi_and_version_ = rhs.time_hi_and_version_; + this->clock_seq_hi_and_reserved_ = rhs.clock_seq_hi_and_reserved_; + this->clock_seq_low_ = rhs.clock_seq_low_; + this->node_ = rhs.node_; + + // Delete the string version of the UUID. + this->as_string_.reset (0); + return *this; } const ACE_CString* - UUID::to_string (void) + UUID::to_string (void) const { /// Only compute the string representation once. - if (as_string_ == 0) + if (this->as_string_.get () == 0) { // Get a buffer exactly the correct size. Use the nil UUID as a // gauge. Don't forget the trailing nul. + ACE_Auto_Array_Ptr <char> auto_clean; size_t UUID_STRING_LENGTH = 36 + thr_id_.length () + pid_.length (); char *buf = 0; @@ -117,6 +148,9 @@ namespace ACE_Utils char[UUID_STRING_LENGTH + 1], 0); + // Let the auto array pointer manage the buffer. + auto_clean.reset (buf); + ACE_OS::sprintf (buf, "%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x-%s-%s", this->time_low_, @@ -124,12 +158,12 @@ namespace ACE_Utils this->time_hi_and_version_, this->clock_seq_hi_and_reserved_, this->clock_seq_low_, - (this->node_->node_ID ()) [0], - (this->node_->node_ID ()) [1], - (this->node_->node_ID ()) [2], - (this->node_->node_ID ()) [3], - (this->node_->node_ID ()) [4], - (this->node_->node_ID ()) [5], + (this->node_.node_ID ()) [0], + (this->node_.node_ID ()) [1], + (this->node_.node_ID ()) [2], + (this->node_.node_ID ()) [3], + (this->node_.node_ID ()) [4], + (this->node_.node_ID ()) [5], thr_id_.c_str (), pid_.c_str () ); @@ -140,6 +174,9 @@ namespace ACE_Utils char[UUID_STRING_LENGTH + 1], 0); + // Let the auto array pointer manage the buffer. + auto_clean.reset (buf); + ACE_OS::sprintf (buf, "%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x", this->time_low_, @@ -147,30 +184,26 @@ namespace ACE_Utils this->time_hi_and_version_, this->clock_seq_hi_and_reserved_, this->clock_seq_low_, - (this->node_->node_ID ()) [0], - (this->node_->node_ID ()) [1], - (this->node_->node_ID ()) [2], - (this->node_->node_ID ()) [3], - (this->node_->node_ID ()) [4], - (this->node_->node_ID ()) [5] + (this->node_.node_ID ()) [0], + (this->node_.node_ID ()) [1], + (this->node_.node_ID ()) [2], + (this->node_.node_ID ()) [3], + (this->node_.node_ID ()) [4], + (this->node_.node_ID ()) [5] ); } - // We allocated 'buf' above dynamically, so we shouldn't use - // ACE_NEW_RETURN here to avoid a possible memory leak. - ACE_NEW_NORETURN (this->as_string_, - ACE_CString (buf, UUID_STRING_LENGTH)); + // Save the string. + ACE_CString * as_string = 0; - // we first free the dynamically allocated 'buf'. - delete [] buf; + ACE_NEW_RETURN (as_string, + ACE_CString (buf, UUID_STRING_LENGTH), + 0); - // then we test that ACE_NEW succeded for 'as_string_' - // if not, we return 0 (NULL) to indicate failure. - if (this->as_string_ == 0 ) - return 0; + this->as_string_.reset (as_string); } - return as_string_; + return this->as_string_.get (); } void @@ -293,9 +326,9 @@ namespace ACE_Utils UUID_Node::Node_ID node_id; for (int i = 0; i < UUID_Node::NODE_ID_SIZE; ++i) - node_id [i] = static_cast<u_char> (node[i]); + node_id[i] = static_cast<u_char> (node[i]); - this->node_->node_ID (node_id); + this->node_.node_ID (node_id); // Support varient 10- only if ((this->clock_seq_hi_and_reserved_ & 0xc0) != 0x80 && (this->clock_seq_hi_and_reserved_ & 0xc0) != 0xc0) @@ -336,7 +369,7 @@ namespace ACE_Utils "IllegalArgument (Thread and Process Id format incorrect)\n")); this->thr_id_ = thr_pid_str.substr (0, pos); - this->pid_ = thr_pid_str.substr (pos+1, thr_pid_str.length ()-pos-1); + this->pid_ = thr_pid_str.substr (pos+1, thr_pid_str.length ()-pos-1); } } @@ -461,7 +494,7 @@ namespace ACE_Utils // sequence. if (timestamp <= time_last_) { - uuid_state_.clock_sequence = static_cast<ACE_UINT16> + uuid_state_.clock_sequence = static_cast<ACE_UINT16> ((uuid_state_.clock_sequence + 1) & ACE_UUID_CLOCK_SEQ_MASK); } // If the system time ticked since the last UUID was diff --git a/ace/UUID.h b/ace/UUID.h index 5be6a4c065a..06f09a95404 100644 --- a/ace/UUID.h +++ b/ace/UUID.h @@ -33,14 +33,25 @@ namespace ACE_Utils class ACE_Export UUID_Node { public: + /// Size of the node in bytes. + enum {NODE_ID_SIZE = 6}; - /// Constructor + /// Type definition of the node. + typedef u_char Node_ID[NODE_ID_SIZE]; + + /// Default constructor UUID_Node (void); - enum {NODE_ID_SIZE = 6}; - typedef u_char Node_ID[NODE_ID_SIZE]; + /** + * Copy constructor. + * + * @param[in] node Source node. + */ + UUID_Node (const UUID_Node & node); Node_ID &node_ID (void); + const Node_ID &node_ID (void) const; + void node_ID (Node_ID&); ///// Equality Operations @@ -50,7 +61,11 @@ namespace ACE_Utils ///// Relational Operations //bool operator < (const UUID_Node& right) const; + /// Assign the value of an existing node id to this object. + const UUID_Node & operator = (const UUID_Node & rhs); + private: + /// The value of the node id. Node_ID node_ID_; }; @@ -102,8 +117,10 @@ namespace ACE_Utils u_char clock_seq_low (void) const; void clock_seq_low (u_char); - UUID_Node* node (void) const; - void node (UUID_Node*); + UUID_Node* node (void); + const UUID_Node* node (void) const; + + void node (const UUID_Node*); ACE_CString* thr_id (void); void thr_id (char*); @@ -112,7 +129,7 @@ namespace ACE_Utils void pid (char*); /// Returns a string representation of the UUID - const ACE_CString* to_string (void); + const ACE_CString* to_string (void) const; /// Set the value using a string void from_string (const ACE_CString& uuid_string); @@ -129,25 +146,32 @@ namespace ACE_Utils //bool operator<= (const UUID &right) const; //bool operator>= (const UUID &right) const; + /// Assign an existing UUID to this UUID. + const UUID & operator = (const UUID & rhs); + private: + /** + * Helper method to convert from a string UUID. + * + * @param[in] uuid_string String version of UUID. + */ void from_string_i (const ACE_CString& uuid_string); - UUID& operator= (const UUID&); - /// Data Members for Class Attributes ACE_UINT32 time_low_; ACE_UINT16 time_mid_; ACE_UINT16 time_hi_and_version_; u_char clock_seq_hi_and_reserved_; u_char clock_seq_low_; - UUID_Node* node_; - bool node_release_; + + UUID_Node node_; + ACE_CString thr_id_; ACE_CString pid_; /// The string representation of the UUID. This is created and /// updated only on demand. - ACE_CString *as_string_; + mutable ACE_Auto_Ptr <ACE_CString> as_string_; }; /** @@ -209,7 +233,7 @@ namespace ACE_Utils /// Obtain a UUID timestamp and clock sequence. Compensate for the /// fact that the time obtained from getSystem time has a /// resolution less than 100ns. - void get_timestamp_and_clocksequence (UUID_Time& timestamp, + void get_timestamp_and_clocksequence (UUID_Time& timestamp, ACE_UINT16& clockSequence); /// Obtain the system time in UTC as a count of 100 nanosecond intervals diff --git a/ace/UUID.inl b/ace/UUID.inl index 89526473b0a..bbc494197bd 100644 --- a/ace/UUID.inl +++ b/ace/UUID.inl @@ -68,20 +68,22 @@ namespace ACE_Utils this->clock_seq_low_ = clock_seq_low; } - ACE_INLINE UUID_Node* + ACE_INLINE const UUID_Node* UUID::node (void) const { - return this->node_; + return &this->node_; } - ACE_INLINE void - UUID::node (UUID_Node* node) + ACE_INLINE UUID_Node* + UUID::node (void) { - if (node_release_) - delete node_; + return &this->node_; + } - this->node_ = node; - node_release_ = false; + ACE_INLINE void + UUID::node (const UUID_Node* node) + { + this->node_ = *node; } ACE_INLINE ACE_CString* @@ -122,7 +124,7 @@ namespace ACE_Utils (this->time_hi_and_version_ != right.time_hi_and_version ()) || (this->clock_seq_hi_and_reserved_ != right.clock_seq_hi_and_reserved ()) || (this->clock_seq_low_ != right.clock_seq_low ()) || - (*this->node_ != *right.node ())) + (this->node_ != *right.node ())) return false; return true; diff --git a/ace/Version.h b/ace/Version.h index 07ed2ba9b6e..39527d83d0e 100644 --- a/ace/Version.h +++ b/ace/Version.h @@ -5,5 +5,5 @@ #define ACE_MAJOR_VERSION 5 #define ACE_MINOR_VERSION 6 -#define ACE_BETA_VERSION 6 -#define ACE_VERSION "5.6.6" +#define ACE_BETA_VERSION 7 +#define ACE_VERSION "5.6.7" diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp index b2f849ae3ad..bae271f850a 100644 --- a/ace/WFMO_Reactor.cpp +++ b/ace/WFMO_Reactor.cpp @@ -1756,9 +1756,12 @@ ACE_WFMO_Reactor::ok_to_wait (ACE_Time_Value *max_wait_time, // grab the lock and recheck the ok_to_wait_ event. When we can get them // both, or there's an error/timeout, return. #if defined (ACE_HAS_WINCE) - ACE_Time_Value timeout = ACE_OS::gettimeofday (); + ACE_Time_Value timeout; if (max_wait_time != 0) - timeout += *max_wait_time; + { + timeout = ACE_OS::gettimeofday (); + timeout += *max_wait_time; + } while (1) { int status; @@ -1773,14 +1776,15 @@ ACE_WFMO_Reactor::ok_to_wait (ACE_Time_Value *max_wait_time, if (max_wait_time == 0) status = this->lock_.acquire (); else - status = this->lock_.acquire (timeout); + { + status = this->lock_.acquire (timeout); + } if (status == -1) return -1; // Have the lock_, now re-check the event. If it's not signaled, // another thread changed something so go back and wait again. - ACE_Time_Value poll_it = ACE_OS::gettimeofday (); - if (this->ok_to_wait_.wait (&poll_it) == 0) + if (this->ok_to_wait_.wait (&ACE_Time_Value::zero, 0) == 0) break; this->lock_.release (); } @@ -1899,10 +1903,8 @@ ACE_WFMO_Reactor::expire_timers (void) int ACE_WFMO_Reactor::dispatch (DWORD wait_status) { - int handlers_dispatched = 0; - // Expire timers - handlers_dispatched += this->expire_timers (); + int handlers_dispatched = this->expire_timers (); switch (wait_status) { @@ -1937,7 +1939,7 @@ ACE_WFMO_Reactor::dispatch_handles (DWORD wait_status) DWORD dispatch_slot = 0; // Cache this value, this is the absolute value. - DWORD max_handlep1 = this->handler_rep_.max_handlep1 (); + DWORD const max_handlep1 = this->handler_rep_.max_handlep1 (); // nCount starts off at <max_handlep1>, this is a transient count of // handles last waited on. @@ -2215,7 +2217,7 @@ ACE_WFMO_Reactor::upcall (ACE_Event_Handler *event_handler, } } - if (ACE_BIT_ENABLED (actual_events, FD_ACCEPT)) + if (ACE_BIT_ENABLED (actual_events, FD_ACCEPT)) { action = event_handler->handle_input (io_handle); if (action <= 0) diff --git a/ace/ace.mpc b/ace/ace.mpc index 40dabf2eb3d..4a643b6494d 100644 --- a/ace/ace.mpc +++ b/ace/ace.mpc @@ -176,6 +176,7 @@ project(ACE) : acedefaults, install, other, codecs, token, svcconf, uuid, fileca OS_NS_time.cpp OS_NS_unistd.cpp OS_NS_wchar.cpp + OS_NS_wctype.cpp OS_QoS.cpp OS_Thread_Adapter.cpp OS_TLI.cpp diff --git a/ace/ace_for_tao.mpc b/ace/ace_for_tao.mpc index 1a4d562211f..707532e3e4f 100644 --- a/ace/ace_for_tao.mpc +++ b/ace/ace_for_tao.mpc @@ -135,6 +135,7 @@ project(ACE_FOR_TAO) : acedefaults, install, svcconf, uuid, versioned_namespace, OS_NS_time.cpp OS_NS_unistd.cpp OS_NS_wchar.cpp + OS_NS_wctype.cpp OS_QoS.cpp OS_Thread_Adapter.cpp OS_TLI.cpp @@ -195,7 +196,7 @@ project(ACE_FOR_TAO) : acedefaults, install, svcconf, uuid, versioned_namespace, } // ACE_Token implementation uses semaphores on Windows and VxWorks. - conditional(vc6,vc71,vc8,vc9,nmake,bmake) { + conditional(vc6,vc71,vc8,vc9,vc10,nmake,bmake) { NT_Service.cpp // Required by ace_for_tao sponsors Semaphore.cpp Process_Mutex.cpp diff --git a/ace/config-WinCE.h b/ace/config-WinCE.h index 76ed2d2eed3..bbdf5699368 100644 --- a/ace/config-WinCE.h +++ b/ace/config-WinCE.h @@ -82,21 +82,38 @@ #define ACE_LACKS_PDHMSG_H #define ACE_LACKS_TIME #define ACE_LACKS_TZSET +#define ACE_LACKS_RAISE +#define ACE_LACKS_BSEARCH #define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 #define ACE_LACKS_MSG_WFMO #define ACE_LACKS_UMASK +#define ACE_HAS_TYPES_H +#define ACE_LACKS_DEV_T + +#define ACE_ISCTYPE_EQUIVALENT ::_isctype // WinCE only supports the UNICODE API #if !defined (ACE_USES_WCHAR) # define ACE_USES_WCHAR #endif /* ACE_USES_WCHAR */ -#define ACE_USES_WINCE_SEMA_SIMULATION +#if (_WIN32_WCE < 0x600) +# define ACE_USES_WINCE_SEMA_SIMULATION +# define ACE_LACKS_ERRNO_H +# define ACE_LACKS_DUP +# define ACE_LACKS_GETSYSTEMTIMEASFILETIME +#endif + +#define ACE_LACKS_REGNOTIFYCHANGEKEYVALUE #define ACE_HAS_NONSTATIC_OBJECT_MANAGER 1 +#if ! defined(ACE_DEFAULT_THREAD_KEYS) +# define ACE_DEFAULT_THREAD_KEYS TLS_MINIMUM_AVAILABLE +#endif // ! defined(ACE_DEFAULT_THREAD_KEYS) + // FILE stuff isn't always defined in CE #if (_MSC_VER < 1400) && !defined (_FILE_DEFINED) typedef void FILE; @@ -173,39 +190,32 @@ // @@ NSIG value. This is definitely not correct. #define NSIG 23 - // @@ For some reason, WinCE forgot to define this. // Need to find out what it is. (Used in MapViewOfFile ().) #define FILE_MAP_COPY 0 +#if (_WIN32_WCE >= 0x400) +# define ACE_HAS_INTERLOCKED_EXCHANGEADD +#endif -#define ACE_LACKS_STRCASECMP // WinCE doesn't support _stricmp -#define ACE_LACKS_GETSERVBYNAME #define ACE_LACKS_ACCESS #define ACE_LACKS__WACCESS #define ACE_HAS_ACCESS_EMULATION -#define ACE_LACKS_FILELOCKS +#if (_WIN32_WCE < 0x500) +# define ACE_LACKS_FILELOCKS +#endif #define ACE_LACKS_EXEC #define ACE_LACKS_MKTEMP -#define ACE_LACKS_STRRCHR -#define ACE_LACKS_BSEARCH -#define ACE_LACKS_SOCKET_BUFSIZ #define ACE_LACKS_ISATTY #define ACE_LACKS_STRERROR #define ACE_LACKS_SYSTEM -#define ACE_LACKS_SIGACTION #define ACE_LACKS_PIPE -//#define ACE_LACKS_CUSERID #define ACE_LACKS_CHDIR #define ACE_LACKS_ENV -#define ACE_LACKS_HOSTNAME #define ACE_LACKS_REALPATH -#define ACE_LACKS_READLINK #define ACE_LACKS_SWAB #define ACE_LACKS_TEMPNAM -#define ACE_LACKS_GETPROTOBYNUMBER -#define ACE_LACKS_GETPROTOBYNAME #if defined (_WIN32_WCE_EMULATION) // @@ For some reason, qsort isn't defined correctly (_stdcall vs _cdecl) @@ -217,25 +227,31 @@ # define BUFSIZ 1024 #endif -typedef void (__cdecl * __sighandler_t)(int); // keep Signal compilation happy -typedef long off_t; - #define ACE_LACKS_MALLOC_H // We do have malloc.h, but don't use it. #define ACE_HAS_WINCE_BROKEN_ERRNO #define ACE_HAS_STRDUP_EMULATION +#if !defined (MAXSYMLINKS) +#define MAXSYMLINKS 0 +#endif + // WinCE can't do fixed addresses for memory-mapped files. #if defined (ACE_DEFAULT_BASE_ADDR) # undef ACE_DEFAULT_BASE_ADDR #endif #define ACE_DEFAULT_BASE_ADDR 0 +#if (_WIN32_WCE < 0x600) #define ACE_HAS_TSS_EMULATION +#endif // WinCE version < 6.0 + +// CE doesn't support FILE_SHARE_DELETE like regular windows +#if !defined (ACE_DEFAULT_FILE_PERMS) +#define ACE_DEFAULT_FILE_PERMS (FILE_SHARE_READ | FILE_SHARE_WRITE) +#endif -// This is still true up thru VC8... -#define ACE_LACKS_ERRNO_H #define ACE_LACKS_SIGNAL_H #define ACE_LACKS_SYS_STAT_H diff --git a/ace/config-aix-5.x.h b/ace/config-aix-5.x.h index 8068829fd2a..2876f052b81 100644 --- a/ace/config-aix-5.x.h +++ b/ace/config-aix-5.x.h @@ -179,6 +179,7 @@ #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT #define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_ICMP_SUPPORT 1 #define ACE_HAS_IP_MULTICAST // Lacks perfect filtering, must bind group address. @@ -246,6 +247,8 @@ #define ACE_HAS_UTIME +#define ACE_HAS_CTYPE_T + // Platform has XPG4 wide character type and functions. However, the size // of wchar_t changes for 32- vs. 64-bit builds (unsigned short vs. unsigned // int, respectively). @@ -329,5 +332,6 @@ #define ACE_SCANDIR_SEL_LACKS_CONST #define ACE_HAS_SIGSUSPEND #define ACE_HAS_TIMEZONE /* Call tzset() to set timezone */ +#define ACE_LACKS_ISCTYPE #endif /* ACE_CONFIG_AIX_5_X_H */ diff --git a/ace/config-cray.h b/ace/config-cray.h index 4a10f013664..94b28a25c16 100644 --- a/ace/config-cray.h +++ b/ace/config-cray.h @@ -203,7 +203,6 @@ /* #define ACE_HAS_TLI */ /* #define ACE_HAS_TIUSER_H */ /* #define ACE_HAS_TLI_PROTOTYPES */ -/* #define ACE_LACKS_T_ERRNO */ /* #define ACE_LACKS_NAMED_POSIX_SEM */ diff --git a/ace/config-cygwin32.h b/ace/config-cygwin32.h index adfb4b1a03c..f1e424319fa 100644 --- a/ace/config-cygwin32.h +++ b/ace/config-cygwin32.h @@ -25,7 +25,7 @@ #endif /* ACE_IOV_MAX */ // Define custom export macros for export/import of symbols from/of dll's -#define ACE_HAS_CUSTOM_EXPORT_MACROS +#define ACE_HAS_CUSTOM_EXPORT_MACROS 1 #define ACE_Proper_Export_Flag __declspec (dllexport) #define ACE_Proper_Import_Flag __declspec (dllimport) #define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T @@ -145,6 +145,7 @@ #define ACE_LACKS_FPUTWS 1 #define ACE_LACKS_WCSTOULL 1 +#define ACE_LACKS_ISCTYPE #define ACE_HAS_AUTOMATIC_INIT_FINI diff --git a/ace/config-hpux-11.00.h b/ace/config-hpux-11.00.h index 4ef1353c7b0..3d5ca503100 100644 --- a/ace/config-hpux-11.00.h +++ b/ace/config-hpux-11.00.h @@ -337,11 +337,15 @@ #define ACE_LACKS_SUSECONDS_T #define ACE_LACKS_SYS_SYSCTL_H -// @@ TODO: It looks like HP-UX provides strtoull and wcstoull -// but some more work is needed to plug them in correctly. +// @@ TODO: It looks like HP-UX provides strtoll, strtoull, wcstoll and +// wcstoull but some more work is needed to plug them in correctly. +#define ACE_LACKS_STRTOLL +#define ACE_LACKS_WCSTOLL #define ACE_LACKS_STRTOULL #define ACE_LACKS_WCSTOULL +#define ACE_LACKS_ISWASCII + // Shared library name/path components #if defined (__ia64) # define ACE_DLL_SUFFIX ACE_TEXT (".so") diff --git a/ace/config-linux-common.h b/ace/config-linux-common.h index c3d709c3645..69acd81901b 100644 --- a/ace/config-linux-common.h +++ b/ace/config-linux-common.h @@ -174,12 +174,6 @@ #elif defined (__DECCXX) # define ACE_CONFIG_INCLUDE_CXX_COMMON # include "ace/config-cxx-common.h" -#elif defined (__BORLANDC__) -# undef ACE_HAS_LLSEEK -# undef ACE_HAS_LSEEK64 -# undef ACE_LACKS_LLSEEK_PROTOTYPE -# undef ACE_LACKS_LSEEK64_PROTOTYPE -# include "ace/config-borland-common.h" #elif defined (__SUNCC_PRO) # include "ace/config-suncc-common.h" #elif defined (__PGI) @@ -199,7 +193,7 @@ * (TAO/orbsvcs/orbsvcs/SSLIOP/params_dup.{h,c}) that may indirectly * include this */ -#else /* ! __GNUG__ && !__DECCXX && !__INTEL_COMPILER && !__BORLANDC__ && !__PGI */ +#else /* ! __GNUG__ && !__DECCXX && !__INTEL_COMPILER && && !__PGI */ # ifdef __cplusplus /* Let it slide for C compilers. */ # error unsupported compiler in ace/config-linux-common.h # endif /* __cplusplus */ @@ -239,6 +233,7 @@ #define ACE_LACKS_ITOW #define ACE_LACKS_WCSICMP #define ACE_LACKS_WCSNICMP +#define ACE_LACKS_ISWASCII #if __GLIBC__ >= 2 # define ACE_HAS_3_PARAM_WCSTOK @@ -378,9 +373,9 @@ #if defined (__ia64) || defined(__alpha) || defined (__x86_64__) // On 64 bit platforms, the "long" type is 64-bits. Override the // default 32-bit platform-specific format specifiers appropriately. -# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%lu") -# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%ld") -# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu") +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%lu" +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" #endif /* __ia64 */ #define ACE_SIZEOF_WCHAR 4 @@ -398,6 +393,13 @@ #define ACE_HAS_ICMP_SUPPORT 1 +// According to man pages Linux uses different (compared to UNIX systems) types +// for setting IP_MULTICAST_TTL and IPV6_MULTICAST_LOOP / IP_MULTICAST_LOOP +// in setsockopt/getsockopt. +#define ACE_HAS_IP_MULTICAST_TTL_AS_INT 1 +#define ACE_HAS_IPV6_MULTICAST_LOOP_AS_BOOL 1 +#define ACE_HAS_IP_MULTICAST_LOOP_AS_INT 1 + #if defined (ACE_LACKS_NETWORKING) # include "ace/config-posix-nonetworking.h" #else diff --git a/ace/config-lynxos.h b/ace/config-lynxos.h index b27c167b594..b0c30ed6cca 100644 --- a/ace/config-lynxos.h +++ b/ace/config-lynxos.h @@ -69,7 +69,6 @@ #define ACE_HAS_SSIZE_T #define ACE_HAS_STREAMS #define ACE_HAS_STRERROR -#define ACE_HAS_SYSV_IPC #define ACE_HAS_SYS_SIGLIST #define ACE_HAS_SYS_SOCKIO_H #define ACE_HAS_TERMIOS @@ -99,6 +98,7 @@ #define ACE_PAGE_SIZE 4096 #define ACE_POSIX_SIG_PROACTOR #define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR +#define ACE_LACKS_ISCTYPE // LynxOS has poll.h but it is unusable since implementation is not provided #define ACE_LACKS_POLL_H @@ -170,6 +170,7 @@ # define ACE_HAS_STRBUF_T # define ACE_HAS_SYSV_IPC # define ACE_LACKS_USECONDS_T +# define ACE_LACKS_ISBLANK #endif #if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) diff --git a/ace/config-macosx-leopard.h b/ace/config-macosx-leopard.h index 30f3f6c90ec..a8678fd6490 100644 --- a/ace/config-macosx-leopard.h +++ b/ace/config-macosx-leopard.h @@ -24,13 +24,15 @@ # include "ace/config-g++-common.h" #endif /* __GNUG__ */ +#define ACE_ISCTYPE_EQUIVALENT __isctype + #ifndef ACE_HAS_NONCONST_FD_ISSET #define ACE_HAS_NONCONST_FD_ISSET #endif #define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR -#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu") +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" #if !defined (__i386__) # if defined (ACE_HAS_PENTIUM) @@ -52,7 +54,7 @@ #define ACE_LACKS_STROPTS_H // Platform provides <execinfo.h> header. -#define ACE_HAS_EXECINFO_H +#define ACE_HAS_EXECINFO_H // Wcharness.... #define ACE_HAS_WCHAR diff --git a/ace/config-macosx-panther.h b/ace/config-macosx-panther.h index 1c7361fd416..b6bc04449c8 100644 --- a/ace/config-macosx-panther.h +++ b/ace/config-macosx-panther.h @@ -15,7 +15,7 @@ #endif /* __GNUG__ */ #define ACE_LACKS_SUSECONDS_T -#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu") +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" #if defined (ACE_HAS_PENTIUM) # undef ACE_HAS_PENTIUM diff --git a/ace/config-macosx-tiger.h b/ace/config-macosx-tiger.h index ffbac895798..60049cb3b79 100644 --- a/ace/config-macosx-tiger.h +++ b/ace/config-macosx-tiger.h @@ -26,7 +26,7 @@ #define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR -#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu") +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" #if !defined (__i386__) # if defined (ACE_HAS_PENTIUM) diff --git a/ace/config-macosx.h b/ace/config-macosx.h index c721353ca48..513a2d3d890 100644 --- a/ace/config-macosx.h +++ b/ace/config-macosx.h @@ -14,7 +14,7 @@ # include "ace/config-g++-common.h" #endif /* __GNUG__ */ -#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu") +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" #if defined (ACE_HAS_PENTIUM) # undef ACE_HAS_PENTIUM diff --git a/ace/config-macros.h b/ace/config-macros.h index f6bba26fec8..b980f998f19 100644 --- a/ace/config-macros.h +++ b/ace/config-macros.h @@ -629,4 +629,10 @@ extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \ #define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B) // ------------------------------------------------------------------- +/// If MPC is using a lib modifier this define will be set and this then +/// is used by the service configurator framework +#if defined MPC_LIB_MODIFIER && !defined (ACE_LD_DECORATOR_STR) +#define ACE_LD_DECORATOR_STR ACE_TEXT( MPC_LIB_MODIFIER ) +#endif /* MPC_LIB_MODIFIER */ + #endif /* ACE_CONFIG_MACROS_H */ diff --git a/ace/config-netbsd.h b/ace/config-netbsd.h index 7c25423fe4c..999b66ce5e5 100644 --- a/ace/config-netbsd.h +++ b/ace/config-netbsd.h @@ -123,6 +123,9 @@ #define ACE_LACKS_WCSICMP 1 #define ACE_LACKS_WCSNICMP 1 #define ACE_SCANDIR_CMP_USES_CONST_VOIDPTR 1 +#define ACE_LACKS_WSCANF +#define ACE_LACKS_SWSCANF +#define ACE_LACKS_ISCTYPE #if defined(__x86_64__) #define ACE_SIZEOF_DOUBLE 8 @@ -138,8 +141,8 @@ typedef unsigned long ACE_UINT64; typedef signed long ACE_INT64; -#define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%ld") -#define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%lu") +#define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%ld" +#define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%lu" #elif defined(__i386__) diff --git a/ace/config-openvms.h b/ace/config-openvms.h index 1f02137f4fa..5df116741d1 100644 --- a/ace/config-openvms.h +++ b/ace/config-openvms.h @@ -129,6 +129,7 @@ #define ACE_LACKS_SETSCHED #define ACE_LACKS_SYSCALL 1 #define ACE_LACKS_WCSTOULL 1 +#define ACE_LACKS_WCSTOLL /* (missing) standard data types */ #define ACE_LACKS_CONST_TIMESPEC_PTR 1 @@ -191,5 +192,7 @@ #define ACE_LACKS_UNIX_DOMAIN_SOCKETS 1 #define ACE_LACKS_UNIX_SYSLOG 1 #define ACE_LACKS_ALPHASORT 1 +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_ISBLANK #endif diff --git a/ace/config-qnx-rtp-62x.h b/ace/config-qnx-rtp-62x.h index 2deaa6b78f8..c7aa8eb08fe 100644 --- a/ace/config-qnx-rtp-62x.h +++ b/ace/config-qnx-rtp-62x.h @@ -101,6 +101,7 @@ #define ACE_LACKS_ALPHASORT #define ACE_LACKS_FD_MASK #define ACE_LACKS_NFDBITS +#define ACE_LACKS_ISCTYPE #define ACE_LACKS_RLIMIT // QNX rlimit syscalls don't work properly with ACE. diff --git a/ace/config-sco-5.0.0.h b/ace/config-sco-5.0.0.h index 519b74a2ead..d5fd5783e09 100644 --- a/ace/config-sco-5.0.0.h +++ b/ace/config-sco-5.0.0.h @@ -48,9 +48,6 @@ // Compiler/platform has correctly prototyped header files. #define ACE_HAS_CPLUSPLUS_HEADERS -// Header files lack t_errno for ACE_TLI. -//#define ACE_LACKS_T_ERRNO - // Compiler/platform supports poll(). // #define ACE_HAS_POLL diff --git a/ace/config-sunos5.10.h b/ace/config-sunos5.10.h index db7ccc7dd1f..ca5b979495b 100644 --- a/ace/config-sunos5.10.h +++ b/ace/config-sunos5.10.h @@ -27,25 +27,38 @@ # undef ACE_LACKS_LOG2 #endif +// Solaris 10 offers a useable isblank() unlike previous Solaris versions. +#if defined (ACE_LACKS_ISBLANK) +# undef ACE_LACKS_ISBLANK +#endif + // Solaris 10 delivers pthread_attr_setstack #if defined (ACE_LACKS_PTHREAD_ATTR_SETSTACK) # undef ACE_LACKS_PTHREAD_ATTR_SETSTACK #endif // Solaris 10 introduced printf() modifiers for [s]size_t types. -#if defined (ACE_SSIZE_T_FORMAT_SPECIFIER) -# undef ACE_SSIZE_T_FORMAT_SPECIFIER -# define ACE_SSIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%zd") -#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER */ +#if defined (ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII) +# undef ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII +# define ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII "%zd" +#endif /* ACE_SSIZE_T_FORMAT_SPECIFIER_ASCII */ -#if defined (ACE_SIZE_T_FORMAT_SPECIFIER) -# undef ACE_SIZE_T_FORMAT_SPECIFIER -# define ACE_SIZE_T_FORMAT_SPECIFIER ACE_TEXT ("%zu") -#endif /* ACE_SIZE_T_FORMAT_SPECIFIER */ +#if defined (ACE_SIZE_T_FORMAT_SPECIFIER_ASCII) +# undef ACE_SIZE_T_FORMAT_SPECIFIER_ASCII +# define ACE_SIZE_T_FORMAT_SPECIFIER_ASCII "%zu" +#endif /* ACE_SIZE_T_FORMAT_SPECIFIER_ASCII */ -// Solaris 10 offers wcstoull() +// Solaris 10 offers wcstoll() and wcstoull() +#if defined (ACE_LACKS_WCSTOLL) +# undef ACE_LACKS_WCSTOLL +#endif /* ACE_LACKS_WCSTOLL */ #if defined (ACE_LACKS_WCSTOULL) # undef ACE_LACKS_WCSTOULL #endif /* ACE_LACKS_WCSTOULL */ +#if defined (ACE_HAS_SCTP) && defined (ACE_HAS_LKSCTP) +# define ACE_HAS_VOID_PTR_SCTP_GETLADDRS +# define ACE_HAS_VOID_PTR_SCTP_GETPADDRS +#endif + #endif /* ACE_CONFIG_H */ diff --git a/ace/config-sunos5.5.h b/ace/config-sunos5.5.h index ec6c0dd9ae6..1fdb78df00f 100644 --- a/ace/config-sunos5.5.h +++ b/ace/config-sunos5.5.h @@ -368,6 +368,9 @@ #define ACE_HAS_GPERF #define ACE_HAS_DIRENT +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_ISBLANK + #if defined (__SUNPRO_CC) # define ACE_CC_NAME ACE_TEXT ("SunPro C++") # define ACE_CC_MAJOR_VERSION (__SUNPRO_CC >> 8) @@ -399,6 +402,7 @@ #define ACE_LACKS_INET_ATON // Solaris doesn't have wcstoull +#define ACE_LACKS_WCSTOLL #define ACE_LACKS_WCSTOULL #if defined (_LARGEFILE_SOURCE) || (_FILE_OFFSET_BITS==64) diff --git a/ace/config-tandem-nsk-mips-v2.h b/ace/config-tandem-nsk-mips-v2.h index 9c302e3c21a..2df876b180b 100644 --- a/ace/config-tandem-nsk-mips-v2.h +++ b/ace/config-tandem-nsk-mips-v2.h @@ -231,8 +231,8 @@ typedef enum CMA_T_SCHED_POLICY { #define ACE_HRTIME_T_IS_BASIC_TYPE // printf format specifiers for 64 bit integers -# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%Ld") -# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%Ld") +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%Ld" +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%Ld" //========================================================================= // Threads specific parts diff --git a/ace/config-tandem-nsk-mips-v3.h b/ace/config-tandem-nsk-mips-v3.h index a70c0016a34..55e119605e5 100644 --- a/ace/config-tandem-nsk-mips-v3.h +++ b/ace/config-tandem-nsk-mips-v3.h @@ -232,8 +232,8 @@ typedef enum CMA_T_SCHED_POLICY { #define ACE_HRTIME_T_IS_BASIC_TYPE // printf format specifiers for 64 bit integers -# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%Ld") -# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%Ld") +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%Ld" +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%Ld" // Use larger default buffer size for ease of interoperability #define ACE_DEFAULT_CDR_BUFSIZE 4096 diff --git a/ace/config-vxworks5.x.h b/ace/config-vxworks5.x.h index ace8dd70bf7..b7570bfbc1e 100644 --- a/ace/config-vxworks5.x.h +++ b/ace/config-vxworks5.x.h @@ -241,6 +241,9 @@ #define ACE_LACKS_TERMIOS_H #define ACE_LACKS_POLL_H #define ACE_LACKS_WCTYPE_H +#define ACE_LACKS_ISCTYPE +#define ACE_LACKS_ISWCTYPE +#define ACE_LACKS_ISBLANK // Not sure if these should always be defined. #define ACE_LACKS_SYS_UN_H @@ -269,6 +272,8 @@ #define ACE_LACKS_WCSTOL #define ACE_LACKS_WCSTOUL #define ACE_LACKS_WCSDUP +#define ACE_LACKS_STRTOLL +#define ACE_LACKS_WCSTOLL #define ACE_LACKS_STRTOULL #define ACE_LACKS_WCSTOULL diff --git a/ace/config-vxworks6.2.h b/ace/config-vxworks6.2.h index b197021ed6a..5e24ae84c2f 100644 --- a/ace/config-vxworks6.2.h +++ b/ace/config-vxworks6.2.h @@ -193,11 +193,14 @@ #define ACE_LACKS_WCSDUP #define ACE_LACKS_WCSICMP #define ACE_LACKS_WCSNICMP +#define ACE_LACKS_STRTOLL +#define ACE_LACKS_WCSTOLL #define ACE_LACKS_STRTOULL #define ACE_LACKS_WCSTOULL #define ACE_HAS_CHARPTR_SOCKOPT #define ACE_LACKS_SYMLINKS +#define ACE_LACKS_ISCTYPE #if defined __RTP__ // We are building for RTP mode @@ -213,6 +216,7 @@ #define ACE_HAS_VFWPRINTF #define ACE_SIZEOF_WCHAR 2 #define ACE_HAS_TIMEZONE + #define ACE_LACKS_ISASCII #else // We are building for kernel mode #define ACE_LACKS_INTPTR_T @@ -258,10 +262,12 @@ #define ACE_LACKS_FGETWC #define ACE_LACKS_FGETWS #define ACE_LACKS_FPUTWS + #define ACE_LACKS_ISWCTYPE #if !defined (ACE_MAIN) # define ACE_MAIN ace_main #endif /* ! ACE_MAIN */ #define ACE_LACKS_TZSET + #define ACE_LACKS_ISBLANK #endif // It is possible to enable pthread support with VxWorks, when the user decides diff --git a/ace/config-vxworks6.3.h b/ace/config-vxworks6.3.h index dfdb80795e0..d8d0697d17a 100644 --- a/ace/config-vxworks6.3.h +++ b/ace/config-vxworks6.3.h @@ -167,11 +167,14 @@ #define ACE_LACKS_WCSDUP #define ACE_LACKS_WCSICMP #define ACE_LACKS_WCSNICMP +#define ACE_LACKS_STRTOLL +#define ACE_LACKS_WCSTOLL #define ACE_LACKS_STRTOULL #define ACE_LACKS_WCSTOULL #define ACE_HAS_CHARPTR_SOCKOPT #define ACE_LACKS_SYMLINKS +#define ACE_LACKS_ISCTYPE #if defined __RTP__ // We are building for RTP mode @@ -196,6 +199,7 @@ #define ACE_IOV_MAX 16 #endif #define ACE_HAS_TIMEZONE + #define ACE_LACKS_ISASCII #else // We are building for kernel mode #define ACE_LACKS_SUSECONDS_T @@ -248,6 +252,8 @@ # define ACE_MAIN ace_main #endif /* ! ACE_MAIN */ #define ACE_LACKS_TZSET + #define ACE_LACKS_ISWCTYPE + #define ACE_LACKS_ISBLANK #endif // It is possible to enable pthread support with VxWorks, when the user decides diff --git a/ace/config-vxworks6.4.h b/ace/config-vxworks6.4.h index ecd231c4129..16aa1d6561c 100644 --- a/ace/config-vxworks6.4.h +++ b/ace/config-vxworks6.4.h @@ -192,11 +192,14 @@ #define ACE_LACKS_WCSDUP #define ACE_LACKS_WCSICMP #define ACE_LACKS_WCSNICMP +#define ACE_LACKS_STRTOLL +#define ACE_LACKS_WCSTOLL #define ACE_LACKS_STRTOULL #define ACE_LACKS_WCSTOULL #define ACE_HAS_CHARPTR_SOCKOPT #define ACE_LACKS_SYMLINKS +#define ACE_LACKS_ISCTYPE #if defined __RTP__ // We are building for RTP mode @@ -223,6 +226,7 @@ #if !defined (IOV_MAX) || (IOV_MAX == 0) #define ACE_IOV_MAX 16 #endif + #define ACE_LACKS_ISASCII #else // We are building for kernel mode #define ACE_LACKS_SUSECONDS_T @@ -274,6 +278,8 @@ # define ACE_MAIN ace_main #endif /* ! ACE_MAIN */ #define ACE_LACKS_TZSET + #define ACE_LACKS_ISWCTYPE + #define ACE_LACKS_ISBLANK #endif // It is possible to enable pthread support with VxWorks, when the user decides diff --git a/ace/config-vxworks6.7.h b/ace/config-vxworks6.7.h new file mode 100644 index 00000000000..7d11b8c53bb --- /dev/null +++ b/ace/config-vxworks6.7.h @@ -0,0 +1,21 @@ +//* -*- C++ -*- */ +// $Id$ + +// The following configuration file is designed to work for VxWorks +// 6.7 platforms using one of these compilers: +// 1) The GNU g++ compiler that is shipped with VxWorks 6.7 +// 2) The Diab compiler that is shipped with VxWorks 6.7 + +#ifndef ACE_CONFIG_VXWORKS_6_7_H +#define ACE_CONFIG_VXWORKS_6_7_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_VXWORKS) +# define ACE_VXWORKS 0x670 +#endif /* ! ACE_VXWORKS */ + +#include "ace/config-vxworks6.6.h" + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_VXWORKS_6_7_H */ + diff --git a/ace/config-win32-borland.h b/ace/config-win32-borland.h index 16c2c3188e2..3e93b6714dc 100644 --- a/ace/config-win32-borland.h +++ b/ace/config-win32-borland.h @@ -11,7 +11,35 @@ #error Use config-win32.h in config.h instead of this header #endif /* ACE_CONFIG_WIN32_H */ -#include "config-borland-common.h" +#if (__BORLANDC__ < 0x593) +#error This version of CodeGear C++ is not supported. +#endif + +#define ACE_HAS_CUSTOM_EXPORT_MACROS +#define ACE_Proper_Export_Flag __declspec (dllexport) +#define ACE_Proper_Import_Flag __declspec (dllimport) +#define ACE_EXPORT_SINGLETON_DECLARATION(T) template class __declspec (dllexport) T +#define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllexport) SINGLETON_TYPE<CLASS, LOCK>; +#define ACE_IMPORT_SINGLETON_DECLARATION(T) template class __declspec (dllimport) T +#define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class __declspec (dllimport) SINGLETON_TYPE <CLASS, LOCK>; + +// In later versions of C++Builder we will prefer inline functions by +// default. The debug configuration of ACE is built with functions +// out-of-line, so when linking your application against a debug ACE +// build, you can choose to use the out-of-line functions by adding +// ACE_NO_INLINE=1 to your project settings. +# if !defined (__ACE_INLINE__) +# define __ACE_INLINE__ 1 +# endif /* __ACE_INLINE__ */ + +# define ACE_CC_NAME ACE_TEXT ("Borland C++ Builder") +# define ACE_CC_MAJOR_VERSION (__BORLANDC__ / 0x100) +# define ACE_CC_MINOR_VERSION (__BORLANDC__ % 0x100) +# define ACE_CC_BETA_VERSION (0) + +# ifndef ACE_USING_MCPP_PREPROCESSOR +# define ACE_CC_PREPROCESSOR_ARGS "-q -P- -o%s" +# endif // Automatically define WIN32 macro if the compiler tells us it is our // target platform. @@ -30,16 +58,10 @@ # include "ace/config-win32-common.h" -// Borland on win32 has swab -# undef ACE_LACKS_SWAB - # define ACE_WSTRING_HAS_USHORT_SUPPORT 1 # define ACE_HAS_DIRENT -#ifdef ACE_USES_STD_NAMESPACE_FOR_STDC_LIB -#undef ACE_USES_STD_NAMESPACE_FOR_STDC_LIB #define ACE_USES_STD_NAMESPACE_FOR_STDC_LIB 1 -#endif #define ACE_NEEDS_DL_UNDERSCORE @@ -84,6 +106,29 @@ #define ACE_LACKS_STRRECVFD #define ACE_USES_EXPLICIT_STD_NAMESPACE +# define ACE_EXPORT_NESTED_CLASSES 1 +# define ACE_HAS_CPLUSPLUS_HEADERS 1 +# define ACE_HAS_EXCEPTIONS +# define ACE_HAS_GNU_CSTRING_H 1 +# define ACE_HAS_NONCONST_SELECT_TIMEVAL +# define ACE_HAS_SIG_ATOMIC_T +# define ACE_HAS_STANDARD_CPP_LIBRARY 1 +# define ACE_HAS_STDCPP_STL_INCLUDES 1 +# define ACE_HAS_STRERROR +# define ACE_HAS_STRING_CLASS 1 +# define ACE_HAS_TEMPLATE_TYPEDEFS 1 +# define ACE_HAS_USER_MODE_MASKS 1 +# define ACE_LACKS_ACE_IOSTREAM 1 +# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 +# define ACE_LACKS_PRAGMA_ONCE 1 +# define ACE_HAS_NEW_NOTHROW +# define ACE_TEMPLATES_REQUIRE_SOURCE 1 +# define ACE_SIZEOF_LONG_DOUBLE 10 +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%Lu" +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%Ld" +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) + #if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) // must have _MT defined to include multithreading // features from win32 headers @@ -95,19 +140,22 @@ # endif /* !_MT && !ACE_HAS_WINCE */ #endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ -#if (__BORLANDC__ < 0x580) -# define ACE_LACKS_INTPTR_T -# define ACE_HAS_NONCONST_SWAB -# define ACE_HAS_NONCONST_FDOPEN -#endif - #if (__BORLANDC__ < 0x610) # define ACE_HAS_NONCONST_TEMPNAM +# define ACE_LACKS_STRTOLL +# define ACE_LACKS_WCSTOLL # define ACE_LACKS_STRTOULL # define ACE_LACKS_WCSTOULL #endif #if (__BORLANDC__ <= 0x610) +# define ACE_LACKS_ISBLANK +# define ACE_LACKS_ISWBLANK +# define ACE_LACKS_ISCTYPE +# define ACE_LACKS_ISWCTYPE +#endif + +#if (__BORLANDC__ <= 0x610) // Older Borland compilers can't handle assembly in inline methods or // templates (E2211). When we build for pentium optimized and we are inlining // then we disable inline assembly @@ -116,9 +164,11 @@ # endif #endif + #define ACE_WCSDUP_EQUIVALENT ::_wcsdup #define ACE_STRCASECMP_EQUIVALENT ::stricmp #define ACE_STRNCASECMP_EQUIVALENT ::strnicmp +#define ACE_WTOF_EQUIVALENT ::_wtof #define ACE_HAS_ITOA 1 #include /**/ "ace/post.h" diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index fab02559189..5d6e52b1832 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -191,7 +191,15 @@ #if !defined (ACE_HAS_WINCE) // Platform supports pread() and pwrite() -# define ACE_HAS_P_READ_WRITE +# define ACE_HAS_WTOF +#endif /* ! ACE_HAS_WINCE */ + +#define ACE_HAS_P_READ_WRITE + +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_DIRECT_H +# define ACE_HAS_PROCESS_H +# define ACE_HAS_IO_H #endif /* ! ACE_HAS_WINCE */ #if !defined (__MINGW32__) @@ -436,12 +444,13 @@ #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) +# define ACE_HAS_ICMP_SUPPORT 1 # if !defined (_WINSOCK2API_) // will also include windows.h, if not present # include /**/ <winsock2.h> // WinCE 4 doesn't define the Exxx values without the WSA prefix, so do that // here. This is all lifted from the #if 0'd out part of winsock2.h. -# if defined (UNDER_CE) +# if defined (_WIN32_WCE) && (_WIN32_WCE < 0x600) # define EWOULDBLOCK WSAEWOULDBLOCK # define EINPROGRESS WSAEINPROGRESS # define EALREADY WSAEALREADY @@ -529,8 +538,8 @@ # define ACE_HAS_IP_MULTICAST #endif /* ACE_HAS_WINSOCK2 */ -#if !defined (ACE_HAS_WINCE) || defined (PPC) /* CE only on some CPUs */ -# define ACE_HAS_INTERLOCKED_EXCHANGEADD +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_INTERLOCKED_EXCHANGEADD #endif #define ACE_HAS_WIN32_TRYLOCK diff --git a/ace/config-win32-ghs.h b/ace/config-win32-ghs.h index 95bf474852e..2467d4845c4 100644 --- a/ace/config-win32-ghs.h +++ b/ace/config-win32-ghs.h @@ -74,9 +74,8 @@ //# define ACE_NEW_THROWS_EXCEPTIONS 1 # define ACE_SIZEOF_LONG_DOUBLE 10 # define ACE_TEMPLATES_REQUIRE_SOURCE 1 -// Changed ACE_TEXT to ACE_TEXT in the following two lines -# define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%I64u") -# define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%I64d") +# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%I64u" +# define ACE_INT64_FORMAT_SPECIFIER_ASCII "%I64d" # define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 // Set the following to zero to placate SString.h ACE_WString CTOR # undef ACE_WSTRING_HAS_USHORT_SUPPORT diff --git a/ace/config-win32-mingw.h b/ace/config-win32-mingw.h index fd61b5bd517..afb1e1233e5 100644 --- a/ace/config-win32-mingw.h +++ b/ace/config-win32-mingw.h @@ -52,6 +52,7 @@ #endif #undef ACE_LACKS_SIGSET +#undef ACE_HAS_WTOF #define ACE_LACKS_SIGSET_DEFINITIONS #define ACE_LACKS_SYS_SHM_H @@ -84,6 +85,7 @@ #define ACE_LACKS_PDHMSG_H #define ACE_HAS_NONCONST_WCSDUP #define ACE_HAS_WINSOCK2_GQOS +#define ACE_ISCTYPE_EQUIVALENT ::_isctype // We trust the user: He must have used -mpentiumpro or -mpentium // if that is what he wants. @@ -91,8 +93,8 @@ # define ACE_HAS_PENTIUM #endif -#define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%I64d") -#define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%I64u") +#define ACE_INT64_FORMAT_SPECIFIER_ASCII "%I64d" +#define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%I64u" #define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) (STATUS)) diff --git a/ace/config-win32-msvc-10.h b/ace/config-win32-msvc-10.h new file mode 100644 index 00000000000..b91e241530d --- /dev/null +++ b/ace/config-win32-msvc-10.h @@ -0,0 +1,142 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file config-win32-msvc-10.h + * + * $Id$ + * + * @brief Microsoft Visual C++ 10.0 configuration file. + * + * This file is the ACE configuration file for Microsoft Visual C++ version 10. + * + * @note Do not include this file directly, include config-win32.h instead. + */ +//============================================================================= + +#ifndef ACE_CONFIG_WIN32_MSVC_10_H +#define ACE_CONFIG_WIN32_MSVC_10_H +#include /**/ "ace/pre.h" + +#ifndef ACE_CONFIG_WIN32_H +#error Use config-win32.h in config.h instead of this header +#endif /* ACE_CONFIG_WIN32_H */ + +#ifndef ACE_WIN32_VC10 +# define ACE_WIN32_VC10 +#endif + +// Visual C++ 9.0 (.NET) deprecated the old iostreams +#if !defined (ACE_HAS_STANDARD_CPP_LIBRARY) +#define ACE_HAS_STANDARD_CPP_LIBRARY 1 +#endif + +#if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +#define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +#endif + +// Windows' timeval is non-conformant (defined in terms of long instead of +// time_t) and VC9 (on desktop, not CE) changed time_t to a 64-bit value +// even when compiling a 32-bit application. Therefore, ace/Time_Value +// needs to rearrange a few things for this compiler. See Time_Value.h +// for complete details. +#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_TIME_T_LONG_MISMATCH +#endif + +#define ACE_HAS_ITOA +#define ACE_HAS_HEADER_ALLOCATED_CLASS_STATIC_CONST_INT_STOREAGE +#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR + +#define ACE_ITOA_EQUIVALENT ::_itoa +#define ACE_STRCASECMP_EQUIVALENT ::_stricmp +#define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp +#define ACE_WCSDUP_EQUIVALENT ::_wcsdup + +#ifndef ACE_HAS_EXCEPTIONS +# define ACE_HAS_EXCEPTIONS +#endif + +// Windows Mobile 6 doesn't do sig_atomic_t, but maybe future versions will. +# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x601) +# define ACE_HAS_SIG_ATOMIC_T +# endif /* !Win CE 6.0 or less */ + +#define ACE_HAS_STRERROR +#define ACE_LACKS_STRPTIME + +// Evaluate this with a WinCE build; maybe things have improved since VC8. +//#if !defined (ACE_HAS_WINCE) +# define ACE_HAS_INTRIN_H +# define ACE_HAS_INTRINSIC_INTERLOCKED +//#endif + +#if !defined (_WIN32_WCE) || (_WIN32_WCE >= 0x501) +# define ACE_HAS_INTRINSIC_BYTESWAP +#endif + +#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES +#define ACE_LACKS_STRRECVFD +#define ACE_HAS_CPLUSPLUS_HEADERS + +#define ACE_HAS_TEMPLATE_TYPEDEFS +#define ACE_TEMPLATES_REQUIRE_SOURCE + +// Platform provides ACE_TLI function prototypes. +// For Win32, this is not really true, but saves a lot of hassle! +#define ACE_HAS_TLI_PROTOTYPES + +// Platform support linebuffered streaming is broken +#define ACE_LACKS_LINEBUFFERED_STREAMBUF + +#if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && (ACE_HAS_STANDARD_CPP_LIBRARY != 0) + +// Platform has its Standard C++ library in the namespace std +# if !defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +# define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 +# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ + +// ace/iostream.h does not work with the standard cpp library (yet). +# if !defined (ACE_USES_OLD_IOSTREAMS) +# define ACE_LACKS_ACE_IOSTREAM +# endif /* ! ACE_USES_OLD_IOSTREAMS */ + +// Starting with MSVC 7.1, std::new throws std::bad_alloc on out-of-memory. +#define ACE_NEW_THROWS_EXCEPTIONS +#define ACE_HAS_NEW_NOTHROW + +#else + +// iostream header lacks ipfx (), isfx (), etc., declarations +# define ACE_LACKS_IOSTREAM_FX + +#endif + +// There are too many instances of this warning to fix it right now. +// Maybe in the future. + +// Disable warning of using Microsoft Extension. +# pragma warning(disable:4231) + +// 'class1' : inherits 'class2::member' via dominance +#pragma warning(disable:4250) + +// 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. +#if defined (ACE_HAS_WINCE) && !defined (ACE_HAS_MFC) +# pragma warning(disable:4291) +#endif + +// A template can not be exported. Only an instantiation may be exported. +#define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT + +// At least for ACE_UNIMPLEMENTED_FUNC in class templates, this is needed to +// explicitly instantiate a template that has ACE_UNIMPLEMENTED_FUNC. +# define ACE_NEEDS_FUNC_DEFINITIONS + +#include /**/ "ace/post.h" +#endif /* ACE_CONFIG_WIN32_MSVC_10_H */ diff --git a/ace/config-win32-msvc-8.h b/ace/config-win32-msvc-8.h index 86681a72cfe..05ba1afe649 100644 --- a/ace/config-win32-msvc-8.h +++ b/ace/config-win32-msvc-8.h @@ -54,12 +54,17 @@ #define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp #define ACE_WCSDUP_EQUIVALENT ::_wcsdup -#define ACE_HAS_EXCEPTIONS +#ifndef ACE_HAS_EXCEPTIONS +# define ACE_HAS_EXCEPTIONS +#endif -// Windows Mobile 5 doesn't do sig_atomic_t, but maybe future versions will. -# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x501) +// Windows Mobile 6 doesn't do sig_atomic_t, but maybe future versions will. +// This has been true up thrugh the versions. We don't have any indication +// that this might be supported in the future, but it is an easy enough fix +// to bump the wince revision number when a new version is released. +# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x601) # define ACE_HAS_SIG_ATOMIC_T -# endif /* !Win CE 5.0 or less */ +# endif /* !Win CE 6.0 or less */ #define ACE_HAS_STRERROR #define ACE_LACKS_STRPTIME diff --git a/ace/config-win32-msvc-9.h b/ace/config-win32-msvc-9.h index 379de17e5fa..65b817482d6 100644 --- a/ace/config-win32-msvc-9.h +++ b/ace/config-win32-msvc-9.h @@ -52,12 +52,14 @@ #define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp #define ACE_WCSDUP_EQUIVALENT ::_wcsdup -#define ACE_HAS_EXCEPTIONS +#ifndef ACE_HAS_EXCEPTIONS +# define ACE_HAS_EXCEPTIONS +#endif -// Windows Mobile 5 doesn't do sig_atomic_t, but maybe future versions will. -# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x501) +// Windows Mobile 6 doesn't do sig_atomic_t, but maybe future versions will. +# if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x601) # define ACE_HAS_SIG_ATOMIC_T -# endif /* !Win CE 5.0 or less */ +# endif /* !Win CE 6.0 or less */ #define ACE_HAS_STRERROR #define ACE_LACKS_STRPTIME diff --git a/ace/config-win32-msvc.h b/ace/config-win32-msvc.h index 49b2656818e..66f5f015434 100644 --- a/ace/config-win32-msvc.h +++ b/ace/config-win32-msvc.h @@ -31,12 +31,6 @@ #define ACE_CC_MINOR_VERSION (_MSC_VER % 100) #define ACE_CC_BETA_VERSION (0) -#if !defined (ACE_LD_DECORATOR_STR) -# if defined (_DEBUG) -# define ACE_LD_DECORATOR_STR ACE_TEXT ("d") -# endif /* _DEBUG */ -#endif /* ACE_LD_DECORATOR_STR */ - #if !defined(_NATIVE_WCHAR_T_DEFINED) #define ACE_LACKS_NATIVE_WCHAR_T #endif @@ -48,7 +42,9 @@ # define ACE_ENDTHREADEX(STATUS) ::_endthreadex ((DWORD) STATUS) #endif /* _WIN32_WCE */ -#if (_MSC_VER >= 1500) +#if (_MSC_VER >= 1600) +# include "ace/config-win32-msvc-10.h" +#elif (_MSC_VER >= 1500) # include "ace/config-win32-msvc-9.h" #elif (_MSC_VER >= 1400) # include "ace/config-win32-msvc-8.h" @@ -124,11 +120,18 @@ #define ACE_LACKS_TERMIOS_H #define ACE_LACKS_REGEX_H -#define ACE_INT64_FORMAT_SPECIFIER ACE_TEXT ("%I64d") -#define ACE_UINT64_FORMAT_SPECIFIER ACE_TEXT ("%I64u") +#define ACE_INT64_FORMAT_SPECIFIER_ASCII "%I64d" +#define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%I64u" +#define ACE_STRTOLL_EQUIVALENT ::_strtoi64 +#define ACE_WCSTOLL_EQUIVALENT ::_wcstoi64 #define ACE_STRTOULL_EQUIVALENT ::_strtoui64 -#define ACE_WCSTOOULL_EQUIVALENT ::_wcstoui64 +#define ACE_WCSTOULL_EQUIVALENT ::_wcstoui64 +#define ACE_WTOF_EQUIVALENT ::_wtof + +#define ACE_LACKS_ISBLANK +#define ACE_LACKS_ISWBLANK +#define ACE_ISCTYPE_EQUIVALENT ::_isctype // Turn off warnings for /W4 // To resume any of these warning: #pragma warning(default: 4xxx) diff --git a/ace/os_include/os_ctype.h b/ace/os_include/os_ctype.h index e1f5f1842af..c997d41255e 100644 --- a/ace/os_include/os_ctype.h +++ b/ace/os_include/os_ctype.h @@ -36,6 +36,9 @@ extern "C" // @todo move the is* and is* emulation methods in ACE_OS here // and let ACE_OS just call them. +#if !defined (ACE_HAS_CTYPE_T) +typedef int ctype_t; +#endif #ifdef __cplusplus } diff --git a/ace/os_include/os_errno.h b/ace/os_include/os_errno.h index 6d2656dba16..eb51405c576 100644 --- a/ace/os_include/os_errno.h +++ b/ace/os_include/os_errno.h @@ -92,9 +92,9 @@ extern "C" void herror (const char *str); #endif /* ACE_HAS_H_ERRNO */ -#if !defined (ACE_WIN32) && defined (ACE_LACKS_T_ERRNO) +#if defined (ACE_LACKS_T_ERRNO) extern int t_errno; -#endif /* ACE_WIN32 && ACE_LACKS_T_ERRNO */ +#endif /* ACE_LACKS_T_ERRNO */ #if !defined (ENOSYS) # define ENOSYS EFAULT /* Operation not supported or unknown error. */ diff --git a/ace/os_include/os_signal.h b/ace/os_include/os_signal.h index fd30f065f1e..dfde6708ff6 100644 --- a/ace/os_include/os_signal.h +++ b/ace/os_include/os_signal.h @@ -134,6 +134,14 @@ extern "C" # define SIGALRM 0 #endif /* SIGALRM */ +#if !defined (SIGABRT) +# define SIGABRT 0 +#endif /* SIGABRT */ + +#if !defined (SIGTERM) +# define SIGTERM 0 +#endif /* SIGTERM */ + #if !defined (SIG_DFL) # define SIG_DFL ((__sighandler_t) 0) #endif /* SIG_DFL */ @@ -165,6 +173,10 @@ extern "C" # define ACE_NSIG NSIG #endif /* __Lynx__ */ +#if defined (ACE_HAS_WINCE) + typedef void (__cdecl * __sighandler_t)(int); +#endif + #if defined (ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES) || defined (ACE_HAS_LYNXOS50_SIGNALS) // Prototypes for both signal() and struct sigaction are consistent.. typedef void (*ACE_SignalHandler)(int); diff --git a/ace/os_include/os_stdlib.h b/ace/os_include/os_stdlib.h index a75dab5e35a..b6ed807c812 100644 --- a/ace/os_include/os_stdlib.h +++ b/ace/os_include/os_stdlib.h @@ -66,9 +66,17 @@ extern "C" #endif /* ACE_LACKS_MKTEMP_PROTOTYPE */ #if defined (ACE_LACKS_MKSTEMP_PROTOTYPE) - int mkstemp(char *); + int mkstemp (char *); #endif /* ACE_LACKS_MKSTEMP_PROTOTYPE */ +#if defined (ACE_LACKS_STRTOLL_PROTOTYPE) + long long strtoll (const char *, char **, int); +#endif /* ACE_LACKS_STRTOLL_PROTOTYPE */ + +#if defined (ACE_LACKS_STRTOULL_PROTOTYPE) + unsigned long long strtoull (const char *, char **, int); +#endif /* ACE_LACKS_STRTOULL_PROTOTYPE */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ace/os_include/os_string.h b/ace/os_include/os_string.h index c2992a06d0e..7c7f63de930 100644 --- a/ace/os_include/os_string.h +++ b/ace/os_include/os_string.h @@ -63,11 +63,6 @@ extern "C" size_t strnlen(const char *s, size_t maxlen); #endif /* ACE_LACKS_STRNLEN_PROTOTYPE */ -#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560) -# define _stricmp stricmp -# define _strnicmp strnicmp -#endif /* __BORLANDC__ */ - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ace/os_include/os_unistd.h b/ace/os_include/os_unistd.h index 7aa4cdf9846..29c9a39e405 100644 --- a/ace/os_include/os_unistd.h +++ b/ace/os_include/os_unistd.h @@ -27,14 +27,13 @@ #include "ace/os_include/sys/os_types.h" #include "ace/os_include/os_inttypes.h" -#if defined (__BORLANDC__) -# include "ace/os_include/os_fcntl.h" -#endif /* __BORLANDC */ - -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) +#if defined (ACE_HAS_PROCESS_H) # include /**/ <process.h> +#endif /* ACE_HAS_PROCESS_H */ + +#if defined (ACE_HAS_IO_H) # include /**/ <io.h> -#endif /* ACE_WIN32 && !ACE_HAS_WINCE */ +#endif /* ACE_HAS_IO_H */ #if defined (ACE_HAS_SYS_SYSTEMINFO_H) # include /**/ <sys/systeminfo.h> @@ -164,12 +163,6 @@ extern "C" #endif /* _LARGEFILE64_SOURCE */ #if defined (__BORLANDC__) -# if (__BORLANDC__ <= 0x540) -# define _getcwd getcwd -# define _chdir chdir -# undef _access -# define _access access -# endif # define _isatty isatty #endif /* __BORLANDC__ */ diff --git a/ace/os_include/os_wchar.h b/ace/os_include/os_wchar.h index c0d1efa7aba..adc5f91b6bd 100644 --- a/ace/os_include/os_wchar.h +++ b/ace/os_include/os_wchar.h @@ -41,6 +41,14 @@ extern "C" { #endif /* __cplusplus */ +#if defined (ACE_LACKS_WCSTOLL_PROTOTYPE) + long long wcstoll (const wchar_t *, wchar_t **, int); +#endif /* ACE_LACKS_WCSTOLL_PROTOTYPE */ + +#if defined (ACE_LACKS_WCSTOULL_PROTOTYPE) + unsigned long long wcstoull (const wchar_t *, wchar_t **, int); +#endif /* ACE_LACKS_WCSTOULL_PROTOTYPE */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ace/os_include/sys/os_stat.h b/ace/os_include/sys/os_stat.h index a7c69dc36d4..389cb1151a6 100644 --- a/ace/os_include/sys/os_stat.h +++ b/ace/os_include/sys/os_stat.h @@ -26,9 +26,9 @@ #include "ace/os_include/sys/os_types.h" -#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) +#if defined (ACE_HAS_DIRECT_H) # include /**/ <direct.h> -#endif /* ACE_WIN32 && !ACE_HAS_WINCE */ +#endif /* ACE_HAS_DIRECT_H */ #if !defined (ACE_LACKS_SYS_STAT_H) # include /**/ <sys/stat.h> @@ -77,7 +77,6 @@ extern "C" #endif /* S_ISLNK */ #if defined (ACE_HAS_WINCE) -# include "ace/Time_Value.h" // Translate the WinCE bits into names expected by our callers. // The dwFileAttributes parameter doesn't have protection info, so @@ -87,6 +86,10 @@ extern "C" # define S_IFREG FILE_ATTRIBUTE_NORMAL # define S_IFLNK 0 + // Since CE does not have _stat by default as NT/2000 does, the 'stat' + // struct defined here will be used. Also note that CE file system + // struct is only for the CE 3.0 or later. + // Refer to the WCHAR.H from Visual C++ and WIBASE.H from eVC 3.0. struct stat { /// always 0 on Windows platforms @@ -96,19 +99,19 @@ extern "C" dev_t st_rdev; /// file attribute - unsigned short st_mode; + mode_t st_mode; /// number of hard links - short st_nlink; + nlink_t st_nlink; /// time of last access - ACE_Time_Value st_atime; + time_t st_atime; /// time of last data modification - ACE_Time_Value st_mtime; + time_t st_mtime; /// time of creation - ACE_Time_Value st_ctime; + time_t st_ctime; /// file size, in bytes ACE_OFF_T st_size; diff --git a/ace/os_include/sys/os_timeb.h b/ace/os_include/sys/os_timeb.h index 2495097d344..b52b232bac8 100644 --- a/ace/os_include/sys/os_timeb.h +++ b/ace/os_include/sys/os_timeb.h @@ -36,11 +36,6 @@ extern "C" { #endif /* __cplusplus */ -#if defined (__BORLANDC__) && (__BORLANDC__ <= 0x560) -# define _ftime ftime -# define _timeb timeb -#endif /* __BORLANDC__ */ - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ace/os_include/sys/os_types.h b/ace/os_include/sys/os_types.h index 2b5743fb035..bb416f3f46e 100644 --- a/ace/os_include/sys/os_types.h +++ b/ace/os_include/sys/os_types.h @@ -30,9 +30,9 @@ # include /**/ <sys/types.h> #endif /* !ACE_LACKS_SYS_TYPES_H */ -#if defined (ACE_HAS_WINCE) +#if defined (ACE_HAS_TYPES_H) # include /**/ <types.h> -#endif /* ACE_HAS_WINCE */ +#endif /* ACE_HAS_TYPES_H */ # if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \ (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0) @@ -55,22 +55,13 @@ typedef double ACE_timer_t; # endif /* CLOCK_REALTIME */ #endif /* ! ACE_HAS_CLOCK_GETTIME && ! _CLOCKID_T_ */ -#if defined (ACE_HAS_WINCE) - -// CE's add-on for c-style fstat/stat functionalities. This struct is -// by no mean complete compared to what you usually find in UNIX -// platforms. Only members that have direct conversion using Win32's -// BY_HANDLE_FILE_INFORMATION are defined so that users can discover -// non-supported members at compile time. Time values are of type -// ACE_Time_Value for easy comparison. - -// Since CE does not have _stat by default as NT/2000 does, the 'stat' -// struct defined here will be used. Also note that CE file system -// struct is only for the CE 3.0 or later. -// Refer to the WCHAR.H from Visual C++ and WIBASE.H from eVC 3.0. - +#if defined (ACE_LACKS_DEV_T) typedef unsigned int dev_t; -#endif /* ACE_HAS_WINCE */ +#endif /* ACE_LACKS_DEV_T */ + +#if defined (ACE_HAS_WINCE) + typedef long off_t; +#endif #if defined(ACE_WIN32) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS==64) typedef __int64 ACE_OFF_T; |