X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=cde%2Fprograms%2Fdtcreate%2FCreateActionAppShell.c;h=cb30aef652ea3d07807528a2df7caaee86ad5cad;hb=aa1bfc0ab33ff7b8863a3623c599c015263bf1d2;hp=a325f7695e322e8cc8acb881dc5fe5ce318a373d;hpb=83b6996daa2c5ae22fc2b69093814cb08314954a;p=oweals%2Fcde.git diff --git a/cde/programs/dtcreate/CreateActionAppShell.c b/cde/programs/dtcreate/CreateActionAppShell.c index a325f769..cb30aef6 100644 --- a/cde/programs/dtcreate/CreateActionAppShell.c +++ b/cde/programs/dtcreate/CreateActionAppShell.c @@ -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 libraries and programs; if not, write + * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth + * Floor, Boston, MA 02110-1301 USA + */ /* $TOG: CreateActionAppShell.c /main/11 1998/10/26 17:17:50 mgreess $ */ /******************************************************************************* CreateActionAppShell.c @@ -33,15 +55,21 @@ #include #include +#include
#include
#include
+#include
+#include
#include "dtcreate.h" #include "UxXt.h" +#include "af_aux.h" #include "ca_aux.h" #include "cmncbs.h" #include "cmnrtns.h" +#include "fileio.h" #include "Confirmed.h" +#include "ErrorDialog.h" #define CONTEXT_MACRO_ACCESS 1 #include "CreateActionAppShell.h" @@ -51,7 +79,7 @@ Includes, Defines, and Global variables from the Declarations Editor: *******************************************************************************/ -Dimension winheight, xprtheight, newheight, wintypeheight; +XtArgVal /* Dimension */ winheight, xprtheight, newheight, wintypeheight; Widget FileTypes; /******************************************************************************* @@ -148,7 +176,7 @@ static void CreateFiles(void) DbInitDone = TRUE; } DtActionInvoke(UxTopLevel, "ReloadActions", - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + NULL, 0, NULL, NULL, NULL, 0, NULL, NULL); _DtTurnOffHourGlass(CreateActionAppShell); @@ -221,7 +249,7 @@ void activateCB_CA_MB_FileSave(Widget UxWidget, { ushort usRc = 0; - char *pszActionFile; + char *pszActionFile = NULL; char *msgPtr, *bufPtr; Boolean bHaveError = FALSE; struct stat statbuf; @@ -291,7 +319,6 @@ What do you want to do?"; "Cancel Save", questionCB_CancelSave, (char *)NULL, (XtCallbackProc)NULL); XtFree(bufPtr); - XtFree(pszActionFile); bHaveError = True; } @@ -309,6 +336,8 @@ What do you want to do?"; } } + + XtFree(pszActionFile); } static void activateCB_CA_FiletypesDelete( Widget UxWidget, @@ -323,6 +352,7 @@ static void activateCB_CA_FiletypesDelete( Widget UxWidget, int cnt; Boolean bFound; char *msgPtr1, *msgPtr2, *fmtPtr, *errPtr; + size_t len; /**************************************************************************/ /* Determine the filetypes to delete and delete them. */ @@ -389,9 +419,9 @@ static void activateCB_CA_FiletypesDelete( Widget UxWidget, msgPtr2 = XtNewString(GETMESSAGE(5, 125, "Please select the Datatype you would like to Delete.")); 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) + 2); + errPtr = XtMalloc(len); + snprintf(errPtr,len - 1, fmtPtr, msgPtr1, msgPtr2); XtFree(msgPtr2); XtFree(msgPtr1); display_error_message(CreateActionAppShell, errPtr); @@ -461,7 +491,7 @@ static void activateCB_WindowTypeOptionMenu( Widget UxWidget, XtPointer UxCallbackArg) { AD.fsFlags &= (~(CA_WT_XWINDOWS | CA_WT_TERM | CA_WT_PERMTERM)); - switch ((int)UxClientData) { + switch ((int)(XtArgVal)UxClientData) { case CA_WT_XWINDOWS : AD.fsFlags |= CA_WT_XWINDOWS; break; @@ -493,7 +523,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) Widget CA_WindowType_Pane; Widget CA_WindowType_OptionMenu; char mnemonic[2]; - Dimension dim1, dim2; + XtArgVal /* Dimension */ dim1, dim2; Widget CA_MED_IconForm, CA_TINY_IconForm, CA_LRG_IconForm; IconData *pIconData; @@ -511,7 +541,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) _UxParent = UxTopLevel; } - strcpy(titleBuf, GETMESSAGE(3, 10, "Create Action")); + snprintf(titleBuf, sizeof(titleBuf), "%s", GETMESSAGE(3, 10, "Create Action")); CreateActionAppShell = XtVaCreatePopupShell( "CreateActionAppShell", applicationShellWidgetClass, _UxParent, @@ -595,7 +625,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* mnemonic = GETMESSAGE(2, 21, "N"); */ - strcpy(mnemonic, GETMESSAGE(2, 21, "N")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 21, "N")); CA_MB_FileNew = XtVaCreateManagedWidget( "CA_MB_FileNew", xmPushButtonWidgetClass, CA_MB_FileOption, @@ -610,7 +640,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* mnemonic = GETMESSAGE(2, 16, "O"); */ - strcpy(mnemonic, GETMESSAGE(2, 16, "O")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 16, "O")); CA_MB_FileOpen = XtVaCreateManagedWidget( "CA_MB_FileOpen", xmPushButtonWidgetClass, CA_MB_FileOption, @@ -625,7 +655,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* mnemonic = GETMESSAGE(2, 26, "S"); */ - strcpy(mnemonic, GETMESSAGE(2, 26, "S")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 26, "S")); CA_MB_FileSave = XtVaCreateManagedWidget( "CA_MB_FileSave", xmPushButtonWidgetClass, CA_MB_FileOption, @@ -646,7 +676,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* mnemonic = GETMESSAGE(2, 31, "x"); */ - strcpy(mnemonic, GETMESSAGE(2, 31, "x")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 31, "x")); CA_MB_FileExit = XtVaCreateManagedWidget( "CA_MB_FileExit", xmPushButtonWidgetClass, CA_MB_FileOption, @@ -661,7 +691,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* mnemonic = GETMESSAGE(2, 11, "F"); */ - strcpy(mnemonic, GETMESSAGE(2, 11, "F")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 11, "F")); CA_MB_FileTop = XtVaCreateManagedWidget( "CA_MB_FileTop", xmCascadeButtonWidgetClass, CA_MenuBar, @@ -688,7 +718,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* * Creation of CA_MB_HelpOverview */ - strcpy(mnemonic, GETMESSAGE(2, 61, "v")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 61, "v")); CA_MB_HelpOverview = XtVaCreateManagedWidget( "CA_MB_HelpOverview", xmPushButtonWidgetClass, CA_MB_HelpOption, @@ -703,7 +733,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* * Creation of CA_MB_HelpTasks */ - strcpy(mnemonic, GETMESSAGE(2, 71, "T")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 71, "T")); CA_MB_HelpTasks = XtVaCreateManagedWidget( "CA_MB_HelpTasks", xmPushButtonWidgetClass, CA_MB_HelpOption, @@ -720,7 +750,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* mnemonic = GETMESSAGE(2, 66, "T"); */ - strcpy(mnemonic, GETMESSAGE(2, 66, "T")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 66, "T")); CA_MB_HelpTOC = XtVaCreateManagedWidget( "CA_MB_HelpTOC", xmPushButtonWidgetClass, CA_MB_HelpOption, @@ -732,7 +762,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* * Creation of CA_MB_HelpReference */ - strcpy(mnemonic, GETMESSAGE(2, 76, "R")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 76, "R")); CA_MB_HelpReference = XtVaCreateManagedWidget( "CA_MB_HelpReference", xmPushButtonWidgetClass, CA_MB_HelpOption, @@ -755,7 +785,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* * Creation of CA_MB_HelpUsing */ - strcpy(mnemonic, GETMESSAGE(2, 81, "U")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 81, "U")); CA_MB_HelpUsing = XtVaCreateManagedWidget( "CA_MB_HelpUsing", xmPushButtonWidgetClass, CA_MB_HelpOption, @@ -778,7 +808,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* * Creation of CA_MB_HelpAbout */ - strcpy(mnemonic, GETMESSAGE(2, 86, "A")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 86, "A")); CA_MB_HelpAbout = XtVaCreateManagedWidget( "CA_MB_HelpAbout", xmPushButtonWidgetClass, CA_MB_HelpOption, @@ -793,7 +823,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* * Creation of CA_MB_HelpTop */ - strcpy(mnemonic, GETMESSAGE(2, 54, "H")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 54, "H")); CA_MB_HelpTop = XtVaCreateManagedWidget( "CA_MB_HelpTop", xmCascadeButtonWidgetClass, CA_MenuBar, @@ -819,7 +849,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) NULL ); /* Creation of ColorMonoOption */ - strcpy(mnemonic, GETMESSAGE(2, 50, "M")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 50, "M")); ColorMonoOption = XtVaCreateManagedWidget( "ColorMonoOption", xmToggleButtonWidgetClass, CA_MB_OptionsOption, @@ -835,7 +865,7 @@ static Widget _Uxbuild_CreateActionAppShell(void) /* Creation of CA_MB_OptionTop */ - strcpy(mnemonic, GETMESSAGE(2, 36, "O")); + snprintf(mnemonic, sizeof(mnemonic), "%s", GETMESSAGE(2, 36, "O")); CA_MB_OptionTop = XtVaCreateManagedWidget( "CA_MB_OptionTop", xmCascadeButtonWidgetClass, CA_MenuBar, @@ -1693,7 +1723,7 @@ Widget create_applicationShell1(swidget _UxUxParent) do { ptr = strchr (workspaces, '*'); - if (ptr != NULL) *ptr = NULL; + if (ptr != NULL) *ptr = '\0'; workspace_atoms = (Atom *) XtRealloc ( (char *)workspace_atoms,