From 55c120b287ffd6ca7c4920ea0cef817028ba5fe8 Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Sat, 28 Apr 2018 21:17:28 +0100 Subject: [PATCH] dtimsstart: Resolve all compiler warnings --- cde/programs/dtimsstart/action.c | 8 ++++---- cde/programs/dtimsstart/env.c | 6 +++--- cde/programs/dtimsstart/main.c | 9 +++++++-- cde/programs/dtimsstart/win.c | 16 +++++++++------- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/cde/programs/dtimsstart/action.c b/cde/programs/dtimsstart/action.c index 239b0bde..4c4a3ea5 100644 --- a/cde/programs/dtimsstart/action.c +++ b/cde/programs/dtimsstart/action.c @@ -30,8 +30,8 @@ static void DbReloadProc(/* cd */); static bool init_action_env(/* */); -static void action_cb(DtActionInvocationID id, XtPointer cd, - DtActionArg *args, int argcnt, int status); +static void action_cb(long unsigned id, XtPointer cd, + DtActionArg *args, int argcnt, DtActionStatus status); static void wait_action_done(/* */); static bool actionEnabled = False; @@ -69,11 +69,11 @@ static bool init_action_env() } static void action_cb(id, cd, args, argcnt, status) - DtActionInvocationID id; + long unsigned id; XtPointer cd; /* unused */ DtActionArg *args; int argcnt; - int status; + DtActionStatus status; { if (actionId == 0) { DPR(("action_cb(): invalid id %d != %d\n", id, actionId)); diff --git a/cde/programs/dtimsstart/env.c b/cde/programs/dtimsstart/env.c index a0c9c633..633e724f 100644 --- a/cde/programs/dtimsstart/env.c +++ b/cde/programs/dtimsstart/env.c @@ -99,7 +99,7 @@ int get_user_environ() if ((p = Opt.DisplayName) && *p) { strcpy(buf, "DISPLAY="); strcat(buf, p); - putenv(NEWSTR(buf)); + putenv(XtNewString(buf)); } else p = getenv("DISPLAY"); if (p && *p) @@ -286,7 +286,7 @@ int make_new_environ(oenv, sel) ep = oenv->set = ALLOC(num + 2 + 1, EnvEnt); for (i = 0; i < num && (p = setp[i]); i++) - if (strcmp(p, xmod) && strcmp(p, xinput)) { + if (strcmp(p, xmod) && (!xinput || strcmp(p, xinput))) { ep->name = NEWSTR(p); ep++; } @@ -335,7 +335,7 @@ int make_new_environ(oenv, sel) } # endif /* old_hpux */ for (i = 0; i < num && (p = unsetp[i]); i++) { - if (strcmp(p, xmod) == 0 || strcmp(p, xinput) == 0) + if (strcmp(p, xmod) == 0 || (xinput && strcmp(p, xinput)) == 0) continue; if (oenv->set) { for (ep2 = oenv->set; ep2->name; ep2++) diff --git a/cde/programs/dtimsstart/main.c b/cde/programs/dtimsstart/main.c index f4b981b9..bc07067b 100644 --- a/cde/programs/dtimsstart/main.c +++ b/cde/programs/dtimsstart/main.c @@ -699,7 +699,9 @@ static int set_locale_env(locale) bp = strcpyx(bp, ":"); } bp = strcpyx(bp, ENV_XFILESEARCHPATH_STRING); - putenv(NEWSTR(buf)); + if(*buf) { + putenv(XtNewString(buf)); + } /* set NLSPATH */ vp = getenv(ENV_NLSPATH); @@ -710,7 +712,10 @@ static int set_locale_env(locale) bp = strcpyx(bp, ":"); } bp = strcpyx(bp, ENV_NLSPATH_STRING); - putenv(NEWSTR(buf)); + /* BUG should this be putenv(bp) ? */ + if(*buf) { + putenv(XtNewString(buf)); + } #ifdef NLS if (catd != (nl_catd) -1) (void) catclose(catd); diff --git a/cde/programs/dtimsstart/win.c b/cde/programs/dtimsstart/win.c index 4c7d4851..9869feca 100644 --- a/cde/programs/dtimsstart/win.c +++ b/cde/programs/dtimsstart/win.c @@ -22,6 +22,8 @@ */ /* @(#)$TOG: win.c /main/9 1997/06/18 17:33:01 samborn $ */ +#include + #include #include #include @@ -583,7 +585,7 @@ static void done_cb(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { - int canceled = (int)client_data == CANCEL_BTN; + int canceled = (int)(intptr_t) client_data == CANCEL_BTN; int idx; UserSelection *sel = &userSel; @@ -619,7 +621,7 @@ static void select_cb(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { - int new_idx = (int) client_data; + int new_idx = (int)(intptr_t) client_data; if (new_idx < 0 || new_idx >= curList->num_ent) { DPR(("select_cb():\tinvalid index (%d)\n", new_idx)); @@ -856,7 +858,7 @@ static void change_ims_list(last_ims_name, init_idx) XtSetValues(tb[j], args, i); } else { tb[j] = createTB(SelRC, "ims", args, i); - XtAddCallback(tb[j], XmNvalueChangedCallback, select_cb, (XtPointer)j); + XtAddCallback(tb[j], XmNvalueChangedCallback, select_cb, (XtPointer)(intptr_t) j); add_btn_trans(tb[j]); } XmStringFree(str); @@ -1038,7 +1040,7 @@ static void host_done_cb(w, client_data, call_data) Widget w; XtPointer client_data, call_data; { - int cancel = (int)client_data == CANCEL_BTN; + int cancel = (int)(intptr_t) client_data == CANCEL_BTN; int ret = NoError; char *new_host, *txt, *p; bool host_changed = False; @@ -1281,7 +1283,7 @@ static void mode_done_cb(w, client_data, call_data) XtPointer client_data, call_data; { int ret = NoError; - int canceled = (int)client_data == CANCEL_BTN; + int canceled = (int)(intptr_t) client_data == CANCEL_BTN; DPR(("mode_done(%s):\torg=%d cur=%d\n", canceled ? "Cancel" : "OK", OrgMode, CurMode)); @@ -1313,7 +1315,7 @@ static void mode_cb(w, client_data, call_data) XtPointer client_data, call_data; { int is_set = (int)((XmToggleButtonCallbackStruct *)call_data)->set; - int is_auto = (int)client_data; + int is_auto = (int)(intptr_t) client_data; CurMode = (is_auto && is_set) ? SEL_MODE_AUTO : SEL_MODE_NOAUTO; } @@ -1378,7 +1380,7 @@ static int create_mode_window(cur_mode) tb[1] = createTB(mode_rc, "button_1", bargs, k); for (k = 0; k < NUM_SEL_MODE; k++) { XtVaSetValues(tb[k], XmNset, k == set_idx ? True : False, NULL); - XtAddCallback(tb[k], XmNvalueChangedCallback, mode_cb, (XtPointer)k); + XtAddCallback(tb[k], XmNvalueChangedCallback, mode_cb, (XtPointer)(intptr_t) k); add_btn_trans(tb[k]); } XtManageChildren(tb, NUM_SEL_MODE); -- 2.25.1