From 466b8d0df5136412cf965f7bf9a9cab2d8f74943 Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Mon, 5 Jan 2015 16:07:49 +0000 Subject: [PATCH] dtstyle: resolve 30 compiler warnings. --- cde/programs/dtstyle/Audio.c | 5 ++++- cde/programs/dtstyle/Backdrop.c | 5 ++++- cde/programs/dtstyle/ColorEdit.c | 9 ++++++--- cde/programs/dtstyle/ColorFile.c | 6 +++++- cde/programs/dtstyle/ColorMain.c | 20 ++++++++++++-------- cde/programs/dtstyle/Dtwm.c | 5 ++++- cde/programs/dtstyle/Font.c | 5 ++++- cde/programs/dtstyle/HelpCB.c | 4 ++-- cde/programs/dtstyle/I18nMain.c | 9 ++++++--- cde/programs/dtstyle/Keyboard.c | 5 ++++- cde/programs/dtstyle/MainWin.c | 7 +++++-- cde/programs/dtstyle/Mouse.c | 11 +++++++---- cde/programs/dtstyle/Protocol.c | 2 +- cde/programs/dtstyle/Screen.c | 5 ++++- cde/programs/dtstyle/Startup.c | 5 ++++- 15 files changed, 72 insertions(+), 31 deletions(-) diff --git a/cde/programs/dtstyle/Audio.c b/cde/programs/dtstyle/Audio.c index 4ae74812..06cbb8ee 100644 --- a/cde/programs/dtstyle/Audio.c +++ b/cde/programs/dtstyle/Audio.c @@ -42,6 +42,7 @@ /*+++++++++++++++++++++++++++++++++++++++*/ #include +#include #include #include @@ -714,7 +715,9 @@ saveAudio( sprintf(bufr, "%s*audioDlg.x: %d\n", bufr, x); sprintf(bufr, "%s*audioDlg.y: %d\n", bufr, y); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/Backdrop.c b/cde/programs/dtstyle/Backdrop.c index 7beb4687..cc7dc8c6 100644 --- a/cde/programs/dtstyle/Backdrop.c +++ b/cde/programs/dtstyle/Backdrop.c @@ -45,6 +45,7 @@ #include #include #include +#include #if defined(_AIX) || defined(__apollo) #include @@ -1235,7 +1236,9 @@ saveBackdrop( backdrops.selected); sprintf(bufr, "%s*backdropsDialog.selectedItem: %s\n", bufr, backdrops.bitmapNames[backdrops.selected]); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/ColorEdit.c b/cde/programs/dtstyle/ColorEdit.c index 17753f0f..ccbb1e71 100644 --- a/cde/programs/dtstyle/ColorEdit.c +++ b/cde/programs/dtstyle/ColorEdit.c @@ -44,6 +44,7 @@ #include #include +#include #include #include @@ -1041,7 +1042,7 @@ changRGB_CB( reason_code = ((XmAnyCallbackStruct *)call_data)->reason; if ( reason_code == XmCR_VALUE_CHANGED || reason_code == XmCR_DRAG ) { - color = (int) client_data; + color = (int) (intptr_t) client_data; value = ((XmScaleCallbackStruct *)call_data)->value; if (edit.current_scale == NONE) @@ -1093,7 +1094,7 @@ changHSV_CB( reason_code = ((XmAnyCallbackStruct *)call_data)->reason; if ( reason_code == XmCR_VALUE_CHANGED || reason_code == XmCR_DRAG ) { - scale = (int) client_data; + scale = (int) (intptr_t) client_data; value = ((XmScaleCallbackStruct *)call_data)->value; if (edit.current_scale == NONE) @@ -1730,7 +1731,9 @@ saveColorEdit( sprintf(bufr, "%s*colorEditDlg.x: %d\n", bufr, x); sprintf(bufr, "%s*colorEditDlg.y: %d\n", bufr, y); /*any other parameter you want to save goes here*/ - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/ColorFile.c b/cde/programs/dtstyle/ColorFile.c index 5222515e..6f5e124b 100644 --- a/cde/programs/dtstyle/ColorFile.c +++ b/cde/programs/dtstyle/ColorFile.c @@ -43,6 +43,7 @@ #include #include +#include #include @@ -482,7 +483,10 @@ WriteOutPalette( pCurrentPalette->color[i].bg.red, pCurrentPalette->color[i].bg.green, pCurrentPalette->color[i].bg.blue); - write(fd, temp, strlen(temp)); + if(-1 == write(fd, temp, strlen(temp))) { + perror(strerror(errno)); + return(-1); + } } XtFree(temp); } diff --git a/cde/programs/dtstyle/ColorMain.c b/cde/programs/dtstyle/ColorMain.c index 5b1fa96f..09bb928f 100644 --- a/cde/programs/dtstyle/ColorMain.c +++ b/cde/programs/dtstyle/ColorMain.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -600,7 +601,7 @@ CreatePaletteButtons( if (style.dynamicColor || style.visualClass==TrueColor || style.visualClass==DirectColor) XtAddCallback(colorButton[i], XmNactivateCallback, selectColorCB, - (XtPointer)i); + (XtPointer) (intptr_t) i); XmStringFree(string); } XtManageChildren(colorButton,pCurrentPalette->num_of_colors); @@ -986,12 +987,13 @@ selectColorCB( XtPointer client_data, XtPointer call_data ) { - int i,n; + intptr_t i; + int n; Arg args[4]; ColorSet *color_set; XmPushButtonCallbackStruct *cb = (XmPushButtonCallbackStruct *)call_data; - i = (int) client_data; + i = (intptr_t) client_data; /* if click_count == 1 .. first button press, set time out */ if(cb->click_count == 1) @@ -1061,14 +1063,14 @@ timeoutCB( XtIntervalId *id ) { register int n; - int i; + intptr_t i; Arg args[2]; Pixel bg_pixel; if (TypeOfMonitor == XmCO_BLACK_WHITE) return; - i = (int)client_data; + i = (intptr_t) client_data; if ((edit.DialogShell == NULL) || (!XtIsManaged(edit.DialogShell))) { @@ -1747,7 +1749,7 @@ colorUseCB( XmToggleButtonCallbackStruct *cb = (XmToggleButtonCallbackStruct *)call_data; - colorDialog.currentColorUse = (int) client_data; + colorDialog.currentColorUse = (int) (intptr_t) client_data; switch (colorDialog.currentColorUse) { case XmCO_HIGH_COLOR: @@ -2327,7 +2329,7 @@ show_selection( style.colorSrv = True; if(value != NULL) { - if((int)client_data == GET_TYPE_MONITOR) + if((intptr_t) client_data == GET_TYPE_MONITOR) { sscanf ((char *)value, "%x_%x_%x_%x", (unsigned int *) &(TypeOfMonitor), (unsigned int *) &(UsePixmaps), (unsigned int *) &(FgColor), (unsigned int *) &dynamic_color); @@ -2456,7 +2458,9 @@ saveColor( pCurrentPalette->name); sprintf(bufr, "%s*paletteDlg.selected_button: %d\n", bufr, selected_button); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/Dtwm.c b/cde/programs/dtstyle/Dtwm.c index d503e46c..e2a0508c 100644 --- a/cde/programs/dtstyle/Dtwm.c +++ b/cde/programs/dtstyle/Dtwm.c @@ -42,6 +42,7 @@ /*+++++++++++++++++++++++++++++++++++++++*/ #include +#include #include #include @@ -981,7 +982,9 @@ saveDtwm( sprintf(bufr, "%s*dtwmDlg.y: %d\n", bufr, y); sprintf(bufr, "%s*dtwmDlg.width: %d\n", bufr, width); sprintf(bufr, "%s*dtwmDlg.height: %d\n", bufr, height); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/Font.c b/cde/programs/dtstyle/Font.c index 7c82acd8..709db7e3 100644 --- a/cde/programs/dtstyle/Font.c +++ b/cde/programs/dtstyle/Font.c @@ -66,6 +66,7 @@ #include
#include +#include #include "Help.h" #include "Main.h" #include "SaveRestore.h" @@ -753,7 +754,9 @@ saveFonts( sprintf(bufr, "%s*Fonts.x: %d\n", bufr, x); sprintf(bufr, "%s*Fonts.y: %d\n", bufr, y); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/HelpCB.c b/cde/programs/dtstyle/HelpCB.c index ca28a09f..4afb3409 100644 --- a/cde/programs/dtstyle/HelpCB.c +++ b/cde/programs/dtstyle/HelpCB.c @@ -54,9 +54,9 @@ HelpRequestCB( caddr_t call_data ) { char *helpVolume, *locationId; - int topic; + intptr_t topic; - topic = (int) client_data; + topic = (intptr_t) client_data; helpVolume = HELP_VOLUME; switch (topic) diff --git a/cde/programs/dtstyle/I18nMain.c b/cde/programs/dtstyle/I18nMain.c index 1a3afbee..f444af8a 100644 --- a/cde/programs/dtstyle/I18nMain.c +++ b/cde/programs/dtstyle/I18nMain.c @@ -46,6 +46,7 @@ /*+++++++++++++++++++++++++++++++++++++++*/ #include +#include #include #include @@ -509,7 +510,7 @@ BuildI18nDlg( n = 0; XtSetArg(args[n], XmNcomboBoxType, XmDROP_DOWN_COMBO_BOX); n++; i18n.serverHostCB = - (Widget) XmCreateComboBox(inputMethodForm, "serverHostCB", args, n); + (Widget) (intptr_t) XmCreateComboBox(inputMethodForm, "serverHostCB", args, n); XtAddCallback(XtNameToWidget(i18n.serverHostCB, "Text"), XmNactivateCallback, ServerHostCB, NULL); @@ -560,7 +561,7 @@ BuildI18nDlg( n = 0; XtSetArg(args[n], XmNselectionPolicy, XmBROWSE_SELECT); n++; i18n.preeditTypeList = - (Widget) XmCreateList(preeditTypeForm, "preeditTypeList", args, n); + (Widget) (intptr_t) XmCreateList(preeditTypeForm, "preeditTypeList", args, n); n = 0; string = CMPSTR((char *)GETMESSAGE(19, 10, "Move Up")); @@ -1205,7 +1206,9 @@ saveI18n( sprintf(bufr, "%s*i18nDlg.y: %d\n", bufr, y); sprintf(bufr, "%s*i18nDlg.width: %d\n", bufr, width); sprintf(bufr, "%s*i18nDlg.height: %d\n", bufr, height); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/Keyboard.c b/cde/programs/dtstyle/Keyboard.c index 41106be8..7112d428 100644 --- a/cde/programs/dtstyle/Keyboard.c +++ b/cde/programs/dtstyle/Keyboard.c @@ -42,6 +42,7 @@ /* include files */ /*+++++++++++++++++++++++++++++++++++++++*/ +#include #include #include @@ -634,7 +635,9 @@ saveKeybd( sprintf(bufr, "%s*keyboardDlg.x: %d\n", bufr, x); sprintf(bufr, "%s*keyboardDlg.y: %d\n", bufr, y); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/MainWin.c b/cde/programs/dtstyle/MainWin.c index c48761d7..9f4ac739 100644 --- a/cde/programs/dtstyle/MainWin.c +++ b/cde/programs/dtstyle/MainWin.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -553,7 +554,7 @@ ProcessComponentList( XtManageChild (componentWidget); XtAddCallback(componentWidget, XmNcallback, activateCB, string); XtAddCallback(componentWidget, XmNhelpCallback, - (XtCallbackProc)HelpRequestCB, (XtPointer)helpTag); + (XtCallbackProc)HelpRequestCB, (XtPointer) (intptr_t) helpTag); XmStringFree(cmp_string); XtFree(dtIcon); @@ -776,7 +777,9 @@ saveMain( sprintf(bufr, "%s*mainWindow.x: %d\n", bufr, x); sprintf(bufr, "%s*mainWindow.y: %d\n", bufr, y); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/Mouse.c b/cde/programs/dtstyle/Mouse.c index e057f9d1..1ba200df 100644 --- a/cde/programs/dtstyle/Mouse.c +++ b/cde/programs/dtstyle/Mouse.c @@ -39,6 +39,7 @@ /*$XConsortium: Mouse.c /main/5 1996/07/19 13:45:42 pascale $*/ #include +#include #include #include @@ -1188,7 +1189,7 @@ midwarnToggleCB( XtUnmanageChild (XmMessageBoxGetChild(midwarnDialog, XmDIALOG_HELP_BUTTON)); - if ((Boolean)client_data == TRANSFER) + if ((intptr_t)client_data == TRANSFER) { warnstring = CMPSTR(MID_WARN_MSG_T); XtVaSetValues(midwarnDialog, XmNmessageString, warnstring, NULL); n++; @@ -1286,7 +1287,7 @@ reverseToggleCB( Boolean set; Boolean toggle; - toggle = (Boolean) client_data; + toggle = (Boolean) (intptr_t) client_data; if(mouse.type == POINTER3B) { @@ -1370,7 +1371,7 @@ midreverseToggleCB( Boolean set; Boolean toggle; - toggle = (Boolean) client_data; + toggle = (Boolean) (intptr_t) client_data; if (toggle == ADJUST) { @@ -1771,7 +1772,9 @@ saveMouse( sprintf(bufr, "%s*Mouse.x: %d\n", bufr, x); sprintf(bufr, "%s*Mouse.y: %d\n", bufr, y); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/Protocol.c b/cde/programs/dtstyle/Protocol.c index 44feef83..67e7f852 100644 --- a/cde/programs/dtstyle/Protocol.c +++ b/cde/programs/dtstyle/Protocol.c @@ -253,7 +253,7 @@ WorkspaceStartupTimer( XtIntervalId *id) { Atom aWS; - int count = (int) client_data; + intptr_t count = (intptr_t) client_data; if (DtWsmGetCurrentWorkspace (style.display, style.root, &aWS) == Success) diff --git a/cde/programs/dtstyle/Screen.c b/cde/programs/dtstyle/Screen.c index a4009ce5..f4f1748d 100644 --- a/cde/programs/dtstyle/Screen.c +++ b/cde/programs/dtstyle/Screen.c @@ -57,6 +57,7 @@ #include #include +#include #include #include @@ -2912,7 +2913,9 @@ saveScreen( sprintf(bufr, "%s*Screen.x: %d\n", bufr, x); sprintf(bufr, "%s*Screen.y: %d\n", bufr, y); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } diff --git a/cde/programs/dtstyle/Startup.c b/cde/programs/dtstyle/Startup.c index c1c39d9d..3fdad77f 100644 --- a/cde/programs/dtstyle/Startup.c +++ b/cde/programs/dtstyle/Startup.c @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -726,7 +727,9 @@ saveStartup( sprintf(bufr, "%s*startupDlg.x: %d\n", bufr, x); sprintf(bufr, "%s*startupDlg.y: %d\n", bufr, y); - write (fd, bufr, strlen(bufr)); + if(-1 == write (fd, bufr, strlen(bufr))) { + perror(strerror(errno)); + } } } -- 2.25.1