nsgmls: resolve coverity warnings related to uninitialed members in C++ classes
[oweals/cde.git] / cde / programs / dtcreate / cmncbs.c
index 62107578995c0b5757bfb86477131ca6ac58457d..5046aeebfec774bc3312afb32197b2a5f3e87140 100644 (file)
@@ -1,3 +1,25 @@
+/*
+ * CDE - Common Desktop Environment
+ *
+ * Copyright (c) 1993-2012, The Open Group. All rights reserved.
+ *
+ * These libraries and programs are free software; you can
+ * redistribute them and/or modify them under the terms of the GNU
+ * Lesser General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * These libraries and programs are distributed in the hope that
+ * they will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with these librararies and programs; if not, write
+ * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ * Floor, Boston, MA 02110-1301 USA
+ */
 /* $TOG: cmncbs.c /main/8 1999/09/17 15:44:29 mgreess $ */
 /*****************************************************************************/
 /*                                                                           */
@@ -7,6 +29,7 @@
 /*                                                                           */
 /*****************************************************************************/
 #include <stdio.h>
+#include <sys/types.h>
 #include <sys/signal.h>
 #include <X11/cursorfont.h>
 
 #include "cmncbs.h"
 #include "cmnrtns.h"
 #include "CreateActionAppShell.h"
+#include "af_aux.h"
 #include "ca_aux.h"
 #include "icon_selection_dialog.h"
 
+/* from main.c */
+extern void UxDoEditPixmap(Widget wid, char *fname);
 
 /******************************************************************************/
 /* Initialize global values.                                                  */
@@ -46,7 +72,7 @@ void activateCB_open_FindSet (Widget find_set_button, XtPointer cdata,
                               XmFileSelectionBoxCallbackStruct *cbstruct)
 {
   Widget filter;
-  Boolean use_bm = False;
+  XtArgVal /* Boolean */ use_bm = False;
   static char *use_bm_filter = "*.m.bm";
   static char *use_pm_filter = "*.m.pm";
   char *search_path;
@@ -84,7 +110,7 @@ void activateCB_open_FindSet (Widget find_set_button, XtPointer cdata,
 
   pre = GETMESSAGE(3, 10, "Create Action");
   suf = GETMESSAGE(6, 18, "Find Set");
-  dialog_title = XtMalloc(strlen(pre) + strlen(suf) + 2);
+  dialog_title = XtMalloc(strlen(pre) + strlen(suf) + 4);
   sprintf(dialog_title, "%s - %s", pre, suf);
 
 #ifdef DEBUG
@@ -179,7 +205,7 @@ void activateCB_edit_icon (Widget wid, XtPointer client_data,
 
   if (bIconEditorDisplayed) return;
 
-  if ((int)client_data == CA_ACTION_ICONS) {
+  if ((int)(XtArgVal)client_data == CA_ACTION_ICONS) {
      IsActionIcons = True;
      widSelectedIcon = get_selected_action_icon();
      widEditSource = CreateActionAppShell;
@@ -198,6 +224,9 @@ void activateCB_edit_icon (Widget wid, XtPointer client_data,
   return;
 }
 
+/* We use this so we can reuse an open help dialog window. */
+static Widget  mainHelpDialog = NULL;
+
 /******************************************************************************/
 /*                                                                            */
 /* closeCB_mainHelpDialog                                                     */
@@ -212,6 +241,7 @@ void closeCB_mainHelpDialog(Widget wid, XtPointer client_data,
                            XtPointer *cbs)
 {
   XtDestroyWidget(wid);
+  mainHelpDialog = NULL;
 }
 
 /******************************************************************************/
@@ -226,7 +256,6 @@ void closeCB_mainHelpDialog(Widget wid, XtPointer client_data,
 /******************************************************************************/
 void DisplayHelpDialog(Widget wid, XtPointer client_data, XtPointer cbs)
 {
-  static Widget  mainHelpDialog = NULL;
   Widget  parent;
   int     i;
   Arg     args[10];
@@ -242,8 +271,7 @@ void DisplayHelpDialog(Widget wid, XtPointer client_data, XtPointer cbs)
   sprintf(pszTitle, "%s  -  %s", GETMESSAGE(3, 10, "Create Action"),
           GETMESSAGE(2, 53, "Help"));
   */
-  sprintf(pszTitle, "%s  -  ", GETMESSAGE(3, 10, "Create Action"));
-  strcat(pszTitle, GETMESSAGE(2, 53, "Help"));
+  snprintf(pszTitle, sizeof(pszTitle), "%s  -  %s", GETMESSAGE(3, 10, "Create Action"), GETMESSAGE(2, 53, "Help"));
   XtSetArg(args[i], XmNtitle, pszTitle); i++;
 
   /***********************************************************************/
@@ -253,7 +281,7 @@ void DisplayHelpDialog(Widget wid, XtPointer client_data, XtPointer cbs)
   XtSetArg(args[i], DtNhelpVolume, "CreatAct"); i++;
   XtSetArg(args[i], DtNlocationId, pszTopic); i++;
 
-  switch ((int)client_data) {
+  switch ((XtArgVal)client_data) {
      case HELP_OVERVIEW:
                          strcpy(pszTopic, "_hometopic");
                          break;