From: Peter Howkins Date: Thu, 12 Apr 2018 20:29:49 +0000 (+0100) Subject: dtterm: coverity fixes X-Git-Tag: 2.2.4a~82 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4e9dc6c50bd776994dfd75976892b8330ca90dc7;p=oweals%2Fcde.git dtterm: coverity fixes --- diff --git a/cde/programs/dtterm/DtTermMain.c b/cde/programs/dtterm/DtTermMain.c index d385f198..1e881997 100644 --- a/cde/programs/dtterm/DtTermMain.c +++ b/cde/programs/dtterm/DtTermMain.c @@ -142,7 +142,7 @@ static void SetWorkSpaceHints( Widget shell, char *workspaces ); -static XtEventHandler TestProbeHandler( +static void TestProbeHandler( Widget w, XtPointer client_data, XEvent *event, @@ -420,7 +420,7 @@ DecrementInstanceCountAndExit(Widget w, XtPointer client_data, InstanceCount--; if (InstanceCount > 0) { - new_instance_list = (DtTermViewWidget *)XtMalloc(sizeof(DtTermViewWidget *)*InstanceCount); + new_instance_list = (DtTermViewWidget *)XtMalloc(sizeof(DtTermViewWidget) * InstanceCount); for (j = 0,i = 0; i < (InstanceCount+1); i++) if (instance_list[i] != (DtTermViewWidget )w) { @@ -505,7 +505,7 @@ static void RegisterTestProbe( * TestProbeHandler - handle the client message for test probes * * * ***************************************************************************/ -static XtEventHandler TestProbeHandler( +static void TestProbeHandler( Widget w, XtPointer client_data, XEvent *event, @@ -535,8 +535,8 @@ static XtEventHandler TestProbeHandler( Arg al[5]; *ctd = True; - if (cm->send_event == False) return 0; - if (cm->message_type != xa_DTTERM_REMOTE_PROBE_REQUEST) return 0; + if (cm->send_event == False) return; + if (cm->message_type != xa_DTTERM_REMOTE_PROBE_REQUEST) return; reply = (unsigned char*) malloc(sizeof(unsigned char) * 1024); @@ -758,7 +758,7 @@ CloneCallback(Widget wid, XtPointer client_data, XtPointer call_data) (void) XtAddCallback(termWidget, DtNnewCallback, CloneCallback, (XtPointer) 0); instance_list = (DtTermViewWidget *)XtRealloc((char *)instance_list, - (sizeof(DtTermViewWidget *)*InstanceCount)); + (sizeof(DtTermViewWidget) * InstanceCount)); instance_list[InstanceCount - 1] = (DtTermViewWidget )termWidget; (void) XtRealizeWidget(shellWidget); @@ -825,11 +825,15 @@ CreateInstance DecrementInstanceCountAndExit, (XtPointer) topLevelWidget); (void) _DtTermPrimAddDeleteWindowCallback(topLevelWidget, DestroyDtTerm, (XtPointer) topLevelWidget); - instance_list = (DtTermViewWidget * )XtRealloc((char *)instance_list,(sizeof(DtTermViewWidget *)*InstanceCount)); + instance_list = (DtTermViewWidget * ) XtRealloc((char *)instance_list, (sizeof(DtTermViewWidget) * InstanceCount)); instance_list[InstanceCount - 1] = (DtTermViewWidget )termViewWidget; if (enableCloneCallback) (void) XtAddCallback(termViewWidget, DtNnewCallback, CloneCallback, (XtPointer) 0); + +#ifdef SUN_TERMINAL_SERVER + return(True); +#endif } void @@ -1061,7 +1065,7 @@ FixOSFBindings /* changed from XtFree to free as it was allocated with malloc to avoid FMM */ if (freeOrigBindings) free(origDisplayBindings); - if (ignoredKeysymList) XtFree((char *)ignoredKeysymList); + XtFree((char *)ignoredKeysymList); /* and finally, reparse the string... */ _XmVirtKeysInitialize(w); @@ -1375,9 +1379,10 @@ main(int argc, char **argv) /* realize the interface... */ i = 0; - (void) XtSetArg(arglist[i], XmNtitle, attrs.title); i++; - if ((!attrs.icon_name) && (!attrs.dtterm_name)) + (void) XtSetArg(arglist[i], XmNtitle, attrs.title); i++; + if ((!attrs.icon_name) && (!attrs.dtterm_name)) { (void) XtSetArg(arglist[i], XmNiconName, attrs.title); i++; + } (void) XtSetArg(arglist[i], XmNmappedWhenManaged, False); i++; (void) XtSetArg(arglist[i], XmNgeometry, NULL); i++; (void) XtSetValues(topShell, arglist, i); diff --git a/cde/programs/dtterm/sunDtTermServer.c b/cde/programs/dtterm/sunDtTermServer.c index 03b90174..56aab199 100644 --- a/cde/programs/dtterm/sunDtTermServer.c +++ b/cde/programs/dtterm/sunDtTermServer.c @@ -28,6 +28,8 @@ * (c) Copyright 1993, 1994 Novell, Inc. * */ +#include + #include "TermHeader.h" #include "TermPrimDebug.h" #include "TermView.h" @@ -188,7 +190,7 @@ FinishToolTalkInit(Widget topLevel) displayString = DisplayString(XtDisplay(refWidget)); } - + return(1); } Tt_callback_action @@ -233,7 +235,7 @@ dttermNewHandler( char *msgFile; char numArgs; int i, j, k; - char *displayEnv, *newDisplayString; + char *displayEnv, *newDisplayString = NULL; msgFile = tt_message_file(msg); if (tt_is_err(tt_ptr_error(msgFile))) msgFile = 0; @@ -342,7 +344,7 @@ TimeOut( static void ExitCB (Widget dialog, XtPointer client_data, XtPointer call_data) { - exit((int) client_data); + exit((int) (intptr_t) client_data); } void