1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 03:32:24 +00:00

Fix a bunch of -Wempty-body warnings reported by clang

Many of these were real bugs, like:

if (cond);
   do_something

etc...

Others were just cosmetic - like placing the ';' on a separate line to
make the intention clear.
This commit is contained in:
Jon Trulson 2021-12-11 13:10:24 -07:00
parent 18e25ce273
commit dda11f0e38
11 changed files with 28 additions and 18 deletions

View file

@ -573,7 +573,8 @@ _DtPrintGetDefaultXPrinterName(
else if((default_printer = getenv("XPRINTER")) != (String)NULL); else if((default_printer = getenv("XPRINTER")) != (String)NULL);
else if((default_printer = getenv("PDPRINTER")) != (String)NULL); else if((default_printer = getenv("PDPRINTER")) != (String)NULL);
else if((default_printer = getenv("LPDEST")) != (String)NULL); else if((default_printer = getenv("LPDEST")) != (String)NULL);
else if((default_printer = getenv("PRINTER")) != (String)NULL); else if((default_printer = getenv("PRINTER")) != (String)NULL)
;
/* /*
* return a copy of the printer name * return a copy of the printer name
*/ */

View file

@ -149,7 +149,7 @@ _GetMwmWindow(
} }
} }
if (rcode == Success); if (rcode == Success)
{ {
*pMwmWindow = pWmInfo->wmWindow; *pMwmWindow = pWmInfo->wmWindow;
} }

View file

@ -3670,7 +3670,7 @@ attch_ed_verify_props(void)
* Get parent of current object * Get parent of current object
*/ */
parent = obj_get_parent(ats->cur_object); parent = obj_get_parent(ats->cur_object);
if (parent); if (parent)
parent = obj_get_root(parent); parent = obj_get_root(parent);
/* /*

View file

@ -2634,11 +2634,11 @@ propP_popup_message(
/* /*
* Free help data strings * Free help data strings
*/ */
if (help_data.help_text); if (help_data.help_text)
XtFree(help_data.help_text); XtFree(help_data.help_text);
if (help_data.help_volume); if (help_data.help_volume)
XtFree(help_data.help_volume); XtFree(help_data.help_volume);
if (help_data.help_locationID); if (help_data.help_locationID)
XtFree(help_data.help_locationID); XtFree(help_data.help_locationID);
} }
else else

View file

@ -539,7 +539,8 @@ do_calc(void) /* Perform arithmetic calculation and display result. */
mpcdm(&dres, v->MPresult) ; mpcdm(&dres, v->MPresult) ;
} }
else if (IS_KEY(v->cur_op, KEY_EQ)) /* do nothing. */ ; /* Equals */ else if (IS_KEY(v->cur_op, KEY_EQ)) /* Equals */
; /* do nothing. */
show_display(v->MPresult) ; show_display(v->MPresult) ;

View file

@ -768,7 +768,8 @@ TblTableRowEnd(
if ((at = FindAttValByName(e, "ROWSEP"))) { if ((at = FindAttValByName(e, "ROWSEP"))) {
if (at[0] == '1') fprintf(fp, "_\n"); if (at[0] == '1') fprintf(fp, "_\n");
} }
else if (rowsep) /* fprintf(fp, "_\n") */ ; else if (rowsep) /* fprintf(fp, "_\n") */
;
} }
/* /*

View file

@ -705,9 +705,10 @@ ScanNLSDir(char *dirname)
continue; continue;
if (locale[0] != '.' && if (locale[0] != '.' &&
LANGLISTSIZE > (int) (strlen(languageList)+strlen(locale)+2)); LANGLISTSIZE > (int) (strlen(languageList)+strlen(locale)+2))
{ {
(void) sprintf(locale_path, "%s/%s", dirname, locale); (void) snprintf(locale_path, MAXPATHLEN, "%s/%s",
dirname, locale);
retval = stat(locale_path, &locale_stat); retval = stat(locale_path, &locale_stat);
if (0 == retval && S_ISDIR(locale_stat.st_mode)) if (0 == retval && S_ISDIR(locale_stat.st_mode))

View file

@ -417,9 +417,14 @@ DialogManager::forceUpdate( Widget w )
if ( !w ) if ( !w )
return; return;
XtAppContext cxt=XtWidgetToApplicationContext( w ); XtAppContext cxt=XtWidgetToApplicationContext( w );
for (diashell=w;!XtIsShell(diashell);diashell=XtParent(diashell)); for (diashell=w;
for ( topshell=diashell;XtIsTopLevelShell( topshell ); !XtIsShell(diashell);
topshell = XtParent( topshell ) ); diashell=XtParent(diashell))
;
for ( topshell=diashell;
XtIsTopLevelShell( topshell );
topshell = XtParent( topshell ) )
;
// if (XtIsRealized(diashell) && XtIsRealized(topshell)){ // if (XtIsRealized(diashell) && XtIsRealized(topshell)){
dpy=XtDisplay(diashell); dpy=XtDisplay(diashell);

View file

@ -2050,8 +2050,8 @@ DtMail::MailRc::expand(char *name)
close(pivec[1]); close(pivec[1]);
l = read(pivec[0], xname, LINESIZE); l = read(pivec[0], xname, LINESIZE);
close(pivec[0]); close(pivec[0]);
while (wait(&s) != pid); while (wait(&s) != pid)
; ;
s &= 0377; s &= 0377;
if (s != 0 && s != SIGPIPE) { if (s != 0 && s != SIGPIPE) {
fprintf(stderr, "Echo failed\n"); fprintf(stderr, "Echo failed\n");

View file

@ -789,8 +789,9 @@ DtMailServer::retrieve_messages(DtMailEnv &error)
if (ok != DTME_MailServerAccess_SocketIOError) if (ok != DTME_MailServerAccess_SocketIOError)
if (ok == DTME_NoError) if (ok == DTME_NoError)
ok = ptrans_quit(); ok = ptrans_quit();
else else {
(void) ptrans_quit(); (void) ptrans_quit();
}
vtalarm_setitimer(0); vtalarm_setitimer(0);
SockClose(_sockfp); SockClose(_sockfp);
_sockfp = NULL; _sockfp = NULL;

View file

@ -280,7 +280,7 @@ PrintSetupDestroy(PrintSetup *pSetup)
if (pSetup->docName) if (pSetup->docName)
free(pSetup->docName); free(pSetup->docName);
if (pSetup->dtprintSetup); if (pSetup->dtprintSetup)
_psReleasePrintSetupDialog(pSetup); _psReleasePrintSetupDialog(pSetup);
XtFree((char*) pSetup); XtFree((char*) pSetup);
} }