[omniORB-dev] Patch: omniORB 4 std headers and namespace fixes

Teemu Torma tot@trema.com
Fri, 2 May 2003 21:45:51 +0200


--Boundary-00=_vrss+iTbG6pSfuI
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline

If anyone is interested, please see the attached patch to conditionally 
use standard headers and namespace.  This avoids deprecated include 
warnings with gcc 3.2 and allows the system to be compiled with Visual 
Studio .Net (or whatever the name officially is, probably starts with 
Microsoft and ends with an ®).

The changes depend on HAVE_STD defined, which is currently set by 
configure script if standard headers and std namespace exists. 

Teemu

--Boundary-00=_vrss+iTbG6pSfuI
Content-Type: text/x-diff;
  charset="us-ascii";
  name="omniorb4-std.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="omniorb4-std.patch"

Index: src/appl/omniMapper/omniMapper.cc
===================================================================
RCS file: /cvsroot/omniorb/omni/src/appl/omniMapper/Attic/omniMapper.cc,v
retrieving revision 1.2.2.7
diff -c -u -r1.2.2.7 omniMapper.cc
--- src/appl/omniMapper/omniMapper.cc	16 Jan 2002 12:35:46 -0000	1.2.2.7
+++ src/appl/omniMapper/omniMapper.cc	2 May 2003 19:34:32 -0000
@@ -59,8 +59,15 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
-#include <iostream.h>
-#include <fstream.h>
+
+#ifdef HAVE_STD
+#  include <iostream>
+#  include <fstream>
+   using namespace std;
+#else
+#  include <iostream.h>
+#  include <fstream.h>
+#endif
 
 static void
 usage()
@@ -186,7 +193,11 @@
 processConfigFile(const char* configFile)
 {
 #ifdef __WIN32__
+#if _MSC_VER >= 1310
+  ifstream cfile(configFile, ios::in);
+#else
   ifstream cfile(configFile, ios::in | ios::nocreate);
+#endif
 #else
   ifstream cfile(configFile);
 #endif
Index: src/appl/omniNames/NamingContext_i.cc
===================================================================
RCS file: /cvsroot/omniorb/omni/src/appl/omniNames/Attic/NamingContext_i.cc,v
retrieving revision 1.12.2.3
diff -c -u -r1.12.2.3 NamingContext_i.cc
--- src/appl/omniNames/NamingContext_i.cc	21 Nov 2002 14:26:11 -0000	1.12.2.3
+++ src/appl/omniNames/NamingContext_i.cc	2 May 2003 19:34:32 -0000
@@ -22,12 +22,20 @@
 //  USA.
 //
 
-#include <iostream.h>
+#include <string.h>
+
 #include <assert.h>
 #include <NamingContext_i.h>
 #include <ObjectBinding.h>
 #include <BindingIterator_i.h>
 #include <omniORB4/omniURI.h>
+
+#ifdef HAVE_STD
+#  include <iostream>
+   using namespace std;
+#else
+#  include <iostream.h>
+#endif
 
 #ifdef DEBUG_NC
 #define DB(x) x
Index: src/appl/omniNames/log.cc
===================================================================
RCS file: /cvsroot/omniorb/omni/src/appl/omniNames/Attic/log.cc,v
retrieving revision 1.22.2.8
diff -c -u -r1.22.2.8 log.cc
--- src/appl/omniNames/log.cc	16 Jan 2003 11:08:26 -0000	1.22.2.8
+++ src/appl/omniNames/log.cc	2 May 2003 19:34:32 -0000
@@ -22,13 +22,13 @@
 //  USA.
 //
 
+#include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
 #include <time.h>
-#include <iostream.h>
 #include <fcntl.h>
 #if defined(__VMS) && __VMS_VER < 70000000
 #  include <omniVMS/unlink.hxx>
@@ -38,7 +38,15 @@
 #include <ObjectBinding.h>
 #include <INSMapper.h>
 #include <log.h>
-#include <iomanip.h>
+
+#ifdef HAVE_STD
+#  include <iostream>
+#  include <iomanip>
+   using namespace std;
+#else
+#  include <iostream.h>
+#  include <iomanip.h>
+#endif
 
 #ifdef __WIN32__
 #  include <io.h>
@@ -61,15 +69,12 @@
 #  endif
 #endif
 
-#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x500
-#  define USE_STREAM_OPEN
-#  define OPEN(name,mode,perm) open(name,mode,perm)
-#elif defined(__KCC)
+#ifdef HAVE_STD
 #  define USE_STREAM_OPEN
 #  define OPEN(name,mode,perm) open(name,mode)
-#elif defined(__GNUG__) && __GNUG__ >= 3
+#elif defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x500
 #  define USE_STREAM_OPEN
-#  define OPEN(name,mode,perm) open(name,mode)
+#  define OPEN(name,mode,perm) open(name,mode,perm)
 #elif defined(__DMC__)
 #  define USE_STREAM_OPEN
 #  define OPEN(name,mode,perm) open(name,mode,perm)
@@ -298,7 +303,11 @@
     firstTime = 0;
 
 #ifdef __WIN32__
+#if _MSC_VER >= 1310
+    ifstream initf(active,ios::in);
+#else
     ifstream initf(active,ios::in | ios::nocreate);
+#endif
 #else
     ifstream initf(active);
 #endif
@@ -1054,7 +1063,7 @@
 void
 omniNameslog::putKey(const PortableServer::ObjectId& id, ostream& file)
 {
-  file << hex;
+  file << ios::hex;
   for (unsigned int i = 0; i < id.length(); i++) {
 #if !defined(__SUNPRO_CC) || __SUNPRO_CC < 0x500
     file << setfill('0') << setw(2) << (int)id[i];
@@ -1063,7 +1072,7 @@
     file << std::setfill('0') << std::setw(2) << (int)id[i];
 #endif
   }
-  file << dec;
+  file << ios::dec;
 }
 
 
Index: src/appl/omniNames/log.h
===================================================================
RCS file: /cvsroot/omniorb/omni/src/appl/omniNames/Attic/log.h,v
retrieving revision 1.7.2.1
diff -c -u -r1.7.2.1 log.h
--- src/appl/omniNames/log.h	9 Oct 2000 16:20:56 -0000	1.7.2.1
+++ src/appl/omniNames/log.h	2 May 2003 19:34:32 -0000
@@ -26,7 +26,13 @@
 #define _log_h_
 
 #include <omniORB4/CORBA.h>
-#include <fstream.h>
+
+#ifdef HAVE_STD
+#  include <fstream>
+   using namespace std;
+#else
+#  include <fstream.h>
+#endif
 
 #ifndef LOGDIR_ENV_VAR
 #define LOGDIR_ENV_VAR "OMNINAMES_LOGDIR"
Index: src/appl/omniNames/omniNames.cc
===================================================================
RCS file: /cvsroot/omniorb/omni/src/appl/omniNames/Attic/omniNames.cc,v
retrieving revision 1.9.2.7
diff -c -u -r1.9.2.7 omniNames.cc
--- src/appl/omniNames/omniNames.cc	14 Oct 2002 15:15:45 -0000	1.9.2.7
+++ src/appl/omniNames/omniNames.cc	2 May 2003 19:34:32 -0000
@@ -28,9 +28,15 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <string.h>
-#include <iostream.h>
 #include <omnithread.h>
 #include <NamingContext_i.h>
+
+#ifdef HAVE_STD
+#  include <iostream>
+   using namespace std;
+#else
+#  include <iostream.h>
+#endif
 
 #ifdef __WIN32__
 #  include <io.h>
Index: src/appl/utils/catior/catior.cc
===================================================================
RCS file: /cvsroot/omniorb/omni/src/appl/utils/catior/Attic/catior.cc,v
retrieving revision 1.12.2.9
diff -c -u -r1.12.2.9 catior.cc
--- src/appl/utils/catior/catior.cc	16 Apr 2002 12:42:54 -0000	1.12.2.9
+++ src/appl/utils/catior/catior.cc	2 May 2003 19:34:32 -0000
@@ -24,12 +24,20 @@
 //
 // Lists contents of an IOR.
 
-#include <iostream.h>
-#include <iomanip.h>
+#include <string.h>
 #include <stdlib.h>
 
 #include <omniORB4/CORBA.h>
 
+#ifdef HAVE_STD
+#  include <iostream>
+#  include <iomanip>
+   using namespace std;
+#else
+#  include <iostream.h>
+#  include <iomanip.h>
+#endif
+
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
 #endif
@@ -423,7 +431,7 @@
 	}
 	else {
 	  cout << "Unrecognised profile tag: 0x"
-	       << hex << (unsigned)(ior.profiles[count].tag)
+	       << ios::hex << (unsigned)(ior.profiles[count].tag)
 	       << endl;
 	}
       }
@@ -435,7 +443,7 @@
     if (ms)
       cerr << "(CORBA::MARSHAL: minor = " << ms << ")" << endl;
     else
-      cerr << "(CORBA::MARSHAL: minor = 0x" << hex << ex.minor() << ")"
+      cerr << "(CORBA::MARSHAL: minor = 0x" << ios::hex << ex.minor() << ")"
 	   << endl;
     return 1;
   }
Index: src/appl/utils/convertior/convertior.cc
===================================================================
RCS file: /cvsroot/omniorb/omni/src/appl/utils/convertior/Attic/convertior.cc,v
retrieving revision 1.10.2.6
diff -c -u -r1.10.2.6 convertior.cc
--- src/appl/utils/convertior/convertior.cc	3 Feb 2003 16:52:02 -0000	1.10.2.6
+++ src/appl/utils/convertior/convertior.cc	2 May 2003 19:34:32 -0000
@@ -24,10 +24,17 @@
 //
 // Takes an IOR, hostname as arguments. Outputs IOR with new hostname.
 
-#include <iostream.h>
+#include <string.h>
 #include <stdlib.h>
 
 #include <omniORB4/CORBA.h>
+
+#ifdef HAVE_STD
+#  include <iostream>
+   using namespace std;
+#else
+#  include <iostream.h>
+#endif
 
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
Index: src/appl/utils/genior/genior.cc
===================================================================
RCS file: /cvsroot/omniorb/omni/src/appl/utils/genior/Attic/genior.cc,v
retrieving revision 1.9.2.5
diff -c -u -r1.9.2.5 genior.cc
--- src/appl/utils/genior/genior.cc	15 Jan 2002 16:38:11 -0000	1.9.2.5
+++ src/appl/utils/genior/genior.cc	2 May 2003 19:34:32 -0000
@@ -26,12 +26,19 @@
 // Program to generate IORs
 
 
-#include <iostream.h>
+#include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include <omniORB4/CORBA.h>
+
+#ifdef HAVE_STD
+#  include <iostream>
+   using namespace std;
+#else
+#  include <iostream.h>
+#endif
 
 #ifdef HAVE_UNISTD_H
 #  include <unistd.h>
Index: src/appl/utils/nameclt/nameclt.cc
===================================================================
RCS file: /cvsroot/omniorb/omni/src/appl/utils/nameclt/Attic/nameclt.cc,v
retrieving revision 1.19.2.3
diff -c -u -r1.19.2.3 nameclt.cc
--- src/appl/utils/nameclt/nameclt.cc	29 Oct 2001 17:43:36 -0000	1.19.2.3
+++ src/appl/utils/nameclt/nameclt.cc	2 May 2003 19:34:32 -0000
@@ -22,10 +22,17 @@
 //  USA.
 //
 
-#include <iostream.h>
+#include <string.h>
 #include <stdlib.h>
 #include <omniORB4/Naming.hh>
 #include <omniORB4/omniURI.h>
+
+#ifdef HAVE_STD
+#  include <iostream>
+   using namespace std;
+#else
+#  include <iostream.h>
+#endif
 
 OMNI_USING_NAMESPACE(omni)
 

--Boundary-00=_vrss+iTbG6pSfuI--