summaryrefslogtreecommitdiff
path: root/ACE
diff options
context:
space:
mode:
authorolli <olli@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-05-20 09:25:51 +0000
committerolli <olli@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-05-20 09:25:51 +0000
commitc057192fa4bf2dbbda4d3fa7c70b41d57644f335 (patch)
tree9a66fb0620b15d9b44cb59ce186e55c97318cbe0 /ACE
parent52cdf992790aa812428ca9e74f735233a7b60ab8 (diff)
downloadATCD-c057192fa4bf2dbbda4d3fa7c70b41d57644f335.tar.gz
ChangeLogTag: Sun May 20 09:16:26 UTC 2007 Olli Savia <ops@iki.fi>
Diffstat (limited to 'ACE')
-rw-r--r--ACE/ChangeLog18
-rw-r--r--ACE/NEWS3
-rw-r--r--ACE/ace/OS_NS_stdio.h77
-rw-r--r--ACE/ace/OS_NS_stdio.inl54
-rw-r--r--ACE/ace/Read_Buffer.cpp4
-rw-r--r--ACE/ace/os_include/os_stdio.h8
6 files changed, 141 insertions, 23 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 72fa9eeb784..069a64d15ce 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,7 +1,23 @@
+Sun May 20 09:16:26 UTC 2007 Olli Savia <ops@iki.fi>
+
+ * ace/OS_NS_stdio.h:
+ * ace/OS_NS_stdio.inl:
+ * ace/os_include/os_stdio.h:
+ Improved support for ACE_OS::fgetc. Added support for ACE_OS::fputc,
+ ACE_OS::getc, ACE_OS::putc and ACE_OS::ungetc.
+
+ * NEWS:
+ Document changes above.
+
+ * ace/Read_Buffer.cpp:
+ Use ACE_OS::getc and ACE_OS::ungetc instead of getc and ungetc.
+ Thanks to Abdullah Sowayan <abdullah dot sowayan at lmco dot com>
+ for motivating all changes above. This fixes Bugzilla #2919.
+
Sat May 19 14:53:44 UTC 2007 Abdullah Sowayan <abdullah.sowayan@lmco.com>
* Kokyu/Dispatcher_Task.cpp:
-
+
More fixes to eliminate "staement is uncreachable" warning.
Fri May 18 22:43:40 UTC 2007 Ossama Othman <ossama_othman at symantec dot com>
diff --git a/ACE/NEWS b/ACE/NEWS
index 12da557e363..c0c7ba1e9d8 100644
--- a/ACE/NEWS
+++ b/ACE/NEWS
@@ -14,6 +14,9 @@ USER VISIBLE CHANGES BETWEEN ACE-5.5.8 and ACE-5.5.9
. Use Intel C++ specific optimizations for Linux on IA64
+. Improved support for ACE_OS::fgetc. Added support for ACE_OS::fputc,
+ ACE_OS::getc, ACE_OS::putc and ACE_OS::ungetc.
+
USER VISIBLE CHANGES BETWEEN ACE-5.5.7 and ACE-5.5.8
====================================================
diff --git a/ACE/ace/OS_NS_stdio.h b/ACE/ace/OS_NS_stdio.h
index 18ca767ddab..69103ca2982 100644
--- a/ACE/ace/OS_NS_stdio.h
+++ b/ACE/ace/OS_NS_stdio.h
@@ -39,22 +39,70 @@
#endif
#define ACE_EXPORT_MACRO ACE_Export
-/**
- * On some platforms clearerr is a macro. Defining ACE_OS::clearerr()
- * becomes really hard, as there is no way to save the macro
- * definition using the pre-processor.
+/*
+ * We inline and undef some functions that may be implemented
+ * as macros on some platforms. This way macro definitions will
+ * be usable later as there is no way to save the macro definition
+ * using the pre-processor.
+ *
*/
# if !defined (ACE_LACKS_CLEARERR)
# if defined (clearerr)
-# define __ace_clearerr_hack
-inline void __ace_clearerr(FILE *stream)
+# define ACE_CLEARERR_MACRO_INLINED
+inline void ace_clearerr_macro_inlined (FILE *stream)
{
- clearerr(stream);
+ clearerr (stream);
}
# undef clearerr
# endif /* defined (clearerr) */
# endif /* !ACE_LACKS_CLEARERR */
+#if defined (fgetc)
+# define ACE_FGETC_MACRO_INLINED
+inline int ace_fgetc_macro_inlined (FILE *fp)
+{
+ return fgetc (fp);
+}
+# undef fgetc
+#endif /* defined (fgetc) */
+
+#if defined (fputc)
+# define ACE_FPUTC_MACRO_INLINED
+inline int ace_fputc_macro_inlined (int ch, FILE *fp)
+{
+ return fputc (ch, fp);
+}
+# undef fputc
+#endif /* defined (fputc) */
+
+#if defined (getc)
+# define ACE_GETC_MACRO_INLINED
+inline int ace_getc_macro_inlined (FILE *fp)
+{
+ return getc (fp);
+}
+# undef getc
+#endif /* defined (getc) */
+
+#if defined (putc)
+# define ACE_PUTC_MACRO_INLINED
+inline int ace_putc_macro_inlined (int ch, FILE *fp)
+{
+ return putc (ch, fp);
+}
+# undef putc
+#endif /* defined (putc) */
+
+#if defined (ungetc)
+# define ACE_UNGETC_MACRO_INLINED
+inline int ace_ungetc_macro_inlined (int ch, FILE *fp)
+{
+ return ungetc (ch, fp);
+}
+# undef ungetc
+#endif /* defined (ungetc) */
+
+
#if !defined (ACE_LACKS_CUSERID) && !defined(ACE_HAS_ALT_CUSERID) \
&& !defined(ACE_WIN32) && !defined (ACE_VXWORKS)
/// Helper for the ACE_OS::cuserid() function
@@ -171,6 +219,9 @@ namespace ACE_OS {
int fgetc (FILE* fp);
ACE_NAMESPACE_INLINE_FUNCTION
+ int getc (FILE* fp);
+
+ ACE_NAMESPACE_INLINE_FUNCTION
int fgetpos (FILE* fp, fpos_t* pos);
ACE_NAMESPACE_INLINE_FUNCTION
@@ -291,6 +342,18 @@ namespace ACE_OS {
# endif /* ACE_HAS_WCHAR */
ACE_NAMESPACE_INLINE_FUNCTION
+ int ungetc (int c,
+ FILE *fp);
+
+ ACE_NAMESPACE_INLINE_FUNCTION
+ int fputc (int c,
+ FILE *fp);
+
+ ACE_NAMESPACE_INLINE_FUNCTION
+ int putc (int c,
+ FILE *fp);
+
+ ACE_NAMESPACE_INLINE_FUNCTION
int fputs (const char *s,
FILE *stream);
diff --git a/ACE/ace/OS_NS_stdio.inl b/ACE/ace/OS_NS_stdio.inl
index 3f9bec46e04..2f6322e08ca 100644
--- a/ACE/ace/OS_NS_stdio.inl
+++ b/ACE/ace/OS_NS_stdio.inl
@@ -379,11 +379,11 @@ ACE_OS::flock_wrlock (ACE_OS::ace_flock_t *lock,
ACE_INLINE void
ACE_OS::clearerr (FILE* fp)
{
-#if defined (__ace_clearerr_hack)
- __ace_clearerr(fp);
+#if defined (ACE_CLEARERR_MACRO_INLINED)
+ ace_clearerr_macro_inlined (fp);
#else
- ::clearerr(fp);
-#endif /* __ace_clearerr_hack */
+ ::clearerr (fp);
+#endif /* ACE_CLEARERR_MACRO_INLINED */
}
#endif /* !ACE_LACKS_CLEARERR */
@@ -600,7 +600,21 @@ ACE_OS::fflush (FILE *fp)
ACE_INLINE int
ACE_OS::fgetc (FILE* fp)
{
- ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetc (fp), int, -1);
+#if defined (ACE_FGETC_MACRO_INLINED)
+ return ace_fgetc_macro_inlined (fp);
+#else
+ return ::fgetc (fp);
+#endif /* ACE_FGETC_MACRO_INLINED */
+}
+
+ACE_INLINE int
+ACE_OS::getc (FILE* fp)
+{
+#if defined (ACE_GETC_MACRO_INLINED)
+ return ace_getc_macro_inlined (fp);
+#else
+ return ::getc (fp);
+#endif /* ACE_GETC_MACRO_INLINED */
}
ACE_INLINE int
@@ -655,6 +669,36 @@ ACE_OS::fopen (const wchar_t *filename, const ACE_TCHAR *mode)
#endif /* ACE_WIN32 */
ACE_INLINE int
+ACE_OS::ungetc (int c, FILE *fp)
+{
+#if defined (ACE_UNGETC_MACRO_INLINED)
+ return ace_ungetc_macro_inlined (c, fp);
+#else
+ return ::ungetc (c, fp);
+#endif /* ACE_UNGETC_MACRO_INLINED */
+}
+
+ACE_INLINE int
+ACE_OS::fputc (int c, FILE *fp)
+{
+#if defined (ACE_FPUTC_MACRO_INLINED)
+ return ace_fputc_macro_inlined (c, fp);
+#else
+ return ::fputc (c, fp);
+#endif /* ACE_FPUTC_MACRO_INLINED */
+}
+
+ACE_INLINE int
+ACE_OS::putc (int c, FILE *fp)
+{
+#if defined (ACE_PUTC_MACRO_INLINED)
+ return ace_putc_macro_inlined (c, fp);
+#else
+ return ::putc (c, fp);
+#endif /* ACE_PUTC_MACRO_INLINED */
+}
+
+ACE_INLINE int
ACE_OS::fputs (const char *s, FILE *stream)
{
ACE_OS_TRACE ("ACE_OS::fputs");
diff --git a/ACE/ace/Read_Buffer.cpp b/ACE/ace/Read_Buffer.cpp
index f57feff1e4a..c2912fd50c1 100644
--- a/ACE/ace/Read_Buffer.cpp
+++ b/ACE/ace/Read_Buffer.cpp
@@ -107,12 +107,12 @@ ACE_Read_Buffer::rec_read (int term, int search, int replace)
// Read in the file char by char
while (slot < BUFSIZ)
{
- c = getc (this->stream_);
+ c = ACE_OS::getc (this->stream_);
// Don't insert EOF into the buffer...
if (c == EOF)
{
- ungetc (c, this->stream_);
+ ACE_OS::ungetc (c, this->stream_);
break;
}
else if (c == term)
diff --git a/ACE/ace/os_include/os_stdio.h b/ACE/ace/os_include/os_stdio.h
index f28c8a03ce3..35724eefd66 100644
--- a/ACE/ace/os_include/os_stdio.h
+++ b/ACE/ace/os_include/os_stdio.h
@@ -42,14 +42,6 @@
# endif
#endif /* ACE_VXWORKS */
-// Undefine "functions" that may be implemented as macros.
-#ifdef fgetc
-#undef fgetc
-#endif
-#ifdef fputc
-#undef fputc
-#endif
-
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"