From fe24d04c6483292efc629c4542d61f514fb33ba4 Mon Sep 17 00:00:00 2001 From: das Date: Sun, 27 Jan 2002 11:10:47 +0000 Subject: * generic/tkFileFilter.c: * mac/tkMacInit.c: * mac/tkMacKeyboard.c: * mac/tkMacMenus.c: TIP 27 CONSTification induced changes --- ChangeLog | 7 +++++++ generic/tkFileFilter.c | 20 ++++++++++---------- mac/tkMacInit.c | 10 ++++++---- mac/tkMacKeyboard.c | 5 +++-- mac/tkMacMenus.c | 4 ++-- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42a6b4b..0b632ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-01-27 Daniel Steffen + + * generic/tkFileFilter.c: + * mac/tkMacInit.c: + * mac/tkMacKeyboard.c: + * mac/tkMacMenus.c: TIP 27 CONSTification induced changes + 2002-01-25 Don Porter * All changes below are Patch 505159 diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index b9bebd7..319065f 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFileFilter.c,v 1.4 2000/07/06 03:17:43 mo Exp $ + * RCS: @(#) $Id: tkFileFilter.c,v 1.5 2002/01/27 11:10:50 das Exp $ */ #include "tkInt.h" @@ -17,7 +17,7 @@ static int AddClause _ANSI_ARGS_(( Tcl_Interp * interp, FileFilter * filterPtr, - char * patternsStr, char * ostypesStr, + CONST char * patternsStr, CONST char * ostypesStr, int isWindows)); static void FreeClauses _ANSI_ARGS_((FileFilter * filterPtr)); static void FreeGlobPatterns _ANSI_ARGS_(( @@ -25,7 +25,7 @@ static void FreeGlobPatterns _ANSI_ARGS_(( static void FreeMacFileTypes _ANSI_ARGS_(( FileFilterClause * clausePtr)); static FileFilter * GetFilter _ANSI_ARGS_((FileFilterList * flistPtr, - char * name)); + CONST char * name)); /* *---------------------------------------------------------------------- @@ -86,8 +86,8 @@ TkGetFileFilters(interp, flistPtr, string, isWindows) int isWindows; /* True if we are running on Windows. */ { int listArgc; - char ** listArgv = NULL; - char ** typeInfo = NULL; + CONST char ** listArgv = NULL; + CONST char ** typeInfo = NULL; int code = TCL_OK; int i; @@ -206,16 +206,16 @@ TkFreeFileFilters(flistPtr) static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows) Tcl_Interp * interp; /* Interpreter to use for error reporting. */ FileFilter * filterPtr; /* Stores the new filter clause */ - char * patternsStr; /* A TCL list of glob patterns. */ - char * ostypesStr; /* A TCL list of Mac OSType strings. */ + CONST char * patternsStr; /* A TCL list of glob patterns. */ + CONST char * ostypesStr; /* A TCL list of Mac OSType strings. */ int isWindows; /* True if we are running on Windows; False * if we are running on the Mac; Glob * patterns need to be processed differently * on these two platforms */ { - char ** globList = NULL; + CONST char ** globList = NULL; int globCount; - char ** ostypeList = NULL; + CONST char ** ostypeList = NULL; int ostypeCount; FileFilterClause * clausePtr; int i; @@ -358,7 +358,7 @@ static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows) static FileFilter * GetFilter(flistPtr, name) FileFilterList * flistPtr; /* The FileFilterList that contains the * newly created filter */ - char * name; /* Name of the filter. It is usually displayed + CONST char * name; /* Name of the filter. It is usually displayed * in the "File Types" listbox in the file * dialogs. */ { diff --git a/mac/tkMacInit.c b/mac/tkMacInit.c index e461073..277bbc6 100644 --- a/mac/tkMacInit.c +++ b/mac/tkMacInit.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacInit.c,v 1.6 2002/01/25 21:09:37 dgp Exp $ + * RCS: @(#) $Id: tkMacInit.c,v 1.7 2002/01/27 11:10:53 das Exp $ */ #include @@ -170,6 +170,7 @@ TkpGetAppName( { int argc; CONST char **argv = NULL, *name, *p; + int nameLength = -1; Handle h = NULL; h = GetNamedResource('STR ', "\pTk App Name"); @@ -188,16 +189,17 @@ TkpGetAppName( name = argv[argc-1]; p = strrchr(name, '.'); if (p != NULL) { - *p = '\0'; + nameLength = p - name; } } else { name = NULL; } } - if ((name == NULL) || (*name == 0)) { + if ((name == NULL) || (*name == 0) || (nameLength == 0)) { name = "tk"; + nameLength = -1; } - Tcl_DStringAppend(namePtr, name, -1); + Tcl_DStringAppend(namePtr, name, nameLength); if (argv != NULL) { ckfree((char *)argv); } diff --git a/mac/tkMacKeyboard.c b/mac/tkMacKeyboard.c index 9039625..def5b19 100644 --- a/mac/tkMacKeyboard.c +++ b/mac/tkMacKeyboard.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacKeyboard.c,v 1.6 2000/04/17 02:16:58 jingham Exp $ + * RCS: @(#) $Id: tkMacKeyboard.c,v 1.7 2002/01/27 11:10:57 das Exp $ */ #include "tkInt.h" @@ -247,7 +247,8 @@ TkpGetString( len = 0; } } - return Tcl_ExternalToUtfDString(NULL, string, len, dsPtr); + Tcl_ExternalToUtfDString(NULL, string, len, dsPtr); + return Tcl_DStringValue(dsPtr); } /* diff --git a/mac/tkMacMenus.c b/mac/tkMacMenus.c index ca17f1d..8114daf 100644 --- a/mac/tkMacMenus.c +++ b/mac/tkMacMenus.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacMenus.c,v 1.7 2001/11/23 02:06:11 das Exp $ + * RCS: @(#) $Id: tkMacMenus.c,v 1.8 2002/01/27 11:11:02 das Exp $ */ #include "tcl.h" @@ -330,7 +330,7 @@ static void SourceDialog() { int result; - char *path; + CONST char *path; char openCmd[] = "tk_getOpenFile -filetypes {\ {{TCL Scripts} {.tcl} TEXT} {{Text Files} {} TEXT}}"; -- cgit v0.12