From 0e91b9bbe6f3d043f38d684f141b077a0882acbc Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 21 May 2019 17:53:28 +0200
Subject: [PATCH 01/21] drop needless checks for libbsd and libelf

Don't check for libbsd and libelf, they aren't needed anywhere
and may break copying binaries from one linux to another, when
they did exist on the build-machine but not on the target.
---
 configure.in | 2 --
 1 file changed, 2 deletions(-)

diff --git a/configure.in b/configure.in
index b132e28..024556a 100644
--- a/configure.in
+++ b/configure.in
@@ -1237,9 +1237,7 @@ HAVE_X11=$have_x
 
 
 AC_CHECK_LIB(socket, open)
-AC_CHECK_LIB(bsd, open)
 
-AC_CHECK_LIB(elf, open)
 AC_CHECK_LIB(dl, open)
 AC_CHECK_LIB(dld, open)
 AC_CHECK_LIB(ld, open)

From fdca256765778eb2a97187123e7fffd7970671a3 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 4 Jun 2019 10:04:53 +0200
Subject: [PATCH 02/21] Patch to compile with gcc-4.3

thanks to Malcolm MacLeod <mmacleod@webmail.co.za>
---
 include/mico/throw.h | 2 +-
 orb/fast_array.cc    | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/mico/throw.h b/include/mico/throw.h
index 28a91a8..7262187 100644
--- a/include/mico/throw.h
+++ b/include/mico/throw.h
@@ -25,7 +25,7 @@
 #define __mico_throw_h__
 
 #include <stdarg.h>
-#include <string.h>
+#include <cstring>
 
 #ifdef HAVE_EXCEPTIONS
 #define MICO_CATCHANY(x) try { x; } catch (...) {}
diff --git a/orb/fast_array.cc b/orb/fast_array.cc
index d2c1272..b0e63ea 100644
--- a/orb/fast_array.cc
+++ b/orb/fast_array.cc
@@ -40,6 +40,7 @@
 
 #endif // FAST_PCH
 
+#include <limits.h>
 
 using namespace std;
 

From c24dbb51b1493fd3df4971807f22f96395a6c74c Mon Sep 17 00:00:00 2001
From: Karel Gardas <kgardas@objectsecurity.com>
Date: Thu, 2 Jun 2011 21:32:32 +0200
Subject: [PATCH 03/21] with gcc, use the '-pthread' compiler flag (Michael
 Haubenwallner)

darcs-hash:902d6ed926df488126fd6e39ee6847b9081f88fb
---
 configure.in | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/configure.in b/configure.in
index 024556a..3d8b903 100644
--- a/configure.in
+++ b/configure.in
@@ -524,7 +524,19 @@ if test X"$platform_supports_threads" = Xno; then
       )
       AC_CHECK_HEADERS(semaphore.h)
       AC_DEFINE(HAVE_PTHREADS)
+      case "${GXX}:${target}" in
+      yes:*solaris*|yes:*sunos*)
+        CXXFLAGS="-pthreads ${CXXFLAGS}"
+        LDFLAGS="-pthreads ${LDFLAGS}"
+	;;
+      yes:*)
+	CXXFLAGS="-pthread ${CXXFLAGS}"
+	LDFLAGS="-pthread ${LDFLAGS}"
+	;;
+      *)
       SHLIBS="-lpthread"
+      ;;
+      esac
     else 
       AC_CHECK_LIB(c_r, pthread_create, use_pthreads=yes, use_pthreads=no)
       if test X"$use_pthreads" = Xyes; then

From e93b1985f4d5b1882f88ca42a82d091c0a0ecd60 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 21 May 2019 17:55:22 +0200
Subject: [PATCH 04/21] do not add '-lstdc++' explicitly on AIX

Adding '-lstdc++' really is the C++ compiler's job.
---
 admin/mico-shld.aix.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/admin/mico-shld.aix.in b/admin/mico-shld.aix.in
index 483c24e..e0ce404 100755
--- a/admin/mico-shld.aix.in
+++ b/admin/mico-shld.aix.in
@@ -87,7 +87,7 @@ eval "/usr/ccs/bin/nm $nmopts -h $ofiles" | sed -e '/:$/d' -e '/ U /d' -e '/_GLO
 
 
 ldcmd="@SHARED_CC@ @LDSOFLAGS@ @DLFLAGS@ $libdirs @LDFLAGS@ \
- -Wl,-bE:lib.exp,-bnoentry -o '$outfile' $args @LIBS@ -lstdc++"
+ -Wl,-bE:lib.exp,-bnoentry -o '$outfile' $args @LIBS@"
 
 echo "$ldcmd"
 eval "$ldcmd"

From b885762588f81d37edf6d72fbc9e985bcb29f9aa Mon Sep 17 00:00:00 2001
From: Karel Gardas <kgardas@objectsecurity.com>
Date: Wed, 8 Apr 2009 10:58:50 +0200
Subject: [PATCH 05/21] fix shared libraries suffix on IA64/HP-UX platform
 (Michael Haubenwallner)

darcs-hash:b0949110aa3129f5d43d3141f7fd27de7b186607
---
 configure.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/configure.in b/configure.in
index 3d8b903..7f7876b 100644
--- a/configure.in
+++ b/configure.in
@@ -1,6 +1,6 @@
 #
 #  MICO --- an Open Source CORBA implementation
-#  Copyright (c) 1997-2008 by The Mico Team
+#  Copyright (c) 1997-2009 by The Mico Team
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Library General Public
@@ -744,7 +744,9 @@ if test X"$GXX" = Xyes; then
     # -mmillicode-long-calls
     CONF_LDFLAGS=-Wl,+s
     CONF_DLFLAGS=-Wl,-E
-    CONF_SOEXT=sl
+    case $target in
+    hppa*) CONF_SOEXT=sl ;;
+    esac
     CONF_OBJ_SIZE_LIMIT=yes
     ;;
   *freebsd2*|*freebsd3*)

From 71d1686ae91e8f3b719ef1a33f7c1e3f7a1b5c51 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 21 May 2019 17:57:29 +0200
Subject: [PATCH 06/21] link libmico.so against detected libraries

Link shared libmico.so against configure detected libraries to avoid
undefined symbols, to let --as-needed linker flag work if forced.
See also: https://bugs.gentoo.org/280678
---
 orb/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/orb/Makefile b/orb/Makefile
index 86b664f..213fe0a 100644
--- a/orb/Makefile
+++ b/orb/Makefile
@@ -30,7 +30,7 @@ CXXFLAGS := -DBUILD_MICO_DLL $(CXXFLAGS)
 endif
 endif
 
-PLATFORM_LIBS =
+PLATFORM_LIBS = $(CONFLIBS)
 ifeq ($(HAVE_CYGWIN), yes)
 ifeq ($(USE_CSL2), yes)
 PLATFORM_LIBS := $(PLATFORM_LIBS) -lssl -lcrypto

From 7182017f3a7f7f9c11d0ca0a694f9957a7c1f513 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 21 May 2019 18:19:56 +0200
Subject: [PATCH 07/21] qt4 doesn't provide different libraries with thread
 support

---
 configure.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.in b/configure.in
index 7f7876b..86271e8 100644
--- a/configure.in
+++ b/configure.in
@@ -1124,7 +1124,7 @@ if test X"$QTDIR" != X; then
     AC_MSG_WARN(cannot find moc. QT parts disabled.)
     HAVE_QT=no
   fi
-  if test X"$HAVE_THREADS" = Xyes; then
+  if false && test X"$HAVE_THREADS" = Xyes; then
     AC_CHECK_LIB(qt-mt, open, qt_mt=yes, qt_mt=no)
     if test X"$qt_mt" = Xno; then
       AC_MSG_WARN(cannot find multi-threaded version of QT library. QT parts disabled.)

From edfe818c7115446283ebb4da11c1a69184e5cd2c Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 21 May 2019 18:22:39 +0200
Subject: [PATCH 08/21] drop check for pgsql/libpq-fe.h, not used anywhere

See also: https://bugs.gentoo.org/306255
---
 configure.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.in b/configure.in
index 86271e8..0d42c77 100644
--- a/configure.in
+++ b/configure.in
@@ -1324,7 +1324,7 @@ AC_CHECK_HEADERS(sys/un.h netinet/in.h arpa/inet.h netdb.h dlfcn.h dl.h)
 AC_CHECK_HEADERS(netinet/tcp.h stdlib.h sys/time.h sunmath.h sys/stat.h)
 AC_CHECK_HEADERS(poll.h)
 
-AC_CHECK_HEADERS(exception exception.h terminate.h openssl/ssl.h pgsql/libpq-fe.h)
+AC_CHECK_HEADERS(exception exception.h terminate.h openssl/ssl.h)
 
 # QT
 AC_CHECK_HEADERS(qapplication.h qsocketnotifier.h qlineedit.h)

From 956f90b4fa56d426e6d5d8116328eae939e611bb Mon Sep 17 00:00:00 2001
From: Karel Gardas <kgardas@objectsecurity.com>
Date: Thu, 2 Jun 2011 21:48:20 +0200
Subject: [PATCH 09/21] fix warning (treated as error) in check for const
 overload (Michael Haubenwallner)

darcs-hash:6ed6032d9767df070e49b32b7325494b6dabdddc
---
 aclocal.m4 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 2177595..80715f7 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -353,11 +353,12 @@ AC_TRY_COMPILE_GLOBAL(,[
 
   void bar (const int &, int &, const int *, int *, int *&);
 
-  void foo (S &s, const S &cs)
+  int foo (S &s, const S &cs)
   {
-     int i = s; i = cs; i = *s; i = *cs;
+     int i = s; int j = cs; int k = *s; int l = *cs;
      bar (s, s, s, s, s);
      bar (cs, s, cs, s, s);
+     return (i + j + k + l);
   }
 ],
 eval "ac_cv_have_const_overload=yes",

From 4dab24746ef68df95a9e0d5abe870a57502fb3d3 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 21 May 2019 18:29:15 +0200
Subject: [PATCH 10/21] if already set, let CFLAGS/CXXFLAGS alone by default

Do not tweak CFLAGS/CXXFLAGS if already set and optimize or debug is not
explicitly requested by configure arguments.
---
 configure.in | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/configure.in b/configure.in
index 0d42c77..4b7e60c 100644
--- a/configure.in
+++ b/configure.in
@@ -112,12 +112,12 @@ AC_ARG_ENABLE(repo,
  use_repo=$enableval, use_repo=no)
 
 AC_ARG_ENABLE(optimize,
- [  --disable-optimize      do not use -O2 to compile],
- use_opt=$enableval, use_opt=yes)
+ [  --enable-optimize       use -O2 to compile],
+ use_opt=$enableval, ${CFLAGS+true} false && use_opt=default || use_opt=yes)
 
 AC_ARG_ENABLE(debug,
  [  --enable-debug          use -g to compile],
- use_debug=$enableval, use_debug=no)
+ use_debug=$enableval, ${CFLAGS+true} false && use_debug=default || use_opt=yes)
 
 AC_ARG_ENABLE(shared,
  [  --disable-shared        don't build shared libs],
@@ -969,7 +969,7 @@ else
       CONF_SHARED_CC="$CXX -shared"
       CONF_PICFLAGS=-fPIC
       CONF_LDSOFLAGS=-fPIC
-      if test X"$use_opt" != Xyes; then
+      if test X"$use_opt" = Xno; then
         # by default Intel uses -O so we need to disable it
         CONF_OPT_FLAGS=-O0
         use_opt=yes
@@ -1025,17 +1025,23 @@ fi
 #
 
 changequote(<<, >>)
-CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -g / /g' -e 's/ -O[0-9]* / /g'`
-CFLAGS=`echo " $CFLAGS " | sed -e 's/ -g / /g' -e 's/ -O[0-9]* / /g'`
-changequote([, ])
-if test X"$use_opt" != Xno; then
-  CXXFLAGS="$CONF_OPT_FLAGS $CXXFLAGS"
-  CFLAGS="$CONF_OPT_FLAGS $CFLAGS"
+if test X"$use_opt" != Xdefault; then
+  CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -O[0-9]* / /g'`
+  CFLAGS=`echo " $CFLAGS " | sed -e 's/ -O[0-9]* / /g'`
+  if test X"$use_opt" = Xyes; then
+    CXXFLAGS="$CONF_OPT_FLAGS $CXXFLAGS"
+    CFLAGS="$CONF_OPT_FLAGS $CFLAGS"
+  fi
 fi
-if test X"$use_debug" != Xno; then
-  CXXFLAGS="$CONF_DEBUG_FLAGS $CXXFLAGS"
-  CFLAGS="$CONF_DEBUG_FLAGS $CFLAGS"
+if test X"$use_debug" != Xdefault; then
+  CXXFLAGS=`echo " $CXXFLAGS " | sed -e 's/ -g / /g'`
+  CFLAGS=`echo " $CFLAGS " | sed -e 's/ -g / /g'`
+  if test X"$use_debug" = Xyes; then
+    CXXFLAGS="$CONF_DEBUG_FLAGS $CXXFLAGS"
+    CFLAGS="$CONF_DEBUG_FLAGS $CFLAGS"
+  fi
 fi
+changequote([, ])
 
 if test "x$use_memcheck" = "xyes" ; then
     case $target in

From 4ee714d0141806e6f216c2333b0c301f172fbf66 Mon Sep 17 00:00:00 2001
From: Karel Gardas <kgardas@objectsecurity.com>
Date: Thu, 2 Jun 2011 21:08:00 +0200
Subject: [PATCH 11/21] fix detection of GTK library (Michael Haubenwallner)

darcs-hash:80072f6abbc75cd3ee8c4fcb6e9bf34a50dc2600
---
 aclocal.m4 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/aclocal.m4 b/aclocal.m4
index 80715f7..8f3a1dc 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -736,6 +736,7 @@ dnl
       AC_TRY_RUN([
 #include <gtk/gtk.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 int 
 main ()

From 6a29d3669fd228d6c7a1506e516503056e9f3b33 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 21 May 2019 18:32:09 +0200
Subject: [PATCH 12/21] run AC_HEADER_STDC check early, for disabled threads

The very first AC_CHECK for HEADERS found by autoconf does pull in the
AC_REQUIRE(AC_PROG_EGREP) configure code.  If we skip that configure
part, which we do when threading was disabled, EGREP is unset for any
subsequent check, breaking the checks for function prototypes at least.
So we better do the AC_HEADER_STDC before any other AC_CHECK_HEADERS.
---
 configure.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure.in b/configure.in
index 4b7e60c..21430ff 100644
--- a/configure.in
+++ b/configure.in
@@ -404,6 +404,8 @@ ac_link="$ac_link "'$EXTRA_LIBS'
 AC_SUBST(EXTRA_CXXFLAGS)
 ac_compile="$ac_compile "'$EXTRA_CXXFLAGS'
 
+AC_HEADER_STDC
+
 #
 # thread support
 #
@@ -1324,7 +1326,6 @@ CURSES_LIBS="$LIBS $SHLIBS"
 # Checks for header files.
 #
 
-AC_HEADER_STDC
 AC_CHECK_HEADERS(fcntl.h unistd.h sys/select.h strings.h float.h ieeefp.h)
 AC_CHECK_HEADERS(sys/un.h netinet/in.h arpa/inet.h netdb.h dlfcn.h dl.h)
 AC_CHECK_HEADERS(netinet/tcp.h stdlib.h sys/time.h sunmath.h sys/stat.h)

From 00631a606c8748ee5711f83d4f4e10f6624fa929 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 21 May 2019 18:41:09 +0200
Subject: [PATCH 13/21] no need for working DNS in idl compiler

---
 idl/main.cc    | 7 +++++++
 orb/address.cc | 7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/idl/main.cc b/idl/main.cc
index a2ad803..61dcdaa 100644
--- a/idl/main.cc
+++ b/idl/main.cc
@@ -75,6 +75,13 @@ int main( int argc, char *argv[] )
   DB db;
 
   // ORB initialization
+  // Resolving the hostname is useless in the IDL compiler.
+  vector<char*> argvv;
+  argvv.push_back(argv[0]);
+  argvv.push_back(strdup("-ORBNoResolve"));
+  argvv.insert(argvv.end(), &argv[1], &argv[argc]);
+  ++argc;
+  argv = &argvv.front();
   CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
 
 #ifdef _WIN32
diff --git a/orb/address.cc b/orb/address.cc
index 7c2b279..10ee5d7 100644
--- a/orb/address.cc
+++ b/orb/address.cc
@@ -624,8 +624,11 @@ MICO::InetAddress::hostname ()
 {
     if (hname.length() == 0) {
         char buf[200];
-        int r = gethostname (buf, 200);
-	assert (r == 0);
+	if (_resolve) {
+	    int r = gethostname (buf, 200);
+	    assert (r == 0);
+	} else
+	    strcpy(buf, "localhost");
         /*
          * some OSes do not return an FQDN. So we get the ip address for the
          * hostname and resolve that address into the FQDN...

From 59d4f879e85bf8434a62cafeb085109dde176688 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 4 Jun 2019 10:21:29 +0200
Subject: [PATCH 14/21] Fix building with GCC-6

uni_fromuni.cc:66:1: error: narrowing conversion of '240' from 'int' to 'char' inside { } [-Wnarrowing]
---
 idl/idlparser.cc   |   6 +-
 idl/yacc.cc        |   6 +-
 orb/uni_fromuni.cc | 688 ++++++++++++++++++++++-----------------------
 3 files changed, 350 insertions(+), 350 deletions(-)

diff --git a/idl/idlparser.cc b/idl/idlparser.cc
index b539650..3b09412 100644
--- a/idl/idlparser.cc
+++ b/idl/idlparser.cc
@@ -395,7 +395,7 @@ IDLParser::collectImport (CORBA::Container_ptr con, ParseNode *node)
   node = node->getBranch (1);
 
   assert (node);
-  assert (node->getType() == string_literals ||
+  assert (node->getType() == ::string_literals ||
 	  node->getType() == scoped_name);
 
   CORBA::String_var to_be_imported = CORBA::string_dup (node->getIdent ());
@@ -427,7 +427,7 @@ IDLParser::collectImport (CORBA::Container_ptr con, ParseNode *node)
 
   CORBA::Contained_var icont = CORBA::Contained::_nil ();
 
-  if (node->getType() == string_literals) {
+  if (node->getType() == ::string_literals) {
     if (CORBA::is_nil (myrepo)) {
       cerr << IDLError (36, node, to_be_imported.in()) << endl;
       exit (1);
@@ -1823,7 +1823,7 @@ void
 IDLParser::collectContextExpr( ParseNode *node, CORBA::ContextIdSeq &ctx )
 {
   while( node != NULL ) {
-    assert( node->getType() == string_literals );
+    assert( node->getType() == ::string_literals );
     int i = ctx.length();
     ctx.length( i + 1 );
     ctx[ i ] = (const char *) node->getIdent();
diff --git a/idl/yacc.cc b/idl/yacc.cc
index aacb293..579e53c 100644
--- a/idl/yacc.cc
+++ b/idl/yacc.cc
@@ -3639,7 +3639,7 @@ yyparse (YYPARSE_PARAM_ARG)
   case 251:
 #line 1792 "yacc.yy"
     {
-	    yyval.node = new ParseNode( string_literals );
+	    yyval.node = new ParseNode( ::string_literals );
 	    yyval.node->setIdent( yyvsp[0]._str );
 	  }
     break;
@@ -3647,7 +3647,7 @@ yyparse (YYPARSE_PARAM_ARG)
   case 252:
 #line 1797 "yacc.yy"
     {
-	    yyval.node = new ParseNode( string_literals, yyvsp[0].node );
+	    yyval.node = new ParseNode( ::string_literals, yyvsp[0].node );
 	    yyval.node->setIdent( yyvsp[-2]._str );
 	  }
     break;
@@ -3774,7 +3774,7 @@ yyparse (YYPARSE_PARAM_ARG)
   case 267:
 #line 1919 "yacc.yy"
     {
-	    yyval.node = new ParseNode (string_literals);
+	    yyval.node = new ParseNode (::string_literals);
 	    yyval.node->setIdent (yyvsp[0]._str);
 	  }
     break;
diff --git a/orb/uni_fromuni.cc b/orb/uni_fromuni.cc
index c483eb5..fdcebb2 100644
--- a/orb/uni_fromuni.cc
+++ b/orb/uni_fromuni.cc
@@ -51,18 +51,18 @@ static char FindException(const cexcept *array, uni_ubyte arrlen,
 
 static const char uni2ebcArray[] =  /* beginning with 0x20 (32) */
 {
-  0x40, 0x5A, 0x7E, 0x7B, 0x5B, 0x6C, 0x50, 0x7D,  /* 0x20-0x27 ( 32- 39) */
-  0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x6D, 0x4B, 0x61,  /* 0x28-0x2F ( 40- 47) */
-  0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,  /* 0x30-0x37 ( 48- 55) */
-  0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,  /* 0x38-0x3F ( 56- 63) */
-  0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,  /* 0x40-0x47 ( 64- 71) */
-  0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,  /* 0x48-0x4F ( 72- 79) */
-  0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6,  /* 0x50-0x57 ( 80- 87) */
-  0xE7, 0xE8, 0xE9, '\0', '\0', '\0', '\0', 0x6D,  /* 0x58-0x5F ( 88- 95) */
-  '\0', 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,  /* 0x60-0x67 ( 96-103) */
-  0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,  /* 0x68-0x6F (104-111) */
-  0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,  /* 0x70-0x77 (112-119) */
-  0xA7, 0xA8, 0xA9, 0x8B, 0x6A, 0x9B, '\0', '\0'   /* 0x78-0x7F (120-127) */
+  (char)0x40, (char)0x5A, (char)0x7E, (char)0x7B, (char)0x5B, (char)0x6C, (char)0x50, (char)0x7D,  /* 0x20-0x27 ( 32- 39) */
+  (char)0x4D, (char)0x5D, (char)0x5C, (char)0x4E, (char)0x6B, (char)0x6D, (char)0x4B, (char)0x61,  /* 0x28-0x2F ( 40- 47) */
+  (char)0xF0, (char)0xF1, (char)0xF2, (char)0xF3, (char)0xF4, (char)0xF5, (char)0xF6, (char)0xF7,  /* 0x30-0x37 ( 48- 55) */
+  (char)0xF8, (char)0xF9, (char)0x7A, (char)0x5E, (char)0x4C, (char)0x7E, (char)0x6E, (char)0x6F,  /* 0x38-0x3F ( 56- 63) */
+  (char)0x7C, (char)0xC1, (char)0xC2, (char)0xC3, (char)0xC4, (char)0xC5, (char)0xC6, (char)0xC7,  /* 0x40-0x47 ( 64- 71) */
+  (char)0xC8, (char)0xC9, (char)0xD1, (char)0xD2, (char)0xD3, (char)0xD4, (char)0xD5, (char)0xD6,  /* 0x48-0x4F ( 72- 79) */
+  (char)0xD7, (char)0xD8, (char)0xD9, (char)0xE2, (char)0xE3, (char)0xE4, (char)0xE5, (char)0xE6,  /* 0x50-0x57 ( 80- 87) */
+  (char)0xE7, (char)0xE8, (char)0xE9, (char)'\0', (char)'\0', (char)'\0', (char)'\0', (char)0x6D,  /* 0x58-0x5F ( 88- 95) */
+  (char)'\0', (char)0x81, (char)0x82, (char)0x83, (char)0x84, (char)0x85, (char)0x86, (char)0x87,  /* 0x60-0x67 ( 96-103) */
+  (char)0x88, (char)0x89, (char)0x91, (char)0x92, (char)0x93, (char)0x94, (char)0x95, (char)0x96,  /* 0x68-0x6F (104-111) */
+  (char)0x97, (char)0x98, (char)0x99, (char)0xA2, (char)0xA3, (char)0xA4, (char)0xA5, (char)0xA6,  /* 0x70-0x77 (112-119) */
+  (char)0xA7, (char)0xA8, (char)0xA9, (char)0x8B, (char)0x6A, (char)0x9B, (char)'\0', (char)'\0'   /* 0x78-0x7F (120-127) */
 };
 
 //  static const cexcept exc2ebcArray[] =
@@ -113,434 +113,434 @@ static const uni_ubyte uni2htmlArray[] =  /* beginning with 0xa0 (160) */
 
 static const char uni2macArray[] =  /* beginning with 0xA0 (160) */
 {
-  0xCA, 0xC1, 0xA2, 0xA3,  /* 0xA0-0xA3 (160-163) */
-  0xDB, 0xB4, '\0', 0xA4,  /* 0xA4-0xA7 (164-167) */
-  0xAC, 0xA9, 0xAB, 0xC7,  /* 0xA8-0xAB (168-171) */
-  0xC2, 0xD0, 0xA8, '\0',  /* 0xAC-0xAF (172-175) */
-
-  0xA1, 0xB1, '\0', '\0',  /* 0xB0-0xB3 (176-179) */
-  0xAB, 0xB5, 0xA6, 0xE1,  /* 0xB4-0xB7 (180-183) */
-  '\0', 0xF5, 0xAC, 0xC8,  /* 0xB8-0xBB (184-187) */
-  '\0', '\0', '\0', 0xC0,  /* 0xBC-0xBF (188-191) */
-
-  0xCB, 0xE7, 0xE5, 0xCC,  /* 0xC0-0xC3 (192-195) */
-  0x80, 0x81, 0xA6, 0x82,  /* 0xC4-0xC7 (196-199) */
-  0xE9, 0x83, 0xE6, 0xE8,  /* 0xC8-0xCB (200-203) */
-  0xCD, 0xCA, 0xCB, 0xCC,  /* 0xCC-0xCF (204-207) */
-
-  '\0', 0x84, 0xF1, 0xCE,  /* 0xD0-0xD3 (208-211) */
-  0xCF, 0xCD, 0x85, '\0',  /* 0xD4-0xD7 (212-215) */
-  0xAF, 0xF5, 0xF3, 0xF4,  /* 0xD8-0xDB (216-219) */
-  0x86, '\0', '\0', 0xA7,  /* 0xDC-0xDF (220-223) */
-
-  0x88, 0x87, 0x89, 0x8B,  /* 0xE0-0xE3 (224-227) */
-  0x8A, 0x8C, 0xBE, 0x8D,  /* 0xE4-0xE7 (228-231) */
-  0x8F, 0x8E, 0x90, 0x91,  /* 0xE8-0xEB (232-235) */
-  0x93, 0x92, 0x94, 0x95,  /* 0xEC-0xEF (236-239) */
-
-  '\0', 0x96, 0x98, 0x97,  /* 0xF0-0xF3 (240-243) */
-  0x99, 0x9B, 0x9A, 0xD6,  /* 0xF4-0xF7 (244-247) */
-  0xBF, 0x9D, 0x9C, 0x9E,  /* 0xF8-0xFB (248-251) */
-  0x9F, '\0', '\0', 0xD8   /* 0xFC-0xFF (252-255) */
+  (char)0xCA, (char)0xC1, (char)0xA2, (char)0xA3,  /* 0xA0-0xA3 (160-163) */
+  (char)0xDB, (char)0xB4, (char)'\0', (char)0xA4,  /* 0xA4-0xA7 (164-167) */
+  (char)0xAC, (char)0xA9, (char)0xAB, (char)0xC7,  /* 0xA8-0xAB (168-171) */
+  (char)0xC2, (char)0xD0, (char)0xA8, (char)'\0',  /* 0xAC-0xAF (172-175) */
+
+  (char)0xA1, (char)0xB1, (char)'\0', (char)'\0',  /* 0xB0-0xB3 (176-179) */
+  (char)0xAB, (char)0xB5, (char)0xA6, (char)0xE1,  /* 0xB4-0xB7 (180-183) */
+  (char)'\0', (char)0xF5, (char)0xAC, (char)0xC8,  /* 0xB8-0xBB (184-187) */
+  (char)'\0', (char)'\0', (char)'\0', (char)0xC0,  /* 0xBC-0xBF (188-191) */
+
+  (char)0xCB, (char)0xE7, (char)0xE5, (char)0xCC,  /* 0xC0-0xC3 (192-195) */
+  (char)0x80, (char)0x81, (char)0xA6, (char)0x82,  /* 0xC4-0xC7 (196-199) */
+  (char)0xE9, (char)0x83, (char)0xE6, (char)0xE8,  /* 0xC8-0xCB (200-203) */
+  (char)0xCD, (char)0xCA, (char)0xCB, (char)0xCC,  /* 0xCC-0xCF (204-207) */
+
+  (char)'\0', (char)0x84, (char)0xF1, (char)0xCE,  /* 0xD0-0xD3 (208-211) */
+  (char)0xCF, (char)0xCD, (char)0x85, (char)'\0',  /* 0xD4-0xD7 (212-215) */
+  (char)0xAF, (char)0xF5, (char)0xF3, (char)0xF4,  /* 0xD8-0xDB (216-219) */
+  (char)0x86, (char)'\0', (char)'\0', (char)0xA7,  /* 0xDC-0xDF (220-223) */
+
+  (char)0x88, (char)0x87, (char)0x89, (char)0x8B,  /* 0xE0-0xE3 (224-227) */
+  (char)0x8A, (char)0x8C, (char)0xBE, (char)0x8D,  /* 0xE4-0xE7 (228-231) */
+  (char)0x8F, (char)0x8E, (char)0x90, (char)0x91,  /* 0xE8-0xEB (232-235) */
+  (char)0x93, (char)0x92, (char)0x94, (char)0x95,  /* 0xEC-0xEF (236-239) */
+
+  (char)'\0', (char)0x96, (char)0x98, (char)0x97,  /* 0xF0-0xF3 (240-243) */
+  (char)0x99, (char)0x9B, (char)0x9A, (char)0xD6,  /* 0xF4-0xF7 (244-247) */
+  (char)0xBF, (char)0x9D, (char)0x9C, (char)0x9E,  /* 0xF8-0xFB (248-251) */
+  (char)0x9F, (char)'\0', (char)'\0', (char)0xD8   /* 0xFC-0xFF (252-255) */
 };
 
 static const cexcept exc2macArray[] =
 {
-  { 0x0152 , 0xCE } , { 0x0153 , 0xCF } , { 0x0178 , 0xD9 } ,
-  { 0x0192 , 0xC4 } , { 0x02C6 , 0xF6 } , { 0x02C7 , 0xF9 } ,
-  { 0x02C9 , 0xF8 } , { 0x02CE , 0xFE } , { 0x02D8 , 0xFF } ,
-  { 0x02D9 , 0xFA } , { 0x02DA , 0xFB } , { 0x02DB , 0xFC } ,
-  { 0x02DC , 0xF7 } , { 0x03A9 , 0xBD } , { 0x03C0 , 0xB9 } ,
-  { 0x2013 , 0xD0 } , { 0x2014 , 0xD1 } , { 0x2018 , 0xD4 } ,
-  { 0x2019 , 0xD5 } , { 0x201A , 0xE2 } , { 0x201C , 0xD2 } ,
-  { 0x201D , 0xD3 } , { 0x201E , 0xE3 } , { 0x2020 , 0xA0 } ,
-  { 0x2021 , 0xE0 } , { 0x2026 , 0xC9 } , { 0x2031 , 0xE4 } ,
-  { 0x2039 , 0xDC } , { 0x20A0 , 0xDD } , { 0x2122 , 0xAA } ,
-  { 0x2190 , 0x1C } , { 0x2191 , 0x1E } , { 0x2192 , 0x1D } ,
-  { 0x2193 , 0x1F } , { 0x2202 , 0xB6 } , { 0x2205 , 0xD7 } ,
-  { 0x2206 , 0xC6 } , { 0x220E , 0xA5 } , { 0x220F , 0xB8 } ,
-  { 0x2211 , 0xB7 } , { 0x2215 , 0xDA } , { 0x221A , 0xC3 } ,
-  { 0x221E , 0xB0 } , { 0x222B , 0xBA } , { 0x2248 , 0xC5 } ,
-  { 0x2260 , 0xAD } , { 0x2264 , 0xB2 } , { 0x2265 , 0xB3 } ,
-  { 0xFB01 , 0xDE } , { 0xFB02 , 0xDF }
+  { (uni_ushort)0x0152 , (char)0xCE } , { (uni_ushort)0x0153 , (char)0xCF } , { (uni_ushort)0x0178 , (char)0xD9 } ,
+  { (uni_ushort)0x0192 , (char)0xC4 } , { (uni_ushort)0x02C6 , (char)0xF6 } , { (uni_ushort)0x02C7 , (char)0xF9 } ,
+  { (uni_ushort)0x02C9 , (char)0xF8 } , { (uni_ushort)0x02CE , (char)0xFE } , { (uni_ushort)0x02D8 , (char)0xFF } ,
+  { (uni_ushort)0x02D9 , (char)0xFA } , { (uni_ushort)0x02DA , (char)0xFB } , { (uni_ushort)0x02DB , (char)0xFC } ,
+  { (uni_ushort)0x02DC , (char)0xF7 } , { (uni_ushort)0x03A9 , (char)0xBD } , { (uni_ushort)0x03C0 , (char)0xB9 } ,
+  { (uni_ushort)0x2013 , (char)0xD0 } , { (uni_ushort)0x2014 , (char)0xD1 } , { (uni_ushort)0x2018 , (char)0xD4 } ,
+  { (uni_ushort)0x2019 , (char)0xD5 } , { (uni_ushort)0x201A , (char)0xE2 } , { (uni_ushort)0x201C , (char)0xD2 } ,
+  { (uni_ushort)0x201D , (char)0xD3 } , { (uni_ushort)0x201E , (char)0xE3 } , { (uni_ushort)0x2020 , (char)0xA0 } ,
+  { (uni_ushort)0x2021 , (char)0xE0 } , { (uni_ushort)0x2026 , (char)0xC9 } , { (uni_ushort)0x2031 , (char)0xE4 } ,
+  { (uni_ushort)0x2039 , (char)0xDC } , { (uni_ushort)0x20A0 , (char)0xDD } , { (uni_ushort)0x2122 , (char)0xAA } ,
+  { (uni_ushort)0x2190 , (char)0x1C } , { (uni_ushort)0x2191 , (char)0x1E } , { (uni_ushort)0x2192 , (char)0x1D } ,
+  { (uni_ushort)0x2193 , (char)0x1F } , { (uni_ushort)0x2202 , (char)0xB6 } , { (uni_ushort)0x2205 , (char)0xD7 } ,
+  { (uni_ushort)0x2206 , (char)0xC6 } , { (uni_ushort)0x220E , (char)0xA5 } , { (uni_ushort)0x220F , (char)0xB8 } ,
+  { (uni_ushort)0x2211 , (char)0xB7 } , { (uni_ushort)0x2215 , (char)0xDA } , { (uni_ushort)0x221A , (char)0xC3 } ,
+  { (uni_ushort)0x221E , (char)0xB0 } , { (uni_ushort)0x222B , (char)0xBA } , { (uni_ushort)0x2248 , (char)0xC5 } ,
+  { (uni_ushort)0x2260 , (char)0xAD } , { (uni_ushort)0x2264 , (char)0xB2 } , { (uni_ushort)0x2265 , (char)0xB3 } ,
+  { (uni_ushort)0xFB01 , (char)0xDE } , { (uni_ushort)0xFB02 , (char)0xDF }
 };
 
 static const char uni2koiArray1[] =  /* beginning with 0x0410 (1040) */
 {
-  0xE1, 0xE2, 0xF7, 0xE7,  /* 0x0410-0x0413 (1040-1043) */
-  0xE4, 0xE5, 0xF6, 0xFA,  /* 0x0414-0x0417 (1044-1047) */
-  0xE9, 0xEA, 0xEB, 0xEC,  /* 0x0418-0x041B (1048-1051) */
-  0xED, 0xEE, 0xEF, 0xF0,  /* 0x041C-0x041F (1042-1055) */
-
-  0xF2, 0xF3, 0xF4, 0xF5,  /* 0x0420-0x0423 (1056-1059) */
-  0xE6, 0xE8, 0xE3, 0xFE,  /* 0x0424-0x0427 (1060-1063) */
-  0xFB, 0xFD, 0xFF, 0xF9,  /* 0x0428-0x042B (1064-1067) */
-  0xF8, 0xFC, 0xE0, 0xF1,  /* 0x042C-0x042F (1068-1071) */
-
-  0xC1, 0xC2, 0xD7, 0xC7,  /* 0x0430-0x0433 (1072-1075) */
-  0xC4, 0xC5, 0xD6, 0xDA,  /* 0x0434-0x0437 (1076-1079) */
-  0xC9, 0xCA, 0xCB, 0xCC,  /* 0x0438-0x043B (1080-1083) */
-  0xCD, 0xCE, 0xCF, 0xD0,  /* 0x043C-0x043F (1084-1087) */
-
-  0xD2, 0xD3, 0xD4, 0xD5,  /* 0x0440-0x0443 (1088-1091) */
-  0xC6, 0xC8, 0xC3, 0xDE,  /* 0x0444-0x0447 (1092-1095) */
-  0xDB, 0xDD, 0xDF, 0xD9,  /* 0x0448-0x044B (1096-1099) */
-  0xD8, 0xDC, 0xC0, 0xD1   /* 0x044C-0x044F (1100-1103) */
+  (char)0xE1, (char)0xE2, (char)0xF7, (char)0xE7,  /* 0x0410-0x0413 (1040-1043) */
+  (char)0xE4, (char)0xE5, (char)0xF6, (char)0xFA,  /* 0x0414-0x0417 (1044-1047) */
+  (char)0xE9, (char)0xEA, (char)0xEB, (char)0xEC,  /* 0x0418-0x041B (1048-1051) */
+  (char)0xED, (char)0xEE, (char)0xEF, (char)0xF0,  /* 0x041C-0x041F (1042-1055) */
+
+  (char)0xF2, (char)0xF3, (char)0xF4, (char)0xF5,  /* 0x0420-0x0423 (1056-1059) */
+  (char)0xE6, (char)0xE8, (char)0xE3, (char)0xFE,  /* 0x0424-0x0427 (1060-1063) */
+  (char)0xFB, (char)0xFD, (char)0xFF, (char)0xF9,  /* 0x0428-0x042B (1064-1067) */
+  (char)0xF8, (char)0xFC, (char)0xE0, (char)0xF1,  /* 0x042C-0x042F (1068-1071) */
+
+  (char)0xC1, (char)0xC2, (char)0xD7, (char)0xC7,  /* 0x0430-0x0433 (1072-1075) */
+  (char)0xC4, (char)0xC5, (char)0xD6, (char)0xDA,  /* 0x0434-0x0437 (1076-1079) */
+  (char)0xC9, (char)0xCA, (char)0xCB, (char)0xCC,  /* 0x0438-0x043B (1080-1083) */
+  (char)0xCD, (char)0xCE, (char)0xCF, (char)0xD0,  /* 0x043C-0x043F (1084-1087) */
+
+  (char)0xD2, (char)0xD3, (char)0xD4, (char)0xD5,  /* 0x0440-0x0443 (1088-1091) */
+  (char)0xC6, (char)0xC8, (char)0xC3, (char)0xDE,  /* 0x0444-0x0447 (1092-1095) */
+  (char)0xDB, (char)0xDD, (char)0xDF, (char)0xD9,  /* 0x0448-0x044B (1096-1099) */
+  (char)0xD8, (char)0xDC, (char)0xC0, (char)0xD1   /* 0x044C-0x044F (1100-1103) */
 };
 
 static const char uni2koiArray2[] =  /* beginning with 0x2550 (9552) */
 {
-  0xA0, 0xA1, 0xA2, 0xA4,  /* 0x0250-0x0253 (9552-9555) */
-  0xA5, 0xA6, 0xA7, 0xA8,  /* 0x0254-0x0257 (9556-9559) */
-  0xA9, 0xAA, 0xAB, 0xAC,  /* 0x0258-0x025B (9560-9563) */
-  0xAD, 0xAE, 0xAF, 0xB0,  /* 0x025C-0x025F (9564-9567) */
-
-  0xB1, 0xB2, 0xB4, 0xB5,  /* 0x0260-0x0263 (9568-9571) */
-  0xB6, 0xB7, 0xB8, 0xB9,  /* 0x0264-0x0267 (9572-9575) */
-  0xBA, 0xBB, 0xBC, 0xBD,  /* 0x0268-0x026B (9576-9579) */
-  0xBE                     /* 0x026C        (9578     ) */
+  (char)0xA0, (char)0xA1, (char)0xA2, (char)0xA4,  /* 0x0250-0x0253 (9552-9555) */
+  (char)0xA5, (char)0xA6, (char)0xA7, (char)0xA8,  /* 0x0254-0x0257 (9556-9559) */
+  (char)0xA9, (char)0xAA, (char)0xAB, (char)0xAC,  /* 0x0258-0x025B (9560-9563) */
+  (char)0xAD, (char)0xAE, (char)0xAF, (char)0xB0,  /* 0x025C-0x025F (9564-9567) */
+
+  (char)0xB1, (char)0xB2, (char)0xB4, (char)0xB5,  /* 0x0260-0x0263 (9568-9571) */
+  (char)0xB6, (char)0xB7, (char)0xB8, (char)0xB9,  /* 0x0264-0x0267 (9572-9575) */
+  (char)0xBA, (char)0xBB, (char)0xBC, (char)0xBD,  /* 0x0268-0x026B (9576-9579) */
+  (char)0xBE                                       /* 0x026C        (9578     ) */
 };
 
 static const cexcept exc2koiArray[] =
 {
-  { 0xA0   , 0x9A } , { 0xA9   , 0xBF } , { 0xB0   , 0x9C } , 
-  { 0xB2   , 0x9D } , { 0xB7   , 0x9E } , { 0xF7   , 0x9F } , 
-  { 0x0401 , 0xB3 } , { 0x0451 , 0xA3 } , { 0x220E , 0x94 } , 
-  { 0x2219 , 0x95 } , { 0x221A , 0x96 } , { 0x2248 , 0x97 } , 
-  { 0x2264 , 0x98 } , { 0x2265 , 0x99 } , { 0x2320 , 0x93 } , 
-  { 0x2321 , 0x9B } , { 0x2500 , 0x80 } , { 0x2502 , 0x81 } , 
-  { 0x250C , 0x82 } , { 0x2510 , 0x83 } , { 0x2514 , 0x84 } , 
-  { 0x2518 , 0x85 } , { 0x251C , 0x86 } , { 0x2524 , 0x87 } , 
-  { 0x252C , 0x88 } , { 0x2534 , 0x89 } , { 0x253C , 0x8A } , 
-  { 0x2580 , 0x8B } , { 0x2584 , 0x8C } , { 0x2588 , 0x8D } , 
-  { 0x258C , 0x8E } , { 0x2590 , 0x8F } , { 0x2591 , 0x90 } , 
-  { 0x2592 , 0x91 } , { 0x2593 , 0x92 }
+  { 0xA0   , (char)0x9A } , { 0xA9   , (char)0xBF } , { 0xB0   , (char)0x9C } , 
+  { 0xB2   , (char)0x9D } , { 0xB7   , (char)0x9E } , { 0xF7   , (char)0x9F } , 
+  { 0x0401 , (char)0xB3 } , { 0x0451 , (char)0xA3 } , { 0x220E , (char)0x94 } , 
+  { 0x2219 , (char)0x95 } , { 0x221A , (char)0x96 } , { 0x2248 , (char)0x97 } , 
+  { 0x2264 , (char)0x98 } , { 0x2265 , (char)0x99 } , { 0x2320 , (char)0x93 } , 
+  { 0x2321 , (char)0x9B } , { 0x2500 , (char)0x80 } , { 0x2502 , (char)0x81 } , 
+  { 0x250C , (char)0x82 } , { 0x2510 , (char)0x83 } , { 0x2514 , (char)0x84 } , 
+  { 0x2518 , (char)0x85 } , { 0x251C , (char)0x86 } , { 0x2524 , (char)0x87 } , 
+  { 0x252C , (char)0x88 } , { 0x2534 , (char)0x89 } , { 0x253C , (char)0x8A } , 
+  { 0x2580 , (char)0x8B } , { 0x2584 , (char)0x8C } , { 0x2588 , (char)0x8D } , 
+  { 0x258C , (char)0x8E } , { 0x2590 , (char)0x8F } , { 0x2591 , (char)0x90 } , 
+  { 0x2592 , (char)0x91 } , { 0x2593 , (char)0x92 }
 };
 
 static const char uni2ibm866Array1[] =  /* beginning with 0x0410 (1040) */
 {
-  0x80, 0x81, 0x82, 0x83,  /* 0x0410-0x0413 (1040-1043) */
-  0x84, 0x85, 0x86, 0x87,  /* 0x0414-0x0417 (1044-1047) */
-  0x88, 0x89, 0x8A, 0x8B,  /* 0x0418-0x041B (1048-1051) */
-  0x8C, 0x8D, 0x8E, 0x8F,  /* 0x041C-0x041F (1042-1055) */
-
-  0x90, 0x91, 0x92, 0x93,  /* 0x0420-0x0423 (1056-1059) */
-  0x94, 0x95, 0x96, 0x97,  /* 0x0424-0x0427 (1060-1063) */
-  0x98, 0x99, 0x9A, 0x9B,  /* 0x0428-0x042B (1064-1067) */
-  0x9C, 0x9D, 0x9E, 0x9F,  /* 0x042C-0x042F (1068-1071) */
-
-  0xA0, 0xA1, 0xA2, 0xA3,  /* 0x0430-0x0433 (1072-1075) */
-  0xA4, 0xA5, 0xA6, 0xA7,  /* 0x0434-0x0437 (1076-1079) */
-  0xA8, 0xA9, 0xAA, 0xAB,  /* 0x0438-0x043B (1080-1083) */
-  0xAC, 0xAD, 0xAE, 0xAF,  /* 0x043C-0x043F (1084-1087) */
-
-  0xE0, 0xE1, 0xE2, 0xE3,  /* 0x0440-0x0443 (1088-1091) */
-  0xE4, 0xE5, 0xE6, 0xE7,  /* 0x0444-0x0447 (1092-1095) */
-  0xE8, 0xE9, 0xEA, 0xEB,  /* 0x0448-0x044B (1096-1099) */
-  0xEC, 0xED, 0xEE, 0xEF,  /* 0x044C-0x044F (1100-1103) */
+  (char)0x80, (char)0x81, (char)0x82, (char)0x83,  /* 0x0410-0x0413 (1040-1043) */
+  (char)0x84, (char)0x85, (char)0x86, (char)0x87,  /* 0x0414-0x0417 (1044-1047) */
+  (char)0x88, (char)0x89, (char)0x8A, (char)0x8B,  /* 0x0418-0x041B (1048-1051) */
+  (char)0x8C, (char)0x8D, (char)0x8E, (char)0x8F,  /* 0x041C-0x041F (1042-1055) */
+
+  (char)0x90, (char)0x91, (char)0x92, (char)0x93,  /* 0x0420-0x0423 (1056-1059) */
+  (char)0x94, (char)0x95, (char)0x96, (char)0x97,  /* 0x0424-0x0427 (1060-1063) */
+  (char)0x98, (char)0x99, (char)0x9A, (char)0x9B,  /* 0x0428-0x042B (1064-1067) */
+  (char)0x9C, (char)0x9D, (char)0x9E, (char)0x9F,  /* 0x042C-0x042F (1068-1071) */
+
+  (char)0xA0, (char)0xA1, (char)0xA2, (char)0xA3,  /* 0x0430-0x0433 (1072-1075) */
+  (char)0xA4, (char)0xA5, (char)0xA6, (char)0xA7,  /* 0x0434-0x0437 (1076-1079) */
+  (char)0xA8, (char)0xA9, (char)0xAA, (char)0xAB,  /* 0x0438-0x043B (1080-1083) */
+  (char)0xAC, (char)0xAD, (char)0xAE, (char)0xAF,  /* 0x043C-0x043F (1084-1087) */
+
+  (char)0xE0, (char)0xE1, (char)0xE2, (char)0xE3,  /* 0x0440-0x0443 (1088-1091) */
+  (char)0xE4, (char)0xE5, (char)0xE6, (char)0xE7,  /* 0x0444-0x0447 (1092-1095) */
+  (char)0xE8, (char)0xE9, (char)0xEA, (char)0xEB,  /* 0x0448-0x044B (1096-1099) */
+  (char)0xEC, (char)0xED, (char)0xEE, (char)0xEF,  /* 0x044C-0x044F (1100-1103) */
 };
 
 static const char uni2ibm866Array2[] =  /* beginning with 0x2550 (9552) */
 {
-  0xCD, 0xBA, 0xD5, 0xD6,  /* 0x2550-0x2553 (9552-9555) */
-  0xC9, 0xB8, 0xB7, 0xBB,  /* 0x2554-0x2557 (9556-9559) */
-  0xD4, 0xD3, 0xC8, 0xBE,  /* 0x2558-0x255B (9560-9563) */
-  0xBD, 0xBC, 0xC6, 0xC7,  /* 0x255C-0x255F (9564-9567) */
-
-  0xCC, 0xB5, 0xB6, 0xB9,  /* 0x2560-0x2563 (9568-9571) */
-  0xD1, 0xD2, 0xCB, 0xCF,  /* 0x2564-0x2567 (9572-9575) */
-  0xD0, 0xCA, 0xD8, 0xD7,  /* 0x2568-0x256B (9576-9579) */
-  0xCE,                    /* 0x256C        (9578     ) */
+  (char)0xCD, (char)0xBA, (char)0xD5, (char)0xD6,  /* 0x2550-0x2553 (9552-9555) */
+  (char)0xC9, (char)0xB8, (char)0xB7, (char)0xBB,  /* 0x2554-0x2557 (9556-9559) */
+  (char)0xD4, (char)0xD3, (char)0xC8, (char)0xBE,  /* 0x2558-0x255B (9560-9563) */
+  (char)0xBD, (char)0xBC, (char)0xC6, (char)0xC7,  /* 0x255C-0x255F (9564-9567) */
+
+  (char)0xCC, (char)0xB5, (char)0xB6, (char)0xB9,  /* 0x2560-0x2563 (9568-9571) */
+  (char)0xD1, (char)0xD2, (char)0xCB, (char)0xCF,  /* 0x2564-0x2567 (9572-9575) */
+  (char)0xD0, (char)0xCA, (char)0xD8, (char)0xD7,  /* 0x2568-0x256B (9576-9579) */
+  (char)0xCE,                                      /* 0x256C        (9578     ) */
 };
 
 static const cexcept exc2ibm866Array[] =
 {
-{ 0xA0   , 0xFF } , { 0xA4   , 0xFD } , { 0xB0   , 0xF8 } ,
-{ 0xB7   , 0xFA } , { 0x0401 , 0xF0 } , { 0x0404 , 0xF2 } ,
-{ 0x0407 , 0xF4 } , { 0x040E , 0xF6 } , { 0x0451 , 0xF1 } ,
-{ 0x0454 , 0xF3 } , { 0x0457 , 0xF5 } , { 0x045E , 0xF7 } ,
-{ 0x2116 , 0xFC } , { 0x2219 , 0xF9 } , { 0x221A , 0xFB } ,
-{ 0x2500 , 0xC4 } , { 0x2502 , 0xB3 } , { 0x250C , 0xDA } ,
-{ 0x2510 , 0xBF } , { 0x2514 , 0xC0 } , { 0x2518 , 0xD9 } ,
-{ 0x251C , 0xC3 } , { 0x2524 , 0xB4 } , { 0x252C , 0xC2 } ,
-{ 0x2534 , 0xC1 } , { 0x253C , 0xC5 } , { 0x2580 , 0xDF } ,
-{ 0x2584 , 0xDC } , { 0x2588 , 0xDB } , { 0x258C , 0xDD } ,
-{ 0x2590 , 0xDE } , { 0x2591 , 0xB0 } , { 0x2592 , 0xB1 } ,
-{ 0x2593 , 0xB2 } , { 0x25A0 , 0xFE } ,
+{ 0xA0   , (char)0xFF } , { 0xA4   , (char)0xFD } , { 0xB0   , (char)0xF8 } ,
+{ 0xB7   , (char)0xFA } , { 0x0401 , (char)0xF0 } , { 0x0404 , (char)0xF2 } ,
+{ 0x0407 , (char)0xF4 } , { 0x040E , (char)0xF6 } , { 0x0451 , (char)0xF1 } ,
+{ 0x0454 , (char)0xF3 } , { 0x0457 , (char)0xF5 } , { 0x045E , (char)0xF7 } ,
+{ 0x2116 , (char)0xFC } , { 0x2219 , (char)0xF9 } , { 0x221A , (char)0xFB } ,
+{ 0x2500 , (char)0xC4 } , { 0x2502 , (char)0xB3 } , { 0x250C , (char)0xDA } ,
+{ 0x2510 , (char)0xBF } , { 0x2514 , (char)0xC0 } , { 0x2518 , (char)0xD9 } ,
+{ 0x251C , (char)0xC3 } , { 0x2524 , (char)0xB4 } , { 0x252C , (char)0xC2 } ,
+{ 0x2534 , (char)0xC1 } , { 0x253C , (char)0xC5 } , { 0x2580 , (char)0xDF } ,
+{ 0x2584 , (char)0xDC } , { 0x2588 , (char)0xDB } , { 0x258C , (char)0xDD } ,
+{ 0x2590 , (char)0xDE } , { 0x2591 , (char)0xB0 } , { 0x2592 , (char)0xB1 } ,
+{ 0x2593 , (char)0xB2 } , { 0x25A0 , (char)0xFE } ,
 };
 
 static const char uni2isoArray[] =  /* beginning with 0x0100 (256) */
 {
-  0xC0, 0xE0, 0xC3, 0xE3,  /* 0x0100-0x0103 (256-259) */
-  0xA1, 0xB1, 0xC6, 0xE6,  /* 0x0104-0x0107 (260-263) */
-  0xC6, 0xE6, 0xC5, 0xE5,  /* 0x0108-0x010B (264-267) */
-  0xC8, 0xE8, 0xCF, 0xEF,  /* 0x010C-0x010F (268-271) */
-
-  0xD0, 0xF0, 0xAA, 0xBA,  /* 0x0110-0x0113 (272-275) */
-  '\0', '\0', 0xCC, 0xEC,  /* 0x0114-0x0117 (276-279) */
-  0xCA, 0xEA, 0xCC, 0xEC,  /* 0x0118-0x011B (280-283) */
-  0xD8, 0xF8, 0xAB, 0xBB,  /* 0x011C-0x011F (284-287) */
-
-  0xD5, 0xF5, 0xAB, 0xBB,  /* 0x0120-0x0123 (288-291) */
-  0xA6, 0xB6, 0xA1, 0xB1,  /* 0x0124-0x0127 (292-295) */
-  0xA5, 0xB5, 0xCF, 0xEF,  /* 0x0128-0x012B (296-299) */
-  '\0', '\0', 0xC7, 0xE7,  /* 0x012C-0x012F (300-302) */
-
-  0xA9, 0xB9, '\0', '\0',  /* 0x0130-0x0133 (304-307) */
-  0xAC, 0xBC, 0xD3, 0xF3,  /* 0x0134-0x0137 (308-311) */
-  0xA2, 0xC5, 0xE5, 0xA6,  /* 0x0138-0x013B (312-315) */
-  0xB6, 0xA5, 0xB5, '\0',  /* 0x013C-0x013F (316-319) */
-
-  '\0', 0xA3, 0xB3, 0xD1,  /* 0x0140-0x0143 (320-323) */
-  0xF1, 0xD1, 0xF1, 0xD2,  /* 0x0144-0x0147 (324-327) */
-  0xF2, '\0', 0xBD, 0xBF,  /* 0x0148-0x014B (328-331) */
-  0xD2, 0xF2, '\0', '\0',  /* 0x014C-0x014F (332-335) */
-
-  0xD5, 0xF5, '\0', '\0',  /* 0x0150-0x0153 (336-339) */
-  0xC0, 0xE0, 0xA3, 0xB3,  /* 0x0154-0x0157 (340-343) */
-  0xD8, 0xF8, 0xA6, 0xB6,  /* 0x0158-0x015B (344-347) */
-  0xDE, 0xFE, 0xAA, 0xBA,  /* 0x015C-0x015F (348-351) */
-
-  0xA9, 0xB9, 0xDE, 0xFE,  /* 0x0160-0x0163 (352-355) */
-  0xAB, 0xBB, 0xFC, 0xAD,  /* 0x0164-0x0167 (356-359) */
-  0xDD, 0xFD, 0xDE, 0xFE,  /* 0x0168-0x016B (360-363) */
-  0xDD, 0xFD, 0xD9, 0xF9,  /* 0x016C-0x016F (364-367) */
-
-  0xDB, 0xFB, 0xD9, 0xF9,  /* 0x0170-0x0173 (368-371) */
-  '\0', '\0', '\0', '\0',  /* 0x0174-0x0177 (372-375) */
-  '\0', 0xAC, 0xBC, 0xAF,  /* 0x0178-0x017B (376-379) */
-  0xBF, 0xAE, 0xBE, '\0'   /* 0x017C-0x017F (380-383) */
+  (char)0xC0, (char)0xE0, (char)0xC3, (char)0xE3,  /* 0x0100-0x0103 (256-259) */
+  (char)0xA1, (char)0xB1, (char)0xC6, (char)0xE6,  /* 0x0104-0x0107 (260-263) */
+  (char)0xC6, (char)0xE6, (char)0xC5, (char)0xE5,  /* 0x0108-0x010B (264-267) */
+  (char)0xC8, (char)0xE8, (char)0xCF, (char)0xEF,  /* 0x010C-0x010F (268-271) */
+
+  (char)0xD0, (char)0xF0, (char)0xAA, (char)0xBA,  /* 0x0110-0x0113 (272-275) */
+  (char)'\0', (char)'\0', (char)0xCC, (char)0xEC,  /* 0x0114-0x0117 (276-279) */
+  (char)0xCA, (char)0xEA, (char)0xCC, (char)0xEC,  /* 0x0118-0x011B (280-283) */
+  (char)0xD8, (char)0xF8, (char)0xAB, (char)0xBB,  /* 0x011C-0x011F (284-287) */
+
+  (char)0xD5, (char)0xF5, (char)0xAB, (char)0xBB,  /* 0x0120-0x0123 (288-291) */
+  (char)0xA6, (char)0xB6, (char)0xA1, (char)0xB1,  /* 0x0124-0x0127 (292-295) */
+  (char)0xA5, (char)0xB5, (char)0xCF, (char)0xEF,  /* 0x0128-0x012B (296-299) */
+  (char)'\0', (char)'\0', (char)0xC7, (char)0xE7,  /* 0x012C-0x012F (300-302) */
+
+  (char)0xA9, (char)0xB9, (char)'\0', (char)'\0',  /* 0x0130-0x0133 (304-307) */
+  (char)0xAC, (char)0xBC, (char)0xD3, (char)0xF3,  /* 0x0134-0x0137 (308-311) */
+  (char)0xA2, (char)0xC5, (char)0xE5, (char)0xA6,  /* 0x0138-0x013B (312-315) */
+  (char)0xB6, (char)0xA5, (char)0xB5, (char)'\0',  /* 0x013C-0x013F (316-319) */
+
+  (char)'\0', (char)0xA3, (char)0xB3, (char)0xD1,  /* 0x0140-0x0143 (320-323) */
+  (char)0xF1, (char)0xD1, (char)0xF1, (char)0xD2,  /* 0x0144-0x0147 (324-327) */
+  (char)0xF2, (char)'\0', (char)0xBD, (char)0xBF,  /* 0x0148-0x014B (328-331) */
+  (char)0xD2, (char)0xF2, (char)'\0', (char)'\0',  /* 0x014C-0x014F (332-335) */
+
+  (char)0xD5, (char)0xF5, (char)'\0', (char)'\0',  /* 0x0150-0x0153 (336-339) */
+  (char)0xC0, (char)0xE0, (char)0xA3, (char)0xB3,  /* 0x0154-0x0157 (340-343) */
+  (char)0xD8, (char)0xF8, (char)0xA6, (char)0xB6,  /* 0x0158-0x015B (344-347) */
+  (char)0xDE, (char)0xFE, (char)0xAA, (char)0xBA,  /* 0x015C-0x015F (348-351) */
+
+  (char)0xA9, (char)0xB9, (char)0xDE, (char)0xFE,  /* 0x0160-0x0163 (352-355) */
+  (char)0xAB, (char)0xBB, (char)0xFC, (char)0xAD,  /* 0x0164-0x0167 (356-359) */
+  (char)0xDD, (char)0xFD, (char)0xDE, (char)0xFE,  /* 0x0168-0x016B (360-363) */
+  (char)0xDD, (char)0xFD, (char)0xD9, (char)0xF9,  /* 0x016C-0x016F (364-367) */
+
+  (char)0xDB, (char)0xFB, (char)0xD9, (char)0xF9,  /* 0x0170-0x0173 (368-371) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x0174-0x0177 (372-375) */
+  (char)'\0', (char)0xAC, (char)0xBC, (char)0xAF,  /* 0x0178-0x017B (376-379) */
+  (char)0xBF, (char)0xAE, (char)0xBE, (char)'\0'   /* 0x017C-0x017F (380-383) */
 };
 
 static const cexcept exc2iso2Array[] =
 {
-  { 0x02C7 , 0xB7 } , { 0x02D8 , 0xA2 } , { 0x02D9 , 0xFF } , 
-  { 0x02DB , 0xB2 } , { 0x02DD , 0xBD } 
+  { 0x02C7 , (char)0xB7 } , { 0x02D8 , (char)0xA2 } , { 0x02D9 , (char)0xFF } , 
+  { 0x02DB , (char)0xB2 } , { 0x02DD , (char)0xBD } 
 };
 
 static const cexcept exc2iso3Array[] =
 {
-  { 0x02D8 , 0xA2 } , { 0x02D9 , 0xFF }
+  { 0x02D8 , (char)0xA2 } , { 0x02D9 , (char)0xFF }
 };
 
 static const cexcept exc2iso4Array[] =
 {
-  { 0x02C7 , 0xB7 } , { 0x02C9 , 0xAF } , { 0x02D9 , 0xFF } ,
-  { 0x02DB , 0xB2 }
+  { 0x02C7 , (char)0xB7 } , { 0x02C9 , (char)0xAF } , { 0x02D9 , (char)0xFF } ,
+  { 0x02DB , (char)0xB2 }
 };
 
 static const cexcept exc2iso7Array[] =
 {
-  { 0x02BC , 0xA2 } , { 0x02BD , 0xA1 } , { 0x0385 , 0xB5 } ,
-  { 0x0386 , 0xB6 } , { 0x0388 , 0xB8 } , { 0x0389 , 0xB9 } ,
-  { 0x038A , 0xBA } , { 0x038C , 0xBC } , { 0x038E , 0xBE } ,
-  { 0x038F , 0xBF }
+  { 0x02BC , (char)0xA2 } , { 0x02BD , (char)0xA1 } , { 0x0385 , (char)0xB5 } ,
+  { 0x0386 , (char)0xB6 } , { 0x0388 , (char)0xB8 } , { 0x0389 , (char)0xB9 } ,
+  { 0x038A , (char)0xBA } , { 0x038C , (char)0xBC } , { 0x038E , (char)0xBE } ,
+  { 0x038F , (char)0xBF }
 };
 
 static const cexcept exc2iso8Array[] =
 {
-  { 0x00D7 , 0xAA } , { 0x00E7 , 0xBA } , { 0x0333 , 0xDF }
+  { 0x00D7 , (char)0xAA } , { 0x00E7 , (char)0xBA } , { 0x0333 , (char)0xDF }
 };
 
 static const cexcept exc2iso9Array[] =
 {
-  { 0x011E , 0xD0 } , { 0x011F , 0xF0 } , { 0x0130 , 0xDD } ,
-  { 0x0131 , 0xFD } , { 0x015E , 0xDE } , { 0x015F , 0xFE }
+  { 0x011E , (char)0xD0 } , { 0x011F , (char)0xF0 } , { 0x0130 , (char)0xDD } ,
+  { 0x0131 , (char)0xFD } , { 0x015E , (char)0xDE } , { 0x015F , (char)0xFE }
 };
 
 static const cexcept exc2iso10Array[] =
 {
-  { 0x0110 , 0xA9 } , { 0x0111 , 0xB9 } , { 0x0112 , 0xA2 } ,
-  { 0x0113 , 0xB2 } , { 0x0122 , 0xA3 } , { 0x0123 , 0xB3 } ,
-  { 0x012A , 0xA4 } , { 0x012B , 0xB4 } , { 0x0130 , 0xBD } ,
-  { 0x0136 , 0xA6 } , { 0x0137 , 0xB6 } , { 0x0138 , 0xFF } ,
-  { 0x013B , 0xA8 } , { 0x013C , 0xA8 } , { 0x014A , 0xAF } ,
-  { 0x015E , 0xBE } , { 0x0160 , 0xAA } , { 0x0161 , 0xBA } ,
-  { 0x0166 , 0xAB } , { 0x0167 , 0xBB } , { 0x0168 , 0xD7 } ,
-  { 0x0169 , 0xF7 } , { 0x016A , 0xAE } , { 0x016B , 0xBE } ,
-  { 0x017D , 0xAC } , { 0x017E , 0xBC } , { 0x0335 , 0xAD } ,
-  { 0x0336 , 0xBD }
+  { 0x0110 , (char)0xA9 } , { 0x0111 , (char)0xB9 } , { 0x0112 , (char)0xA2 } ,
+  { 0x0113 , (char)0xB2 } , { 0x0122 , (char)0xA3 } , { 0x0123 , (char)0xB3 } ,
+  { 0x012A , (char)0xA4 } , { 0x012B , (char)0xB4 } , { 0x0130 , (char)0xBD } ,
+  { 0x0136 , (char)0xA6 } , { 0x0137 , (char)0xB6 } , { 0x0138 , (char)0xFF } ,
+  { 0x013B , (char)0xA8 } , { 0x013C , (char)0xA8 } , { 0x014A , (char)0xAF } ,
+  { 0x015E , (char)0xBE } , { 0x0160 , (char)0xAA } , { 0x0161 , (char)0xBA } ,
+  { 0x0166 , (char)0xAB } , { 0x0167 , (char)0xBB } , { 0x0168 , (char)0xD7 } ,
+  { 0x0169 , (char)0xF7 } , { 0x016A , (char)0xAE } , { 0x016B , (char)0xBE } ,
+  { 0x017D , (char)0xAC } , { 0x017E , (char)0xBC } , { 0x0335 , (char)0xAD } ,
+  { 0x0336 , (char)0xBD }
 };
 
 static const char uni2ibmArray1[] =  /* beginning with 0xA0 (160) */
 {
-  0xFF, 0xAD, 0x9B, 0x9C,  /* 0xA0-0xA3 (160-163) */
-  0xCF, 0x9D, 0xDD, 0x15,  /* 0xA4-0xA7 (164-167) */
-  0xF9, 0xB7, 0xA6, 0xAE,  /* 0xA8-0xAB (168-171) */
-  0xAA, 0xF0, 0xA9, 0xEE,  /* 0xAC-0xAF (172-175) */
-
-  0xF8, 0xF1, 0xFD, 0xFC,  /* 0xB0-0xB3 (176-179) */
-  0xEF, 0xE6, 0x14, 0xF9,  /* 0xB4-0xB7 (180-183) */
-  0xF7, 0xD5, 0xA7, 0xAF,  /* 0xB8-0xBB (184-187) */
-  0xAC, 0xAB, 0xF3, 0xA8,  /* 0xBC-0xBF (188-191) */
-
-  0xB7, 0xB5, 0xB6, 0xC7,  /* 0xC0-0xC3 (192-195) */
-  0x8E, 0x8F, 0x92, 0x80,  /* 0xC4-0xC7 (196-199) */
-  0xD4, 0x90, 0xD2, 0xD3,  /* 0xC8-0xCB (200-203) */
-  0xDE, 0xD6, 0xD7, 0xD8,  /* 0xCC-0xCF (204-207) */
-
-  0xD1, 0xA5, 0xE3, 0xE0,  /* 0xD0-0xD3 (208-211) */
-  0xE2, 0xE5, 0x99, 0x8E,  /* 0xD4-0xD7 (202-215) */
-  0x9D, 0xEB, 0xE9, 0xEA,  /* 0xD8-0xDB (216-219) */
-  0x9A, 0xED, 0xE8, 0xE1,  /* 0xDC-0xDF (220-223) */
-
-  0x85, 0xA0, 0x83, 0xC6,  /* 0xE0-0xE3 (224-227) */
-  0x84, 0x86, 0x91, 0x87,  /* 0xE4-0xE7 (228-231) */
-  0x8A, 0x82, 0x88, 0x89,  /* 0xE8-0xEB (232-235) */
-  0x8D, 0xA1, 0x8C, 0x8B,  /* 0xEC-0xEF (236-239) */
-
-  0xD0, 0xA4, 0x95, 0xA2,  /* 0xF0-0xF3 (240-243) */
-  0x93, 0xE4, 0x94, 0xF6,  /* 0xF4-0xF7 (244-247) */
-  0x9B, 0x97, 0xA3, 0x96,  /* 0xF8-0xFB (248-251) */
-  0x81, 0xEC, 0xE7, 0x98,  /* 0xFC-0xFF (252-255) */
-
-  '\0', '\0', 0xC6, 0xC7,  /* 0x0100-0x0103 (256-259) */
-  0xA4, 0xA5, 0x8F, 0x86,  /* 0x0104-0x0107 (260-263) */
-  '\0', '\0', '\0', '\0',  /* 0x0108-0x010B (264-267) */
-  0xAC, 0x9F, 0xD2, 0xD4,  /* 0x010C-0x010F (268-271) */
-
-  0xD1, 0xD0, '\0', '\0',  /* 0x0110-0x0113 (272-275) */
-  '\0', '\0', '\0', '\0',  /* 0x0114-0x0117 (276-279) */
-  0xA8, 0xA9, 0xB7, 0xD8,  /* 0x0118-0x011B (280-283) */
-  '\0', '\0', '\0', '\0',  /* 0x011C-0x011F (284-287) */
-
-  '\0', '\0', '\0', '\0',  /* 0x0120-0x0123 (288-291) */
-  '\0', '\0', '\0', '\0',  /* 0x0124-0x0127 (292-295) */
-  '\0', '\0', '\0', '\0',  /* 0x0128-0x012B (296-299) */
-  '\0', '\0', '\0', '\0',  /* 0x012C-0x012F (300-302) */
-
-  '\0', '\0', '\0', '\0',  /* 0x0130-0x0133 (304-307) */
-  '\0', '\0', '\0', '\0',  /* 0x0134-0x0137 (308-311) */
-  '\0', 0x91, 0x92, '\0',  /* 0x0138-0x013B (312-315) */
-  '\0', 0x95, 0x96, '\0',  /* 0x013C-0x013F (316-319) */
-
-  '\0', 0x9D, 0x88, 0xE5,  /* 0x0140-0x0143 (320-323) */
-  0xE4, '\0', '\0', 0xD5,  /* 0x0144-0x0147 (324-327) */
-  0xE5, '\0', '\0', '\0',  /* 0x0148-0x014B (328-331) */
-  '\0', '\0', '\0', '\0',  /* 0x014C-0x014F (332-335) */
-
-  0x8A, 0x8B, '\0', '\0',  /* 0x0150-0x0153 (336-339) */
-  0xE8, 0xEA, '\0', '\0',  /* 0x0154-0x0157 (340-343) */
-  0xFC, 0xFD, 0x97, 0x98,  /* 0x0158-0x015B (344-347) */
-  '\0', '\0', 0xB8, 0xAD,  /* 0x015C-0x015F (348-351) */
-
-  0xE6, 0xE7, 0xDD, 0xEE,  /* 0x0160-0x0163 (352-355) */
-  0x9B, 0x9C, '\0', '\0',  /* 0x0164-0x0167 (356-359) */
-  '\0', '\0', '\0', '\0',  /* 0x0168-0x016B (360-363) */
-  '\0', '\0', 0xDE, 0x85,  /* 0x016C-0x016F (364-367) */
-
-  0xEB, 0xFB, '\0', '\0',  /* 0x0170-0x0173 (368-371) */
-  '\0', '\0', '\0', '\0',  /* 0x0174-0x0177 (372-375) */
-  '\0', 0x8D, 0xAB, 0xBD,  /* 0x0178-0x017B (376-379) */
-  0xBE, 0xA6, 0xA7, '\0'   /* 0x017C-0x017F (380-383) */
+  (char)0xFF, (char)0xAD, (char)0x9B, (char)0x9C,  /* 0xA0-0xA3 (160-163) */
+  (char)0xCF, (char)0x9D, (char)0xDD, (char)0x15,  /* 0xA4-0xA7 (164-167) */
+  (char)0xF9, (char)0xB7, (char)0xA6, (char)0xAE,  /* 0xA8-0xAB (168-171) */
+  (char)0xAA, (char)0xF0, (char)0xA9, (char)0xEE,  /* 0xAC-0xAF (172-175) */
+
+  (char)0xF8, (char)0xF1, (char)0xFD, (char)0xFC,  /* 0xB0-0xB3 (176-179) */
+  (char)0xEF, (char)0xE6, (char)0x14, (char)0xF9,  /* 0xB4-0xB7 (180-183) */
+  (char)0xF7, (char)0xD5, (char)0xA7, (char)0xAF,  /* 0xB8-0xBB (184-187) */
+  (char)0xAC, (char)0xAB, (char)0xF3, (char)0xA8,  /* 0xBC-0xBF (188-191) */
+
+  (char)0xB7, (char)0xB5, (char)0xB6, (char)0xC7,  /* 0xC0-0xC3 (192-195) */
+  (char)0x8E, (char)0x8F, (char)0x92, (char)0x80,  /* 0xC4-0xC7 (196-199) */
+  (char)0xD4, (char)0x90, (char)0xD2, (char)0xD3,  /* 0xC8-0xCB (200-203) */
+  (char)0xDE, (char)0xD6, (char)0xD7, (char)0xD8,  /* 0xCC-0xCF (204-207) */
+
+  (char)0xD1, (char)0xA5, (char)0xE3, (char)0xE0,  /* 0xD0-0xD3 (208-211) */
+  (char)0xE2, (char)0xE5, (char)0x99, (char)0x8E,  /* 0xD4-0xD7 (202-215) */
+  (char)0x9D, (char)0xEB, (char)0xE9, (char)0xEA,  /* 0xD8-0xDB (216-219) */
+  (char)0x9A, (char)0xED, (char)0xE8, (char)0xE1,  /* 0xDC-0xDF (220-223) */
+
+  (char)0x85, (char)0xA0, (char)0x83, (char)0xC6,  /* 0xE0-0xE3 (224-227) */
+  (char)0x84, (char)0x86, (char)0x91, (char)0x87,  /* 0xE4-0xE7 (228-231) */
+  (char)0x8A, (char)0x82, (char)0x88, (char)0x89,  /* 0xE8-0xEB (232-235) */
+  (char)0x8D, (char)0xA1, (char)0x8C, (char)0x8B,  /* 0xEC-0xEF (236-239) */
+
+  (char)0xD0, (char)0xA4, (char)0x95, (char)0xA2,  /* 0xF0-0xF3 (240-243) */
+  (char)0x93, (char)0xE4, (char)0x94, (char)0xF6,  /* 0xF4-0xF7 (244-247) */
+  (char)0x9B, (char)0x97, (char)0xA3, (char)0x96,  /* 0xF8-0xFB (248-251) */
+  (char)0x81, (char)0xEC, (char)0xE7, (char)0x98,  /* 0xFC-0xFF (252-255) */
+
+  (char)'\0', (char)'\0', (char)0xC6, (char)0xC7,  /* 0x0100-0x0103 (256-259) */
+  (char)0xA4, (char)0xA5, (char)0x8F, (char)0x86,  /* 0x0104-0x0107 (260-263) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x0108-0x010B (264-267) */
+  (char)0xAC, (char)0x9F, (char)0xD2, (char)0xD4,  /* 0x010C-0x010F (268-271) */
+
+  (char)0xD1, (char)0xD0, (char)'\0', (char)'\0',  /* 0x0110-0x0113 (272-275) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x0114-0x0117 (276-279) */
+  (char)0xA8, (char)0xA9, (char)0xB7, (char)0xD8,  /* 0x0118-0x011B (280-283) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x011C-0x011F (284-287) */
+
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x0120-0x0123 (288-291) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x0124-0x0127 (292-295) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x0128-0x012B (296-299) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x012C-0x012F (300-302) */
+
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x0130-0x0133 (304-307) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x0134-0x0137 (308-311) */
+  (char)'\0', (char)0x91, (char)0x92, (char)'\0',  /* 0x0138-0x013B (312-315) */
+  (char)'\0', (char)0x95, (char)0x96, (char)'\0',  /* 0x013C-0x013F (316-319) */
+
+  (char)'\0', (char)0x9D, (char)0x88, (char)0xE5,  /* 0x0140-0x0143 (320-323) */
+  (char)0xE4, (char)'\0', (char)'\0', (char)0xD5,  /* 0x0144-0x0147 (324-327) */
+  (char)0xE5, (char)'\0', (char)'\0', (char)'\0',  /* 0x0148-0x014B (328-331) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x014C-0x014F (332-335) */
+
+  (char)0x8A, (char)0x8B, (char)'\0', (char)'\0',  /* 0x0150-0x0153 (336-339) */
+  (char)0xE8, (char)0xEA, (char)'\0', (char)'\0',  /* 0x0154-0x0157 (340-343) */
+  (char)0xFC, (char)0xFD, (char)0x97, (char)0x98,  /* 0x0158-0x015B (344-347) */
+  (char)'\0', (char)'\0', (char)0xB8, (char)0xAD,  /* 0x015C-0x015F (348-351) */
+
+  (char)0xE6, (char)0xE7, (char)0xDD, (char)0xEE,  /* 0x0160-0x0163 (352-355) */
+  (char)0x9B, (char)0x9C, (char)'\0', (char)'\0',  /* 0x0164-0x0167 (356-359) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x0168-0x016B (360-363) */
+  (char)'\0', (char)'\0', (char)0xDE, (char)0x85,  /* 0x016C-0x016F (364-367) */
+
+  (char)0xEB, (char)0xFB, (char)'\0', (char)'\0',  /* 0x0170-0x0173 (368-371) */
+  (char)'\0', (char)'\0', (char)'\0', (char)'\0',  /* 0x0174-0x0177 (372-375) */
+  (char)'\0', (char)0x8D, (char)0xAB, (char)0xBD,  /* 0x0178-0x017B (376-379) */
+  (char)0xBE, (char)0xA6, (char)0xA7, (char)'\0'   /* 0x017C-0x017F (380-383) */
 };
 
 static const char uni2ibmArray2[] =  /* beginning with 0x2550 (9552) */
 {
-  0xCD, 0xBA, 0xD5, 0xD6,  /* 0x0250-0x0253 (9552-9555) */
-  0xC9, 0xB8, 0xB7, 0xBB,  /* 0x0254-0x0257 (9556-9559) */
-  0xD4, 0xD3, 0xC8, 0xBE,  /* 0x0258-0x025B (9560-9563) */
-  0xBD, 0xBC, 0xC6, 0xC7,  /* 0x025C-0x025F (9564-9567) */
-
-  0xCC, 0xB5, 0xB6, 0xB9,  /* 0x0260-0x0263 (9568-9571) */
-  0xD1, 0xD2, 0xCB, 0xCF,  /* 0x0264-0x0267 (9572-9575) */
-  0xD0, 0xCA, 0xD8, 0xD7,  /* 0x0268-0x026B (9576-9579) */
-  0xCE                     /* 0x026C        (9578     ) */
+  (char)0xCD, (char)0xBA, (char)0xD5, (char)0xD6,  /* 0x0250-0x0253 (9552-9555) */
+  (char)0xC9, (char)0xB8, (char)0xB7, (char)0xBB,  /* 0x0254-0x0257 (9556-9559) */
+  (char)0xD4, (char)0xD3, (char)0xC8, (char)0xBE,  /* 0x0258-0x025B (9560-9563) */
+  (char)0xBD, (char)0xBC, (char)0xC6, (char)0xC7,  /* 0x025C-0x025F (9564-9567) */
+
+  (char)0xCC, (char)0xB5, (char)0xB6, (char)0xB9,  /* 0x0260-0x0263 (9568-9571) */
+  (char)0xD1, (char)0xD2, (char)0xCB, (char)0xCF,  /* 0x0264-0x0267 (9572-9575) */
+  (char)0xD0, (char)0xCA, (char)0xD8, (char)0xD7,  /* 0x0268-0x026B (9576-9579) */
+  (char)0xCE                                       /* 0x026C        (9578     ) */
 };
 
 static const cexcept exc2ibm437Array[] =
 {
-  { 0x0192 , 0x9F } , { 0x0393 , 0xE2 } , { 0x0398 , 0xE9 } ,
-  { 0x03A0 , 0xE3 } , { 0x03A3 , 0xE4 } , { 0x03A6 , 0xE8 } ,
-  { 0x03A9 , 0xEA } , { 0x03B1 , 0xE0 } , { 0x03B4 , 0xEB } ,
-  { 0x03B7 , 0xFC } , { 0x03C3 , 0xE5 } , { 0x03D2 , 0xE7 } ,
-  { 0x20C3 , 0x13 } , { 0x2191 , 0x18 } , { 0x2192 , 0x1A } ,
-  { 0x2193 , 0x19 } , { 0x2194 , 0x1D } , { 0x2195 , 0x12 } ,
-  { 0x21A8 , 0x17 } , { 0x2205 , 0xED } , { 0x2208 , 0xEE } ,
-  { 0x220E , 0xFE } , { 0x2219 , 0xFA } , { 0x221A , 0xFB } ,
-  { 0x221E , 0xEC } , { 0x2229 , 0xEF } , { 0x2248 , 0xF7 } ,
-  { 0x2261 , 0xF0 } , { 0x2264 , 0xF3 } , { 0x2265 , 0xF2 } ,
-  { 0x2310 , 0xA9 } , { 0x2319 , 0x1C } , { 0x2320 , 0xF4 } ,
-  { 0x2321 , 0xF5 } , { 0x2500 , 0xC4 } , { 0x2502 , 0xB3 } ,
-  { 0x250C , 0xDA } , { 0x2510 , 0xBF } , { 0x2514 , 0xC0 } ,
-  { 0x2518 , 0xD9 } , { 0x251C , 0xC3 } , { 0x2524 , 0xB4 } ,
-  { 0x252C , 0xC2 } , { 0x2534 , 0xC1 } , { 0x253C , 0xC5 } ,
-  { 0x2580 , 0xDF } , { 0x2584 , 0xDC } , { 0x2588 , 0xDB } ,
-  { 0x258C , 0xDD } , { 0x2590 , 0xDE } , { 0x2591 , 0xB0 } ,
-  { 0x2592 , 0xB1 } , { 0x2593 , 0xB2 } , { 0x25B2 , 0x1E } ,
-  { 0x25B6 , 0x10 } , { 0x25BC , 0x1F } , { 0x25C0 , 0x11 } ,
-  { 0x263A , 0x01 } , { 0x263B , 0x02 } , { 0x2660 , 0x06 } ,
-  { 0x2663 , 0x05 } , { 0x2665 , 0x03 } , { 0x2666 , 0x04 }
+  { 0x0192 , (char)0x9F } , { 0x0393 , (char)0xE2 } , { 0x0398 , (char)0xE9 } ,
+  { 0x03A0 , (char)0xE3 } , { 0x03A3 , (char)0xE4 } , { 0x03A6 , (char)0xE8 } ,
+  { 0x03A9 , (char)0xEA } , { 0x03B1 , (char)0xE0 } , { 0x03B4 , (char)0xEB } ,
+  { 0x03B7 , (char)0xFC } , { 0x03C3 , (char)0xE5 } , { 0x03D2 , (char)0xE7 } ,
+  { 0x20C3 , (char)0x13 } , { 0x2191 , (char)0x18 } , { 0x2192 , (char)0x1A } ,
+  { 0x2193 , (char)0x19 } , { 0x2194 , (char)0x1D } , { 0x2195 , (char)0x12 } ,
+  { 0x21A8 , (char)0x17 } , { 0x2205 , (char)0xED } , { 0x2208 , (char)0xEE } ,
+  { 0x220E , (char)0xFE } , { 0x2219 , (char)0xFA } , { 0x221A , (char)0xFB } ,
+  { 0x221E , (char)0xEC } , { 0x2229 , (char)0xEF } , { 0x2248 , (char)0xF7 } ,
+  { 0x2261 , (char)0xF0 } , { 0x2264 , (char)0xF3 } , { 0x2265 , (char)0xF2 } ,
+  { 0x2310 , (char)0xA9 } , { 0x2319 , (char)0x1C } , { 0x2320 , (char)0xF4 } ,
+  { 0x2321 , (char)0xF5 } , { 0x2500 , (char)0xC4 } , { 0x2502 , (char)0xB3 } ,
+  { 0x250C , (char)0xDA } , { 0x2510 , (char)0xBF } , { 0x2514 , (char)0xC0 } ,
+  { 0x2518 , (char)0xD9 } , { 0x251C , (char)0xC3 } , { 0x2524 , (char)0xB4 } ,
+  { 0x252C , (char)0xC2 } , { 0x2534 , (char)0xC1 } , { 0x253C , (char)0xC5 } ,
+  { 0x2580 , (char)0xDF } , { 0x2584 , (char)0xDC } , { 0x2588 , (char)0xDB } ,
+  { 0x258C , (char)0xDD } , { 0x2590 , (char)0xDE } , { 0x2591 , (char)0xB0 } ,
+  { 0x2592 , (char)0xB1 } , { 0x2593 , (char)0xB2 } , { 0x25B2 , (char)0x1E } ,
+  { 0x25B6 , (char)0x10 } , { 0x25BC , (char)0x1F } , { 0x25C0 , (char)0x11 } ,
+  { 0x263A , (char)0x01 } , { 0x263B , (char)0x02 } , { 0x2660 , (char)0x06 } ,
+  { 0x2663 , (char)0x05 } , { 0x2665 , (char)0x03 } , { 0x2666 , (char)0x04 }
 };
 
 static const cexcept exc2ibm850Array[] =
 {
-  { 0x0192 , 0x9F } , { 0x20C3 , 0x13 } , { 0x2191 , 0x18 } ,
-  { 0x2192 , 0x1A } , { 0x2193 , 0x19 } , { 0x2194 , 0x1D } ,
-  { 0x2195 , 0x12 } , { 0x21A8 , 0x17 } , { 0x220E , 0xFE } ,
-  { 0x2219 , 0xFA } , { 0x2319 , 0x1C } , { 0x2500 , 0xC4 } ,
-  { 0x2502 , 0xB3 } , { 0x250C , 0xDA } , { 0x2510 , 0xBF } ,
-  { 0x2514 , 0xC0 } , { 0x2518 , 0xD9 } , { 0x251C , 0xC3 } ,
-  { 0x252C , 0xC2 } , { 0x2534 , 0xC1 } , { 0x253C , 0xC5 } ,
-  { 0x2580 , 0xDF } , { 0x2584 , 0xDC } , { 0x2588 , 0xDB } ,
-  { 0x2591 , 0xB0 } , { 0x2592 , 0xB1 } , { 0x2593 , 0xB2 } ,
-  { 0x25B2 , 0x1E } , { 0x25B6 , 0x10 } , { 0x25BC , 0x1F } ,
-  { 0x25C0 , 0x11 } , { 0x263A , 0x01 } , { 0x263B , 0x02 } ,
-  { 0x2660 , 0x06 } , { 0x2663 , 0x05 } , { 0x2665 , 0x03 } ,
-  { 0x2666 , 0x04 }
+  { 0x0192 , (char)0x9F } , { 0x20C3 , (char)0x13 } , { 0x2191 , (char)0x18 } ,
+  { 0x2192 , (char)0x1A } , { 0x2193 , (char)0x19 } , { 0x2194 , (char)0x1D } ,
+  { 0x2195 , (char)0x12 } , { 0x21A8 , (char)0x17 } , { 0x220E , (char)0xFE } ,
+  { 0x2219 , (char)0xFA } , { 0x2319 , (char)0x1C } , { 0x2500 , (char)0xC4 } ,
+  { 0x2502 , (char)0xB3 } , { 0x250C , (char)0xDA } , { 0x2510 , (char)0xBF } ,
+  { 0x2514 , (char)0xC0 } , { 0x2518 , (char)0xD9 } , { 0x251C , (char)0xC3 } ,
+  { 0x252C , (char)0xC2 } , { 0x2534 , (char)0xC1 } , { 0x253C , (char)0xC5 } ,
+  { 0x2580 , (char)0xDF } , { 0x2584 , (char)0xDC } , { 0x2588 , (char)0xDB } ,
+  { 0x2591 , (char)0xB0 } , { 0x2592 , (char)0xB1 } , { 0x2593 , (char)0xB2 } ,
+  { 0x25B2 , (char)0x1E } , { 0x25B6 , (char)0x10 } , { 0x25BC , (char)0x1F } ,
+  { 0x25C0 , (char)0x11 } , { 0x263A , (char)0x01 } , { 0x263B , (char)0x02 } ,
+  { 0x2660 , (char)0x06 } , { 0x2663 , (char)0x05 } , { 0x2665 , (char)0x03 } ,
+  { 0x2666 , (char)0x04 }
 };
 
 static const cexcept exc2ibm852Array[] =
 {
-  { 0x02C7 , 0xF3 } , { 0x02D8 , 0xF4 } , { 0x02DB , 0xF2 } ,
-  { 0x02DD , 0xF1 } , { 0x20C3 , 0x13 } , { 0x2191 , 0x18 } ,
-  { 0x2192 , 0x1A } , { 0x2193 , 0x19 } , { 0x2194 , 0x1D } ,
-  { 0x2195 , 0x12 } , { 0x21A8 , 0x17 } , { 0x220E , 0xFE } ,
-  { 0x2219 , 0xFA } , { 0x2319 , 0x1C } , { 0x2500 , 0xC4 } ,
-  { 0x2502 , 0xB3 } , { 0x250C , 0xDA } , { 0x2510 , 0xBF } ,
-  { 0x2514 , 0xC0 } , { 0x2518 , 0xD9 } , { 0x251C , 0xC3 } ,
-  { 0x252C , 0xC2 } , { 0x2534 , 0xC1 } , { 0x253C , 0xC5 } ,
-  { 0x2580 , 0xDF } , { 0x2584 , 0xDC } , { 0x2588 , 0xDB } ,
-  { 0x2591 , 0xB0 } , { 0x2592 , 0xB1 } , { 0x2593 , 0xB2 } ,
-  { 0x25B2 , 0x1E } , { 0x25B6 , 0x10 } , { 0x25BC , 0x1F } ,
-  { 0x25C0 , 0x11 } , { 0x263A , 0x01 } , { 0x263B , 0x02 } ,
-  { 0x2660 , 0x06 } , { 0x2663 , 0x05 } , { 0x2665 , 0x03 } ,
-  { 0x2666 , 0x04 }
+  { 0x02C7 , (char)0xF3 } , { 0x02D8 , (char)0xF4 } , { 0x02DB , (char)0xF2 } ,
+  { 0x02DD , (char)0xF1 } , { 0x20C3 , (char)0x13 } , { 0x2191 , (char)0x18 } ,
+  { 0x2192 , (char)0x1A } , { 0x2193 , (char)0x19 } , { 0x2194 , (char)0x1D } ,
+  { 0x2195 , (char)0x12 } , { 0x21A8 , (char)0x17 } , { 0x220E , (char)0xFE } ,
+  { 0x2219 , (char)0xFA } , { 0x2319 , (char)0x1C } , { 0x2500 , (char)0xC4 } ,
+  { 0x2502 , (char)0xB3 } , { 0x250C , (char)0xDA } , { 0x2510 , (char)0xBF } ,
+  { 0x2514 , (char)0xC0 } , { 0x2518 , (char)0xD9 } , { 0x251C , (char)0xC3 } ,
+  { 0x252C , (char)0xC2 } , { 0x2534 , (char)0xC1 } , { 0x253C , (char)0xC5 } ,
+  { 0x2580 , (char)0xDF } , { 0x2584 , (char)0xDC } , { 0x2588 , (char)0xDB } ,
+  { 0x2591 , (char)0xB0 } , { 0x2592 , (char)0xB1 } , { 0x2593 , (char)0xB2 } ,
+  { 0x25B2 , (char)0x1E } , { 0x25B6 , (char)0x10 } , { 0x25BC , (char)0x1F } ,
+  { 0x25C0 , (char)0x11 } , { 0x263A , (char)0x01 } , { 0x263B , (char)0x02 } ,
+  { 0x2660 , (char)0x06 } , { 0x2663 , (char)0x05 } , { 0x2665 , (char)0x03 } ,
+  { 0x2666 , (char)0x04 }
 };
 
 static const cexcept exc2ibm860Array[] =
 {
-  { 0xC0 , 0x91 } , { 0xC1 , 0x86 } , { 0xC2 , 0x8F }, { 0xC3 , 0x8E } ,
-  { 0xC8 , 0x92 } , { 0xC9 , 0x86 } , { 0xCA , 0x89 }, { 0xCC , 0x98 } ,
-  { 0xCD , 0x8B } , { 0xD2 , 0xA9 } , { 0xD3 , 0x9F }, { 0xD4 , 0x8C } ,
-  { 0xD5 , 0x99 } , { 0xD9 , 0x9D } , { 0xDA , 0x96 }, { 0xE3 , 0x84 } ,
-  { 0xF5 , 0x94 }
+  { 0xC0 , (char)0x91 } , { 0xC1 , (char)0x86 } , { 0xC2 , (char)0x8F }, { 0xC3 , (char)0x8E } ,
+  { 0xC8 , (char)0x92 } , { 0xC9 , (char)0x86 } , { 0xCA , (char)0x89 }, { 0xCC , (char)0x98 } ,
+  { 0xCD , (char)0x8B } , { 0xD2 , (char)0xA9 } , { 0xD3 , (char)0x9F }, { 0xD4 , (char)0x8C } ,
+  { 0xD5 , (char)0x99 } , { 0xD9 , (char)0x9D } , { 0xDA , (char)0x96 }, { 0xE3 , (char)0x84 } ,
+  { 0xF5 , (char)0x94 }
 };
 
 static const cexcept exc2ibm863Array[] =
 {
-  { 0xA4 , 0x98 } , { 0xA6 , 0xA0 } , { 0xA8 , 0xA4 }, { 0xAF , 0xA7 } ,
-  { 0xB3 , 0xA6 } , { 0xB4 , 0xA1 } , { 0xB8 , 0xA5 }, { 0xBE , 0xAD } ,
-  { 0xC0 , 0x8E } , { 0xC2 , 0x84 } , { 0xC8 , 0x91 }, { 0xCA , 0x92 } ,
-  { 0xCB , 0x94 } , { 0xCE , 0xA8 } , { 0xCF , 0x95 }, { 0xD4 , 0x99 } ,
-  { 0xD9 , 0x9D } , { 0xDB , 0x9E } , { 0xFA , 0x97 }
+  { 0xA4 , (char)0x98 } , { 0xA6 , (char)0xA0 } , { 0xA8 , (char)0xA4 }, { 0xAF , (char)0xA7 } ,
+  { 0xB3 , (char)0xA6 } , { 0xB4 , (char)0xA1 } , { 0xB8 , (char)0xA5 }, { 0xBE , (char)0xAD } ,
+  { 0xC0 , (char)0x8E } , { 0xC2 , (char)0x84 } , { 0xC8 , (char)0x91 }, { 0xCA , (char)0x92 } ,
+  { 0xCB , (char)0x94 } , { 0xCE , (char)0xA8 } , { 0xCF , (char)0x95 }, { 0xD4 , (char)0x99 } ,
+  { 0xD9 , (char)0x9D } , { 0xDB , (char)0x9E } , { 0xFA , (char)0x97 }
 };
 
 static const cexcept exc2ibm865Array[] =
 {
-  { 0xA4 , 0xAF } , { 0xFA , 0x97 }
+  { 0xA4 , (char)0xAF } , { 0xFA , (char)0x97 }
 };
 
 static const cexcept exc2winArray[] =
 {
-  { 0x0118 , 0x9F } , { 0x0152 , 0x8C } , { 0x0153 , 0x9C } ,
-  { 0x0160 , 0x8A } , { 0x0161 , 0x9A } , { 0x0192 , 0x83 } ,
-  { 0x02C6 , 0x88 } , { 0x02DC , 0x98 } , { 0x2013 , 0x96 } ,
-  { 0x2014 , 0x97 } , { 0x2018 , 0x91 } , { 0x2019 , 0x92 } ,
-  { 0x201A , 0x82 } , { 0x201C , 0x93 } , { 0x201D , 0x94 } ,
-  { 0x201E , 0x84 } , { 0x2020 , 0x86 } , { 0x2021 , 0x87 } ,
-  { 0x2026 , 0x85 } , { 0x2031 , 0x89 } , { 0x2039 , 0x8B } ,
-  { 0x20A0 , 0x9B } , { 0x2122 , 0x99 } , { 0x220F , 0x95 }
+  { 0x0118 , (char)0x9F } , { 0x0152 , (char)0x8C } , { 0x0153 , (char)0x9C } ,
+  { 0x0160 , (char)0x8A } , { 0x0161 , (char)0x9A } , { 0x0192 , (char)0x83 } ,
+  { 0x02C6 , (char)0x88 } , { 0x02DC , (char)0x98 } , { 0x2013 , (char)0x96 } ,
+  { 0x2014 , (char)0x97 } , { 0x2018 , (char)0x91 } , { 0x2019 , (char)0x92 } ,
+  { 0x201A , (char)0x82 } , { 0x201C , (char)0x93 } , { 0x201D , (char)0x94 } ,
+  { 0x201E , (char)0x84 } , { 0x2020 , (char)0x86 } , { 0x2021 , (char)0x87 } ,
+  { 0x2026 , (char)0x85 } , { 0x2031 , (char)0x89 } , { 0x2039 , (char)0x8B } ,
+  { 0x20A0 , (char)0x9B } , { 0x2122 , (char)0x99 } , { 0x220F , (char)0x95 }
 };
 
 

From 816cb146b7f58f0b7bb04727f0e4f591e97cd33f Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 4 Jun 2019 10:24:54 +0200
Subject: [PATCH 15/21] Support using parity to compile on windows.

---
 MakeVars.in                   | 17 ++++++++++++---
 auxdir/Makefile               |  9 ++++++--
 ccm/Makefile                  | 30 ++++++++++++++------------
 configure.in                  | 11 +++++++---
 coss/Makefile                 |  6 +++++-
 coss/events/Makefile          | 10 ++++-----
 coss/externalization/Makefile | 34 ++++++++++++++---------------
 coss/lifecycle/Makefile       | 40 +++++++++++++++++------------------
 coss/naming/Makefile          | 18 ++++++++--------
 coss/property/Makefile        | 10 ++++-----
 coss/relship/Makefile         | 40 +++++++++++++++++------------------
 coss/time/Makefile            | 10 ++++-----
 coss/trader/Makefile          | 10 ++++-----
 coss/wireless/Makefile        | 30 +++++++++++++-------------
 cpp/Makefile                  |  8 +++----
 daemon/Makefile               | 14 ++++++------
 idl/Makefile                  | 12 +++++------
 idl/params.cc                 |  2 ++
 ir/Makefile                   | 16 ++++++++------
 orb/Makefile                  | 20 +++++++++++++++++-
 orb/orb_all.cc                |  4 ++++
 tools/iordump/Makefile        |  6 +++---
 22 files changed, 207 insertions(+), 150 deletions(-)

diff --git a/MakeVars.in b/MakeVars.in
index 7e8890b..03ea816 100644
--- a/MakeVars.in
+++ b/MakeVars.in
@@ -28,6 +28,15 @@ INSTDIR		= @ABSEXECDIR@
 SHARED_INSTDIR	= @ABSSHRDDIR@
 
 OSTYPE          = @OSTYPE@
+SUBOSTYPE		= @SUBOSTYPE@
+EXEEXT =
+
+ifeq ($(OSTYPE), windows)
+ifeq ($(SUBOSTYPE), parity)
+EXEEXT = .exe
+endif
+endif
+
 # We need the compiler type, not just the os
 HAVE_MINGW	= @HAVE_MINGW@
 HAVE_CYGWIN	= @HAVE_CYGWIN@
@@ -129,9 +138,9 @@ DVIPDFM		= dvipdfm
 LATEX2HTML	= latex2html
 FIG2DEV		= fig2dev
 MKFAQ           = $(SRCDIR)/admin/mkfaq
-IDL		= @IDL@
-IDLGEN		= @IDL@
-CCMGEN          = @CCMGEN@
+IDL		= @IDL@$(EXEEXT)
+IDLGEN		= @IDL@$(EXEEXT)
+CCMGEN          = @CCMGEN@$(EXEEXT)
 MKDEPEND	= @MKDEPEND@
 # on some Solaris systems strip does not support ELF binaries ...
 IBINCMD         = $(SRCDIR)/admin/install-sh -c -m 755
@@ -177,6 +186,7 @@ LDMICOAUX              = -lmicoaux$(VERSION)
 LDMICOCCM              = -lmicoccm$(VERSION)
 
 ifeq ($(OSTYPE), windows)
+ifneq ($(SUBOSTYPE), parity)
 ifeq ($(HAVE_SHARED), yes)
 export PATH           := @LIBPATH@:$(PATH)
 NODOTVERSION           = $(shell tr -d \. < $(SRCDIR)/VERSION)
@@ -187,6 +197,7 @@ LIBMICOAUX	       = libmicoaux$(VERSION).a
 LIBMICOCOSS	       = libmicocoss$(VERSION).a
 endif
 endif
+endif
 
 export PATH           := @CPPPATH@:$(PATH):.
 
diff --git a/auxdir/Makefile b/auxdir/Makefile
index c283147..533460c 100644
--- a/auxdir/Makefile
+++ b/auxdir/Makefile
@@ -127,6 +127,7 @@ endif
 		-L../libs $(LDMICO)
 	$(IDIRCMD) ../libs
 	cd ../libs; rm -f $@; $(LN) ../auxdir/$@ .
+	test ! -f $@.dll || ( cd ../libs; rm -f $@.dll; $(LN) ../auxdir/$@.dll . )
 
 libmicox$(VERSION).$(SOEXT): $(SHARED_X11_OBJS)
 ifeq ($(HAVE_REPO), yes)
@@ -137,6 +138,7 @@ endif
 		$(PURE_LDFLAGS) -lXt -lX11 -L../libs $(LDMICO) $(PLATFORM_LIBS)
 	$(IDIRCMD) ../libs
 	cd ../libs; rm -f $@; $(LN) ../auxdir/$@ .
+	test ! -f $@.dll || ( cd ../libs; rm -f $@.dll; $(LN) ../auxdir/$@.dll . )
 
 libmicoqt$(VERSION).$(SOEXT): $(SHARED_QT_OBJS)
 ifeq ($(HAVE_REPO), yes)
@@ -147,6 +149,7 @@ endif
 		$(PURE_LDFLAGS) $(QT_LIBS) -L../libs $(LDMICO)
 	$(IDIRCMD) ../libs
 	cd ../libs; rm -f $@; $(LN) ../auxdir/$@ .
+	test ! -f $@.dll || ( cd ../libs; rm -f $@.dll; $(LN) ../auxdir/$@.dll . )
 
 libmicogtk$(VERSION).$(SOEXT): $(SHARED_GTK_OBJS)
 ifeq ($(HAVE_REPO), yes)
@@ -157,6 +160,7 @@ endif
 		$(PURE_LDFLAGS) $(GTK_LIBS) -L../libs $(LDMICO)
 	$(IDIRCMD) ../libs
 	cd ../libs; rm -f $@; $(LN) ../auxdir/$@ .
+	test ! -f $@.dll || ( cd ../libs; rm -f $@.dll; $(LN) ../auxdir/$@.dll . )
 
 libmicotcl$(VERSION).$(SOEXT): $(SHARED_TCL_OBJS)
 ifeq ($(HAVE_REPO), yes)
@@ -167,6 +171,7 @@ endif
 		$(PURE_LDFLAGS) $(TCL_LIBS) -L../libs $(LDMICO)
 	$(IDIRCMD) ../libs
 	cd ../libs; rm -f $@; $(LN) ../auxdir/$@ .
+	test ! -f $@.dll || ( cd ../libs; rm -f $@.dll; $(LN) ../auxdir/$@.dll . )
 
 
 # static
@@ -220,14 +225,14 @@ endif
 # cleaning
 
 clean:
-	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.ii *.ti *.objid *.moc
+	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.ii *.ti *.objid *.moc *.dll *.pdb *.exp
 	-$(RM) .depend TAGS core nohup.out
 	-$(RM) *.orig
 
 install:
 	$(IDIRCMD) $(INSTDIR)/lib
 ifeq ($(HAVE_SHARED), yes)
-	@for i in $(SHARED_LIBS); do $(ILIBCMD) $$i $(INSTDIR)/lib; done
+	@for i in $(SHARED_LIBS); do $(ILIBCMD) $$i $(INSTDIR)/lib; test ! -f $$i.dll || $(ILIBCMD) $$i.dll $(INSTDIR)/lib; done
 endif
 ifeq ($(HAVE_STATIC), yes)
 	@for i in $(STATIC_LIBS); do $(ILIBCMD) $$i $(INSTDIR)/lib; done
diff --git a/ccm/Makefile b/ccm/Makefile
index f726403..2480cb5 100644
--- a/ccm/Makefile
+++ b/ccm/Makefile
@@ -49,11 +49,13 @@ SHARED_OBJS=$(STATIC_OBJS:.o=.pic.o)
 # mingw hack
 
 ifeq ($(OSTYPE), windows)
+ifneq ($(SUBOSTYPE), parity)
 ifeq ($(HAVE_SHARED), yes)
 HAVE_SHARED := no
 HAVE_STATIC := yes
 endif
 endif
+endif
 
 # normal rules
 
@@ -65,15 +67,15 @@ ifeq ($(HAVE_SHARED), yes)
 LIBMICOCCM := libmicoccm$(VERSION).$(SOEXT)
 ifeq ($(HAVE_STATIC), yes)
 prg: .depend libmicoccm$(VERSION).$(SOEXT) libmicoccm$(VERSION).a \
-	mico-ccm componentserver mico-ccmd ccmload
+	mico-ccm$(EXEEXT) componentserver$(EXEEXT) mico-ccmd$(EXEEXT) ccmload$(EXEEXT)
 else
 prg: .depend libmicoccm$(VERSION).$(SOEXT) \
-	mico-ccm componentserver mico-ccmd ccmload
+	mico-ccm$(EXEEXT) componentserver$(EXEEXT) mico-ccmd$(EXEEXT) ccmload$(EXEEXT)
 endif
 else
 LIBMICOCCM := libmicoccm$(VERSION).a
 prg: .depend libmicoccm$(VERSION).a \
-	mico-ccm componentserver mico-ccmd ccmload
+	mico-ccm$(EXEEXT) componentserver$(EXEEXT) mico-ccmd$(EXEEXT) ccmload$(EXEEXT)
 endif
 else
 all:
@@ -81,17 +83,17 @@ lib:
 prg:
 endif
 
-mico-ccm: ../idl/libidl.a ../orb/$(LIBMICO) ../ir/$(LIBMICOIR) $(LIBMICOCCM) mico-ccm.o
+mico-ccm$(EXEEXT): ../idl/libidl.a ../orb/$(LIBMICO) ../ir/$(LIBMICOIR) $(LIBMICOCCM) mico-ccm.o
 	$(CXX) -o $@ $(LDFLAGS) mico-ccm.o -L. $(LDMICOCCM) $(LDMICOIR) $(LDLIBS)
 	$(POSTLD) $@
 
-componentserver: ../orb/$(LIBMICO) $(LIBMICOCCM) componentserver.o
+componentserver$(EXEEXT): ../orb/$(LIBMICO) $(LIBMICOCCM) componentserver.o
 	$(CXX) -o $@ $(LDFLAGS) componentserver.o -L. $(LDMICOCCM) $(LDLIBS)
 
-mico-ccmd: ../orb/$(LIBMICO) $(LIBMICOCCM) mico-ccmd.o
+mico-ccmd$(EXEEXT): ../orb/$(LIBMICO) $(LIBMICOCCM) mico-ccmd.o
 	$(CXX) -o $@ $(LDFLAGS) mico-ccmd.o -L. $(LDMICOCCM) $(LDLIBS)
 
-ccmload: ../orb/$(LIBMICO) $(LIBMICOCCM) ccmload.o
+ccmload$(EXEEXT): ../orb/$(LIBMICO) $(LIBMICOCCM) ccmload.o
 	$(CXX) -o $@ $(LDFLAGS) ccmload.o -L. $(LDMICOCCM) $(LDMICOCOSS) $(LDLIBS)
 
 libmicoccm$(VERSION).$(SOEXT): $(SHARED_OBJS)
@@ -105,6 +107,7 @@ endif
 	$(LDSO) -o libmicoccm$(VERSION) $(SHARED_OBJS) -L../libs $(LDMICO) $(PLATFORM_LIBS)
 	$(IDIRCMD) ../libs
 	cd ../libs; $(RM) $@; $(LN) ../ccm/$@ .
+	test ! -f $@.dll || ( cd ../libs; rm -f $@.dll; $(LN) ../ccm/$@.dll . )
 
 libmicoccm$(VERSION).a: $(STATIC_OBJS)
 ifeq ($(HAVE_REPO), yes)
@@ -121,22 +124,23 @@ endif
 # cleaning
 
 clean:
-	-$(RM) mico-ccmd ccmload componentserver mico-ccm libmicoccm*
-	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.ii *.ti *.objid
+	-$(RM) mico-ccmd$(EXEEXT) ccmload$(EXEEXT) componentserver$(EXEEXT) mico-ccm$(EXEEXT) libmicoccm*
+	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.ii *.ti *.objid *.dll *.pdb *.exp
 	-$(RM) .depend TAGS core nohup.out
 
 install: all
 ifeq ($(USE_CCM), yes)
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) mico-ccm $(INSTDIR)/bin
-	$(IBINCMD) componentserver $(INSTDIR)/bin
-	$(IBINCMD) mico-ccmd $(INSTDIR)/bin
-	$(IBINCMD) ccmload $(INSTDIR)/bin
+	$(IBINCMD) mico-ccm$(EXEEXT) $(INSTDIR)/bin
+	$(IBINCMD) componentserver$(EXEEXT) $(INSTDIR)/bin
+	$(IBINCMD) mico-ccmd$(EXEEXT) $(INSTDIR)/bin
+	$(IBINCMD) ccmload$(EXEEXT) $(INSTDIR)/bin
 ifeq ($(HAVE_STATIC), yes)
 	$(ILIBCMD) libmicoccm$(VERSION).a $(INSTDIR)/lib
 endif
 ifeq ($(HAVE_SHARED), yes)
 	$(ILIBCMD) libmicoccm$(VERSION).$(SOEXT) $(INSTDIR)/lib
+	test -t libmicoccm$(VERSION).$(SOEXT).dll && $(ILIBCMD) libmicoccm$(VERSION).$(SOEXT).dll $(INSTDIR)/lib
 endif
 endif
 
diff --git a/configure.in b/configure.in
index 21430ff..ccc7044 100644
--- a/configure.in
+++ b/configure.in
@@ -375,11 +375,15 @@ AC_LANG_CPLUSPLUS
 AC_MSG_CHECKING(OS Type)
 gxxversion=`$CXX -v 2>&1`
 case $gxxversion in
-*mingw*special*)
+*mingw*special*|*parity*)
 	#
-	# This is the MinGW compiler in a Cygwin environment
+	# This is the MinGW compiler in a Cygwin environment,
+	# or the parity compiler in an interix environment
 	#
 	OSTYPE=windows
+	case $gxxversion in
+	*parity*) SUBOSTYPE=parity ;;
+	esac
 	RMPROG="rm -f"
 	LNPROG="cp"
 	;;
@@ -389,8 +393,9 @@ case $gxxversion in
 	LNPROG="ln -f -s"
 	;;
 esac
-AC_MSG_RESULT($OSTYPE)
+AC_MSG_RESULT([$OSTYPE ($SUBOSTYPE)])
 AC_SUBST(OSTYPE)
+AC_SUBST(SUBOSTYPE)
 AC_SUBST(RMPROG)
 AC_SUBST(LNPROG)
 
diff --git a/coss/Makefile b/coss/Makefile
index 04c1d28..c3701c7 100644
--- a/coss/Makefile
+++ b/coss/Makefile
@@ -193,12 +193,14 @@ SHARED_OBJS = $(STATIC_OBJS:.o=.pic.o)
 # mingw hack
 
 ifeq ($(OSTYPE), windows)
+ifneq ($(SUBOSTYPE), parity)
 ifeq ($(HAVE_SHARED), yes)
 HAVE_SHARED_EXCEPTS := no
 HAVE_SHARED := no
 HAVE_STATIC := yes
 endif
 endif
+endif
 
 
 all: lib prg
@@ -241,6 +243,7 @@ endif
 		-L../libs $(LDMICO) $(PLATFORM_LIBS)
 	$(IDIRCMD) ../libs
 	cd ../libs; $(RM) $@; $(LN) ../coss/$@ .
+	test ! -f $@.dll || ( cd ../libs; rm -f $@.dll; $(LN) ../coss/$@.dll . )
 endif
 
 # static
@@ -261,7 +264,7 @@ endif
 
 clean:
 	for i in $(CLEANDIRS); do $(MAKE) -C $$i clean || exit 1; done
-	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.objid
+	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.objid *.dll *.pdb *.exp
 	-$(RM) .depend TAGS core nohup.out
 
 idlcompile:
@@ -274,6 +277,7 @@ install:
 ifneq ($(strip $(SUBDIRS)),)
 ifeq ($(HAVE_SHARED_EXCEPTS), yes)
 	$(ILIBCMD) libmicocoss$(VERSION).$(SOEXT) $(INSTDIR)/lib
+	test ! -f libmicocoss$(VERSION).$(SOEXT).dll || $(ILIBCMD) libmicocoss$(VERSION).$(SOEXT).dll $(INSTDIR)/lib
 ifeq ($(HAVE_STATIC), yes)
 	$(ILIBCMD) libmicocoss$(VERSION).a $(INSTDIR)/lib
 endif
diff --git a/coss/events/Makefile b/coss/events/Makefile
index 30c9427..4afd246 100644
--- a/coss/events/Makefile
+++ b/coss/events/Makefile
@@ -51,12 +51,12 @@ else
 lib:
 endif
 
-prg: .depend eventd
+prg: .depend eventd$(EXEEXT)
 
 idlcompile: CosEventComm.cc CosEventChannelAdmin.cc
 
-eventd: $(SRV_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SRV_OBJS) $(LDLIBS) -o eventd
+eventd$(EXEEXT): $(SRV_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SRV_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
 CosEventComm.h CosEventComm.cc: ../../include/coss/CosEventComm.idl $(IDL)
@@ -74,7 +74,7 @@ CosEventChannelAdmin.h CosEventChannelAdmin.cc: \
 # cleaning
 
 clean:
-	-$(RM) *.o *.a *~ *.rpo *.objid eventd
+	-$(RM) *.o *.a *~ *.rpo *.objid eventd$(EXEEXT)
 	-$(RM) .depend TAGS core nohup.out
 	-$(RM) CosEventChannelAdmin.h CosEventChannelAdmin.cc 
 	-$(RM) ../../include/coss/CosEventChannelAdmin.h
@@ -83,7 +83,7 @@ clean:
 
 install:
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) eventd $(INSTDIR)/bin
+	$(IBINCMD) eventd$(EXEEXT) $(INSTDIR)/bin
 
 ifeq (.depend, $(wildcard .depend))
 include .depend
diff --git a/coss/externalization/Makefile b/coss/externalization/Makefile
index fcdba24..c35a0bd 100644
--- a/coss/externalization/Makefile
+++ b/coss/externalization/Makefile
@@ -63,26 +63,26 @@ else
 lib: .depend $(STATIC_OBJS)
 endif
 
-prg: .depend extnoded extcontainmentd extreferenced streamd extcriteriad
+prg: .depend extnoded$(EXEEXT) extcontainmentd$(EXEEXT) extreferenced$(EXEEXT) streamd$(EXEEXT) extcriteriad$(EXEEXT)
 
-streamd: streamd.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) streamd.o $(LDLIBS) -o streamd
+streamd$(EXEEXT): streamd.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) streamd.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-extnoded: extnoded.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) extnoded.o $(LDLIBS) -o extnoded
+extnoded$(EXEEXT): extnoded.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) extnoded.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-extcriteriad: extcriteriad.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) extcriteriad.o $(LDLIBS) -o extcriteriad
+extcriteriad$(EXEEXT): extcriteriad.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) extcriteriad.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-extcontainmentd: extcontainmentd.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) extcontainmentd.o $(LDLIBS) -o extcontainmentd
+extcontainmentd$(EXEEXT): extcontainmentd.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) extcontainmentd.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-extreferenced: extreferenced.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) extreferenced.o $(LDLIBS) -o extreferenced
+extreferenced$(EXEEXT): extreferenced.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) extreferenced.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
 idlcompile: CosExternalization.cc CosExternalizationContainment.cc CosExternalizationReference.cc
@@ -109,7 +109,7 @@ CosExternalizationReference.h CosExternalizationReference.cc: \
 # cleaning
 
 clean:
-	-$(RM) *.o *.a *~ *.rpo *.objid extnoded extcontainmentd extreferenced streamd extcriteriad
+	-$(RM) *.o *.a *~ *.rpo *.objid extnoded$(EXEEXT) extcontainmentd$(EXEEXT) extreferenced$(EXEEXT) streamd$(EXEEXT) extcriteriad$(EXEEXT)
 	-$(RM) .depend TAGS core nohup.out
 	-$(RM) CosExternalization.h CosExternalization.cc
 	-$(RM) ../../include/coss/CosExternalization.h
@@ -120,15 +120,15 @@ clean:
 
 install:
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) streamd $(INSTDIR)/bin
+	$(IBINCMD) streamd$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) extnoded $(INSTDIR)/bin
+	$(IBINCMD) extnoded$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) extcontainmentd $(INSTDIR)/bin
+	$(IBINCMD) extcontainmentd$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) extreferenced $(INSTDIR)/bin
+	$(IBINCMD) extreferenced$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) extcriteriad $(INSTDIR)/bin
+	$(IBINCMD) extcriteriad$(EXEEXT) $(INSTDIR)/bin
 
 
 ifeq (.depend, $(wildcard .depend))
diff --git a/coss/lifecycle/Makefile b/coss/lifecycle/Makefile
index 1ebced1..5fe3160 100644
--- a/coss/lifecycle/Makefile
+++ b/coss/lifecycle/Makefile
@@ -71,34 +71,34 @@ else
 lib: .depend $(STATIC_OBJS)
 endif
 
-prg: .depend lifenoded lifecontainmentd lifereferenced operationd lifecriteriad factoryfinderd genericfactory
+prg: .depend lifenoded$(EXEEXT) lifecontainmentd$(EXEEXT) lifereferenced$(EXEEXT) operationd$(EXEEXT) lifecriteriad$(EXEEXT) factoryfinderd$(EXEEXT) genericfactory$(EXEEXT)
 
-operationd: operationd.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) operationd.o $(LDLIBS) -o operationd
+operationd$(EXEEXT): operationd.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) operationd.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-lifenoded: lifenoded.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) lifenoded.o $(LDLIBS) -o lifenoded
+lifenoded$(EXEEXT): lifenoded.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) lifenoded.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-lifecontainmentd: lifecontainmentd.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) lifecontainmentd.o $(LDLIBS) -o lifecontainmentd
+lifecontainmentd$(EXEEXT): lifecontainmentd.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) lifecontainmentd.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-lifereferenced: lifereferenced.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) lifereferenced.o  $(LDLIBS) -o lifereferenced
+lifereferenced$(EXEEXT): lifereferenced.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) lifereferenced.o  $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-lifecriteriad: lifecriteriad.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) lifecriteriad.o $(LDLIBS) -o lifecriteriad
+lifecriteriad$(EXEEXT): lifecriteriad.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) lifecriteriad.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-factoryfinderd: factoryfinderd.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) factoryfinderd.o $(LDLIBS) -o factoryfinderd
+factoryfinderd$(EXEEXT): factoryfinderd.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) factoryfinderd.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-genericfactory: genericfactory.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) genericfactory.o $(LDLIBS) -o genericfactory
+genericfactory$(EXEEXT): genericfactory.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) genericfactory.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
 idlcompile: CosLifeCycle.cc CosCompoundLifeCycle.cc CosLifeCycleContainment.cc CosLifeCycleReference.cc
@@ -131,7 +131,7 @@ CosLifeCycleReference.h CosLifeCycleReference.cc: \
 # cleaning
 
 clean:
-	-$(RM) *.o *.a *~ *.rpo *.objid lifenoded lifecontainmentd lifereferenced operationd lifecriteriad factoryfinderd genericfactory
+	-$(RM) *.o *.a *~ *.rpo *.objid lifenoded$(EXEEXT) lifecontainmentd$(EXEEXT) lifereferenced$(EXEEXT) operationd$(EXEEXT) lifecriteriad$(EXEEXT) factoryfinderd$(EXEEXT) genericfactory$(EXEEXT)
 	-$(RM) .depend TAGS core nohup.out
 	-$(RM) CosLifeCycle.h CosLifeCycle.cc
 	-$(RM) ../../include/coss/CosLifeCycle.h
@@ -144,13 +144,13 @@ clean:
 
 install:
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) operationd $(INSTDIR)/bin
+	$(IBINCMD) operationd$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) lifenoded $(INSTDIR)/bin
+	$(IBINCMD) lifenoded$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) lifecontainmentd $(INSTDIR)/bin
+	$(IBINCMD) lifecontainmentd$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) lifereferenced $(INSTDIR)/bin
+	$(IBINCMD) lifereferenced$(EXEEXT) $(INSTDIR)/bin
 
 
 ifeq (.depend, $(wildcard .depend))
diff --git a/coss/naming/Makefile b/coss/naming/Makefile
index 69ec911..5c112ae 100644
--- a/coss/naming/Makefile
+++ b/coss/naming/Makefile
@@ -51,36 +51,36 @@ else
 lib:
 endif
 
-prg: .depend nsd nsadmin
+prg: .depend nsd$(EXEEXT) nsadmin$(EXEEXT)
 
 idlcompile: CosNaming.cc CosNaming_skel.cc
 
-nsd: $(SRV_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SRV_OBJS) $(LDLIBS) -o nsd
+nsd$(EXEEXT): $(SRV_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SRV_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-nsadmin: $(CLNT_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CLNT_OBJS) $(ALLLIBS) -o nsadmin
+nsadmin$(EXEEXT): $(CLNT_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CLNT_OBJS) $(ALLLIBS) -o $@
 	$(POSTLD) $@
 
 
 CosNaming.h CosNaming.cc CosNaming_skel.cc .NOTPARALLEL: ../../include/coss/CosNaming.idl $(IDL)
-	$(IDL) $(IDLFLAGS) --c++-skel --name CosNaming \
+	$(IDL) $(IDLFLAGS) --c++-skel --name CosNaming --windows-dll cossnaming \
 		../../include/coss/CosNaming.idl
 	cp CosNaming.h ../../include/coss
 
 # cleaning
 
 clean:
-	-$(RM) *.o *.a *~ *.rpo *.ii *.ti *.objid nsd nsadmin
+	-$(RM) *.o *.a *~ *.rpo *.ii *.ti *.objid nsd$(EXEEXT) nsadmin$(EXEEXT)
 	-$(RM) .depend TAGS core nohup.out
 	-$(RM) CosNaming.h CosNaming.cc ../../include/coss/CosNaming.h \
 		CosNaming_skel.cc
 
 install:
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) nsd $(INSTDIR)/bin
-	$(IBINCMD) nsadmin $(INSTDIR)/bin
+	$(IBINCMD) nsd$(EXEEXT) $(INSTDIR)/bin
+	$(IBINCMD) nsadmin$(EXEEXT) $(INSTDIR)/bin
 
 ifeq (.depend, $(wildcard .depend))
 include .depend
diff --git a/coss/property/Makefile b/coss/property/Makefile
index b5caa90..c3b6975 100644
--- a/coss/property/Makefile
+++ b/coss/property/Makefile
@@ -52,12 +52,12 @@ else
 lib:
 endif
 
-prg: .depend propertyd
+prg: .depend propertyd$(EXEEXT)
 
 idlcompile: PropertyService.cc
 
-propertyd: $(SRV_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SRV_OBJS) $(LDLIBS) -o propertyd
+propertyd$(EXEEXT): $(SRV_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SRV_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
 PropertyService.h PropertyService.cc: ../../include/coss/PropertyService.idl $(IDL)
@@ -72,11 +72,11 @@ clean:
 	-$(RM) *.o *.a *~ *.rpo *.objid
 	-$(RM) .depend TAGS core nohup.out
 	-$(RM) PropertyService.h PropertyService.cc ../../include/coss/PropertyService.h
-	-$(RM) propertyd
+	-$(RM) propertyd$(EXEEXT)
 
 install:
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) propertyd $(INSTDIR)/bin
+	$(IBINCMD) propertyd$(EXEEXT) $(INSTDIR)/bin
 
 ifeq (.depend, $(wildcard .depend))
 include .depend
diff --git a/coss/relship/Makefile b/coss/relship/Makefile
index 4caaf9a..fe99c02 100644
--- a/coss/relship/Makefile
+++ b/coss/relship/Makefile
@@ -70,32 +70,32 @@ else
 lib:
 endif
 
-prg: .depend traversald noded containmentd referenced randomd proxyd
+prg: .depend traversald$(EXEEXT) noded$(EXEEXT) containmentd$(EXEEXT) referenced$(EXEEXT) randomd$(EXEEXT) proxyd$(EXEEXT)
 
 idlcompile: $(OMG_SRCS) $(EXT_SRCS)
 
-traversald: traversald.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) traversald.o $(LDLIBS) -o traversald
+traversald$(EXEEXT): traversald.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) traversald.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-noded: noded.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) noded.o $(LDLIBS) -o noded
+noded$(EXEEXT): noded.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) noded.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-containmentd: containmentd.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) containmentd.o $(LDLIBS) -o containmentd
+containmentd$(EXEEXT): containmentd.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) containmentd.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-referenced: referenced.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) referenced.o $(LDLIBS) -o referenced
+referenced$(EXEEXT): referenced.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) referenced.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-randomd: randomd.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) randomd.o $(LDLIBS) -o randomd
+randomd$(EXEEXT): randomd.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) randomd.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-proxyd: proxyd.o ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) proxyd.o $(LDLIBS) -o proxyd
+proxyd$(EXEEXT): proxyd.o ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) proxyd.o $(LDLIBS) -o $@
 	$(POSTLD) $@
 
 CosObjectIdentity.h CosObjectIdentity.cc: \
@@ -150,7 +150,7 @@ random.h random.cc: \
 # cleaning
 
 clean:
-	-$(RM) *.o *.a *~ *.rpo *.objid traversald noded containmentd referenced randomd proxyd
+	-$(RM) *.o *.a *~ *.rpo *.objid traversald$(EXEEXT) noded$(EXEEXT) containmentd$(EXEEXT) referenced$(EXEEXT) randomd$(EXEEXT) proxyd$(EXEEXT)
 	-$(RM) .depend TAGS core nohup.out
 	-$(RM) CosObjectIdentity.h CosObjectIdentity.cc
 	-$(RM) ../../include/coss/CosObjectIdentity.h
@@ -171,17 +171,17 @@ clean:
 
 install:
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) traversald $(INSTDIR)/bin
+	$(IBINCMD) traversald$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) noded $(INSTDIR)/bin
+	$(IBINCMD) noded$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) containmentd $(INSTDIR)/bin
+	$(IBINCMD) containmentd$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) referenced $(INSTDIR)/bin
+	$(IBINCMD) referenced$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) randomd $(INSTDIR)/bin
+	$(IBINCMD) randomd$(EXEEXT) $(INSTDIR)/bin
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) proxyd $(INSTDIR)/bin
+	$(IBINCMD) proxyd$(EXEEXT) $(INSTDIR)/bin
 
 
 ifeq (.depend, $(wildcard .depend))
diff --git a/coss/time/Makefile b/coss/time/Makefile
index 3a63e05..548adb8 100644
--- a/coss/time/Makefile
+++ b/coss/time/Makefile
@@ -50,12 +50,12 @@ else
 lib:
 endif
 
-prg: .depend timed
+prg: .depend timed$(EXEEXT)
 
 idlcompile: CosTime.cc
 
-timed: $(SRV_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SRV_OBJS) $(LDLIBS) -o timed
+timed$(EXEEXT): $(SRV_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SRV_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
 CosTime.h CosTime.cc: ../../include/coss/CosTime.idl $(IDL)
@@ -74,14 +74,14 @@ generate:
 # cleaning
 
 clean:
-	-$(RM) *.o *.a *~ *.rpo *.objid timed
+	-$(RM) *.o *.a *~ *.rpo *.objid timed$(EXEEXT)
 	-$(RM) .depend TAGS core nohup.out
 	-$(RM) CosTime.h CosTime.cc
 	-$(RM) ../../include/coss/CosTime.h
 
 install:
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) timed $(INSTDIR)/bin
+	$(IBINCMD) timed$(EXEEXT) $(INSTDIR)/bin
 
 ifeq (.depend, $(wildcard .depend))
 include .depend
diff --git a/coss/trader/Makefile b/coss/trader/Makefile
index b9b451a..3d2f514 100644
--- a/coss/trader/Makefile
+++ b/coss/trader/Makefile
@@ -62,12 +62,12 @@ else
 lib:
 endif
 
-prg: .depend traderd
+prg: .depend traderd$(EXEEXT)
 
 idlcompile: CosTrading.cc CosTrading_skel.cc CosTradingRepos.cc CosTradingRepos_skel.cc
 
-traderd: $(SRV_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SRV_OBJS) $(LDLIBS) -o traderd
+traderd$(EXEEXT): $(SRV_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(SRV_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
 
@@ -83,7 +83,7 @@ CosTradingRepos.h CosTradingRepos.cc CosTradingRepos_skel.cc .NOTPARALLEL: ../..
 # cleaning
 
 clean:
-	-$(RM) *.o *.a *~ *.rpo *.objid traderd
+	-$(RM) *.o *.a *~ *.rpo *.objid traderd$(EXEEXT)
 	-$(RM) .depend TAGS core nohup.out
 	-$(RM) CosTrading.h CosTrading.cc CosTradingRepos.h CosTradingRepos.cc
 	-$(RM) ../../include/coss/CosTrading.h ../../include/coss/CosTradingRepos.h
@@ -91,7 +91,7 @@ clean:
 
 install:
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) traderd $(INSTDIR)/bin
+	$(IBINCMD) traderd$(EXEEXT) $(INSTDIR)/bin
 
 generate:
 	$(BISON) -d -t -v -o yacc.c yacc.yy
diff --git a/coss/wireless/Makefile b/coss/wireless/Makefile
index 473671b..922990c 100644
--- a/coss/wireless/Makefile
+++ b/coss/wireless/Makefile
@@ -21,15 +21,15 @@ include ../../MakeVars
 TARGETS =
 
 ifeq ($(USE_WIRELESS_HOME), yes)
-TARGETS := $(TARGETS) hla
+TARGETS := $(TARGETS) hla$(EXEEXT)
 endif
 
 ifeq ($(USE_WIRELESS_TERMINAL), yes)
-TARGETS := $(TARGETS) tadmin tb
+TARGETS := $(TARGETS) tadmin$(EXEEXT) tb$(EXEEXT)
 endif
 
 ifeq ($(USE_WIRELESS_ACCESS), yes)
-TARGETS := $(TARGETS) callback nadmin ab
+TARGETS := $(TARGETS) callback$(EXEEXT) nadmin$(EXEEXT) ab$(EXEEXT)
 endif
 
 LDLIBS    = $(LDMICOCOSS) $(LDMICO) $(CONFLIBS)
@@ -65,28 +65,28 @@ prg: .depend $(TARGETS)
 
 idlcompile: MobileTerminal.cc GTP.cc MobileTerminalNotification.cc
 
-hla: $(HLA_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(HLA_OBJS) $(LDLIBS) -o hla
+hla$(EXEEXT): $(HLA_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(HLA_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-tb: $(TB_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TB_OBJS) $(LDLIBS) -o tb
+tb$(EXEEXT): $(TB_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TB_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-ab: $(AB_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(AB_OBJS) $(LDLIBS) -o ab
+ab$(EXEEXT): $(AB_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(AB_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-callback: $(CB_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CB_OBJS) $(LDLIBS) -o callback
+callback$(EXEEXT): $(CB_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CB_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-tadmin: $(TAD_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TAD_OBJS) $(LDLIBS) -o tadmin
+tadmin$(EXEEXT): $(TAD_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TAD_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-nadmin: $(NAD_OBJS) ../../orb/$(LIBMICO)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(NAD_OBJS) $(LDLIBS) -o nadmin
+nadmin$(EXEEXT): $(NAD_OBJS) ../../orb/$(LIBMICO)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(NAD_OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
 MobileTerminal.cc MobileTerminal.h: \
diff --git a/cpp/Makefile b/cpp/Makefile
index 8474c08..7adbcc8 100644
--- a/cpp/Makefile
+++ b/cpp/Makefile
@@ -40,24 +40,24 @@ OBJS=cexp.o cccp.o config.o alloca.o
 
 all: lib prg
 
-prg: .depend mico-cpp
+prg: .depend mico-cpp$(EXEEXT)
 
 lib: .depend
 
-mico-cpp: $(OBJS)
+mico-cpp$(EXEEXT): $(OBJS)
 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
 # cleaning
 
 clean:
-	-$(RM) *.o *.a *~ *.rpo mico-cpp
+	-$(RM) *.o *.a *~ *.rpo mico-cpp$(EXEEXT)
 	-$(RM) .depend TAGS core nohup.out $(GENERATED)
 
 
 install: all
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) mico-cpp $(INSTDIR)/bin
+	$(IBINCMD) mico-cpp$(EXEEXT) $(INSTDIR)/bin
 
 install-cd: install
 
diff --git a/daemon/Makefile b/daemon/Makefile
index e43b105..ea17b53 100644
--- a/daemon/Makefile
+++ b/daemon/Makefile
@@ -38,13 +38,13 @@ IMRCLOBJS=imr_client.o
 
 all: prg
 
-prg: .depend micod imr
+prg: .depend micod$(EXEEXT) imr$(EXEEXT)
 
-micod: $(MICODOBJS) ../orb/$(LIBMICO)
+micod$(EXEEXT): $(MICODOBJS) ../orb/$(LIBMICO)
 	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(MICODOBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
-imr: $(IMRCLOBJS) ../orb/$(LIBMICO)
+imr$(EXEEXT): $(IMRCLOBJS) ../orb/$(LIBMICO)
 	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(IMRCLOBJS) $(LDLIBS) -o $@
 	$(POSTLD) $@
 
@@ -75,15 +75,15 @@ diffs:
 # cleaning
 
 clean:
-	-$(RM) micod imr
-	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.ii *.ti *.objid
+	-$(RM) micod$(EXEEXT) imr$(EXEEXT)
+	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.ii *.ti *.objid *.dll *.pdb *.exp
 	-$(RM) .depend TAGS core nohup.out
 
 
 install: all
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) micod $(INSTDIR)/bin
-	$(IBINCMD) imr $(INSTDIR)/bin
+	$(IBINCMD) micod$(EXEEXT) $(INSTDIR)/bin
+	$(IBINCMD) imr$(EXEEXT) $(INSTDIR)/bin
 
 install-cd: install
 
diff --git a/idl/Makefile b/idl/Makefile
index 756133b..85bac8b 100644
--- a/idl/Makefile
+++ b/idl/Makefile
@@ -56,7 +56,7 @@ endif
 
 all: lib prg
 
-prg: .depend idl
+prg: .depend idl$(EXEEXT)
 
 lib: .depend libidl.a $(OBJS)
 
@@ -71,8 +71,8 @@ endif
 	$(AR) $(ARFLAGS) $@ $(OBJS)
 	$(RANLIB) $@
 
-idl: libidl.a main.o ../orb/$(LIBMICO) ../ir/$(LIBMICOIR) $(IR_OBJS)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) main.o $(IR_OBJS) $(LDLIBS) libidl.a -o idl
+idl$(EXEEXT): libidl.a main.o ../orb/$(LIBMICO) ../ir/$(LIBMICOIR) $(IR_OBJS)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) main.o $(IR_OBJS) $(LDLIBS) libidl.a -o $@
 	$(POSTLD) $@
 
 main.o:
@@ -80,14 +80,14 @@ main.o:
 # cleaning
 
 clean:
-	-$(RM) idl idl.install
-	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.ii *.ti *.objid
+	-$(RM) idl$(EXEEXT) idl.install
+	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.ii *.ti *.objid *.dll *.pdb *.exp
 	-$(RM) .depend TAGS core nohup.out $(GENERATED)
 
 
 install: all
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) idl $(INSTDIR)/bin
+	$(IBINCMD) idl$(EXEEXT) $(INSTDIR)/bin
 
 install-cd: install
 
diff --git a/idl/params.cc b/idl/params.cc
index fc15b35..a37690a 100644
--- a/idl/params.cc
+++ b/idl/params.cc
@@ -72,11 +72,13 @@ IDLParam::set_defaults()
   cpp = "mico-cpp";
 #else // _WIN32
   cpp = "mico-cpp.exe";
+#ifndef __PARITY__
   char sz_path[256] = "";
   GetModuleFileName(0, sz_path, 255);
   string p(sz_path);
   p.erase(p.find_last_of("\\") + 1, p.length());
   cpp = "\"" + p + cpp + "\"";
+#endif
 #endif // _WIN32
 
   base_dir = "";
diff --git a/ir/Makefile b/ir/Makefile
index 74a3283..c7de7c9 100644
--- a/ir/Makefile
+++ b/ir/Makefile
@@ -57,17 +57,19 @@ SHARED_OBJS=$(STATIC_OBJS:.o=.pic.o)
 # mingw hack
 
 ifeq ($(OSTYPE), windows)
+ifneq ($(SUBOSTYPE), parity)
 ifeq ($(HAVE_SHARED), yes)
 HAVE_SHARED := no
 HAVE_STATIC := yes
 endif
 endif
+endif
 
 # normal rules
 
 all: lib prg
 
-prg: ird
+prg: ird$(EXEEXT)
 
 ifeq ($(HAVE_SHARED), yes)
 ifeq ($(HAVE_STATIC), yes)
@@ -79,8 +81,8 @@ else
 lib: .depend libmicoir$(VERSION).a
 endif
 
-ird: main.o ../idl/libidl.a ../orb/$(LIBMICO) $(LIBMICOIR)
-	$(CXX) $(CXXFLAGS) $(LDFLAGS) main.o -L. $(LDLIBS) ../idl/libidl.a -o ird
+ird$(EXEEXT): main.o ../idl/libidl.a ../orb/$(LIBMICO) $(LIBMICOIR)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) main.o -L. $(LDLIBS) ../idl/libidl.a -o $@
 	$(POSTLD) $@
 
 libmicoir$(VERSION).$(SOEXT): $(SHARED_OBJS)
@@ -96,6 +98,7 @@ endif
 	$(LDSO) -o libmicoir$(VERSION) $(SHARED_OBJS) -L../libs $(LDMICO) $(PLATFORM_LIBS)
 	$(IDIRCMD) ../libs
 	cd ../libs; $(RM) $@; $(LN) ../ir/$@ .
+	test ! -f $@.dll || ( cd ../libs; $(RM) $@.dll; $(LN) ../ir/$@.dll . )
 
 libmicoir$(VERSION).a: $(STATIC_OBJS)
 ifeq ($(HAVE_REPO), yes)
@@ -155,18 +158,19 @@ diffs:
 # cleaning
 
 clean:
-	-$(RM) libs libmicoir* ird
-	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.ii *.ti *.objid
+	-$(RM) libs libmicoir* ird$(EXEEXT)
+	-$(RM) *.o *.o0 *.a *~ *.$(SOEXT) *.exe *.rpo *.ii *.ti *.objid *.dll *.pdb *.exp
 	-$(RM) .depend TAGS core nohup.out
 
 install:
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) ird $(INSTDIR)/bin
+	$(IBINCMD) ird$(EXEEXT) $(INSTDIR)/bin
 ifeq ($(HAVE_STATIC), yes)
 	$(ILIBCMD) libmicoir$(VERSION).a $(INSTDIR)/lib
 endif
 ifeq ($(HAVE_SHARED), yes)
 	$(ILIBCMD) libmicoir$(VERSION).$(SOEXT) $(INSTDIR)/lib
+	test ! -f libmicoir$(VERSION).$(SOEXT).dll || $(ILIBCMD) libmicoir$(VERSION).$(SOEXT).dll $(INSTDIR)/lib
 endif
 
 install-cd: install
diff --git a/orb/Makefile b/orb/Makefile
index 213fe0a..c961fe2 100644
--- a/orb/Makefile
+++ b/orb/Makefile
@@ -207,10 +207,23 @@ all: lib prg
 prg:
 
 ifeq ($(OSTYPE), windows)
+ifneq ($(SUBOSTYPE), parity)
 ifeq ($(HAVE_SHARED), yes)
 lib: .depend libmico$(VERSION).a mico$(NODOTVERSION).dll
 else
 lib: .depend libmico$(VERSION).a
+endif
+else
+ifeq ($(HAVE_SHARED), yes)
+ifeq ($(HAVE_STATIC), yes)
+lib: .depend libmico$(VERSION).$(SOEXT) libmico$(VERSION).a
+else
+lib: .depend libmico$(VERSION).$(SOEXT)
+endif
+else
+lib: .depend libmico$(VERSION).a
+endif
+
 endif
 
 else
@@ -252,6 +265,10 @@ endif
 	$(LDSO) -o libmico$(VERSION) $(SHARED_OBJS) $(PLATFORM_LIBS)
 	$(IDIRCMD) ../libs
 	cd ../libs; $(RM) $@; $(LN) ../orb/$@ .
+	if test -f $@.dll; then \
+		cd ../libs; $(RM) $@.dll; $(LN) ../orb/$@.dll .; \
+	fi
+
 endif
 
 # static
@@ -412,7 +429,7 @@ diffs:
 	$(RM) -r orig
 
 clean:
-	$(RM) *.rpo *.ii *.ti *.a *.o *~ *.$(SOEXT) *.exe .depend
+	$(RM) *.rpo *.ii *.ti *.a *.o *~ *.$(SOEXT) *.exe .depend *.dll *.pdb *.exp
 	(cd transport; $(RM) *.rpo *.ii *.ti *.a *.o *~ .depend)
 	(cd os-thread; $(RM) *.rpo *.ii *.ti *.a *.o *~ .depend)
 	(cd security; $(RM) *.rpo *.ii *.ti *.a *.o *~ .depend)
@@ -425,6 +442,7 @@ ifeq ($(HAVE_STATIC), yes)
 endif
 ifeq ($(HAVE_SHARED), yes)
 	$(ILIBCMD) libmico$(VERSION).$(SOEXT) $(INSTDIR)/lib
+	test ! -f libmico$(VERSION).$(SOEXT).dll || $(ILIBCMD) libmico$(VERSION).$(SOEXT).dll $(INSTDIR)/lib
 endif
 
 install-cd: install
diff --git a/orb/orb_all.cc b/orb/orb_all.cc
index 0cbe617..8b20bd3 100644
--- a/orb/orb_all.cc
+++ b/orb/orb_all.cc
@@ -26,7 +26,11 @@
 #include "codeset.cc"
 #include "queue.cc"
 #include "static.cc"
+#ifndef _WIN32
 #include "os-unix.cc"
+#else
+#include "os-windows.cc"
+#endif
 #include "ssl.cc"
 #include "current.cc"
 #include "valuetype.cc"
diff --git a/tools/iordump/Makefile b/tools/iordump/Makefile
index e7db669..03f772e 100644
--- a/tools/iordump/Makefile
+++ b/tools/iordump/Makefile
@@ -34,15 +34,15 @@ OBJS = ${SRCS:.cc=.o}
 
 # normal rules
 
-all: .depend iordump
+all: .depend iordump$(EXEEXT)
 
-iordump: $(OBJS) ../../orb/$(LIBMICO)
+iordump$(EXEEXT): $(OBJS) ../../orb/$(LIBMICO)
 	$(CXX) $(CXXFLAGS) $(LDFLAGS) -L../../idl $(OBJS) -lidl $(LDLIBS) -o $@
 	$(POSTLD) $@
 
 install:
 	$(IDIRCMD) $(INSTDIR)/bin
-	$(IBINCMD) iordump $(INSTDIR)/bin
+	$(IBINCMD) iordump$(EXEEXT) $(INSTDIR)/bin
 
 # cleaning
 

From 8f2db7d54c44e6ff88a10603372d9c17b8916eee Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 21 May 2019 18:37:25 +0200
Subject: [PATCH 16/21] check for gtk-3, gtk-2, gtk-1 in order

---
 aclocal.m4   | 419 +++++++++++++++++++++++++++++++++++++++++++++++++++
 configure.in |  28 +++-
 2 files changed, 439 insertions(+), 8 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 8f3a1dc..a38990b 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -849,3 +849,422 @@ main ()
   AC_SUBST(GTK_LIBS)
   rm -f conf.gtktest
 ])
+
+
+# Configure paths for GTK+
+# Owen Taylor     1997-2001
+
+dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
+dnl pass to pkg-config
+dnl
+AC_DEFUN([AM_PATH_GTK_2_0],
+[dnl
+dnl Get the cflags and libraries from pkg-config
+dnl
+AC_ARG_ENABLE(gtktest, [  --disable-gtktest       do not try to compile and run a test GTK+ program],
+		    , enable_gtktest=yes)
+
+  pkg_config_args=gtk+-2.0
+  for module in . $4
+  do
+      case "$module" in
+         gthread)
+             pkg_config_args="$pkg_config_args gthread-2.0"
+         ;;
+      esac
+  done
+
+  no_gtk=""
+
+  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+  if test x$PKG_CONFIG != xno ; then
+    if pkg-config --atleast-pkgconfig-version 0.7 ; then
+      :
+    else
+      echo "*** pkg-config too old; version 0.7 or better required."
+      no_gtk=yes
+      PKG_CONFIG=no
+    fi
+  else
+    no_gtk=yes
+  fi
+
+  min_gtk_version=ifelse([$1], ,2.0.0,$1)
+  AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
+
+  if test x$PKG_CONFIG != xno ; then
+    ## don't try to run the test against uninstalled libtool libs
+    if $PKG_CONFIG --uninstalled $pkg_config_args; then
+	  echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
+	  enable_gtktest=no
+    fi
+
+    if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
+	  :
+    else
+	  no_gtk=yes
+    fi
+  fi
+
+  if test x"$no_gtk" = x ; then
+    GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
+    GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
+    gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_gtktest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GTK_CFLAGS"
+      LIBS="$GTK_LIBS $LIBS"
+dnl
+dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
+dnl
+      rm -f conf.gtktest
+      AC_TRY_RUN([
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  fclose (fopen ("conf.gtktest", "w"));
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_gtk_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_gtk_version");
+     exit(1);
+   }
+
+  if ((gtk_major_version != $gtk_config_major_version) ||
+      (gtk_minor_version != $gtk_config_minor_version) ||
+      (gtk_micro_version != $gtk_config_micro_version))
+    {
+      printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
+             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+             gtk_major_version, gtk_minor_version, gtk_micro_version);
+      printf ("*** was found! If pkg-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+      printf("*** to point to the correct configuration files\n");
+    }
+  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+	   (gtk_minor_version != GTK_MINOR_VERSION) ||
+           (gtk_micro_version != GTK_MICRO_VERSION))
+    {
+      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+	     gtk_major_version, gtk_minor_version, gtk_micro_version);
+    }
+  else
+    {
+      if ((gtk_major_version > major) ||
+        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+               gtk_major_version, gtk_minor_version, gtk_micro_version);
+        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+	       major, minor, micro);
+        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
+        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_gtk" = x ; then
+     AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
+     ifelse([$2], , :, [$2])
+  else
+     AC_MSG_RESULT(no)
+     if test "$PKG_CONFIG" = "no" ; then
+       echo "*** A new enough version of pkg-config was not found."
+       echo "*** See http://pkgconfig.sourceforge.net"
+     else
+       if test -f conf.gtktest ; then
+        :
+       else
+          echo "*** Could not run GTK+ test program, checking why..."
+	  ac_save_CFLAGS="$CFLAGS"
+	  ac_save_LIBS="$LIBS"
+          CFLAGS="$CFLAGS $GTK_CFLAGS"
+          LIBS="$LIBS $GTK_LIBS"
+          AC_TRY_LINK([
+#include <gtk/gtk.h>
+#include <stdio.h>
+],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
+          echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+	  echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GTK_CFLAGS=""
+     GTK_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GTK_CFLAGS)
+  AC_SUBST(GTK_LIBS)
+  rm -f conf.gtktest
+])
+
+
+# Configure paths for GTK+
+# Owen Taylor     1997-2001
+
+dnl AM_PATH_GTK_3_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
+dnl pass to pkg-config
+dnl
+AC_DEFUN([AM_PATH_GTK_3_0],
+[dnl
+dnl Get the cflags and libraries from pkg-config
+dnl
+AC_ARG_ENABLE(gtktest, [  --disable-gtktest       do not try to compile and run a test GTK+ program],
+		    , enable_gtktest=yes)
+
+  pkg_config_args=gtk+-3.0
+  for module in . $4
+  do
+      case "$module" in
+         gthread)
+             pkg_config_args="$pkg_config_args gthread-2.0"
+         ;;
+      esac
+  done
+
+  no_gtk=""
+
+  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+  if test x$PKG_CONFIG != xno ; then
+    if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
+      :
+    else
+      echo "*** pkg-config too old; version 0.7 or better required."
+      no_gtk=yes
+      PKG_CONFIG=no
+    fi
+  else
+    no_gtk=yes
+  fi
+
+  min_gtk_version=ifelse([$1], ,3.0.0,$1)
+  AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
+
+  if test x$PKG_CONFIG != xno ; then
+    ## don't try to run the test against uninstalled libtool libs
+    if $PKG_CONFIG --uninstalled $pkg_config_args; then
+	  echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
+	  enable_gtktest=no
+    fi
+
+    if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
+	  :
+    else
+	  no_gtk=yes
+    fi
+  fi
+
+  if test x"$no_gtk" = x ; then
+    GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
+    GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
+    gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-3.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_gtktest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GTK_CFLAGS"
+      LIBS="$GTK_LIBS $LIBS"
+dnl
+dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
+dnl
+      rm -f conf.gtktest
+      AC_TRY_RUN([
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  fclose (fopen ("conf.gtktest", "w"));
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_gtk_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_gtk_version");
+     exit(1);
+   }
+
+  if ((gtk_major_version != $gtk_config_major_version) ||
+      (gtk_minor_version != $gtk_config_minor_version) ||
+      (gtk_micro_version != $gtk_config_micro_version))
+    {
+      printf("\n*** 'pkg-config --modversion gtk+-3.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
+             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+             gtk_major_version, gtk_minor_version, gtk_micro_version);
+      printf ("*** was found! If pkg-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+      printf("*** to point to the correct configuration files\n");
+    }
+  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+	   (gtk_minor_version != GTK_MINOR_VERSION) ||
+           (gtk_micro_version != GTK_MICRO_VERSION))
+    {
+      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+	     gtk_major_version, gtk_minor_version, gtk_micro_version);
+    }
+  else
+    {
+      if ((gtk_major_version > major) ||
+        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+               gtk_major_version, gtk_minor_version, gtk_micro_version);
+        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+	       major, minor, micro);
+        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
+        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_gtk" = x ; then
+     AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
+     ifelse([$2], , :, [$2])
+  else
+     AC_MSG_RESULT(no)
+     if test "$PKG_CONFIG" = "no" ; then
+       echo "*** A new enough version of pkg-config was not found."
+       echo "*** See http://pkgconfig.sourceforge.net"
+     else
+       if test -f conf.gtktest ; then
+        :
+       else
+          echo "*** Could not run GTK+ test program, checking why..."
+	  ac_save_CFLAGS="$CFLAGS"
+	  ac_save_LIBS="$LIBS"
+          CFLAGS="$CFLAGS $GTK_CFLAGS"
+          LIBS="$LIBS $GTK_LIBS"
+          AC_TRY_LINK([
+#include <gtk/gtk.h>
+#include <stdio.h>
+],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
+          echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+	  echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GTK_CFLAGS=""
+     GTK_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GTK_CFLAGS)
+  AC_SUBST(GTK_LIBS)
+  rm -f conf.gtktest
+])
+
+dnl GTK_CHECK_BACKEND(BACKEND-NAME [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl   Tests for BACKEND-NAME in the GTK targets list
+dnl
+AC_DEFUN([GTK_CHECK_BACKEND],
+[
+  pkg_config_args=ifelse([$1],,gtk+-3.0, gtk+-$1-3.0)
+  min_gtk_version=ifelse([$2],,3.0.0,$2)
+
+  AC_PATH_PROG(PKG_CONFIG, [pkg-config], [AC_MSG_ERROR([No pkg-config found])])
+
+  if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args ; then
+    target_found=yes
+  else
+    target_found=no
+  fi
+
+  if test "x$target_found" = "xno"; then
+    ifelse([$4],,[AC_MSG_ERROR([Backend $backend not found.])],[$4])
+  else
+    ifelse([$3],,[:],[$3])
+  fi
+])
diff --git a/configure.in b/configure.in
index ccc7044..2a13e9a 100644
--- a/configure.in
+++ b/configure.in
@@ -152,8 +152,8 @@ AC_ARG_WITH(qt,
  QTDIR=$withval, QTDIR="")
 
 AC_ARG_WITH(gtk,
- [  --with-gtk=gtkdir       use GTK installed in gtkdir],
- GTKDIR=$withval, GTKDIR="")
+ [  --with-gtk=gtk-major    use GTK major version, either 1, 2 or 3],
+ , with_gtk="no")
 
 AC_ARG_WITH(tcl,
  [  --with-tcl=tcldir       use TCL installed in tcldir],
@@ -1151,16 +1151,28 @@ else
 fi
 
 
+HAVE_GTK=no
 AC_SUBST(HAVE_GTK)
 
-if test X"$GTKDIR" != X; then
-  AM_PATH_GTK(,HAVE_GTK=yes,
-	      AC_MSG_WARN(cannot find gtk-config. GTK parts disabled)
-              HAVE_GTK=no)
-else
-  HAVE_GTK=no
+if test "X$with_gtk" = Xyes -o "X$with_gtk" = X3; then
+  AC_LANG_C
+  AM_PATH_GTK_3_0(,HAVE_GTK=yes; with_gtk=3)
+  AC_LANG_CPLUSPLUS
+fi
+
+if test "X$with_gtk" = Xyes -o "X$with_gtk" = X2; then
+  AC_LANG_C
+  AM_PATH_GTK_2_0(,HAVE_GTK=yes; with_gtk=2)
+  AC_LANG_CPLUSPLUS
 fi
 
+if test "X$with_gtk" = Xyes -o "X$with_gtk" = X1; then
+  AM_PATH_GTK(,HAVE_GTK=yes; with_gtk=1)
+fi
+
+if test "X$with_gtk" != Xno && test "X$HAVE_GTK" = Xno; then
+  AC_MSG_WARN(cannot find any GTK+ version, GTK parts disabled)
+fi
 
 AC_SUBST(HAVE_TCL)
 AC_SUBST(TCL_LIBS)

From 7bf439271fb5be2dfa79e868cec1361c8b79dced Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Wed, 22 May 2019 15:07:13 +0200
Subject: [PATCH 17/21] fix narrowing unsigned int to bits32 errors

The bits32 datatype needs to be unsigned, or the compiler chokes like:
uni_fromuni.cc:554:16: error: narrowing conversion of '4026531840' from 'unsigned int' to 'bits32' {aka 'long int'} inside { } [-Wnarrowing]
     0xF0000000 };

Also, the bits32 datatype needs to be 'int', as 'long' might be 64bit.
---
 orb/uni_types.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/orb/uni_types.h b/orb/uni_types.h
index de21ea5..ed94c50 100644
--- a/orb/uni_types.h
+++ b/orb/uni_types.h
@@ -39,15 +39,15 @@
 #include <sys/types.h>
 #endif
 
-typedef char  bits8;
-typedef short bits16;
-typedef long  bits32;
+typedef unsigned char  bits8;
+typedef unsigned short bits16;
+typedef unsigned int   bits32;
 #if defined(_WIN32) && !defined(__MINGW32__)
-typedef __int64 bits64;
+typedef unsigned __int64 bits64;
 #elif defined (_POCKET_PC)
-typedef __int64 bits64;
+typedef unsigned __int64 bits64;
 #else
-typedef long long bits64;
+typedef unsigned long long bits64;
 #endif
 
 typedef char uni_byte;

From 5c03b8017f3ccfa3dfcbffe6ff25f6ae86ad896c Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Tue, 4 Jun 2019 08:59:37 +0200
Subject: [PATCH 18/21] support opaque BIO_METHOD API since openssl-1.1.0

Because of the now dynamically allocated BIO_METHOD object, with threads
we need to lock the singleton creation, so the BIO_mico method now needs
to be a member of SSLTransport, to utilize the _ssl_mutex.
---
 include/mico/ssl.h |  2 +
 orb/ssl.cc         | 91 ++++++++++++++++++++++++++++++++++++----------
 2 files changed, 73 insertions(+), 20 deletions(-)

diff --git a/include/mico/ssl.h b/include/mico/ssl.h
index 66ad654..db80880 100644
--- a/include/mico/ssl.h
+++ b/include/mico/ssl.h
@@ -238,6 +238,8 @@ class SSLTransport : public MICO::SocketTransport,
     static int _ssl_verify_depth;
     static int ssl_verify_callback (int ok, X509_STORE_CTX *);
 
+    BIO_METHOD * BIO_mico ();
+
     void callback (CORBA::Transport *, CORBA::TransportCallback::Event);
 public:
     SSLTransport (const SSLAddress *, CORBA::Transport * = 0);
diff --git a/orb/ssl.cc b/orb/ssl.cc
index f88b782..7ba439d 100644
--- a/orb/ssl.cc
+++ b/orb/ssl.cc
@@ -106,13 +106,31 @@ extern "C" {
     typedef int (*ssl_int_t) ();
 }
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+
+void BIO_set_init    (BIO *b, int   init)     { b->init     = init;     }
+void BIO_set_num     (BIO *b, int   num)      { b->num      = num;      }
+void BIO_set_data    (BIO *b, void *ptr)      { b->ptr      = ptr;      }
+void BIO_set_flags   (BIO *b, int   flags)    { b->flags    = flags;    }
+void BIO_set_shutdown(BIO *b, int   shutdown) { b->shutdown = shutdown; }
+
+int   BIO_get_init    (BIO *b) { return b->init;     }
+void *BIO_get_data    (BIO *b) { return b->ptr;      }
+int   BIO_get_shutdown(BIO *b) { return b->shutdown; }
+
+#else // OPENSSL_VERSION_NUMBER >= 0x10100000L
+
+#  define BIO_set_num(b, num) /* noop */
+
+#endif // OPENSSL_VERSION_NUMBER >= 0x10100000L
+
 static int
 mico_bio_new (BIO *b)
 {
-    b->init = 0;
-    b->num = 0;
-    b->ptr = 0;
-    b->flags = 0;
+    BIO_set_init(b, 0);
+    BIO_set_num(b, 0);
+    BIO_set_data(b, 0);
+    BIO_set_flags(b, 0);
     return 1;
 }
 
@@ -121,14 +139,14 @@ mico_bio_free (BIO *b)
 {
     if (!b)
 	return 0;
-    if (b->shutdown) {
-	if (b->init) {
-	    CORBA::Transport *t = (CORBA::Transport *)b->ptr;	
+    if (BIO_get_shutdown(b)) {
+	if (BIO_get_init(b)) {
+	    CORBA::Transport *t = (CORBA::Transport *)BIO_get_data(b);
 	    assert (t);
 	    t->close ();
 	}
-	b->init = 0;
-	b->flags = 0;
+	BIO_set_init(b, 0);
+	BIO_set_flags(b, 0);
     }
     return 1;
 }
@@ -138,7 +156,7 @@ mico_bio_read (BIO *b, char *out, int len)
 {
     int ret = 0;
     if (out) {
-	CORBA::Transport *t = (CORBA::Transport *)b->ptr;
+	CORBA::Transport *t = (CORBA::Transport *)BIO_get_data(b);
 	assert (t);
 	ret = t->read (out, len);
 	BIO_clear_retry_flags (b);
@@ -155,7 +173,7 @@ mico_bio_write (BIO *b, const char *in, int len)
 {
     int ret;
 
-    CORBA::Transport *t = (CORBA::Transport *)b->ptr;
+    CORBA::Transport *t = (CORBA::Transport *)BIO_get_data(b);
     assert (t);
 
     ret = t->write (in, len);
@@ -189,29 +207,29 @@ mico_bio_ctrl (BIO *b, int cmd, long num, void *ptr)
 	break;
 
     case BIO_CTRL_SET:
-	b->ptr = ptr;
-	b->num = 0;
-	b->shutdown = (int)num;
-	b->init = 1;
+	BIO_set_data(b, ptr);
+	BIO_set_num(b, 0);
+	BIO_set_shutdown(b, (int)num);
+	BIO_set_init(b, 1);
 	break;
 
     case BIO_CTRL_GET:
-	if (b->init) {
+	if (BIO_get_init(b)) {
 	    if (!ptr)
 		ret = 0;
 	    else
-		*(char **)ptr = (char *)b->ptr;
+		*(char **)ptr = (char *)BIO_get_data(b);
 	} else {
 	    ret = -1;
 	}
 	break;
 
     case BIO_CTRL_GET_CLOSE:
-	ret = b->shutdown;
+	ret = BIO_get_shutdown(b);
 	break;
 
     case BIO_CTRL_SET_CLOSE:
-	b->shutdown = (int)num;
+	BIO_set_shutdown(b, (int)num);
 	break;
 
     case BIO_CTRL_PENDING:
@@ -230,6 +248,7 @@ mico_bio_ctrl (BIO *b, int cmd, long num, void *ptr)
     return ret;
 }
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
 
 static BIO_METHOD mico_bio_methods = {
     BIO_TYPE_MEM, "mico_bio",
@@ -242,11 +261,43 @@ static BIO_METHOD mico_bio_methods = {
     (int (*)(BIO*))mico_bio_free
 };
 
-static BIO_METHOD *BIO_mico ()
+BIO_METHOD *MICOSSL::SSLTransport::BIO_mico ()
 {
     return &mico_bio_methods;
 }
 
+#else // OPENSSL_VERSION_NUMBER >= 0x10100000L
+
+BIO_METHOD *MICOSSL::SSLTransport::BIO_mico ()
+{
+    static BIO_METHOD *mico_bio_methods = NULL;
+    if (mico_bio_methods != NULL)
+	return mico_bio_methods;
+
+    BIO_METHOD *biom = BIO_meth_new(BIO_TYPE_MEM, "mico_bio");
+    assert (biom);
+
+    assert (BIO_meth_set_write (biom, mico_bio_write));
+    assert (BIO_meth_set_read (biom, mico_bio_read));
+    assert (BIO_meth_set_puts (biom, mico_bio_puts));
+    assert (BIO_meth_set_gets (biom, NULL));
+    assert (BIO_meth_set_ctrl (biom, mico_bio_ctrl));
+    assert (BIO_meth_set_create (biom, mico_bio_new));
+    assert (BIO_meth_set_destroy (biom, mico_bio_free));
+
+#ifdef HAVE_THREADS
+    MICOMT::AutoLock lock(_ssl_mutex);
+    if (mico_bio_methods != NULL) {
+	BIO_meth_free (biom);
+	return mico_bio_methods;
+    }
+#endif
+    mico_bio_methods = biom;
+    return mico_bio_methods;
+}
+
+#endif // OPENSSL_VERSION_NUMBER >= 0x10100000L
+
 //
 // OpenSSL locking primitives
 //

From 4db9baf6d8eececc363304a956e9f7c2158b5240 Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Wed, 22 May 2019 14:36:12 +0200
Subject: [PATCH 19/21] fix uninitialized discriminator values

Plain old data types lack a constructor for default initialization, and
valgrind does detect them uninitialized in the idl compiler for example.
---
 include/mico/security/csi.h | 4 ++--
 orb/security/csi.cc         | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/mico/security/csi.h b/include/mico/security/csi.h
index ab66c69..7b9cfec 100644
--- a/include/mico/security/csi.h
+++ b/include/mico/security/csi.h
@@ -154,8 +154,8 @@ class IdentityToken {
     } _m;
 
   public:
-    #ifdef HAVE_EXPLICIT_STRUCT_OPS
     IdentityToken();
+    #ifdef HAVE_EXPLICIT_STRUCT_OPS
     ~IdentityToken();
     IdentityToken( const IdentityToken& s );
     IdentityToken& operator=( const IdentityToken& s );
@@ -304,8 +304,8 @@ class SASContextBody {
     } _m;
 
   public:
-    #ifdef HAVE_EXPLICIT_STRUCT_OPS
     SASContextBody();
+    #ifdef HAVE_EXPLICIT_STRUCT_OPS
     ~SASContextBody();
     SASContextBody( const SASContextBody& s );
     SASContextBody& operator=( const SASContextBody& s );
diff --git a/orb/security/csi.cc b/orb/security/csi.cc
index ce3d92e..700da59 100644
--- a/orb/security/csi.cc
+++ b/orb/security/csi.cc
@@ -193,11 +193,12 @@ namespace CSI
 CORBA::TypeCodeConst _tc_IdentityToken;
 }
 
-#ifdef HAVE_EXPLICIT_STRUCT_OPS
 CSI::IdentityToken::IdentityToken()
+	: _discriminator(ITTAbsent)
 {
 }
 
+#ifdef HAVE_EXPLICIT_STRUCT_OPS
 CSI::IdentityToken::IdentityToken( const IdentityToken&_u )
 {
   _discriminator = _u._discriminator;
@@ -904,11 +905,12 @@ namespace CSI
 CORBA::TypeCodeConst _tc_SASContextBody;
 }
 
-#ifdef HAVE_EXPLICIT_STRUCT_OPS
 CSI::SASContextBody::SASContextBody()
+	: _discriminator(MTEstablishContext)
 {
 }
 
+#ifdef HAVE_EXPLICIT_STRUCT_OPS
 CSI::SASContextBody::SASContextBody( const SASContextBody&_u )
 {
   _discriminator = _u._discriminator;

From c54d0c2c6de4bbdd761ba04b3c70b21e20c8e41d Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Wed, 22 May 2019 15:18:39 +0200
Subject: [PATCH 20/21] fix potential buffer overflow warning

gcc-8 is able to detect potential buffer overflows:
cccp.c:4083:20: warning: '%d' directive writing between 1 and 10 bytes into a region of size 8 [-Wformat-overflow=]
     sprintf (buf, "%d", true_indepth - 1);
                    ^~
cccp.c:4083:19: note: directive argument in the range [-1, 2147483646]
     sprintf (buf, "%d", true_indepth - 1);
                   ^~~~
In file included from /usr/include/stdio.h:862,
                 from cccp.c:57:
/usr/include/bits/stdio2.h:33:10: note: '__builtin___sprintf_chk' output between 2 and 11 bytes into a destination of size 8
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 cpp/cccp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpp/cccp.c b/cpp/cccp.c
index d40d10c..ce8007b 100644
--- a/cpp/cccp.c
+++ b/cpp/cccp.c
@@ -4079,7 +4079,7 @@ special_symbol (hp, op)
       if (instack[i].fname != NULL)
         true_indepth++;
 
-    buf = (char *) alloca (8);	/* Eight bytes ought to be more than enough */
+    buf = (char *) alloca (11+1);	/* Maximum length for signed datatype */
     sprintf (buf, "%d", true_indepth - 1);
     break;
 

From 03e94e0c7cdc6dcc7ef1196f40f5f12a7820661d Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Date: Wed, 22 May 2019 15:26:53 +0200
Subject: [PATCH 21/21] fix format string mixing 32bit and 64bit datatypes

CORBA::Long datatype is 32bit, but C datatype long may be 64bit.
For CORBA::Long better always use C datatype int (when it has 32bit).
---
 idl/codegen-wsdl.cc  |  8 ++++----
 idl/codegen.cc       | 15 ---------------
 idl/codegen.h        |  8 --------
 include/mico/types.h | 12 ++++++------
 orb/uni_fromuni.cc   |  2 +-
 orb/uni_touni.cc     |  2 +-
 orb/uni_types.h      |  8 ++++----
 7 files changed, 16 insertions(+), 39 deletions(-)

diff --git a/idl/codegen-wsdl.cc b/idl/codegen-wsdl.cc
index e2847be..0ddef32 100644
--- a/idl/codegen-wsdl.cc
+++ b/idl/codegen-wsdl.cc
@@ -934,7 +934,7 @@ CodeGenWSDL::Identifier CodeGenWSDL::getTypename(CORBA::IDLType_ptr type, bool p
  		{
  			CORBA::StringDef_ptr s =
  				CORBA::StringDef::_narrow(type);
- 			sprintf(&buf[0], "%sCORBA.string_%lu",
+			sprintf(&buf[0], "%sCORBA.string_%u",
 				prefix?"tns:":"",
  				s->bound());
  			return &buf[0];
@@ -945,7 +945,7 @@ CodeGenWSDL::Identifier CodeGenWSDL::getTypename(CORBA::IDLType_ptr type, bool p
  		{
  			CORBA::WstringDef_ptr s =
  				CORBA::WstringDef::_narrow(type);
-	 		sprintf(&buf[0], "%sCORBA.string_%lu",
+			sprintf(&buf[0], "%sCORBA.string_%u",
 				prefix?"tns:":"",
 	 			s->bound());
 	 		return &buf[0];
@@ -956,7 +956,7 @@ CodeGenWSDL::Identifier CodeGenWSDL::getTypename(CORBA::IDLType_ptr type, bool p
 		{
 			CORBA::SequenceDef_ptr s =
 				CORBA::SequenceDef::_narrow(type);
-			sprintf(&buf[0], "%sCORBA.sequence_%lu_",
+			sprintf(&buf[0], "%sCORBA.sequence_%u_",
 				prefix?"tns:":"",
 				s->bound());
 			return &buf[0] +  getTypename(s->element_type_def(), false);
@@ -967,7 +967,7 @@ CodeGenWSDL::Identifier CodeGenWSDL::getTypename(CORBA::IDLType_ptr type, bool p
 		{
 			CORBA::ArrayDef_ptr a =
 				CORBA::ArrayDef::_narrow(type);
-			sprintf(&buf[0], "%sCORBA.array_%lu_",
+			sprintf(&buf[0], "%sCORBA.array_%u_",
 				prefix?"tns:":"",
 				a->length());
 			return &buf[0] + getTypename(a->element_type_def(), false);
diff --git a/idl/codegen.cc b/idl/codegen.cc
index fb4ff7d..12cba95 100644
--- a/idl/codegen.cc
+++ b/idl/codegen.cc
@@ -124,14 +124,6 @@ OutputStream &OutputStream::operator<<( const CORBA::WChar *s )
   return *this;
 }
 
-#if SIZEOF_LONG == 4
-OutputStream &OutputStream::operator<<( int i )
-{
-  checkBofL();
-  *_ostr << i;
-  return *this;
-}
-#endif
 
 
 OutputStream &OutputStream::operator<<( CORBA::LongDouble ld )
@@ -605,13 +597,6 @@ Output &Output::operator<<( const CORBA::WChar *s )
   return *this;
 }
 
-#if SIZEOF_LONG == 4
-Output &Output::operator<<( int i )
-{
-  (*_streams[ _current_stream ]) << i;
-  return *this;
-}
-#endif
 
 Output &Output::operator<<( CORBA::LongDouble ld )
 {
diff --git a/idl/codegen.h b/idl/codegen.h
index 86885e2..732eb0a 100644
--- a/idl/codegen.h
+++ b/idl/codegen.h
@@ -80,10 +80,6 @@ class OutputStream
   OutputStream &operator<<( const char *s );
   OutputStream &operator<<( const std::string &str );
   OutputStream &operator<<( const CORBA::WChar *s );
-#if SIZEOF_LONG == 4
-  // on 64 bit systems CORBA::Long is int
-  OutputStream &operator<<( int i );
-#endif
   OutputStream &operator<<( CORBA::LongDouble ld );
   OutputStream &operator<<( CORBA::Float f );
   OutputStream &operator<<( CORBA::Double d );
@@ -127,10 +123,6 @@ class Output
   Output &operator<<( const char *s );
   Output &operator<<( const std::string &str );
   Output &operator<<( const CORBA::WChar *s );
-#if SIZEOF_LONG == 4
-  // on 64 bit systems CORBA::Long is int
-  Output &operator<<( int i );
-#endif
   Output &operator<<( CORBA::LongDouble ld );
   Output &operator<<( CORBA::Float f );
   Output &operator<<( CORBA::Double d );
diff --git a/include/mico/types.h b/include/mico/types.h
index 36c5924..f2c7810 100644
--- a/include/mico/types.h
+++ b/include/mico/types.h
@@ -31,10 +31,10 @@ typedef short MICO_Short;
 #error "sizeof(short) != 2"
 #endif
 
-#if SIZEOF_LONG == 4
-typedef long MICO_Long;
-#elif SIZEOF_INT == 4
+#if SIZEOF_INT == 4
 typedef int MICO_Long;
+#elif SIZEOF_LONG == 4
+typedef long MICO_Long;
 #else
 #error "sizeof(long) != 4 and sizeof(int) != 4"
 #endif
@@ -55,10 +55,10 @@ typedef unsigned short MICO_UShort;
 #error "sizeof(unsigned short) != 2"
 #endif
 
-#if SIZEOF_UNSIGNED_LONG == 4
-typedef unsigned long MICO_ULong;
-#elif SIZEOF_UNSIGNED_INT == 4
+#if SIZEOF_UNSIGNED_INT == 4
 typedef unsigned int MICO_ULong;
+#elif SIZEOF_UNSIGNED_LONG == 4
+typedef unsigned long MICO_ULong;
 #else
 #error "sizeof(unsigned long) != 4 and sizeof(unsigned int) != 4"
 #endif
diff --git a/orb/uni_fromuni.cc b/orb/uni_fromuni.cc
index fdcebb2..cb9e22b 100644
--- a/orb/uni_fromuni.cc
+++ b/orb/uni_fromuni.cc
@@ -1073,7 +1073,7 @@ cont:         dest[di++] = ';';
             }
             else
             {
-              sprintf(buffer, "&#%lu;", character);
+              sprintf(buffer, "&#%u;", character);
               strcpy(&dest[di], buffer);
               di += strlen(buffer);
             }
diff --git a/orb/uni_touni.cc b/orb/uni_touni.cc
index f04f161..8130286 100644
--- a/orb/uni_touni.cc
+++ b/orb/uni_touni.cc
@@ -838,7 +838,7 @@ static uni_ulong ScanHTML(register const char *src, uni_uword *length)
     if(src[i] != ';') return(0l);  /* no terminating ';'-sign */
 
     buffer[mid]='\0';
-    sscanf(buffer,"%lu", &upper);
+    sscanf(buffer,"%u", &upper);
     *length = i+1;
     return(upper);
   }
diff --git a/orb/uni_types.h b/orb/uni_types.h
index ed94c50..0dcbb0c 100644
--- a/orb/uni_types.h
+++ b/orb/uni_types.h
@@ -55,12 +55,12 @@ typedef unsigned char uni_ubyte;
 typedef unsigned char uni_uchar;
 typedef unsigned short uni_ushort;
 
-#if SIZEOF_LONG == 4
-typedef long uni_slong;
-typedef unsigned long uni_ulong;
-#elif SIZEOF_INT == 4
+#if SIZEOF_INT == 4
 typedef int uni_slong;
 typedef unsigned int uni_ulong;
+#elif SIZEOF_LONG == 4
+typedef long uni_slong;
+typedef unsigned long uni_ulong;
 #else
 #error "no builtin 4 byte interger type"
 #endif
