nsgmls: resolve coverity warnings related to uninitialed members in C++ classes
[oweals/cde.git] / cde / programs / dtcreate / icon_selection_dialog.c
index f88b352299bdf8021b5fac439589a7388b82e324..c0bff51f4ce97d8546e8938d05bab58561978966 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
+ */
 /* $XConsortium: icon_selection_dialog.c /main/10 1996/10/15 13:39:13 rswiston $ */
 /*******************************************************************************
         icon_selection_dialog.c
@@ -28,6 +50,7 @@
 #include <Xm/Form.h>
 #include <Xm/RowColumn.h>
 #include <Xm/MessageB.h>
+#include <Xm/XmPrivate.h> /* XmeFlushIconFileCache */
 #include <X11/cursorfont.h>
 
 #include <Dt/Icon.h>
@@ -37,6 +60,8 @@
 #include "cmncbs.h"
 #include "cmnrtns.h"
 #include "cmnutils.h"
+#include "fileio.h"
+#include "ErrorDialog.h"
 
 /*******************************************************************************
        Includes, Defines, and Global variables from the Declarations Editor:
@@ -765,7 +790,7 @@ void  update_container_contents (char *filter)
     XmeFlushIconFileCache(NULL);
 
     for (lcv = 0; lcv < count; lcv++) {
-       sprintf (iconfile, "%s%s", path, filelist[lcv]->d_name);
+       snprintf(iconfile, sizeof(iconfile), "%s%s", path, filelist[lcv]->d_name);
        ptr = strstr(filelist[lcv]->d_name, ".m.");
        if (ptr) {
           *ptr = '\0';
@@ -788,7 +813,7 @@ void  update_container_contents (char *filter)
   /* This is the empty directory case                               */
   /******************************************************************/
   } else {
-       strcpy(iconfile, GETMESSAGE(11, 60, "[Empty]"));
+       snprintf(iconfile, sizeof(iconfile), "%s", GETMESSAGE(11, 60, "[Empty]"));
        xmstring = XmStringCreateLocalized(iconfile);
        XtVaSetValues ((Widget) icons_in_container[0],
                              XmNstring,        xmstring,
@@ -816,6 +841,7 @@ void  update_container_contents (char *filter)
   }
 
   XtManageChild (icon_scrolled_container);
+  free(path);
   return;
 
 }
@@ -1013,7 +1039,7 @@ void display_nofindicon_message (Widget parent)
 
   /*********  WARNING - this needs to be translated !!! ***********/
   strcpy(buffer, "There is no set of icons with that filename in the icon folders.\n");
-  strcat(buffer, "Move the icons into one of the icon folers, then select \"Name OK\".\n");
+  strcat(buffer, "Move the icons into one of the icon folders, then select \"Name OK\".\n");
   strcat(buffer, "Or, to select a different set of icons, select \"Change Name\".\n");
   strcat(buffer, "\nIf you are a software developer creating a registration package,\n");
   strcat(buffer, "ignore this message and select \"Name OK\".");
@@ -1236,6 +1262,7 @@ static  void    defaultActionCB_dir_scrolled_list( Widget UxWidget,
     filter = (char *)XmStringToText (listcb->item);
     apply_filter (filter);
  /* XtManageChild (icon_scrolled_win);  */
+    free(filter);
   }
   UxIcon_selection_dialogContext = UxSaveCtx;
 }
@@ -1293,7 +1320,7 @@ void    resizeCB_clipWindow( Widget UxWidget,
   Widget     widvScrollbar;
   Widget     widRowColumn;
   int        increment;
-  Dimension  height;
+  XtArgVal /* Dimension */  height;
 
   XtVaGetValues(XtParent(UxWidget), XmNverticalScrollBar, &widvScrollbar, NULL);
   widRowColumn = (Widget)UxClientData;
@@ -1757,7 +1784,7 @@ static Widget   _Uxbuild_icon_selection_dialog(void)
                         XmNleftWidget, icon_container_label,
                         XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET,
                         XmNbottomOffset, 10,
-                        XmNbottomWidget, XmATTACH_NONE,
+                        XmNbottomWidget, None,
                         XmNbottomAttachment, XmATTACH_WIDGET,
                         NULL );