From bf399748adb5599f4dec35d856681a5ca10e58bd Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Sat, 20 Sep 2014 16:39:57 -0600 Subject: [PATCH] dtappbuilder/dtcodegen: Fix up some warnings, remove use of sys_errlist[]. Removed all the cases of sys_errlist[], no one should be using that today. Also, correct code generation so that declarations like 'Widget w = NULL; Pixmap p = NULL;' etc, aren't produced, which is wrong. Use '0', not NULL for these. This should also correct the 2 mis-definitions of Pixmap that commit 6a9327f2ab0bb09a681b86a45cf4a7bf9e9c28d4 attempted to fix in ttsnoop. dtappbuilder still needs a lot of work. --- .../dtappbuilder/src/ab/palette_stubs.c | 4 - cde/programs/dtappbuilder/src/ab/proj.c | 3 - .../dtappbuilder/src/ab/projP_utils.c | 7 +- cde/programs/dtappbuilder/src/ab/proj_utils.c | 12 +- cde/programs/dtappbuilder/src/ab/x_util.c | 2 +- .../dtappbuilder/src/abmf/lib_func_strings.c | 140 +++++++++--------- .../dtappbuilder/src/abmf/proj_c_file.c | 6 +- .../dtappbuilder/src/libABil/bil_loadfile.c | 5 +- .../dtappbuilder/src/libAButil/abio.c | 13 +- 9 files changed, 85 insertions(+), 107 deletions(-) diff --git a/cde/programs/dtappbuilder/src/ab/palette_stubs.c b/cde/programs/dtappbuilder/src/ab/palette_stubs.c index 5cd12c2c..8f40f0fa 100644 --- a/cde/programs/dtappbuilder/src/ab/palette_stubs.c +++ b/cde/programs/dtappbuilder/src/ab/palette_stubs.c @@ -140,10 +140,6 @@ static void register_palette_info( ** ** **************************************************************************/ -#if !defined(linux) && !defined(CSRG_BASED) -extern char *sys_errlist[]; -#endif - static Widget HelpDialog; diff --git a/cde/programs/dtappbuilder/src/ab/proj.c b/cde/programs/dtappbuilder/src/ab/proj.c index 975b6c09..bc93f8ac 100644 --- a/cde/programs/dtappbuilder/src/ab/proj.c +++ b/cde/programs/dtappbuilder/src/ab/proj.c @@ -228,9 +228,6 @@ static XtTranslations proj_transtbl = NULL; static XRectangle *rband_rect = NULL; static Boolean mselect_adjust = False; -#if !defined(linux) && !defined(CSRG_BASED) -extern char *sys_errlist[]; -#endif char Buf[MAXPATHLEN]; /* Work buffer */ /************************************************************************* diff --git a/cde/programs/dtappbuilder/src/ab/projP_utils.c b/cde/programs/dtappbuilder/src/ab/projP_utils.c index dae3c5e1..015bd25b 100644 --- a/cde/programs/dtappbuilder/src/ab/projP_utils.c +++ b/cde/programs/dtappbuilder/src/ab/projP_utils.c @@ -93,9 +93,6 @@ static void mult_module_selected( ** ** **************************************************************************/ -#if !defined(linux) && !defined(CSRG_BASED) -extern char *sys_errlist[]; -#endif char Buf[MAXPATHLEN]; /* Work buffer */ /************************************************************************* @@ -374,8 +371,8 @@ projP_save_export_bil( } else /* An error occurred with stat */ { - sprintf(Buf, "%s: %s", new_filename, sys_errlist[errno]); - util_printf_err(Buf); + sprintf(Buf, "%s: %s", new_filename, strerror(errno)); + util_printf_err(Buf); } XtUnmanageChild(AB_generic_chooser); } diff --git a/cde/programs/dtappbuilder/src/ab/proj_utils.c b/cde/programs/dtappbuilder/src/ab/proj_utils.c index 0a787f93..26e07808 100644 --- a/cde/programs/dtappbuilder/src/ab/proj_utils.c +++ b/cde/programs/dtappbuilder/src/ab/proj_utils.c @@ -180,10 +180,6 @@ static void notify_proj_save_as_okCB( ** ** **************************************************************************/ -#if !defined(linux) && !defined(CSRG_BASED) -extern char *sys_errlist[]; -#endif - /************************************************************************* ** ** ** Function Definitions ** @@ -1497,7 +1493,7 @@ proj_save_exploded( else /* An error occurred with stat */ { obj_set_name(project, old_name); - sprintf(Buf, "%s: %s", mod_exp_file, sys_errlist[errno]); + sprintf(Buf, "%s: %s", mod_exp_file, strerror(errno)); util_printf_err(Buf); if (old_name != NULL) util_free(old_name); if (old_file != NULL) util_free(old_file); @@ -1563,7 +1559,7 @@ proj_save_exploded( if ((iRet = util_mkdir_hier(dir)) < 0) { obj_set_name(project, old_name); - sprintf(Buf, "%s: %s", dir, sys_errlist[errno]); + sprintf(Buf, "%s: %s", dir, strerror(errno)); util_printf_err(Buf); if (rel_path) util_free(rel_path); if (old_name != NULL) util_free(old_name); @@ -2140,7 +2136,7 @@ save_proj_as_bix( } else /* An error occurred with stat */ { - sprintf(Buf, "%s: %s", bix_file, sys_errlist[errno]); + sprintf(Buf, "%s: %s", bix_file, strerror(errno)); xm_buf = XmStringCreateLocalized(Buf); dtb_proj_error_msg_initialize(&dtb_proj_error_msg); (void)dtb_show_modal_message(dtb_get_toplevel_widget(), @@ -2229,7 +2225,7 @@ export_uil_file( else { /* An error occurred in stat (inside util_file_exists()) */ - sprintf(Buf, "%s: %s", fullpath, sys_errlist[errno]); + sprintf(Buf, "%s: %s", fullpath, strerror(errno)); xm_buf = XmStringCreateLocalized(Buf); dtb_proj_error_msg_initialize(&dtb_proj_error_msg); (void)dtb_show_modal_message(dtb_get_toplevel_widget(), diff --git a/cde/programs/dtappbuilder/src/ab/x_util.c b/cde/programs/dtappbuilder/src/ab/x_util.c index cbda2609..c4632074 100644 --- a/cde/programs/dtappbuilder/src/ab/x_util.c +++ b/cde/programs/dtappbuilder/src/ab/x_util.c @@ -178,7 +178,7 @@ x_create_stencil_cursor( { if (util_get_verbosity() > 0) fprintf(stderr,"x_create_stencil_cursor: widget must be realized\n"); - return NULL; + return 0; } dpy = XtDisplay(widget); diff --git a/cde/programs/dtappbuilder/src/abmf/lib_func_strings.c b/cde/programs/dtappbuilder/src/abmf/lib_func_strings.c index dacf362b..1ccad9b7 100644 --- a/cde/programs/dtappbuilder/src/abmf/lib_func_strings.c +++ b/cde/programs/dtappbuilder/src/abmf/lib_func_strings.c @@ -94,7 +94,7 @@ static LibFuncRec abmfP_lrc_cvt_file_to_pixmap = ")\n" "{\n" "#define pixmapReturn (*pixmapReturnPtr)\n" - " Pixmap pixmap = NULL;\n" + " Pixmap pixmap = 0;\n" " Screen *screen = NULL;\n" " Pixel fgPixel = 0;\n" " Pixel bgPixel = 0;\n" @@ -123,21 +123,21 @@ static LibFuncRec abmfP_lrc_cvt_file_to_pixmap = " {\n" " pixmap = XmGetPixmap(screen, fileName, fgPixel, bgPixel);\n" " }\n" - " pixmap_found = ((pixmap != NULL) && (pixmap != XmUNSPECIFIED_PIXMAP));\n" + " pixmap_found = ((pixmap != 0) && (pixmap != XmUNSPECIFIED_PIXMAP));\n" "\n" " if (!pixmap_found)\n" " {\n" " sprintf(image_path, \"%s/%s\", dtb_get_exe_dir(), fileName);\n" " pixmap = XmGetPixmap(screen, image_path, fgPixel, bgPixel);\n" " }\n" - " pixmap_found = ((pixmap != NULL) && (pixmap != XmUNSPECIFIED_PIXMAP));\n" + " pixmap_found = ((pixmap != 0) && (pixmap != XmUNSPECIFIED_PIXMAP));\n" "\n" " if (!pixmap_found)\n" " {\n" " sprintf(image_path, \"%s/bitmaps/%s\", dtb_get_exe_dir(), fileName);\n" " pixmap = XmGetPixmap(screen, image_path, fgPixel, bgPixel);\n" " }\n" - " pixmap_found = ((pixmap != NULL) && (pixmap != XmUNSPECIFIED_PIXMAP));\n" + " pixmap_found = ((pixmap != 0) && (pixmap != XmUNSPECIFIED_PIXMAP));\n" "\n" " if (!pixmap_found)\n" " {\n" @@ -196,8 +196,8 @@ static LibFuncRec abmfP_lrc_create_greyed_pixmap = "\n" " dpy = XtDisplayOfObject(widget);\n" "\n" - " if(pixmap == XmUNSPECIFIED_PIXMAP || pixmap == (Pixmap)NULL) {\n" - " return((Pixmap)NULL);\n" + " if(pixmap == XmUNSPECIFIED_PIXMAP || pixmap == 0) {\n" + " return(0);\n" " }\n" "\n" " XtVaGetValues(widget,\n" @@ -206,7 +206,7 @@ static LibFuncRec abmfP_lrc_create_greyed_pixmap = "\n" " /* Get width/height of source pixmap */\n" " if (!XGetGeometry(dpy,pixmap,&root,&x,&y,&width,&height,&bw,&depth)) {\n" - " return((Pixmap)NULL);\n" + " return((Pixmap)0);\n" " }\n" " gcv.foreground = background;\n" " gcv.fill_style = FillStippled;\n" @@ -245,7 +245,7 @@ static LibFuncRec abmfP_lrc_set_label_pixmaps = "/*\n" " * Sets the label and insensitive label pixmaps of the widget. \n" " *\n" - " * If either (or both) pixmap is NULL, it is ignored.\n" + " * If either (or both) pixmap is 0, it is ignored.\n" " */\n" "int\n" "dtb_set_label_pixmaps(\n" @@ -254,8 +254,8 @@ static LibFuncRec abmfP_lrc_set_label_pixmaps = " Pixmap labelInsensitivePixmap\n" ")\n" "{\n" - " if ( (widget == NULL)\n" - " || ((labelPixmap == NULL) && (labelInsensitivePixmap == NULL)) )\n" + " if ( (widget == 0)\n" + " || ((labelPixmap == 0) && (labelInsensitivePixmap == 0)) )\n" " {\n" " return -1;\n" " }\n" @@ -391,7 +391,7 @@ static LibFuncRec abmfP_lrc_cvt_image_file_to_pixmap = ")\n" "{\n" " int rc = 0; /* return code */\n" - " Pixmap tmpPixmap = NULL;\n" + " Pixmap tmpPixmap = 0;\n" " int depth;\n" "\n" " if (dtb_file_has_extension(fileName, \"pm\") ||\n" @@ -431,7 +431,7 @@ static LibFuncRec abmfP_lrc_cvt_image_file_to_pixmap = "\n" " if (rc < 0)\n" " {\n" - " *pixmap = NULL;\n" + " *pixmap = 0;\n" " return rc;\n" " }\n" "\n" @@ -468,8 +468,8 @@ static LibFuncRec abmfP_lrc_set_label_from_image_file = ")\n" "{\n" " int rc = 0; /* return code */\n" - " Pixmap labelPixmap = NULL;\n" - " Pixmap insensitivePixmap = NULL;\n" + " Pixmap labelPixmap = 0;\n" + " Pixmap insensitivePixmap = 0;\n" " int depth;\n" "\n" " rc = dtb_cvt_image_file_to_pixmap(widget, fileName, &labelPixmap);\n" @@ -520,13 +520,13 @@ static LibFuncRec abmfP_lrc_set_label_from_bitmap_data = "{\n" " Display *display = NULL;\n" " Screen *screen = NULL;\n" - " Drawable window = NULL;\n" + " Drawable window = 0;\n" " long bgPixel = 0;\n" " long fgPixel = 0;\n" " unsigned int depth = 0;\n" - " Pixmap labelPixmap = NULL;\n" + " Pixmap labelPixmap = 0;\n" "\n" - " if ( (widget == NULL)\n" + " if ( (widget == 0)\n" " || (width < 1)\n" " || (height < 1)\n" " || (bitmapData == NULL) )\n" @@ -545,7 +545,7 @@ static LibFuncRec abmfP_lrc_set_label_from_bitmap_data = " display = XtDisplay(widget);\n" " screen = XtScreen(widget);\n" " window = XtWindow(widget);\n" - " if (window == NULL)\n" + " if (window == 0)\n" " {\n" " /* Widget has not been realized, yet */\n" " window = RootWindowOfScreen(screen);\n" @@ -571,12 +571,12 @@ static LibFuncRec abmfP_lrc_set_label_from_bitmap_data = " width, height,\n" " fgPixel, bgPixel,\n" " depth);\n" - " if (labelPixmap == NULL)\n" + " if (labelPixmap == 0)\n" " {\n" " return -1;\n" " }\n" "\n" - " dtb_set_label_pixmaps(widget, labelPixmap, NULL);\n" + " dtb_set_label_pixmaps(widget, labelPixmap, 0);\n" "\n" " return 0;\n" "}" @@ -610,10 +610,10 @@ static LibFuncRec abmfP_lrc_set_label_from_xpm_data = " int status = 0;\n" " Display *display = NULL;\n" " Screen *screen = NULL;\n" - " Drawable window = NULL;\n" - " Pixmap labelPixmap = NULL;\n" + " Drawable window = 0;\n" + " Pixmap labelPixmap = 0;\n" "\n" - " if ( (widget == NULL)\n" + " if ( (widget == 0)\n" " || (xpmData == NULL) )\n" " {\n" " return -1;\n" @@ -622,7 +622,7 @@ static LibFuncRec abmfP_lrc_set_label_from_xpm_data = " display = XtDisplay(widget);\n" " screen = XtScreen(widget);\n" " window = XtWindow(widget);\n" - " if (window == NULL)\n" + " if (window == 0)\n" " {\n" " /* Widget has not been realized, yet */\n" " window = RootWindowOfScreen(screen);\n" @@ -638,7 +638,7 @@ static LibFuncRec abmfP_lrc_set_label_from_xpm_data = " if (status != XpmSuccess)\n" " return -1;\n" "\n" - " dtb_set_label_pixmaps(widget, labelPixmap, NULL);\n" + " dtb_set_label_pixmaps(widget, labelPixmap, 0);\n" "\n" " return 0;\n" "}" @@ -771,7 +771,7 @@ static LibFuncRec abmfP_lrc_save_toplevel_widget = "** Routines to save and access the toplevel widget for an application.\n" "** This is useful in dtb_ convenience functions, and also probably by\n" "** developers in routines they provide in their _stubs.c files.\n" - "** static Widget dtb_project_toplevel_widget = (Widget) NULL;\n" + "** static Widget dtb_project_toplevel_widget = (Widget) 0;\n" "*/\n" "void\n" "dtb_save_toplevel_widget(\n" @@ -830,7 +830,7 @@ static LibFuncRec abmfP_lrc_remove_sash_focus = " WidgetList children;\n" " int numChildren, i;\n" "\n" - " if (widget == NULL || !XtIsSubclass(widget, xmPanedWindowWidgetClass))\n" + " if (widget == 0 || !XtIsSubclass(widget, xmPanedWindowWidgetClass))\n" " return;\n" "\n" " XtVaGetValues(widget,\n" @@ -940,7 +940,7 @@ static LibFuncRec abmfP_lrc_help_dispatch = " Arg wargs[10];\n" " char buffer[100];\n" " Widget back_button;\n" - " static Widget Quick_help_dialog = (Widget)NULL;\n" + " static Widget Quick_help_dialog = (Widget)0;\n" " static Widget MoreButton;\n" "\n" " /* \n" @@ -969,7 +969,7 @@ static LibFuncRec abmfP_lrc_help_dispatch = " ** its internal stack mechanism takes repeated settings as separate items\n" " ** and updates the stack for each.)\n" " */\n" - " if(Quick_help_dialog == (Widget)NULL) {\n" + " if(Quick_help_dialog == (Widget)0) {\n" " /* Create shared help dialog */\n" " i = 0;\n" " XtSetArg(wargs[i],XmNtitle, \"Application Help\"); i++;\n" @@ -1119,7 +1119,7 @@ static LibFuncRec abmfP_lrc_more_help_dispatch = " Arg wargs[10];\n" " String buffer, vol, loc;\n" " char *cp;\n" - " static Widget GeneralHelpDialog = (Widget) NULL;\n" + " static Widget GeneralHelpDialog = (Widget) 0;\n" " Widget help_dialog = (Widget)clientData;\n" " Widget more_button;\n" "\n" @@ -1139,7 +1139,7 @@ static LibFuncRec abmfP_lrc_more_help_dispatch = " loc = cp; \n" " }\n" "\n" - " if(GeneralHelpDialog == (Widget)NULL) {\n" + " if(GeneralHelpDialog == (Widget)0) {\n" " /* Create General Help Dialog */\n" " i = 0;\n" " XtSetArg(wargs[i],XmNtitle, \"Application Help\"); i++;\n" @@ -1196,7 +1196,7 @@ static LibFuncRec abmfP_lrc_do_onitem_help = " ** for one that has an XmNhelpCallback, and call the first one we\n" " ** find.\n" " */\n" - " while(target != (Widget)NULL) {\n" + " while(target != (Widget)0) {\n" " if( XtHasCallbacks(target,XmNhelpCallback) == XtCallbackHasSome) {\n" " XtCallCallbacks(target,XmNhelpCallback,(XtPointer)NULL);\n" " return;\n" @@ -1238,9 +1238,9 @@ static LibFuncRec abmfP_lrc_show_help_volume_info = "{\n" " int i;\n" " Arg wargs[10];\n" - " static Widget GeneralHelpDialog = (Widget) NULL;\n" + " static Widget GeneralHelpDialog = (Widget)0;\n" " \n" - " if(GeneralHelpDialog == (Widget)NULL) {\n" + " if(GeneralHelpDialog == (Widget)0) {\n" " /* Create General Help Dialog */\n" " i = 0;\n" " XtSetArg(wargs[i],XmNtitle, \"Application Help\"); i++;\n" @@ -1646,10 +1646,10 @@ static LibFuncRec abmfP_lrc_create_message_dlg = " DtbObjectHelpData override_help\n" ")\n" "{\n" - " Widget msg_dlg = (Widget) NULL;\n" - " Widget shell = (Widget) NULL;\n" - " Widget button = (Widget) NULL;\n" - " Widget action_button = (Widget) NULL;\n" + " Widget msg_dlg = (Widget) 0;\n" + " Widget shell = (Widget) 0;\n" + " Widget button = (Widget) 0;\n" + " Widget action_button = (Widget) 0;\n" " unsigned char default_btn = XmDIALOG_NONE;\n" " Arg arg[12];\n" " int n = 0;\n" @@ -1759,7 +1759,7 @@ static LibFuncRec abmfP_lrc_create_message_dlg = " DTB_ACTION3_BUTTON);\n" " }\n" "\n" - " if (action_button != (Widget) NULL)\n" + " if (action_button != (Widget) 0)\n" " {\n" " XtVaSetValues(action_button, \n" " XmNdefaultButtonShadowThickness, 2,\n" @@ -1846,7 +1846,7 @@ static LibFuncRec abmfP_lrc_MessageBoxGetActionButton = "{\n" " int i, numChildren = 0;\n" " WidgetList children = NULL;\n" - " Widget action_button = NULL;\n" + " Widget action_button = 0;\n" " int button = -1;\n" " Boolean Found = False;\n" "\n" @@ -1898,8 +1898,8 @@ static LibFuncRec abmfP_lrc_show_message = ")\n" "{\n" " DtbObjectHelpData help_data_copy = (DtbObjectHelpData)NULL;\n" - " Widget msg_dlg = (Widget) NULL, \n" - " action_btn = (Widget) NULL;\n" + " Widget msg_dlg = (Widget) 0, \n" + " action_btn = (Widget) 0;\n" "\n" " if (override_help != (DtbObjectHelpData) NULL)\n" " {\n" @@ -1919,7 +1919,7 @@ static LibFuncRec abmfP_lrc_show_message = " msg_dlg = dtb_create_message_dlg(parent, \n" " mbr, override_msg, help_data_copy);\n" "\n" - " if (msg_dlg == (Widget) NULL)\n" + " if (msg_dlg == (Widget) 0)\n" " return;\n" "\n" " /* Add Callbacks if necessary */\n" @@ -1930,13 +1930,13 @@ static LibFuncRec abmfP_lrc_show_message = " if (mbr->action2_callback != (XtCallbackProc) NULL)\n" " {\n" " action_btn = dtb_MessageBoxGetActionButton(msg_dlg, DTB_ACTION2_BUTTON);\n" - " if (action_btn != NULL)\n" + " if (action_btn != 0)\n" " XtAddCallback(action_btn, XmNactivateCallback,\n" " mbr->action2_callback, NULL);\n" " }\n" " if (mbr->action3_callback != (XtCallbackProc) NULL)\n" " {\n" - " action_btn = dtb_MessageBoxGetActionButton(msg_dlg, DTB_ACTION3_BUTTON); if (action_btn != NULL)\n" + " action_btn = dtb_MessageBoxGetActionButton(msg_dlg, DTB_ACTION3_BUTTON); if (action_btn != 0)\n" " XtAddCallback(action_btn, XmNactivateCallback,\n" " mbr->action3_callback, NULL);\n" " }\n" @@ -1996,9 +1996,9 @@ static LibFuncRec abmfP_lrc_show_modal_message = ") \n" "{\n" " XtAppContext app;\n" - " Widget modal_dlg_pane = (Widget) NULL;\n" - " Widget action2_button = (Widget) NULL;\n" - " Widget action3_button = (Widget) NULL;\n" + " Widget modal_dlg_pane = (Widget) 0;\n" + " Widget action2_button = (Widget) 0;\n" + " Widget action3_button = (Widget) 0;\n" " DtbObjectHelpData help_data_copy = (DtbObjectHelpData)NULL;\n" " DTB_MODAL_ANSWER answer = DTB_ANSWER_NONE;\n" " XtCallbackRec ok_callback[] = {\n" @@ -2028,7 +2028,7 @@ static LibFuncRec abmfP_lrc_show_modal_message = " modal_dlg_pane = dtb_create_message_dlg(parent, mbr, \n" " override_msg, help_data_copy);\n" "\n" - " if (modal_dlg_pane == (Widget) NULL)\n" + " if (modal_dlg_pane == (Widget) 0)\n" " return (answer);\n" " \n" " XtVaSetValues(modal_dlg_pane,\n" @@ -2040,7 +2040,7 @@ static LibFuncRec abmfP_lrc_show_modal_message = "\n" " action2_button = dtb_MessageBoxGetActionButton(modal_dlg_pane,\n" " DTB_ACTION2_BUTTON);\n" - " if (action2_button != (Widget) NULL)\n" + " if (action2_button != (Widget) 0)\n" " {\n" " XtVaSetValues(action2_button,\n" " XmNuserData, (XtPointer) &answer,\n" @@ -2560,7 +2560,7 @@ static LibFuncRec abmfP_lrc_get_label_widget = ")\n" "{\n" " WidgetList children_list;\n" - " Widget label_widget = NULL;\n" + " Widget label_widget = 0;\n" " int i,\n" " num_children = 0;\n" " char *subobj_name = NULL,\n" @@ -2580,7 +2580,7 @@ static LibFuncRec abmfP_lrc_get_label_widget = " strcpy(underscore_ptr, \"_label\");\n" " label_widget = XtNameToWidget(widget, label_name);\n" " }\n" - " if (label_widget == NULL)\n" + " if (label_widget == 0)\n" " {\n" " strcpy(label_name+1, subobj_name);\n" " strcat(label_name, \"_label\");\n" @@ -2607,7 +2607,7 @@ static LibFuncRec abmfP_lrc_get_label_widget = " if (num_children > 0)\n" " return(get_label_widget(children_list[0]));\n" "\n" - " return (NULL);\n" + " return (0);\n" "}" }; /* abmfP_lrc_get_label_widget */ LibFunc abmfP_lib_get_label_widget = &(abmfP_lrc_get_label_widget); @@ -2634,7 +2634,7 @@ static LibFuncRec abmfP_lrc_get_offset_from_ancestor = ")\n" "{\n" " Widget cur = w;\n" - " Widget cur_parent = NULL;\n" + " Widget cur_parent = 0;\n" " Position offset = 0;\n" "\n" " if (!ancestor || !w || (w == ancestor))\n" @@ -2680,7 +2680,7 @@ static LibFuncRec abmfP_lrc_get_label_width = ")\n" "{\n" " WidgetList children_list;\n" - " Widget lbl_widget = NULL;\n" + " Widget lbl_widget = 0;\n" " Dimension lbl_width = 0;\n" "\n" " lbl_widget = get_label_widget(widget);\n" @@ -2728,7 +2728,7 @@ static LibFuncRec abmfP_lrc_get_widest_label = " Dimension *label_width\n" ")\n" "{\n" - " Widget cur_widest = NULL;\n" + " Widget cur_widest = 0;\n" " Dimension cur_width = 0;\n" " int i;\n" "\n" @@ -2776,7 +2776,7 @@ static LibFuncRec abmfP_lrc_get_widest_value = " Dimension *value_width\n" ")\n" "{\n" - " Widget cur_widest = NULL;\n" + " Widget cur_widest = 0;\n" " Dimension cur_width = 0;\n" " int i;\n" "\n" @@ -3040,7 +3040,7 @@ static LibFuncRec abmfP_lrc_get_group_child = "{\n" " DTB_GROUP_TYPES group_type;\n" " WidgetList children_list = NULL;\n" - " Widget ret_child = NULL;\n" + " Widget ret_child = 0;\n" " int num_children = 0,\n" " num_rows,\n" " num_columns,\n" @@ -3048,7 +3048,7 @@ static LibFuncRec abmfP_lrc_get_group_child = "\n" " if (!parent || !group_info || \n" " (x_pos < 0) || (y_pos < 0))\n" - " return (NULL);\n" + " return (0);\n" "\n" " group_type = group_info->group_type;\n" " num_rows = group_info->num_rows;\n" @@ -3063,7 +3063,7 @@ static LibFuncRec abmfP_lrc_get_group_child = " NULL);\n" "\n" " if (num_children <= 0)\n" - " return (NULL);\n" + " return (0);\n" "\n" " switch (group_type)\n" " {\n" @@ -3183,7 +3183,7 @@ static LibFuncRec abmfP_lrc_children_align = " group_info->num_cols = num_cols;\n" " group_info->hoffset = hoffset;\n" " group_info->voffset = voffset;\n" - " group_info->ref_widget = NULL;\n" + " group_info->ref_widget = 0;\n" "\n" " align_children(parent, group_info, True);\n" "\n" @@ -3903,10 +3903,10 @@ static LibFuncRec abmfP_lrc_align_labels = "{\n" " WidgetList children_list = NULL,\n" " one_col;\n" - " Widget previous_child = NULL,\n" + " Widget previous_child = 0,\n" " child,\n" " ref_widget,\n" - " previous_ref_widget = NULL;\n" + " previous_ref_widget = 0;\n" " Dimension ref_lbl_width = 0,\n" " max_label_width = 0,\n" " max_value_width = 0;\n" @@ -4140,7 +4140,7 @@ static LibFuncRec abmfP_lrc_align_top = ")\n" "{\n" " WidgetList children_list;\n" - " Widget previous_child = NULL,\n" + " Widget previous_child = 0,\n" " child,\n" " cur_child;\n" " int num_children = 0,\n" @@ -5352,7 +5352,7 @@ static LibFuncRec abmfP_lrc_popup_menu_register = " /* look for an empty slot */\n" " for (i = 0; i < numPopupMenus; ++i)\n" " {\n" - " if (popupMenus[i].widget == NULL)\n" + " if (popupMenus[i].widget == 0)\n" " {\n" " foundEntry = True;\n" " break;\n" @@ -5416,7 +5416,7 @@ static LibFuncRec abmfP_lrc_popup_menu = ")\n" "{\n" " int i = 0;\n" - " Widget menu = NULL;\n" + " Widget menu = 0;\n" "\n" " if (event->type == ButtonPress)\n" " {\n" @@ -5429,7 +5429,7 @@ static LibFuncRec abmfP_lrc_popup_menu = " }\n" " }\n" "\n" - " if (menu != NULL)\n" + " if (menu != 0)\n" " {\n" " XmMenuPosition(menu, (XButtonPressedEvent*)event);\n" " XtManageChild(menu);\n" @@ -5470,7 +5470,7 @@ static LibFuncRec abmfP_lrc_popup_menu_destroyCB = " if ( (popupMenus[i].widget == widget) \n" " || (popupMenus[i].menu == widget) )\n" " {\n" - " popupMenus[i].widget = NULL;\n" + " popupMenus[i].widget = 0;\n" " popupMenus[i].menu = NULL;\n" " break;\n" " }\n" @@ -5518,7 +5518,7 @@ static LibFuncRec abmfP_lrc_drag_site_register = ")\n" "{\n" " DtbDragSite dragSite = (DtbDragSite)XtCalloc(1,sizeof(DtbDragSiteRec));\n" - " Widget sourceIcon = NULL;\n" + " Widget sourceIcon = 0;\n" "\n" " if (dragSite != NULL)\n" " {\n" @@ -5527,7 +5527,7 @@ static LibFuncRec abmfP_lrc_drag_site_register = " dragSite->operations = operations;\n" " dragSite->bufferIsText = bufferIsText;\n" " dragSite->allowDropOnRootWindow = allowDropOnRootWindow;\n" - " if ((cursor != NULL) && (cursorMask != NULL))\n" + " if ((cursor != 0) && (cursorMask != 0))\n" " {\n" " dragSite->sourceIcon = \n" " DtDndCreateSourceIcon(widget, cursor, cursorMask);\n" diff --git a/cde/programs/dtappbuilder/src/abmf/proj_c_file.c b/cde/programs/dtappbuilder/src/abmf/proj_c_file.c index 517323e9..7b461970 100644 --- a/cde/programs/dtappbuilder/src/abmf/proj_c_file.c +++ b/cde/programs/dtappbuilder/src/abmf/proj_c_file.c @@ -542,7 +542,7 @@ write_main(GenCodeInfo genCodeInfo, ABObj project) /* * Local variables */ - abio_puts(codeFile, "Widget\t\ttoplevel = (Widget)NULL;\n"); + abio_puts(codeFile, "Widget\t\ttoplevel = 0;\n"); abio_puts(codeFile, "Display\t\t*display = (Display*)NULL;\n"); abio_puts(codeFile, "XtAppContext\tapp = (XtAppContext)NULL;\n"); abio_puts(codeFile, "String\t\t*fallback_resources = (String*)NULL;\n"); @@ -560,8 +560,8 @@ write_main(GenCodeInfo genCodeInfo, ABObj project) abmfP_icon_pixmap_var(genCodeInfo) = istr_const("icon_pixmap"); abmfP_icon_mask_pixmap_var(genCodeInfo) = istr_const("icon_mask_pixmap"); - abio_puts(codeFile, "Pixmap\ticon_pixmap = NULL;\n"); - abio_puts(codeFile, "Pixmap\ticon_mask_pixmap = NULL;\n"); + abio_puts(codeFile, "Pixmap\ticon_pixmap = 0;\n"); + abio_puts(codeFile, "Pixmap\ticon_mask_pixmap = 0;\n"); } abmfP_write_user_long_seg(genCodeInfo, diff --git a/cde/programs/dtappbuilder/src/libABil/bil_loadfile.c b/cde/programs/dtappbuilder/src/libABil/bil_loadfile.c index 3a82118f..89620fe6 100644 --- a/cde/programs/dtappbuilder/src/libABil/bil_loadfile.c +++ b/cde/programs/dtappbuilder/src/libABil/bil_loadfile.c @@ -61,9 +61,6 @@ BIL_LOAD_INFO bilP_load; char Buf[MAXPATHLEN]; -#if !defined(linux) && !defined(CSRG_BASED) -extern char *sys_errlist[]; -#endif /* * Read a BIL file into memory. Returns a project node. @@ -327,7 +324,7 @@ bil_load_file_and_resolve_all( util_get_file_name_from_path(path, fileName, MAXPATHLEN); if (chdir(dirName) != 0) { - util_printf_err("%s: %s\n", dirName, sys_errlist[errno]); + util_printf_err("%s: %s\n", dirName, strerror(errno)); return ERR; } } diff --git a/cde/programs/dtappbuilder/src/libAButil/abio.c b/cde/programs/dtappbuilder/src/libAButil/abio.c index a1486f6e..471d0828 100644 --- a/cde/programs/dtappbuilder/src/libAButil/abio.c +++ b/cde/programs/dtappbuilder/src/libAButil/abio.c @@ -115,10 +115,6 @@ static char Buf[MAXBSIZE]; /* work buffer */ /* * System error message definitions. */ -#if !defined(linux) -extern int sys_nerr; -extern STRING sys_errlist[]; -#endif /* * Internal function declarations. @@ -1080,8 +1076,7 @@ abio_open_bil_input(STRING name, int *pLinesRead, FILE ** pInFile) } else { - errmsg = sys_errlist[errno]; - sprintf(Buf, "%s: %s", name, errmsg); + sprintf(Buf, "%s: %s", name, strerror(errno)); errmsg = Buf; } @@ -1317,7 +1312,7 @@ abio_open_gil_input(STRING name, FILE ** pInFile) } else { - errmsg = sys_errlist[errno]; + errmsg = strerror(errno); } /* @@ -1431,7 +1426,7 @@ ERROR_EXIT: /* * Return a message if unsuccessful. */ - sprintf(Buf, "%s: %s", outfile, sys_errlist[errno]); + sprintf(Buf, "%s: %s", outfile, strerror(errno)); return Buf; #undef outFile } @@ -1493,7 +1488,7 @@ abio_open_output(STRING name, FILE ** pOutFile) return NULL; } - sprintf(Buf, "%s: %s", name, sys_errlist[errno]); + sprintf(Buf, "%s: %s", name, strerror(errno)); return Buf; #undef outFile } -- 2.25.1