diff --git a/dos/pdcclip.c b/dos/pdcclip.c index 32403779..34b051f9 100644 --- a/dos/pdcclip.c +++ b/dos/pdcclip.c @@ -16,7 +16,7 @@ #include #include -RCSID("$Id: pdcclip.c,v 1.25 2006/10/15 02:42:25 wmcbrine Exp $"); +RCSID("$Id: pdcclip.c,v 1.26 2006/11/05 05:37:40 wmcbrine Exp $"); /* global clipboard contents, should be NULL if none set */ @@ -54,7 +54,7 @@ int PDC_getclipboard(char **contents, long *length) PDC_LOG(("PDC_getclipboard() - called\n")); - if (pdc_DOS_clipboard == NULL) + if (!pdc_DOS_clipboard) return PDC_CLIP_EMPTY; len = strlen(pdc_DOS_clipboard); @@ -93,13 +93,13 @@ int PDC_setclipboard(const char *contents, long length) { PDC_LOG(("PDC_setclipboard() - called\n")); - if (pdc_DOS_clipboard != NULL) + if (pdc_DOS_clipboard) { free(pdc_DOS_clipboard); pdc_DOS_clipboard = NULL; } - if (contents != NULL) + if (contents) { if ((pdc_DOS_clipboard = malloc(length + 1)) == NULL) return PDC_CLIP_MEMORY_ERROR; @@ -134,7 +134,7 @@ int PDC_freeclipboard(char *contents) /* should we also free empty the system clipboard? probably not */ - if (contents != NULL) + if (contents) { /* NOTE: We free the memory, but we can not set caller's pointer to NULL, so if caller calls again then will @@ -174,7 +174,7 @@ int PDC_clearclipboard(void) { PDC_LOG(("PDC_clearclipboard() - called\n")); - if (pdc_DOS_clipboard != NULL) + if (pdc_DOS_clipboard) { free(pdc_DOS_clipboard); pdc_DOS_clipboard = NULL; diff --git a/dos/pdcgetsc.c b/dos/pdcgetsc.c index b6fea606..ef2dd601 100644 --- a/dos/pdcgetsc.c +++ b/dos/pdcgetsc.c @@ -15,7 +15,7 @@ #include -RCSID("$Id: pdcgetsc.c,v 1.34 2006/10/15 02:42:25 wmcbrine Exp $"); +RCSID("$Id: pdcgetsc.c,v 1.35 2006/11/05 05:37:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -140,7 +140,7 @@ int PDC_get_cursor_mode(void) int PDC_get_rows(void) { - char *env_rows; + const char *env_rows; int rows; PDC_LOG(("PDC_get_rows() - called\n")); @@ -149,14 +149,14 @@ int PDC_get_rows(void) /* and use the minimum of LINES and *ROWS. MH 18-Jun-92 */ rows = getdosmembyte(0x484) + 1; - env_rows = (char *)getenv("LINES"); + env_rows = getenv("LINES"); - if (env_rows != (char *)NULL) + if (env_rows) rows = min(atoi(env_rows), rows); - if ((rows == 1) && (pdc_adapter == _MDS_GENIUS)) + if (rows == 1 && pdc_adapter == _MDS_GENIUS) rows = 66; - if ((rows == 1) && (pdc_adapter == _MDA)) + if (rows == 1 && pdc_adapter == _MDA) rows = 25; if (rows == 1) diff --git a/dos/pdcscrn.c b/dos/pdcscrn.c index 30573124..cb4d0b37 100644 --- a/dos/pdcscrn.c +++ b/dos/pdcscrn.c @@ -20,7 +20,7 @@ # include #endif -RCSID("$Id: pdcscrn.c,v 1.66 2006/10/28 13:26:01 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.67 2006/11/05 05:37:40 wmcbrine Exp $"); int pdc_adapter; /* screen type */ int pdc_scrnmode; /* default screen mode */ @@ -470,7 +470,7 @@ void PDC_scr_close(void) #endif PDC_LOG(("PDC_scr_close() - called\n")); - if ((getenv("PDC_RESTORE_SCREEN") != NULL) && (saved_screen != NULL)) + if (getenv("PDC_RESTORE_SCREEN") && saved_screen) { #ifdef __DJGPP__ dosmemput(saved_screen, saved_lines * saved_cols * 2, @@ -566,12 +566,12 @@ int PDC_scr_open(int argc, char **argv) int10() BIOS calls are used in place of direct video memory access. */ - if (getenv("PDCURSES_BIOS") != NULL) + if (getenv("PDCURSES_BIOS")) pdc_direct_video = FALSE; /* This code for preserving the current screen. */ - if (getenv("PDC_RESTORE_SCREEN") != NULL) + if (getenv("PDC_RESTORE_SCREEN")) { saved_lines = SP->lines; saved_cols = SP->cols; diff --git a/os2/pdcgetsc.c b/os2/pdcgetsc.c index be5c0c17..c4f7c476 100644 --- a/os2/pdcgetsc.c +++ b/os2/pdcgetsc.c @@ -13,7 +13,7 @@ #include "pdcos2.h" -RCSID("$Id: pdcgetsc.c,v 1.31 2006/10/15 02:42:25 wmcbrine Exp $"); +RCSID("$Id: pdcgetsc.c,v 1.32 2006/11/05 05:37:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -79,7 +79,7 @@ int PDC_get_columns(void) VIOMODEINFO modeInfo = {0}; #endif int cols = 0; - char *env_cols = NULL; + const char *env_cols; PDC_LOG(("PDC_get_columns() - called\n")); @@ -90,9 +90,9 @@ int PDC_get_columns(void) VioGetMode(&modeInfo, 0); cols = modeInfo.col; #endif - env_cols = (char *)getenv("COLS"); + env_cols = getenv("COLS"); - if (env_cols != (char *)NULL) + if (env_cols) cols = min(atoi(env_cols), cols); PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols)); @@ -157,7 +157,7 @@ int PDC_get_rows(void) VIOMODEINFO modeInfo = {0}; #endif int rows = 0; - char *env_rows = NULL; + const char *env_rows; PDC_LOG(("PDC_get_rows() - called\n")); @@ -171,9 +171,9 @@ int PDC_get_rows(void) VioGetMode(&modeInfo, 0); rows = modeInfo.row; #endif - env_rows = (char *)getenv("LINES"); + env_rows = getenv("LINES"); - if (env_rows != (char *)NULL) + if (env_rows) rows = min(atoi(env_rows), rows); PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows)); diff --git a/os2/pdcscrn.c b/os2/pdcscrn.c index 1385376d..e691a2e7 100644 --- a/os2/pdcscrn.c +++ b/os2/pdcscrn.c @@ -13,7 +13,7 @@ #include "pdcos2.h" -RCSID("$Id: pdcscrn.c,v 1.57 2006/10/18 23:09:16 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.58 2006/11/05 05:37:40 wmcbrine Exp $"); int pdc_font; /* default font size */ @@ -94,7 +94,7 @@ void PDC_scr_close(void) if (DosScanEnv("PDC_RESTORE_SCREEN", (PSZ *)&ptr)) ptr = NULL; #endif - if ((ptr != NULL) && (saved_screen != NULL)) + if (ptr && saved_screen) { #ifdef EMXVIDEO v_putline(saved_screen, 0, 0, saved_lines * saved_cols); diff --git a/win32/pdcclip.c b/win32/pdcclip.c index 150b25af..095e5eb3 100644 --- a/win32/pdcclip.c +++ b/win32/pdcclip.c @@ -13,7 +13,7 @@ #include "pdcwin.h" -RCSID("$Id: pdcclip.c,v 1.20 2006/10/15 02:42:26 wmcbrine Exp $"); +RCSID("$Id: pdcclip.c,v 1.21 2006/11/05 05:37:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -49,12 +49,10 @@ int PDC_getclipboard(char **contents, long *length) PDC_LOG(("PDC_getclipboard() - called\n")); - if (OpenClipboard(NULL) == 0) + if (!OpenClipboard(NULL)) return PDC_CLIP_ACCESS_ERROR; - handle = GetClipboardData(CF_TEXT); - - if (handle == NULL) + if ((handle = GetClipboardData(CF_TEXT)) == NULL) { CloseClipboard(); return PDC_CLIP_EMPTY; @@ -104,7 +102,7 @@ int PDC_setclipboard(const char *contents, long length) PDC_LOG(("PDC_setclipboard() - called\n")); - if (OpenClipboard(NULL) == 0) + if (!OpenClipboard(NULL)) return PDC_CLIP_ACCESS_ERROR; ptr1 = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, @@ -119,7 +117,7 @@ int PDC_setclipboard(const char *contents, long length) GlobalUnlock(ptr1); EmptyClipboard(); - if (SetClipboardData(CF_TEXT, ptr1) == NULL) + if (!SetClipboardData(CF_TEXT, ptr1)) { GlobalFree(ptr1); return PDC_CLIP_ACCESS_ERROR; diff --git a/win32/pdcscrn.c b/win32/pdcscrn.c index b017fe32..5c4ed7e5 100644 --- a/win32/pdcscrn.c +++ b/win32/pdcscrn.c @@ -13,7 +13,7 @@ #include "pdcwin.h" -RCSID("$Id: pdcscrn.c,v 1.68 2006/10/18 23:09:16 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.69 2006/11/05 05:37:40 wmcbrine Exp $"); #define PDC_RESTORE_NONE 0 #define PDC_RESTORE_BUFFER 1 @@ -354,7 +354,7 @@ int PDC_scr_open(int argc, char **argv) SP->_restore = PDC_RESTORE_NONE; - if (getenv("PDC_RESTORE_SCREEN") != NULL) + if (getenv("PDC_RESTORE_SCREEN")) { /* Attempt to save the complete console buffer */ diff --git a/x11/pdcscrn.c b/x11/pdcscrn.c index fc680c91..efa269d5 100644 --- a/x11/pdcscrn.c +++ b/x11/pdcscrn.c @@ -13,7 +13,7 @@ #include "pdcx11.h" -RCSID("$Id: pdcscrn.c,v 1.45 2006/10/18 23:09:16 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.46 2006/11/05 05:37:40 wmcbrine Exp $"); /*man-start************************************************************** @@ -66,7 +66,7 @@ int PDC_scr_open(int argc, char **argv) PDC_LOG(("PDC_scr_open() - called\n")); - if ((XCursesInitscr(argc, argv) == ERR) || (SP == (SCREEN *)NULL)) + if ((XCursesInitscr(argc, argv) == ERR) || !SP) return ERR; SP->cursrow = SP->curscol = 0; diff --git a/x11/pdcx11.c b/x11/pdcx11.c index 958b2a57..5d144139 100644 --- a/x11/pdcx11.c +++ b/x11/pdcx11.c @@ -15,7 +15,7 @@ #include -RCSID("$Id: pdcx11.c,v 1.87 2006/10/15 02:42:26 wmcbrine Exp $"); +RCSID("$Id: pdcx11.c,v 1.88 2006/11/05 05:37:40 wmcbrine Exp $"); /*** Functions that are called by both processes ***/ @@ -239,7 +239,7 @@ int XCursesInitscr(int argc, char *argv[]) XC_LOG(("XCursesInitscr() - called\n")); #if defined FOREIGN - if (setlocale(LC_ALL, "") == NULL) + if (!setlocale(LC_ALL, "")) { fprintf(stderr, "ERROR: cannot set locale\n"); return ERR; @@ -251,7 +251,7 @@ int XCursesInitscr(int argc, char *argv[]) return ERR; } - if (XSetLocaleModifiers("") == NULL) + if (!XSetLocaleModifiers("")) fprintf(stderr, "WARNING: Cannot set locale modifiers\n"); #endif shmkeySP = getpid(); diff --git a/x11/x11.c b/x11/x11.c index d626adf1..c6e07ee9 100644 --- a/x11/x11.c +++ b/x11/x11.c @@ -28,7 +28,7 @@ #include #include -RCSID("$Id: x11.c,v 1.28 2006/10/28 13:26:01 wmcbrine Exp $"); +RCSID("$Id: x11.c,v 1.29 2006/11/05 05:37:40 wmcbrine Exp $"); #ifndef XPOINTER_TYPEDEFED typedef char * XPointer; @@ -661,7 +661,7 @@ static Atom XA_UTF8_STRING(Display *dpy) { static AtomPtr p = NULL; - if (p == NULL) + if (!p) p = XmuMakeAtom("UTF8_STRING"); return XmuInternAtom(dpy, p); @@ -1029,7 +1029,7 @@ static void GetIcon(void) XFree((char *)icon_size); #ifdef HAVE_XPM_H - if (strcmp(xc_app_data.pixmap, "") != 0) /* supplied pixmap */ + if (xc_app_data.pixmap && xc_app_data.pixmap[0]) /* supplied pixmap */ { XpmReadFileToPixmap(XtDisplay(topLevel), RootWindowOfScreen(XtScreen(topLevel)), @@ -1039,7 +1039,7 @@ static void GetIcon(void) } #endif - if (strcmp(xc_app_data.bitmap, "") != 0) /* supplied bitmap */ + if (xc_app_data.bitmap && xc_app_data.bitmap[0]) /* supplied bitmap */ { int x_hot = 0, y_hot = 0; @@ -1558,7 +1558,7 @@ static void RequestorCallbackForPaste(Widget w, XtPointer data, XC_LOG(("RequestorCallbackForPaste() - called\n")); - if ((value == NULL) && (*length == 0)) + if (!string) return; for (i = 0; i < (*length); i++) @@ -2080,7 +2080,7 @@ static void SendKeyToCurses(unsigned long key, MOUSE_STATUS *ms) ExitProcess(1, SIGKILL, "exiting from SendKeyToCurses"); } - if (ms != NULL) + if (ms) { MOUSE_LOG(("%s:writing mouse stuff\n", XCLOGMSG)); @@ -2557,14 +2557,14 @@ static void ExitProcess(int rc, int sig, char *msg) shmctl(shmidSP, IPC_RMID, 0); shmctl(shmid_Xcurscr, IPC_RMID, 0); - if (bitmap_file != NULL) + if (bitmap_file) { XFreePixmap(XCURSESDISPLAY, icon_bitmap); free(bitmap_file); } #ifdef HAVE_XPM_H - if (pixmap_file != NULL) + if (pixmap_file) { XFreePixmap(XCURSESDISPLAY, icon_pixmap); XFreePixmap(XCURSESDISPLAY, icon_pixmap_mask); @@ -2978,7 +2978,7 @@ int XCursesSetupX(int argc, char *argv[]) /* Exit if no DISPLAY variable set */ - if (getenv("DISPLAY") == NULL) + if (!getenv("DISPLAY")) { fprintf(stderr, "Error: no DISPLAY variable set\n"); kill(xc_otherpid, SIGKILL); @@ -3035,8 +3035,7 @@ int XCursesSetupX(int argc, char *argv[]) GetIcon(); #ifdef HAVE_XPM_H - if (xc_app_data.pixmap != NULL && - strcmp(xc_app_data.pixmap, "") != 0) + if (xc_app_data.pixmap && xc_app_data.pixmap[0]) XtVaSetValues(topLevel, XtNminWidth, minwidth, XtNminHeight, minheight, XtNbaseWidth, xc_app_data.borderWidth * 2, XtNbaseHeight, xc_app_data.borderWidth * 2, @@ -3378,7 +3377,7 @@ static void RequestorCallbackForGetSelection(Widget w, XtPointer data, { XC_LOG(("RequestorCallbackForGetSelection() - called\n")); - if ((value == NULL) && (*length == 0)) + if (!value && !(*length)) { if (XC_write_display_socket_int(PDC_CLIP_EMPTY) >= 0) return;