summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2021-07-19 16:41:23 +0200
committerGitHub <noreply@github.com>2021-07-19 16:41:23 +0200
commit4e4a1260bc4bb65abdde4542cbdaba20e270ed45 (patch)
tree1b7fb0831fefdbb35545bd19597d0ea0248e8e72
parent0dbbaa0ee8e72731380c2f4b9811023ca463ce20 (diff)
parent8dcbc57bc0b5870c41f886a491c7c324e4a43274 (diff)
downloadATCD-4e4a1260bc4bb65abdde4542cbdaba20e270ed45.tar.gz
Merge pull request #1619 from jwillemsen/jwi-stdcleanup
Make use of std namespace functions now that we have C++11
-rw-r--r--ACE/ace/OS_NS_math.h11
-rw-r--r--ACE/ace/OS_NS_stdio.h30
-rw-r--r--ACE/ace/OS_NS_stdio.inl44
-rw-r--r--ACE/ace/OS_NS_stdlib.h5
-rw-r--r--ACE/ace/OS_NS_time.cpp2
-rw-r--r--ACE/ace/OS_NS_time.inl9
-rw-r--r--ACE/ace/OS_NS_wchar.inl4
7 files changed, 43 insertions, 62 deletions
diff --git a/ACE/ace/OS_NS_math.h b/ACE/ace/OS_NS_math.h
index 9bbb0dbc369..daf9e9f70c4 100644
--- a/ACE/ace/OS_NS_math.h
+++ b/ACE/ace/OS_NS_math.h
@@ -22,6 +22,7 @@
# endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/os_include/os_math.h"
+#include <cmath>
#include /**/ "ace/ACE_export.h"
@@ -44,7 +45,7 @@ inline double ace_log2_helper (double x)
#undef log2
#else
# if !defined (ACE_LACKS_LOG2)
- return ACE_STD_NAMESPACE::log2 (x);
+ return std::log2 (x);
# else
/*
==================================================================
@@ -87,7 +88,7 @@ namespace ACE_OS
inline
T floor (T x)
{
- return ACE_STD_NAMESPACE::floor (x);
+ return std::floor (x);
}
#if defined (ACE_HAS_WINCE)
@@ -96,7 +97,7 @@ namespace ACE_OS
inline
float floor (float x)
{
- return ACE_STD_NAMESPACE::floorf (x);
+ return std::floorf (x);
}
#endif
@@ -105,7 +106,7 @@ namespace ACE_OS
inline
T ceil (T x)
{
- return ACE_STD_NAMESPACE::ceil (x);
+ return std::ceil (x);
}
#if defined (ACE_HAS_WINCE)
@@ -114,7 +115,7 @@ namespace ACE_OS
inline
float ceil (float x)
{
- return ACE_STD_NAMESPACE::ceilf (x);
+ return std::ceilf (x);
}
#endif
diff --git a/ACE/ace/OS_NS_stdio.h b/ACE/ace/OS_NS_stdio.h
index 1c4046f73a9..03366458315 100644
--- a/ACE/ace/OS_NS_stdio.h
+++ b/ACE/ace/OS_NS_stdio.h
@@ -47,23 +47,13 @@
* be usable later as there is no way to save the macro definition
* using the pre-processor.
*/
-inline void ace_clearerr_helper (FILE *stream)
-{
-#if defined (clearerr)
- clearerr (stream);
-#undef clearerr
-#else
- ACE_STD_NAMESPACE::clearerr (stream);
-#endif /* defined (clearerr) */
-}
-
inline int ace_fgetc_helper (FILE *fp)
{
#if defined (fgetc)
return fgetc (fp);
#undef fgetc
#else
- return ACE_STD_NAMESPACE::fgetc (fp);
+ return ::fgetc (fp);
#endif /* defined (fgetc) */
}
@@ -74,7 +64,7 @@ inline int ace_fputc_helper (int ch, FILE *fp)
return fputc (ch, fp);
#undef fputc
#else
- return ACE_STD_NAMESPACE::fputc (ch, fp);
+ return ::fputc (ch, fp);
#endif /* defined (fputc) */
}
#endif /* !ACE_LACKS_FPUTC */
@@ -86,7 +76,7 @@ inline int ace_getc_helper (FILE *fp)
return getc (fp);
#undef getc
#else
- return ACE_STD_NAMESPACE::getc (fp);
+ return ::getc (fp);
#endif /* defined (getc) */
}
#elif defined getc
@@ -99,7 +89,7 @@ inline int ace_putc_helper (int ch, FILE *fp)
return putc (ch, fp);
#undef putc
#elif !defined (ACE_LACKS_PUTC)
- return ACE_STD_NAMESPACE::putc (ch, fp);
+ return ::putc (ch, fp);
#else
ACE_UNUSED_ARG (ch);
ACE_UNUSED_ARG (fp);
@@ -107,18 +97,6 @@ inline int ace_putc_helper (int ch, FILE *fp)
#endif /* defined (putc) */
}
-#if !defined (ACE_LACKS_UNGETC)
-inline int ace_ungetc_helper (int ch, FILE *fp)
-{
-#if defined (ungetc)
- return ungetc (ch, fp);
-#undef ungetc
-#else
- return ACE_STD_NAMESPACE::ungetc (ch, fp);
-#endif /* defined (ungetc) */
-}
-#endif /* !ACE_LACKS_UNGETC */
-
#if !defined ACE_FILENO_EQUIVALENT
inline ACE_HANDLE ace_fileno_helper (FILE *fp)
{
diff --git a/ACE/ace/OS_NS_stdio.inl b/ACE/ace/OS_NS_stdio.inl
index 9c448db1562..b97adfdbbc9 100644
--- a/ACE/ace/OS_NS_stdio.inl
+++ b/ACE/ace/OS_NS_stdio.inl
@@ -343,7 +343,7 @@ ACE_OS::flock_wrlock (ACE_OS::ace_flock_t *lock,
ACE_INLINE void
ACE_OS::clearerr (FILE* fp)
{
- ace_clearerr_helper (fp);
+ std::clearerr (fp);
}
#if !defined (ACE_LACKS_CUSERID)
@@ -492,7 +492,7 @@ ACE_INLINE int
ACE_OS::fclose (FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fclose");
- return ACE_STD_NAMESPACE::fclose (fp);
+ return std::fclose (fp);
}
ACE_INLINE FILE *
@@ -541,13 +541,13 @@ ACE_INLINE int
ACE_OS::fflush (FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fflush");
- return ACE_STD_NAMESPACE::fflush (fp);
+ return std::fflush (fp);
}
ACE_INLINE int
ACE_OS::fgetc (FILE *fp)
{
- return ace_fgetc_helper (fp);
+ return std::fgetc (fp);
}
ACE_INLINE int
@@ -569,7 +569,7 @@ ACE_OS::fgetpos (FILE *fp, fpos_t *pos)
ACE_UNUSED_ARG (pos);
ACE_NOTSUP_RETURN (-1);
#else
- return ACE_STD_NAMESPACE::fgetpos (fp, pos);
+ return std::fgetpos (fp, pos);
#endif
}
@@ -582,14 +582,14 @@ ACE_OS::fgets (char *buf, int size, FILE *fp)
int c = EOF;
for (int i = 0; i < size - 1 && c != '\n'; ++i)
{
- c = ACE_STD_NAMESPACE::fgetc (fp);
+ c = std::fgetc (fp);
if (c != EOF)
*iter++ = static_cast<char> (c);
}
*iter = '\0';
return c == EOF ? 0 : buf;
#else
- return ACE_STD_NAMESPACE::fgets (buf, size, fp);
+ return std::fgets (buf, size, fp);
#endif /* ACE_LACKS_FGETS */
}
@@ -598,7 +598,7 @@ ACE_INLINE wchar_t *
ACE_OS::fgets (wchar_t *buf, int size, FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fgets");
- return ACE_STD_NAMESPACE::fgetws (buf, size, fp);
+ return std::fgetws (buf, size, fp);
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_FGETWS */
@@ -671,7 +671,7 @@ ACE_OS::ungetc (int c, FILE *fp)
ACE_UNUSED_ARG (fp);
ACE_NOTSUP_RETURN (-1);
#else
- return ace_ungetc_helper (c, fp);
+ return std::ungetc (c, fp);
#endif
}
@@ -695,7 +695,7 @@ ACE_OS::putc (int c, FILE *fp)
ACE_UNUSED_ARG (fp);
ACE_NOTSUP_RETURN (-1);
#else
- return ace_putc_helper (c, fp);
+ return std::putc (c, fp);
#endif
}
@@ -708,7 +708,7 @@ ACE_OS::fputs (const char *s, FILE *stream)
ACE_UNUSED_ARG (stream);
ACE_NOTSUP_RETURN (-1);
#else
- return ACE_STD_NAMESPACE::fputs (s, stream);
+ return std::fputs (s, stream);
#endif
}
@@ -717,7 +717,7 @@ ACE_INLINE int
ACE_OS::fputs (const wchar_t *s, FILE *stream)
{
ACE_OS_TRACE ("ACE_OS::fputs");
- return ACE_STD_NAMESPACE::fputws (s, stream);
+ return std::fputws (s, stream);
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_FPUTWS */
@@ -725,7 +725,7 @@ ACE_INLINE size_t
ACE_OS::fread (void *ptr, size_t size, size_t nelems, FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fread");
- return ACE_STD_NAMESPACE::fread (ptr, size, nelems, fp);
+ return std::fread (ptr, size, nelems, fp);
}
ACE_INLINE FILE *
@@ -740,7 +740,7 @@ ACE_OS::freopen (const ACE_TCHAR *filename, const ACE_TCHAR *mode, FILE* stream)
ACE_UNUSED_ARG (stream);
ACE_NOTSUP_RETURN (0);
#else
- return ACE_STD_NAMESPACE::freopen (ACE_TEXT_ALWAYS_CHAR (filename), ACE_TEXT_ALWAYS_CHAR (mode), stream);
+ return std::freopen (ACE_TEXT_ALWAYS_CHAR (filename), ACE_TEXT_ALWAYS_CHAR (mode), stream);
#endif /* ACE_WIN32 && ACE_USES_WCHAR */
}
@@ -767,7 +767,7 @@ ACE_OS::fseek (FILE *fp, long offset, int whence)
}
# endif /* SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END */
#endif /* ACE_WIN32 */
- return ACE_STD_NAMESPACE::fseek (fp, offset, whence);
+ return std::fseek (fp, offset, whence);
}
ACE_INLINE int
@@ -785,14 +785,14 @@ ACE_OS::fsetpos (FILE* fp, fpos_t* pos)
ACE_INLINE long
ACE_OS::ftell (FILE* fp)
{
- return ACE_STD_NAMESPACE::ftell (fp);
+ return std::ftell (fp);
}
ACE_INLINE size_t
ACE_OS::fwrite (const void *ptr, size_t size, size_t nitems, FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fwrite");
- return ACE_STD_NAMESPACE::fwrite (ptr, size, nitems, fp);
+ return std::fwrite (ptr, size, nitems, fp);
}
ACE_INLINE void
@@ -830,7 +830,7 @@ ACE_OS::puts (const char *s)
ACE_UNUSED_ARG (s);
ACE_NOTSUP_RETURN (-1);
#else
- return ::puts (s);
+ return std::puts (s);
#endif /* ACE_LACKS_PUTS */
}
@@ -934,7 +934,7 @@ ACE_OS::rewind (FILE *fp)
#else
// This isn't perfect since it doesn't reset EOF, but it's probably
// the closest we can get on WINCE.
- (void) ::fseek (fp, 0L, SEEK_SET);
+ (void) std::fseek (fp, 0L, SEEK_SET);
#endif /* ACE_HAS_WINCE */
}
@@ -1034,7 +1034,7 @@ ACE_OS::vprintf (const char *format, va_list argptr)
ACE_UNUSED_ARG (argptr);
ACE_NOTSUP_RETURN (-1);
#else
- return ::vprintf (format, argptr);
+ return std::vprintf (format, argptr);
#endif /* ACE_LACKS_VPRINTF */
}
@@ -1061,7 +1061,7 @@ ACE_OS::vfprintf (FILE *fp, const char *format, va_list argptr)
ACE_UNUSED_ARG (argptr);
ACE_NOTSUP_RETURN (-1);
#else
- return ACE_STD_NAMESPACE::vfprintf (fp, format, argptr);
+ return std::vfprintf (fp, format, argptr);
#endif
}
@@ -1089,7 +1089,7 @@ ACE_OS::vsprintf (char *buffer, const char *format, va_list argptr)
ACE_UNUSED_ARG (argptr);
ACE_NOTSUP_RETURN (-1);
#else
- return ::vsprintf (buffer, format, argptr);
+ return std::vsprintf (buffer, format, argptr);
#endif /* ACE_LACKS_VSPRINTF */
}
diff --git a/ACE/ace/OS_NS_stdlib.h b/ACE/ace/OS_NS_stdlib.h
index ab0f86884b1..3ba96b67427 100644
--- a/ACE/ace/OS_NS_stdlib.h
+++ b/ACE/ace/OS_NS_stdlib.h
@@ -22,6 +22,7 @@
# endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/os_include/os_stdlib.h"
+#include <cstdlib>
#include /**/ "ace/ACE_export.h"
#include "ace/Basic_Types.h" /* ACE_UINT64 and intptr_t in inl file */
@@ -58,7 +59,7 @@ inline ACE_INT64 ace_strtoll_helper (const char *s, char **ptr, int base)
return strtoll (s, ptr, base);
# undef strtoll
# else
- return ACE_STD_NAMESPACE::strtoll (s, ptr, base);
+ return std::strtoll (s, ptr, base);
# endif /* strtoll */
}
#endif /* !ACE_LACKS_STRTOLL && !ACE_STRTOLL_EQUIVALENT */
@@ -70,7 +71,7 @@ inline ACE_INT64 ace_strtoull_helper (const char *s, char **ptr, int base)
return strtoull (s, ptr, base);
# undef strtoull
# else
- return ACE_STD_NAMESPACE::strtoull (s, ptr, base);
+ return std::strtoull (s, ptr, base);
# endif /* strtoull */
}
#endif /* !ACE_LACKS_STRTOULL && !ACE_STRTOULL_EQUIVALENT */
diff --git a/ACE/ace/OS_NS_time.cpp b/ACE/ace/OS_NS_time.cpp
index 09a223b8574..81b634f9899 100644
--- a/ACE/ace/OS_NS_time.cpp
+++ b/ACE/ace/OS_NS_time.cpp
@@ -315,7 +315,7 @@ ACE_OS::mktime (struct tm *t)
ACE_OS_GUARD
# endif /* ACE_HAS_THREADS && ! ACE_HAS_MT_SAFE_MKTIME */
- return ACE_STD_NAMESPACE::mktime (t);
+ return std::mktime (t);
# endif /* ACE_HAS_WINCE */
}
diff --git a/ACE/ace/OS_NS_time.inl b/ACE/ace/OS_NS_time.inl
index c5f676ae800..03bb984d762 100644
--- a/ACE/ace/OS_NS_time.inl
+++ b/ACE/ace/OS_NS_time.inl
@@ -4,6 +4,7 @@
#include "ace/Time_Value.h"
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_sys_time.h"
+#include <ctime>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -15,7 +16,7 @@ ACE_OS::asctime (const struct tm *t)
ACE_UNUSED_ARG (t);
ACE_NOTSUP_RETURN (0);
#else
- return ACE_STD_NAMESPACE::asctime (t);
+ return std::asctime (t);
#endif /* ACE_LACKS_ASCTIME */
}
@@ -48,7 +49,7 @@ ACE_OS::asctime_r (const struct tm *t, char *buf, int buflen)
ACE_NOTSUP_RETURN (0);
#else
char *result = 0;
- ACE_OSCALL (ACE_STD_NAMESPACE::asctime (t), char *, result);
+ ACE_OSCALL (std::asctime (t), char *, result);
ACE_OS::strsncpy (buf, result, buflen);
return buf;
#endif /* ACE_HAS_REENTRANT_FUNCTIONS */
@@ -421,7 +422,7 @@ ACE_OS::strftime (char *s, size_t maxsize, const char *format,
ACE_UNUSED_ARG (timeptr);
ACE_NOTSUP_RETURN (0);
#else
- return ACE_STD_NAMESPACE::strftime (s, maxsize, format, timeptr);
+ return std::strftime (s, maxsize, format, timeptr);
#endif /* ACE_LACKS_STRFTIME */
}
@@ -432,7 +433,7 @@ ACE_OS::strptime (const char *buf, const char *format, struct tm *tm)
#if defined (ACE_LACKS_STRPTIME)
return ACE_OS::strptime_emulation (buf, format, tm);
#else
- return ACE_STD_NAMESPACE::strptime (buf, format, tm);
+ return ::strptime (buf, format, tm);
#endif /* ACE_LACKS_STRPTIME */
}
diff --git a/ACE/ace/OS_NS_wchar.inl b/ACE/ace/OS_NS_wchar.inl
index 3feee38ec13..29f5b70f1b3 100644
--- a/ACE/ace/OS_NS_wchar.inl
+++ b/ACE/ace/OS_NS_wchar.inl
@@ -9,7 +9,7 @@ ACE_OS::fgetwc (FILE* fp)
ACE_UNUSED_ARG (fp);
ACE_NOTSUP_RETURN (0);
# else
- return ACE_STD_NAMESPACE::fgetwc (fp);
+ return std::fgetwc (fp);
# endif /* ACE_LACKS_FGETWC */
}
#endif /* ACE_HAS_WCHAR */
@@ -76,7 +76,7 @@ ACE_OS::ungetwc (wint_t c, FILE* fp)
ACE_UNUSED_ARG (fp);
ACE_NOTSUP_RETURN (0);
# else
- return ACE_STD_NAMESPACE::ungetwc (c, fp);
+ return std::ungetwc (c, fp);
# endif /* ACE_LACKS_FGETWC */
}
#endif /* ACE_HAS_WCHAR */