dtmail: Fix XtVaGetValues() return value storage
authorMarcin Cieslak <saper@saper.info>
Mon, 24 Sep 2012 11:36:14 +0000 (13:36 +0200)
committerJon Trulson <jon@radscan.com>
Tue, 25 Sep 2012 00:26:11 +0000 (18:26 -0600)
At least one crash was caused by this
on the 64-bit system

cde/programs/dtmail/MotifApp/MenuBar.C
cde/programs/dtmail/MotifApp/MenuWindow.C
cde/programs/dtmail/MotifApp/SelectFileCmd.C
cde/programs/dtmail/dtmail/AttachArea.C
cde/programs/dtmail/dtmail/DmxPrintJob.C
cde/programs/dtmail/dtmail/DmxPrintOutput.C
cde/programs/dtmail/dtmail/DmxPrintSetup.C
cde/programs/dtmail/dtmail/IndexedOptionMenu.C

index 5d41b8c8f63eb2b0f6d70bbc371c858724e48545..be61fb6ba2b404c9d6adccff49d3fa095f2b6d78 100644 (file)
@@ -406,7 +406,8 @@ MenuBar::addCommands(
     // if(isValidMenuPane(pulldown) == FALSE)
     //         return NULL;
 
-    int    i, num_children;
+    int    i;
+    XtArgVal num_children;
     WidgetList children;
     Boolean haveNoSeparator;
     int newItemIndex, numPBUnmanaged, tmpPBUnmanaged;
@@ -503,7 +504,8 @@ MenuBar::removeOnlyCommands(
     // if(isValidMenuPane(pulldown) == FALSE)
     // return;
 
-    int    i, j, num_children;
+    int    i, j;
+    XtArgVal num_children;
     WidgetList children;
     
     XtVaGetValues(pulldown,
@@ -545,7 +547,8 @@ MenuBar::removeCommands(
     // if(isValidMenuPane(pulldown) == FALSE)
     // return;
 
-    int    i, j, num_children;
+    int    i, j;
+    XtArgVal num_children;
     WidgetList children;
     
     XtVaGetValues(pulldown,
@@ -615,7 +618,8 @@ MenuBar::changeLabel(
     // if(isValidMenuPane(pulldown) == FALSE)
     //         return;
 
-    int managed_widgets, i, num_children;
+    int managed_widgets, i;
+    XtArgVal num_children;
     WidgetList children;
     XmString label;
     Widget wid;
@@ -658,7 +662,7 @@ MenuBar::changeLabel(Widget pulldown,
 
     // Locate the appropriate widget in the list.
     //
-    int num_children;
+    XtArgVal num_children;
     char wid_name[200];
     XmString label_string = XmStringCreateLocalized((char *)label);
 
@@ -695,7 +699,8 @@ MenuBar::rotateLabels(
     // if(isValidMenuPane(pulldown) == FALSE)
     //         return;
 
-    int    num_managed_wids=0, i, j, num_children, num_to_change;
+    int    num_managed_wids=0, i, j, num_to_change;
+    XtArgVal num_children;
     WidgetList children;
     XmString label, endlabel;
     Widget prevwid, wid;
@@ -805,7 +810,8 @@ MenuBar::removeCommand(
     //if(isValidMenuPane(pulldown) == FALSE)
     //   return;
 
-    int   managed_widgets, i, num_children;
+    int   managed_widgets, i;
+    XtArgVal num_children;
     WidgetList children;
 
     XtVaGetValues(pulldown,
index fa9f274f30fc071ec71e62d2ba9153cdae5d3b65..15eab339b168e86817907fc9114ce90bf84c14e6 100644 (file)
@@ -111,10 +111,13 @@ void
 MenuWindow::getIconColors(Pixel & fore, Pixel & back)
 {
     if (_menuBar) {
+        XtArgVal fore0, back0;
        XtVaGetValues (_menuBar->baseWidget(),
-                      XmNforeground, &fore,
-                      XmNbackground, &back,
+                      XmNforeground, &fore0,
+                      XmNbackground, &back0,
                       NULL);
+        fore = (Pixel) fore0;
+        back = (Pixel) back0;
     }
     else {
        MainWindow::getIconColors(fore, back);
index b346e2a8de89b013006cc01d09bae206435b8866..d67ff94a4283c3d1d8d43539ad801101dfe4ad2c 100644 (file)
@@ -347,7 +347,7 @@ int
 SelectFileCmd::getHidden()
 {
     int                        val;
-    unsigned char      current_state;
+    XtArgVal           current_state;
 
     if (NULL == _fileBrowser || NULL == _hidden_button)
       return 0;
@@ -388,8 +388,8 @@ SelectFileCmd::setSelected(char *path)
 void
 SelectFileCmd::setHidden(int on)
 {
-    unsigned char      current_state;
-    unsigned char      desired_state;
+    XtArgVal           current_state;
+    XtArgVal           desired_state;
 
     if (NULL == _fileBrowser || NULL == _hidden_button)
       return;
index 81ce86b8868df50f29bf4da696691e093b74cd8e..7f1c21ea6a738767c890a3e3efdbe86199f7f201 100644 (file)
@@ -475,7 +475,7 @@ void AttachArea::resizeCallback (
                                  XtPointer //callData
                                  )
 {
-    Dimension wid;
+    XtArgVal wid;
 
     AttachArea *obj = (AttachArea *) clientData;
     XtVaGetValues(
@@ -484,7 +484,7 @@ void AttachArea::resizeCallback (
        NULL
     );
 
-    obj->resize(wid);
+    obj->resize((Dimension)wid);
 }
 
 void AttachArea::resize(
@@ -1284,13 +1284,11 @@ AttachArea::attachment_summary(
 void
 AttachArea::manage()
 {
-    Dimension wid;
-    Dimension ht;
-    Dimension pht;
+    XtArgVal /* Dimension */ ht;
+    XtArgVal /* Dimension */ pht;
     Widget sww;
 
     // Update the display
-    XtVaGetValues(this->baseWidget(), XmNwidth, &wid, NULL);
     sww = getSWWindow();
     this->manageList();
 
index c5b058b0f54ff8cd61f155cde7a9ae944424888c..710327ed88f7f00ebde9992f4ffa49051268b885 100644 (file)
@@ -674,7 +674,7 @@ DmxPrintJob::printOnePageCB(
     if (thisJob->_print_output == NULL)
     {
         
-       Dimension       width, height;
+       XtArgVal /* Dimension */        width, height;
 
         width = 0; height=0;
         XtVaGetValues(
index 8968a917554419c237c9d05a927992a9562f1929..55808c47e22bedef8698f4247fd8362d5327d1a5 100644 (file)
@@ -546,7 +546,7 @@ DmxPrintOutput::setWrapToFit (DtMailBoolean onoff)
 
 int DmxPrintOutput::getCharactersPerLine ()
 {
-    short      columns = 0;
+    XtArgVal   columns = 0;
 
 #ifdef USE_DTEDITOR
     XtVaGetValues(_editor, DtNcolumns, &columns, NULL);
@@ -560,7 +560,7 @@ int DmxPrintOutput::getCharactersPerLine ()
 
 int DmxPrintOutput::getNumLines ()
 {
-    int        total = 0;
+    XtArgVal   total = 0;
 
 #ifdef USE_DTEDITOR
 #else
@@ -570,7 +570,7 @@ int DmxPrintOutput::getNumLines ()
     //
     total -= 1;
 #endif
-    return(total);
+    return((int)total);
 }
 
 
@@ -726,7 +726,7 @@ void DmxPrintOutput::clearContents (void)
 int
 DmxPrintOutput::doGetLinesPerPage ()
 {
-    Dimension  lpp;
+    XtArgVal /* Dimension */   lpp;
 
     XtVaGetValues(_editor, XmNrows, &lpp, NULL);
     return ((int) lpp);
@@ -741,22 +741,27 @@ DmxPrintOutput::setInnerPageDimensions (
                                        Dimension left
                                           )
 {
+    XtArgVal height0, width0;
     Dimension  inner_height, inner_width, inner_x, inner_y,
                outer_height, outer_width,
                editor_height, footer_height, header_height;
 
     XtVaGetValues(_form,
-                 XmNheight, &outer_height,
-                 XmNwidth, &outer_width,
+                 XmNheight, &height0,
+                 XmNwidth, &width0,
                  NULL);
+    outer_height = (Dimension)height0;
+    outer_width = (Dimension)width0;
 
     XtVaGetValues(_header_left,
-                 XmNheight, &header_height,
+                 XmNheight, &height0,
                  NULL);
+    header_height = (Dimension)height0;
 
     XtVaGetValues(_footer_left,
-                 XmNheight, &footer_height,
+                 XmNheight, &height0,
                  NULL);
+    footer_height = (Dimension)height0;
 
     inner_x = left;
     inner_y = top;
index a7a555a5c97b9340d178704105643c1e9cc6324a..8aa00e69cfbf360f845323228cfb546ae29d4520 100644 (file)
@@ -161,8 +161,8 @@ DmxPrintSetup::display (void)
     if (_dtprint_setup == NULL) return;
 
 #ifdef REUSE_PRINT_SETUP_DIALOGS
-    Position x1, y1, x2, y2;
-    Dimension w1, h1, w2, h2;
+    XtArgVal /* Position */ x1, y1, x2, y2;
+    XtArgVal /* Dimension */ w1, h1, w2, h2;
     XtVaGetValues(
                XtParent(_dtprint_setup),
                XmNx, &x1, XmNy, &y1,
@@ -444,7 +444,7 @@ DmxPrintSetup::detachPrintSetupDialog (void)
 void
 DmxPrintSetup::savePrintSetupOptions(DtPrintSetupData *print_data)
 {
-    unsigned char      is_set;
+    XtArgVal /* unsigned char */       is_set;
 
     XtVaGetValues(_widgets->print_separately_tb, XmNset, &is_set, NULL);
     _print_separately = (is_set == XmSET) ? DTM_TRUE : DTM_FALSE;
@@ -479,7 +479,7 @@ DmxPrintSetup::destinationChangedCB(
                                XtPointer)
 {
     PrintSetupWidgets  *widgets = (PrintSetupWidgets*) client_data;
-    Boolean            toggleFlag;
+    XtArgVal /* Boolean */ toggleFlag;
 
     if (NULL == checkbox_tb) return;
 
index 1a9dc94c3e4226ef03e8b13b7109190a87d698a0..f00b7409c33059940a47e6675033552e3ff6fbb2 100644 (file)
@@ -214,9 +214,12 @@ IndexedOptionMenu::getIndexSpec (void)
 
     if (_w)
     {
+        XtArgVal arg;
         Widget selected;
-        XtVaGetValues(_w, XmNmenuHistory, &selected, NULL);
-        XtVaGetValues(selected, XmNuserData, &data, NULL);
+        XtVaGetValues(_w, XmNmenuHistory, &arg, NULL);
+        selected = (Widget)arg;
+        XtVaGetValues(selected, XmNuserData, &arg, NULL);
+        data = (int)arg;
     }
     return data;
 }