From 55539b71c143c7197c3fab6a491dc882d97cb65b Mon Sep 17 00:00:00 2001 From: Peter Howkins Date: Thu, 30 Aug 2012 17:48:26 +0100 Subject: [PATCH] dticon: Fix some warnings related to mixing NULL, 0 and '\0' randomly. --- cde/programs/dticon/event.c | 4 ++-- cde/programs/dticon/fileIO.c | 22 +++++++++++----------- cde/programs/dticon/help.c | 2 +- cde/programs/dticon/main.c | 2 +- cde/programs/dticon/process.c | 4 ++-- cde/programs/dticon/utils.c | 14 +++++++------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cde/programs/dticon/event.c b/cde/programs/dticon/event.c index 23d27c96..20ef5b12 100644 --- a/cde/programs/dticon/event.c +++ b/cde/programs/dticon/event.c @@ -550,7 +550,7 @@ Do_ButtonOp( min(tx, last_tx), min(ty, last_ty), abs(tx-last_tx), abs(ty-last_ty)); GraphicsOp = Backup_G_Op; - Backup_G_Op = NULL; + Backup_G_Op = 0; Pressed = False; } break; @@ -571,7 +571,7 @@ Do_ButtonOp( case S_HOTSPOT : case S_WAIT_RELEASE : GraphicsOp = Backup_G_Op; - Backup_G_Op = NULL; + Backup_G_Op = 0; break; case S_ROTATE : case S_SCALE_2 : diff --git a/cde/programs/dticon/fileIO.c b/cde/programs/dticon/fileIO.c index 4e3e80ff..ca03aa0c 100644 --- a/cde/programs/dticon/fileIO.c +++ b/cde/programs/dticon/fileIO.c @@ -132,9 +132,9 @@ Do_FileIO( if (debug) stat_out("Entering Do_FileIO\n"); #endif - pix_ret = NULL; - shape_ret = NULL; - mask_ret = NULL; + pix_ret = 0; + shape_ret = 0; + mask_ret = 0; /* get file name */ if (SaveMeNot){ @@ -294,9 +294,9 @@ Read_File( XmUpdateDisplay(mainWindow); - pix_ret = NULL; - shape_ret = NULL; - mask_ret = NULL; + pix_ret = 0; + shape_ret = 0; + mask_ret = 0; xpm_ReadAttribs.valuemask = READ_FLAGS; xpm_ReadAttribs.colorsymbols = colorSymbols; xpm_ReadAttribs.numsymbols = NUM_PENS; @@ -388,7 +388,7 @@ Read_File( /*** does a suffix exist? ***/ if (suffix) { strncpy(dummy, fname, ((suffix-fname)-1)); - dummy[(int) (suffix-fname)-1] = NULL; + dummy[(int) (suffix-fname)-1] = '\0'; strcat(dummy, "_m."); strcat(dummy, suffix); #ifdef DEBUG @@ -412,11 +412,11 @@ Read_File( if (status == BitmapSuccess) { if ((width_ret != mask_width_ret) || (height_ret != mask_height_ret)) { XFreePixmap(dpy, mask_ret); - mask_ret = NULL; + mask_ret = 0; } } else - mask_ret = NULL; + mask_ret = 0; } strcpy(last_fname, fname); @@ -517,7 +517,7 @@ Write_File( if (debug) Dump_AttribStruct(&xpm_WriteAttribs); #endif - status = _DtXpmWriteFileFromPixmap(dpy, fname, color_icon, NULL, + status = _DtXpmWriteFileFromPixmap(dpy, fname, color_icon, 0, &xpm_WriteAttribs); /******* @@ -550,7 +550,7 @@ Write_File( /*** THIRD, construct the mask filename ***/ if (suffix) { strncpy(dummy, fname, ((suffix-fname)-1)); - dummy[(int) (suffix-fname)-1] = NULL; + dummy[(int) (suffix-fname)-1] = '\0'; strcat(dummy, "_m."); strcat(dummy, suffix); } diff --git a/cde/programs/dticon/help.c b/cde/programs/dticon/help.c index 2dbeb32c..b27c8088 100644 --- a/cde/programs/dticon/help.c +++ b/cde/programs/dticon/help.c @@ -359,7 +359,7 @@ HelpOnItemCB( while (!XtIsSubclass(w, applicationShellWidgetClass)) w = XtParent(w); - status = DtHelpReturnSelectedWidgetId(w, NULL, &selWidget); + status = DtHelpReturnSelectedWidgetId(w, 0, &selWidget); /* NULL value for cursor, uses default cursor value. */ switch ((int)status) diff --git a/cde/programs/dticon/main.c b/cde/programs/dticon/main.c index e648d20c..381086c1 100644 --- a/cde/programs/dticon/main.c +++ b/cde/programs/dticon/main.c @@ -220,7 +220,7 @@ main( TopLevel = XtAppInitialize(&AppContext, CLASS_NAME, option_list, XtNumber(option_list), - &argc, argv, NULL, NULL, NULL); + &argc, argv, NULL, NULL, 0); XtGetApplicationResources(TopLevel, &xrdb, resources, XtNumber(resources), NULL, 0); diff --git a/cde/programs/dticon/process.c b/cde/programs/dticon/process.c index 0e807a1d..87c35eb3 100644 --- a/cde/programs/dticon/process.c +++ b/cde/programs/dticon/process.c @@ -216,7 +216,7 @@ Process_Save( void ) tmp2 = strchr(tmp1, c); strcpy(newName, tmp2); } - if (strncmp(newName, untitledStr, 8) == 0 || last_fname[0] == NULL) Process_SaveAs(); + if (strncmp(newName, untitledStr, 8) == 0 || last_fname[0] == '\0') Process_SaveAs(); else { if (SavedOnce == True) @@ -969,7 +969,7 @@ Do_Paste( GraphicsOp = Backup_G_Op; if (Backup_G_Op == SELECT) Start_HotBox(CONTINUE); - Backup_G_Op = NULL; + Backup_G_Op = 0; } XPutImage(dpy, color_icon, Color_gc, color_img, 0, 0, x, y, diff --git a/cde/programs/dticon/utils.c b/cde/programs/dticon/utils.c index 5ccde1d0..307aa0c2 100644 --- a/cde/programs/dticon/utils.c +++ b/cde/programs/dticon/utils.c @@ -333,7 +333,7 @@ Init_Editor( Position lx, ly; /*** window ID of tablet ***/ - tablet_win = NULL; + tablet_win = 0; /*** Nothing needs to be saved, yet ***/ Dirty = False; @@ -347,7 +347,7 @@ Init_Editor( pointCount = 0; /*** file I/O related globals ***/ - last_fname[0] = NULL; + last_fname[0] = '\0'; X_Hot = -1; Y_Hot = -1; @@ -1346,8 +1346,8 @@ Init_Icons( stat_out(" Init_Icons: color=%x mono=%x\n", color_icon, mono_icon); #endif - tmp_color = NULL; - tmp_mono = NULL; + tmp_color = 0; + tmp_mono = 0; /*** App. init or 'New Icon' ***/ if (!saveFlag) { @@ -1371,7 +1371,7 @@ Init_Icons( mono_icon = XCreatePixmap(dpy, root, width, height, DefaultDepth(dpy, screen)); - if ((color_icon == NULL) || (mono_icon == NULL)) + if ((color_icon == 0) || (mono_icon == 0)) Abort(GETSTR(10,50, "Cannot initialize application icon storage")); XSetForeground(dpy, scratch_gc, Transparent); @@ -2337,7 +2337,7 @@ SaveSession( void ) sprintf(bufr, "%s*y: %d\n", bufr, y); sprintf(bufr, "%s*width: %d\n", bufr, width); sprintf(bufr, "%s*height: %d\n", bufr, height); - if (last_fname[0] != NULL) + if (last_fname[0] != '\0') sprintf(bufr, "%s*file: %s\n", bufr, last_fname); write (fd, bufr, strlen(bufr)); @@ -2414,7 +2414,7 @@ GetSessionInfo( void ) /*** now get the information we want from the database ***/ /*** make sure values are at least somewhat reasonable ***/ - xrm_name[1] = NULL; + xrm_name[1] = '\0'; /* get x position */ xrm_name[0] = XrmStringToQuark ("x"); -- 2.25.1