Author: Andreas Tille <tille@debian.org>
Last-Update: 2026-01-06
Description: These patches are needed to build successfully when
             configuring with --with-corba option as recommended in
             upstream README (which was obviously not really tested
             by upstream.

--- a/src/GenerateCodeJava.cpp
+++ b/src/GenerateCodeJava.cpp
@@ -201,7 +201,7 @@ GenerateCodeJava::writeFunction1 (const
                                   Visibility &) {
 #ifdef ENABLE_CORBA
     if (getCorba ()) {
-        if (ope.getVisibility () != '0') {
+        if ((char)ope.getVisibility () != '0') {
             std::cerr << "CORBAValue " << ope.getName ()
                       << ": must be public.\n";
         }
@@ -369,7 +369,7 @@ GenerateCodeJava::writeClassStart1 (cons
     if (!node.getTemplates ().empty ()) {
 #ifdef ENABLE_CORBA
         if (isCorba) {
-            std::cerr << "CORBAValue " << name << ": template ignored.\n";
+            std::cerr << "CORBAValue " << node.getName() << ": template ignored.\n";
         } else
 #endif
         {
--- a/src/GenerateCodeCpp.cpp
+++ b/src/GenerateCodeCpp.cpp
@@ -226,7 +226,7 @@ GenerateCodeCpp::writeFunction (const um
 
 #ifdef ENABLE_CORBA
     if (getCorba ()) {
-        if (ope.getVisibility () != '0') {
+        if ((char)ope.getVisibility () != '0') {
             std::cerr << "CORBAValue " << ope.getName ()
                       << ": must be public.\n";
         }
@@ -303,7 +303,7 @@ GenerateCodeCpp::writeClassStart (const
     if (!node.getTemplates ().empty ()) {
 #ifdef ENABLE_CORBA
         if (isCorba) {
-            std::cerr << "CORBAValue " << name << ": template ignored.\n";
+            std::cerr << "CORBAValue " << node.getName() << ": template ignored.\n";
         } else
 #endif
         {
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
 bin_PROGRAMS = dia2code
 dia2code_CPPFLAGS = @XML_CFLAGS@
-dia2code_CXXFLAGS = @XML_CFLAGS@ -std=c++11 -Wall -Wextra -Wpacked -Wmissing-format-attribute -fstrict-aliasing -Wstrict-aliasing=3 -Wuninitialized -Wfloat-equal -Wno-comment -Wswitch-enum -Wswitch-default -Wshadow -Wpedantic -Wformat=2 -Wformat-nonliteral -Wformat-security -Winit-self -fstrict-overflow -Wstrict-overflow=5 -Wconversion -Wold-style-cast -Wno-overloaded-virtual -Wwrite-strings -Wcast-qual -Wcast-align -Wredundant-decls -Wlogical-op -Wpointer-arith -g3 -ggdb3 -O0 -pipe -fno-omit-frame-pointer -ftrapv -Wzero-as-null-pointer-constant -ftest-coverage -fprofile-arcs
+dia2code_CXXFLAGS = @XML_CFLAGS@ -std=c++11 -Wall -Wextra -Wpacked -Wmissing-format-attribute -fstrict-aliasing -Wstrict-aliasing=3 -Wuninitialized -Wfloat-equal -Wno-comment -Wswitch-enum -Wswitch-default -Wshadow -Wpedantic -Wformat=2 -Wformat-nonliteral -Wformat-security -Winit-self -fstrict-overflow -Wstrict-overflow=5 -Wconversion -Wno-overloaded-virtual -Wwrite-strings -Wcast-qual -Wcast-align -Wredundant-decls -Wlogical-op -Wpointer-arith -g3 -ggdb3 -O0 -pipe -fno-omit-frame-pointer -ftrapv -Wzero-as-null-pointer-constant -ftest-coverage -fprofile-arcs
 dia2code_LDADD    = @XML_LIBS@
 dia2code_SOURCES  = DiaGram.cpp \
 										GenerateCode.cpp \
--- a/src/DiaGram.cpp
+++ b/src/DiaGram.cpp
@@ -293,7 +293,7 @@ DiaGram::push (umlClassNode * node) {
     }
 
 #ifdef ENABLE_CORBA
-    if (node->getStereotype ().compare (0, 5, "CORBA") == 0) {
+    if (node->isStereotypeCorba()) {
         usecorba = true;
     }
 #endif
--- a/src/GenerateCode.cpp
+++ b/src/GenerateCode.cpp
@@ -317,17 +317,11 @@ GenerateCode::passByReference (umlClass
 #ifdef ENABLE_CORBA
 static bool
 isOoClass (umlClass &cl) {
-    const char *st;
-    st = cl.getStereotype ().c_str ();
-    if (strlen (st) == 0) {
-        return true;
-    }
-    return (!isConstStereo (st) &&
-            !isTypedefStereo (st) &&
-            !isEnumStereo (st) &&
-            !isStructStereo (st) &&
-            !eq (st, "CORBAUnion") &&
-            !eq (st, "CORBAException"));
+    return (!cl.isStereotypeConst () &&
+            !cl.isStereotypeTypedef () &&
+            !cl.isStereotypeEnum () &&
+            !cl.isStereotypeStruct () &&
+            !cl.isStereotypeCorba ());
 }
 #endif
 
@@ -447,12 +441,12 @@ GenerateCode::genClass (const umlClassNo
             for (const umlAttribute & umla : node.getAttributes ()) {
                 const char *member = umla.getName ().c_str ();
                 umlClassNode *ref;
-                if (umla.getVisibility () != '0') {
+                if ((char)umla.getVisibility () != '0') {
                     continue;
                 }
                 if (umla.isStatic ()) {
                     std::cerr << "CORBAValue " << name << "/" << member
-                              << ": static not supported.\n",
+                              << ": static not supported.\n";
                 }
                 ref = findByName (dia.getUml (), umla.getType ().c_str ());
                 if (ref != NULL) {
@@ -670,7 +664,7 @@ GenerateCode::genDecl (declaration &d,
 #endif
 
 #ifdef ENABLE_CORBA
-    if (eq (stype, "CORBANative")) {
+    if (node->isStereotypeCorba()) {
         writeComment (std::string ("CORBANative: ") +
                       node->getName () +
                       std::string ("\n"));
@@ -696,13 +690,13 @@ GenerateCode::genDecl (declaration &d,
         writeStruct (*node);
     }
 #ifdef ENABLE_CORBA
-    else if (eq (stype, "CORBAException")) {
+    else if (node->isStereotypeCorba()) {
         std::cerr << name << ": CORBAException not yet implemented.\n";
 
     }
-    else if (eq (stype, "CORBAUnion")) {
+    else if (node->isStereotypeCorba()) {
         if (umla == node->getAttributes ().end ()) {
-            throw std::string ("Attributes not set at union " + name + "\n");
+            throw std::string (std::string("Attributes not set at union ") + name + "\n");
         }
         std::cerr << name << ": CORBAUnion not yet fully implemented.\n";
         if (bOpenBraceOnNewline) {
@@ -719,7 +713,7 @@ GenerateCode::genDecl (declaration &d,
         getFile () << spc () << (*umla).getType () << " _d();\n\n";
         ++umla;
         while (umla != node->getAttributes ().end ()) {
-            (*umla).check (name);
+            (*umla).check (*node);
             getFile () << spc () << cppName ((*umla).getType ()) << " "
                  << (*umla).getName () << " ();\n";
             getFile () << spc () << "void " << (*umla).getName () << " ("
--- a/src/GenerateCode.hpp
+++ b/src/GenerateCode.hpp
@@ -32,7 +32,7 @@ along with this program.  If not, see <h
  * Abstract base class for code generators.
  */
 class GenerateCode {
-    private:
+    protected:
         DiaGram &   dia;  ///< Diagram to generate into code
         std::string license;  ///< License file
      
@@ -114,7 +114,7 @@ class GenerateCode {
 
         void genClass (const umlClassNode & node);
 
-        static const char * cppName (std::string name);
+        const char * cppName (std::string name);
 
         const char * fqname (const umlClassNode & node,
                              bool use_ref_type) const;
--- a/src/umlClass.cpp
+++ b/src/umlClass.cpp
@@ -204,7 +204,7 @@ umlClass::isTypedefStereo (std::string &
 #ifdef ENABLE_CORBA
 bool
 umlClass::isCorbaStereo (std::string & stereo) {
-    return (!stereo.compare (0, 5, "CORBA");
+    return (!stereo.compare (0, 5, "CORBA"));
 }
 #endif
 
