dtcm: Coverity 89287
[oweals/cde.git] / cde / programs / ttsnoop / ttChooser_stubs.C.src
index ed0f854a84a9551a361f8dd1f57f721bbe2f0306..9ef1c53ffaca339dc2eeda137f174bf0cef1c3fa 100644 (file)
@@ -21,6 +21,7 @@
  *  ** DELETE THE GENERATED COMMENTS!                                 **
  */
 
+#include <stdint.h>
 #include <stdio.h>
 #include <Xm/Xm.h>
 #include "dtb_utils.h"
 
 #include <stdio.h>
 
-#if defined(linux) || defined(CSRG_BASED)
-#include <strstream>
-#else
-#include <strstream.h>
-#endif
+#include <sstream>
 
 #include <Xm/TextF.h>
 #include <Xm/List.h>
@@ -213,12 +210,11 @@ _DtTtChooserSet(
     XmTextFieldSetString( instance->chooserText, 0 );
     XtVaSetValues( instance->chooser, XmNtitle, title, NULL );
 
-    std::ostrstream valuesStream;
+    std::ostringstream valuesStream;
     valuesStream << itemCount << " " << valuesLabel;
     if (itemCount != 1) valuesStream << "s";
     valuesStream << ends;
-    DtTtSetLabel( instance->chooserList_label, valuesStream.str() );
-    delete valuesStream.str();
+    DtTtSetLabel( instance->chooserList_label, valuesStream.str().c_str() );
 
     // Remember dialog mode, entity
     XtVaSetValues( instance->chooserOkButton, XmNuserData, choice, NULL );
@@ -314,14 +310,13 @@ choiceSelected(
            break;
     }
     void *entity = DtTtNth( type, info->item_position - 1 );
-    std::ostrstream entityName;
+    std::ostringstream entityName;
     if (isString) {
            entityName << (char *)entity << ends;
     } else {
            entityName << entity << ends;
     }
-    XmTextFieldSetString( instance->chooserText, entityName.str() );
-    delete entityName.str();
+    XmTextFieldSetString( instance->chooserText, const_cast<char *>(entityName.str().c_str()) );
     /*** DTB_USER_CODE_END   ^^^ Add C code above ^^^ ***/
 }
 
@@ -403,7 +398,7 @@ choiceOkayed(
            }
            ival = 0;
            sscanf( text, "%i", &ival );
-           msg = (Tt_message)ival;
+           msg = (Tt_message) (intptr_t) ival;
            if (DtTtIndex( DTTT_MESSAGE, msg ) < 0) {
                    return;
            }
@@ -438,7 +433,7 @@ choiceOkayed(
            }
            ival = 0;
            sscanf( text, "%i", &ival );
-           pat = (Tt_pattern)ival;
+           pat = (Tt_pattern) (intptr_t) ival;
            if (DtTtIndex( DTTT_PATTERN, pat ) < 0) {
                    return;
            }
@@ -472,7 +467,7 @@ choiceOkayed(
            }
            ival = 0;
            sscanf( text, "%i", &ival );
-           pats = (Tt_pattern *)ival;
+           pats = (Tt_pattern *) (intptr_t) ival;
            if (DtTtIndex( DTTT_DTSESSION, pats ) < 0) {
                    return;
            }
@@ -498,7 +493,7 @@ choiceOkayed(
            }
            ival = 0;
            sscanf( text, "%i", &ival );
-           pats = (Tt_pattern *)ival;
+           pats = (Tt_pattern *) (intptr_t) ival;
            if (DtTtIndex( DTTT_DTFILE, pats ) < 0) {
                    return;
            }