nsgmls: resolve coverity warnings related to uninitialed members in C++ classes
[oweals/cde.git] / cde / programs / dtcreate / ca_aux.c
index a495675d7fb65a0be8d6e992d04e2ab4fcdcb4fd..29f5ebaa6ff2b26a7ba10cb6f55991b4bc982b28 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: ca_aux.c /main/10 1999/09/17 15:44:00 mgreess $ */
 /******************************************************************************/
 /*                                                                            */
 #include <Dt/IconFile.h>
 
 #include "dtcreate.h"
+#include "af_aux.h"
 #include "ca_aux.h"
-#include "cmnutils.h"
+#include "cmncbs.h"
 #include "cmnrtns.h"
+#include "cmnutils.h"
 #include "CreateActionAppShell.h"
 #include "Confirmed.h"
+#include "ErrorDialog.h"
+#include "FileCharacteristics.h"
+
+/* from main.c */
+extern void RemoveTmpIconFiles( void );
 
 /******************************************************************************/
 /*                                                                            */
 /*  External Variables                                                        */
 /*                                                                            */
 /******************************************************************************/
-extern Dimension wintypeheight, winheight, xprtheight, newheight;
+extern XtArgVal /* Dimension */ wintypeheight, winheight, xprtheight, newheight;
 
 /******************************************************************************/
 /*                                                                            */
@@ -630,7 +659,7 @@ void activateCB_FileQuit (Widget wid, XtPointer cdata,
 void activateCB_ExpertOption (Widget wid, XtPointer client_data,
                               XtPointer *cbs)
 {
-  Dimension  ca_width;
+  XtArgVal /* Dimension */  ca_width;
 
   if (!XtIsManaged(XprtOptionForm)) {
      /**********************************************************************/
@@ -806,7 +835,8 @@ void activateCB_action_icon (Widget wid, XtPointer client_data,
     printf("DblClick icon callback.\n");
 #endif
 
-    activateCB_edit_icon(wid, CA_ACTION_ICONS, cbs);
+    activateCB_edit_icon(wid, (XtPointer)CA_ACTION_ICONS,
+               (XmPushButtonCallbackStruct *)cbs /* unused anyway */);
 
   }
   return;
@@ -827,6 +857,7 @@ void activateCB_add_filetype (Widget wid, XtPointer client_data,
   char         *ptr;
   char          tmpbuf[50];
   char        *pre, *suf, *title;
+  size_t       len;
 
   if (!CreateActionAppShellCheckFields()) {
 
@@ -871,8 +902,9 @@ void activateCB_add_filetype (Widget wid, XtPointer client_data,
 
     pre = GETMESSAGE(3, 10, "Create Action");
     suf = GETMESSAGE(7, 10, "Add Datatype");
-    title = XtMalloc(strlen(pre) + strlen(suf) + 2);
-    sprintf(title, "%s - %s", pre, suf);
+    len = strlen(pre) + strlen(suf) + 4;
+    title = XtMalloc(len);
+    snprintf(title,len - 1,"%s - %s", pre, suf);
 
     XtVaSetValues (AddFiletype,
                    RES_CONVERT (XmNdialogTitle, title ),
@@ -902,11 +934,13 @@ void activateCB_edit_filetype (Widget wid, XtPointer client_data,
   int          selecteditem;
   char         *msgPtr1, *msgPtr2, *fmtPtr, *errPtr;
   char        *pre, *suf, *title;
+  size_t len;
 
   pre = GETMESSAGE(3, 10, "Create Action");
   suf = GETMESSAGE(7, 11, "Edit Datatype");
-  title = XtMalloc(strlen(pre) + strlen(suf) + 2);
-  sprintf(title, "%s - %s", pre, suf);
+  len = strlen(pre) + strlen(suf) + 4;
+  title = XtMalloc(len);
+  snprintf(title,len - 1, "%s - %s", pre, suf);
 
   /**************************************************************************/
   /* Determine the selected list item.                                      */
@@ -937,9 +971,10 @@ void activateCB_edit_filetype (Widget wid, XtPointer client_data,
      msgPtr2 = XtNewString(GETMESSAGE(5, 130,
                  "Please select the Datatype you would like to Edit."));
      fmtPtr = "%s\n%s";
-     errPtr = XtMalloc((strlen(msgPtr1) + strlen(msgPtr2) +
-                       strlen(fmtPtr) + 1) * sizeof(char));
-     sprintf(errPtr, fmtPtr, msgPtr1, msgPtr2);
+     len = (strlen(msgPtr1) + strlen(msgPtr2) +
+             strlen(fmtPtr) + 3);
+     errPtr = XtMalloc(len);
+     snprintf(errPtr,len - 1, fmtPtr, msgPtr1, msgPtr2);
      XtFree(msgPtr2);
      XtFree(msgPtr1);
      display_error_message(CreateActionAppShell, errPtr);