From 91bfe1e4dc819a96cc12acfe633f2fd6631c131f Mon Sep 17 00:00:00 2001 From: Marcin Cieslak Date: Mon, 24 Sep 2012 13:36:14 +0200 Subject: [PATCH] dtmail: Fix XtVaGetValues() return value storage At least one crash was caused by this on the 64-bit system --- cde/programs/dtmail/MotifApp/MenuBar.C | 20 +++++++++++------- cde/programs/dtmail/MotifApp/MenuWindow.C | 7 +++++-- cde/programs/dtmail/MotifApp/SelectFileCmd.C | 6 +++--- cde/programs/dtmail/dtmail/AttachArea.C | 10 ++++----- cde/programs/dtmail/dtmail/DmxPrintJob.C | 2 +- cde/programs/dtmail/dtmail/DmxPrintOutput.C | 21 ++++++++++++------- cde/programs/dtmail/dtmail/DmxPrintSetup.C | 8 +++---- .../dtmail/dtmail/IndexedOptionMenu.C | 7 +++++-- 8 files changed, 48 insertions(+), 33 deletions(-) diff --git a/cde/programs/dtmail/MotifApp/MenuBar.C b/cde/programs/dtmail/MotifApp/MenuBar.C index 5d41b8c8f..be61fb6ba 100644 --- a/cde/programs/dtmail/MotifApp/MenuBar.C +++ b/cde/programs/dtmail/MotifApp/MenuBar.C @@ -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, diff --git a/cde/programs/dtmail/MotifApp/MenuWindow.C b/cde/programs/dtmail/MotifApp/MenuWindow.C index fa9f274f3..15eab339b 100644 --- a/cde/programs/dtmail/MotifApp/MenuWindow.C +++ b/cde/programs/dtmail/MotifApp/MenuWindow.C @@ -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); diff --git a/cde/programs/dtmail/MotifApp/SelectFileCmd.C b/cde/programs/dtmail/MotifApp/SelectFileCmd.C index b346e2a8d..d67ff94a4 100644 --- a/cde/programs/dtmail/MotifApp/SelectFileCmd.C +++ b/cde/programs/dtmail/MotifApp/SelectFileCmd.C @@ -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; diff --git a/cde/programs/dtmail/dtmail/AttachArea.C b/cde/programs/dtmail/dtmail/AttachArea.C index 81ce86b88..7f1c21ea6 100644 --- a/cde/programs/dtmail/dtmail/AttachArea.C +++ b/cde/programs/dtmail/dtmail/AttachArea.C @@ -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(); diff --git a/cde/programs/dtmail/dtmail/DmxPrintJob.C b/cde/programs/dtmail/dtmail/DmxPrintJob.C index c5b058b0f..710327ed8 100644 --- a/cde/programs/dtmail/dtmail/DmxPrintJob.C +++ b/cde/programs/dtmail/dtmail/DmxPrintJob.C @@ -674,7 +674,7 @@ DmxPrintJob::printOnePageCB( if (thisJob->_print_output == NULL) { - Dimension width, height; + XtArgVal /* Dimension */ width, height; width = 0; height=0; XtVaGetValues( diff --git a/cde/programs/dtmail/dtmail/DmxPrintOutput.C b/cde/programs/dtmail/dtmail/DmxPrintOutput.C index 8968a9175..55808c47e 100644 --- a/cde/programs/dtmail/dtmail/DmxPrintOutput.C +++ b/cde/programs/dtmail/dtmail/DmxPrintOutput.C @@ -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; diff --git a/cde/programs/dtmail/dtmail/DmxPrintSetup.C b/cde/programs/dtmail/dtmail/DmxPrintSetup.C index a7a555a5c..8aa00e69c 100644 --- a/cde/programs/dtmail/dtmail/DmxPrintSetup.C +++ b/cde/programs/dtmail/dtmail/DmxPrintSetup.C @@ -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; diff --git a/cde/programs/dtmail/dtmail/IndexedOptionMenu.C b/cde/programs/dtmail/dtmail/IndexedOptionMenu.C index 1a9dc94c3..f00b7409c 100644 --- a/cde/programs/dtmail/dtmail/IndexedOptionMenu.C +++ b/cde/programs/dtmail/dtmail/IndexedOptionMenu.C @@ -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; }