head	1.13;
access;
symbols
	core-8-5-9:1.10.4.1
	core-8-5-8:1.10.4.1
	macosx-cocoa-merge:1.12
	macosx-cocoa-premerge:1.12
	macosx-carbon-freeze:1.12
	core-8-5-7:1.10.4.1
	core-8-5-6:1.10
	core-8-6-b1:1.12
	core-8-6-a3:1.11
	core-8-5-5:1.10
	core-8-6-a2:1.11
	core-8-5-4:1.10
	core-8-5-3:1.10
	core-8-6-a1:1.11
	core-8-4-19:1.5.2.2
	core-8-5-branch:1.10.0.4
	core-8-5-2:1.10
	core-8-4-18:1.5.2.2
	core-8-5-1:1.10
	core-8-4-17:1.5.2.2
	core-8-5-0:1.10
	core-8-5-b3:1.10
	core-8-5-b2:1.10
	core-8-4-16:1.5.2.2
	core-8-5-b1:1.10
	core-stablilizer-merge:1.10
	core-stabilizer-branch:1.10.0.2
	core-stabilizer-merge:1.10
	core-8-4-15:1.5.2.1
	core-8-5-a6:1.9
	core-8-5-a5:1.9
	core-8-4-14:1.5
	core-8-5-a4:1.9
	core-8-4-13:1.5
	core-8-4-12:1.5
	core-8-4-11:1.5
	core-8-5-a3:1.8
	core-8-4-10:1.5
	core-8-4-9-branch:1.5.0.6
	core-8-5-a2:1.5
	core-8-4-9:1.5
	core-8-4-8:1.5
	core-8-4-7:1.5
	core-8-5-a1:1.5
	core-8-4-6:1.5
	core-8-4-5:1.5
	mistachkin-dev-branch:1.5.0.4
	core-8-4-4:1.5
	core-8-4-3:1.5
	core-8-4-branch:1.5.0.2
	core-8-4-2:1.5
	core-8-4-1:1.5
	core-8-3-5:1.3.12.1
	core-8-4-0:1.5
	macosx-8-4-merge-2002-08-31-trunk:1.5
	macosx-8-4-premerge-2002-08-31-branch:1.4.6.1
	macosx-8-4-premerge-2002-08-31-trunk:1.5
	macosx-8-4-merge-2002-08-30-branch:1.4.6.1
	macosx-8-4-merge-2002-08-30-trunk:1.5
	macosx-8-4-merge-2002-08-20-branch:1.4.6.1
	macosx-8-4-merge-2002-08-20-trunk:1.5
	core-8-4-b2:1.5
	core-8-4-b1:1.5
	macosx-premerge-6-9-02:1.4.6.1
	core-8-4-a4:1.5
	core-8-3-4:1.3.12.1
	macosx-8-4-branch:1.4.0.6
	macosx-8-4-branchpoint:1.4
	core-8-4-a3:1.4
	core-8-3-3:1.3.12.1
	dgp-privates-into-namespace:1.4.0.4
	tclpro-1-5-0:1.3
	core-8-4-win-speedup:1.4.0.2
	core-8-4-a2:1.4
	tclpro-1-4-1:1.3
	tclpro-1-4-0:1.3
	core-8-3-2:1.3
	ajuba-ajuba2-2-1-base:1.3
	ajuba-ajuba2-2-0:1.3
	core-8-4-a1:1.3
	core-8-3-1-branch:1.3.0.12
	core-8-3-1:1.3
	scriptics-sc-2-0-b5:1.3
	scriptics-sc-2-0-fixed:1.3
	scriptics-sc-2-0-b2:1.3
	scriptics-sc-2-0-b1:1.3
	core-8-3-0:1.3
	core-8-3-b2:1.3
	core-8-3-b1:1.3
	scriptics-sc-1-1:1.3
	scriptics-sc-1-1-b1:1.3
	core-8-2-3:1.3
	scriptics-sc-1-1-branch:1.3.0.10
	scriptics-sc-1-1-base:1.3
	scriptics-sc-1-0:1.3
	scriptics-sc-1-0-branch:1.3.0.8
	scriptics-sc-1-0-base:1.3
	core-8-2-2:1.3
	core-8-2-1:1.3
	scriptics-bc-1-0-b1:1.3
	core-8-2-1-branch:1.3.0.6
	scriptics-tclpro-1-3-0:1.3
	core-8-2-0:1.3
	core-8-2-b3-branch:1.3.0.4
	core-8-2-b3-base:1.3
	scriptics-tclpro-1-3-b4:1.3
	core-8-2-b2:1.3
	scriptics-tclpro-1-3-b3:1.3
	core-8-2-b1:1.3
	scriptics-tclpro-1-3-b2:1.3
	merge-to-mainline-5/21/99:1.3
	scriptics-tclpro-1-3-b2-branch:1.3.0.2
	core-8-1-1:1.3
	scriptics-tclpro-1-3-b1:1.3
	core-8-1-1-base:1.3
	core-8-1-0:1.3
	merge-to-mainline-4-29-99:1.3
	merge-to-mainline-4-23-99:1.3
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.2
	core-8-1-b2:1.1.4.2
	dev-8-1-stubs-branch:1.1.4.2.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.2
	core-8-0-4:1.2
	core-8-1-a2:1.1.4.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@ * @;


1.13
date	2009.11.09.11.56.57;	author dkf;	state Exp;
branches;
next	1.12;

1.12
date	2008.12.07.16.34.12;	author das;	state Exp;
branches;
next	1.11;

1.11
date	2008.04.27.22.38.56;	author dkf;	state Exp;
branches;
next	1.10;

1.10
date	2007.05.09.12.51.30;	author das;	state Exp;
branches
	1.10.4.1;
next	1.9;

1.9
date	2005.11.04.11.52.50;	author dkf;	state Exp;
branches;
next	1.8;

1.8
date	2005.05.23.23.19.35;	author hobbs;	state Exp;
branches;
next	1.7;

1.7
date	2005.05.21.23.29.40;	author dkf;	state Exp;
branches;
next	1.6;

1.6
date	2004.12.20.10.34.20;	author vincentdarley;	state Exp;
branches;
next	1.5;

1.5
date	2002.01.27.11.10.50;	author das;	state Exp;
branches
	1.5.2.1;
next	1.4;

1.4
date	2000.07.06.03.17.43;	author mo;	state Exp;
branches
	1.4.2.1
	1.4.6.1;
next	1.3;

1.3
date	99.04.16.01.51.13;	author stanton;	state Exp;
branches
	1.3.12.1;
next	1.2;

1.2
date	98.09.14.18.23.10;	author stanton;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.51.56;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.29.00.25.17;	author stanton;	state Exp;
branches;
next	1.1.4.2;

1.1.4.2
date	98.09.30.02.16.55;	author stanton;	state Exp;
branches;
next	;

1.3.12.1
date	2001.04.04.07.57.16;	author hobbs;	state Exp;
branches;
next	;

1.4.2.1
date	2002.04.02.21.00.49;	author hobbs;	state Exp;
branches;
next	;

1.4.6.1
date	2002.02.05.02.25.15;	author wolfsuit;	state Exp;
branches;
next	;

1.5.2.1
date	2007.05.09.12.55.57;	author das;	state Exp;
branches;
next	1.5.2.2;

1.5.2.2
date	2007.05.30.06.37.41;	author das;	state Exp;
branches;
next	;

1.10.4.1
date	2009.03.03.23.54.11;	author patthoyts;	state Exp;
branches;
next	;


desc
@@


1.13
log
@Some code consolidation (don't scatter deletion code where unnecessary).
@
text
@/*
 * tkFileFilter.c --
 *
 *	Process the -filetypes option for the file dialogs on Windows and the
 *	Mac.
 *
 * Copyright (c) 1996 Sun Microsystems, Inc.
 *
 * 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.12 2008/12/07 16:34:12 das Exp $
 */

#include "tkInt.h"
#include "tkFileFilter.h"

static int		AddClause(Tcl_Interp *interp, FileFilter *filterPtr,
			    Tcl_Obj *patternsObj, Tcl_Obj *ostypesObj,
			    int isWindows);
static FileFilter *	GetFilter(FileFilterList *flistPtr, const char *name);

/*
 *----------------------------------------------------------------------
 *
 * TkInitFileFilters --
 *
 *	Initializes a FileFilterList data structure. A FileFilterList must be
 *	initialized EXACTLY ONCE before any calls to TkGetFileFilters() is
 *	made. The usual flow of control is:
 *		TkInitFileFilters(&flist);
 *		    TkGetFileFilters(&flist, ...);
 *		    TkGetFileFilters(&flist, ...);
 *		    ...
 *		TkFreeFileFilters(&flist);
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The fields in flistPtr are initialized.
 *
 *----------------------------------------------------------------------
 */

void
TkInitFileFilters(
    FileFilterList *flistPtr)	/* The structure to be initialized. */
{
    flistPtr->filters = NULL;
    flistPtr->filtersTail = NULL;
    flistPtr->numFilters = 0;
}

/*
 *----------------------------------------------------------------------
 *
 * TkGetFileFilters --
 *
 *	This function is called by the Mac and Windows implementation of
 *	tk_getOpenFile and tk_getSaveFile to translate the string value of the
 *	-filetypes option into an easy-to-parse C structure (flistPtr). The
 *	caller of this function will then use flistPtr to perform filetype
 *	matching in a platform specific way.
 *
 *	flistPtr must be initialized (See comments in TkInitFileFilters).
 *
 * Results:
 *	A standard TCL return value.
 *
 * Side effects:
 *	The fields in flistPtr are changed according to 'types'.
 *
 *----------------------------------------------------------------------
 */

int
TkGetFileFilters(
    Tcl_Interp *interp,		/* Interpreter to use for error reporting. */
    FileFilterList *flistPtr,	/* Stores the list of file filters. */
    Tcl_Obj *types,		/* Value of the -filetypes option. */
    int isWindows)		/* True if we are running on Windows. */
{
    int listObjc;
    Tcl_Obj ** listObjv = NULL;
    int i;

    if (types == NULL) {
	return TCL_OK;
    }

    if (Tcl_ListObjGetElements(interp, types, &listObjc,
	    &listObjv) != TCL_OK) {
	return TCL_ERROR;
    }
    if (listObjc == 0) {
	return TCL_OK;
    }

    /*
     * Free the filter information that have been allocated the previous time;
     * the -filefilters option may have been used more than once in the
     * command line.
     */

    TkFreeFileFilters(flistPtr);

    for (i = 0; i<listObjc; i++) {
	/*
	 * Each file type should have two or three elements: the first one is
	 * the name of the type and the second is the filter of the type. The
	 * third is the Mac OSType ID, but we don't care about them here.
	 */

	int count;
	FileFilter *filterPtr;
	Tcl_Obj **typeInfo;

	if (Tcl_ListObjGetElements(interp, listObjv[i], &count,
		&typeInfo) != TCL_OK) {
	    return TCL_ERROR;
	}

	if (count != 2 && count != 3) {
	    Tcl_AppendResult(interp, "bad file type \"",
		    Tcl_GetString(listObjv[i]), "\", ",
		    "should be \"typeName {extension ?extensions ...?} ",
		    "?{macType ?macTypes ...?}?\"", NULL);
	    return TCL_ERROR;
	}

	filterPtr = GetFilter(flistPtr, Tcl_GetString(typeInfo[0]));

	if (AddClause(interp, filterPtr, typeInfo[1],
		(count==2 ? NULL : typeInfo[2]), isWindows) != TCL_OK) {
	    return TCL_ERROR;
	}
    }

    return TCL_OK;
}

/*
 *----------------------------------------------------------------------
 *
 * TkFreeFileFilters --
 *
 *	Frees the malloc'ed file filter information.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The fields allocated by TkGetFileFilters() are freed.
 *
 *----------------------------------------------------------------------
 */

void
TkFreeFileFilters(
    FileFilterList *flistPtr)	/* List of file filters to free */
{
    FileFilter *filterPtr;
    FileFilterClause *clausePtr;
    GlobPattern *globPtr;
    MacFileType *mfPtr;
    register void *toFree;	/* A pointer that we are about to free. */

    for (filterPtr = flistPtr->filters; filterPtr != NULL; ) {
	for (clausePtr = filterPtr->clauses; clausePtr != NULL; ) {
	    /*
	     * Squelch each of the glob patterns.
	     */

	    for (globPtr = clausePtr->patterns; globPtr != NULL; ) {
		ckfree(globPtr->pattern);
		toFree = globPtr;
		globPtr = globPtr->next;
		ckfree(toFree);
	    }

	    /*
	     * Squelch each of the Mac file type codes.
	     */

	    for (mfPtr = clausePtr->macTypes; mfPtr != NULL; ) {
		toFree = mfPtr;
		mfPtr = mfPtr->next;
		ckfree(toFree);
	    }
	    toFree = clausePtr;
	    clausePtr = clausePtr->next;
	    ckfree(toFree);
	}

	/*
	 * Squelch the name of the filter and the overall structure.
	 */

	ckfree(filterPtr->name);
	toFree = filterPtr;
	filterPtr = filterPtr->next;
	ckfree(toFree);
    }
    flistPtr->filters = NULL;
}

/*
 *----------------------------------------------------------------------
 *
 * AddClause --
 *
 *	Add one FileFilterClause to filterPtr.
 *
 * Results:
 *	A standard TCL result.
 *
 * Side effects:
 *	The list of filter clauses are updated in filterPtr.
 *
 *----------------------------------------------------------------------
 */

static int
AddClause(
    Tcl_Interp *interp,		/* Interpreter to use for error reporting. */
    FileFilter *filterPtr,	/* Stores the new filter clause */
    Tcl_Obj *patternsObj,	/* A Tcl list of glob patterns. */
    Tcl_Obj *ostypesObj,	/* 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 */
{
    Tcl_Obj **globList = NULL, **ostypeList = NULL;
    int globCount, ostypeCount, i, code = TCL_OK;
    FileFilterClause *clausePtr;
    Tcl_Encoding macRoman = NULL;

    if (Tcl_ListObjGetElements(interp, patternsObj,
	    &globCount, &globList) != TCL_OK) {
	code = TCL_ERROR;
	goto done;
    }
    if (ostypesObj != NULL) {
	if (Tcl_ListObjGetElements(interp, ostypesObj,
		&ostypeCount, &ostypeList) != TCL_OK) {
	    code = TCL_ERROR;
	    goto done;
	}

	/*
	 * We probably need this encoding now...
	 */

	macRoman = Tcl_GetEncoding(NULL, "macRoman");

	/*
	 * Might be cleaner to use 'Tcl_GetOSTypeFromObj' but that is actually
	 * static to the MacOS X/Darwin version of Tcl, and would therefore
	 * require further code refactoring.
	 */

	for (i=0; i<ostypeCount; i++) {
	    int len;
	    const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);

	    /*
	     * If len is < 4, it is definitely an error. If equal or longer,
	     * we need to use the macRoman encoding to determine the correct
	     * length (assuming there may be non-ascii characters, e.g.,
	     * embedded nulls or accented characters in the string, the
	     * macRoman length will be different).
	     *
	     * If we couldn't load the encoding, then we can't actually check
	     * the correct length. But here we assume we're probably operating
	     * on unix/windows with a minimal set of encodings and so don't
	     * care about MacOS types. So we won't signal an error.
	     */

	    if (len >= 4 && macRoman != NULL) {
		Tcl_DString osTypeDS;

		/*
		 * Convert utf to macRoman, since MacOS types are defined to
		 * be 4 macRoman characters long
		 */

		Tcl_UtfToExternalDString(macRoman, strType, len, &osTypeDS);
		len = Tcl_DStringLength(&osTypeDS);
		Tcl_DStringFree(&osTypeDS);
	    }
	    if (len != 4) {
		Tcl_AppendResult(interp, "bad Macintosh file type \"",
			Tcl_GetString(ostypeList[i]), "\"", NULL);
		code = TCL_ERROR;
		goto done;
	    }
	}
    }

    /*
     * Add the clause into the list of clauses
     */

    clausePtr = (FileFilterClause *) ckalloc(sizeof(FileFilterClause));
    clausePtr->patterns = NULL;
    clausePtr->patternsTail = NULL;
    clausePtr->macTypes = NULL;
    clausePtr->macTypesTail = NULL;

    if (filterPtr->clauses == NULL) {
	filterPtr->clauses = filterPtr->clausesTail = clausePtr;
    } else {
	filterPtr->clausesTail->next = clausePtr;
	filterPtr->clausesTail = clausePtr;
    }
    clausePtr->next = NULL;

    if (globCount > 0 && globList != NULL) {
	for (i=0; i<globCount; i++) {
	    GlobPattern *globPtr = (GlobPattern *)
		    ckalloc(sizeof(GlobPattern));
	    int len;
	    const char *str = Tcl_GetStringFromObj(globList[i], &len);

	    len = (len + 1) * sizeof(char);
	    if (str[0] && str[0] != '*') {
		/*
		 * Prepend a "*" to patterns that do not have a leading "*"
		 */

		globPtr->pattern = ckalloc((unsigned) len+1);
		globPtr->pattern[0] = '*';
		strcpy(globPtr->pattern+1, str);
	    } else if (isWindows) {
		if (strcmp(str, "*") == 0) {
		    globPtr->pattern = ckalloc(4 * sizeof(char));
		    strcpy(globPtr->pattern, "*.*");
		} else if (strcmp(str, "") == 0) {
		    /*
		     * An empty string means "match all files with no
		     * extensions"
		     * TODO: "*." actually matches with all files on Win95
		     */

		    globPtr->pattern = ckalloc(3 * sizeof(char));
		    strcpy(globPtr->pattern, "*.");
		} else {
		    globPtr->pattern = ckalloc((unsigned) len);
		    strcpy(globPtr->pattern, str);
		}
	    } else {
		globPtr->pattern = ckalloc((unsigned) len);
		strcpy(globPtr->pattern, str);
	    }

	    /*
	     * Add the glob pattern into the list of patterns.
	     */

	    if (clausePtr->patterns == NULL) {
		clausePtr->patterns = clausePtr->patternsTail = globPtr;
	    } else {
		clausePtr->patternsTail->next = globPtr;
		clausePtr->patternsTail = globPtr;
	    }
	    globPtr->next = NULL;
	}
    }
    if (ostypeList != NULL && ostypeCount > 0) {
	if (macRoman == NULL) {
	    macRoman = Tcl_GetEncoding(NULL, "macRoman");
	}
	for (i=0; i<ostypeCount; i++) {
	    Tcl_DString osTypeDS;
	    int len;
	    MacFileType *mfPtr = (MacFileType *) ckalloc(sizeof(MacFileType));
	    const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
	    char *string;

	    /*
	     * Convert utf to macRoman, since MacOS types are defined to be 4
	     * macRoman characters long
	     */

	    Tcl_UtfToExternalDString(macRoman, strType, len, &osTypeDS);
	    string = Tcl_DStringValue(&osTypeDS);
	    mfPtr->type = (OSType) string[0] << 24 | (OSType) string[1] << 16 |
		    (OSType) string[2] <<  8 | (OSType) string[3];
	    Tcl_DStringFree(&osTypeDS);

	    /*
	     * Add the Mac type pattern into the list of Mac types
	     */

	    if (clausePtr->macTypes == NULL) {
		clausePtr->macTypes = clausePtr->macTypesTail = mfPtr;
	    } else {
		clausePtr->macTypesTail->next = mfPtr;
		clausePtr->macTypesTail = mfPtr;
	    }
	    mfPtr->next = NULL;
	}
    }

  done:
    if (macRoman != NULL) {
	Tcl_FreeEncoding(macRoman);
    }
    return code;
}

/*
 *----------------------------------------------------------------------
 *
 * GetFilter --
 *
 *	Add one FileFilter to flistPtr.
 *
 * Results:
 *	A standard TCL result.
 *
 * Side effects:
 *	The list of filters are updated in flistPtr.
 *
 *----------------------------------------------------------------------
 */

static FileFilter *
GetFilter(
    FileFilterList *flistPtr,	/* The FileFilterList that contains the newly
				 * created filter */
    const char *name)		/* Name of the filter. It is usually displayed
				 * in the "File Types" listbox in the file
				 * dialogs. */
{
    FileFilter *filterPtr = flistPtr->filters;
    size_t len;

    for (; filterPtr; filterPtr=filterPtr->next) {
	if (strcmp(filterPtr->name, name) == 0) {
	    return filterPtr;
	}
    }

    filterPtr = (FileFilter *) ckalloc(sizeof(FileFilter));
    filterPtr->clauses = NULL;
    filterPtr->clausesTail = NULL;
    len = strlen(name) + 1;
    filterPtr->name = ckalloc((unsigned) len);
    memcpy(filterPtr->name, name, len);

    if (flistPtr->filters == NULL) {
	flistPtr->filters = flistPtr->filtersTail = filterPtr;
    } else {
	flistPtr->filtersTail->next = filterPtr;
	flistPtr->filtersTail = filterPtr;
    }
    filterPtr->next = NULL;

    ++flistPtr->numFilters;
    return filterPtr;
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
@


1.12
log
@Fix potential use of uninitialized variable flagged by clang static analyzer
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.11 2008/04/27 22:38:56 dkf Exp $
a20 3
static void		FreeClauses(FileFilter *filterPtr);
static void		FreeGlobPatterns(FileFilterClause *clausePtr);
static void		FreeMacFileTypes(FileFilterClause *clausePtr);
d89 1
a89 1
        return TCL_OK;
d105 1
d163 36
a198 1
    FileFilter *filterPtr, *toFree;
d200 1
a200 2
    filterPtr=flistPtr->filters;
    while (filterPtr != NULL) {
d203 1
a203 3
	FreeClauses(toFree);
	ckfree(toFree->name);
	ckfree((char *) toFree);
d450 2
a451 2
    len = (strlen(name) + 1) * sizeof(char);
    filterPtr->name = ckalloc(len);
a466 98
 *----------------------------------------------------------------------
 *
 * FreeClauses --
 *
 *	Frees the malloc'ed file type clause.
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The list of clauses in filterPtr->clauses are freed.
 *
 *----------------------------------------------------------------------
 */

static void
FreeClauses(
    FileFilter *filterPtr)	/* FileFilter whose clauses are to be freed */
{
    FileFilterClause *clausePtr = filterPtr->clauses;

    while (clausePtr != NULL) {
	FileFilterClause *toFree = clausePtr;

	clausePtr = clausePtr->next;
	FreeGlobPatterns(toFree);
	FreeMacFileTypes(toFree);
	ckfree((char *) toFree);
    }
    filterPtr->clauses = NULL;
    filterPtr->clausesTail = NULL;
}

/*
 *----------------------------------------------------------------------
 *
 * FreeGlobPatterns --
 *
 *	Frees the malloc'ed glob patterns in a clause
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The list of glob patterns in clausePtr->patterns are freed.
 *
 *----------------------------------------------------------------------
 */

static void
FreeGlobPatterns(
    FileFilterClause *clausePtr)/* The clause whose patterns are to be freed*/
{
    GlobPattern *globPtr = clausePtr->patterns;

    while (globPtr != NULL) {
	GlobPattern *toFree = globPtr;
	globPtr = globPtr->next;

	ckfree(toFree->pattern);
	ckfree((char *) toFree);
    }
    clausePtr->patterns = NULL;
}

/*
 *----------------------------------------------------------------------
 *
 * FreeMacFileTypes --
 *
 *	Frees the malloc'ed Mac file types in a clause
 *
 * Results:
 *	None.
 *
 * Side effects:
 *	The list of Mac file types in clausePtr->macTypes are freed.
 *
 *----------------------------------------------------------------------
 */

static void
FreeMacFileTypes(
    FileFilterClause *clausePtr)/* The clause whose mac types are to be
				 * freed. */
{
    MacFileType *mfPtr = clausePtr->macTypes;

    while (mfPtr != NULL) {
	MacFileType *toFree = mfPtr;

	mfPtr = mfPtr->next;
	ckfree((char *) toFree);
    }
    clausePtr->macTypes = NULL;
}

/*
@


1.11
log
@Get rid of pre-C89-isms (esp. CONST vs const).
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.10 2007/05/09 12:51:30 das Exp $
d341 1
a341 1
    if (ostypeCount > 0 && ostypeList != NULL) {
@


1.10
log
@	* generic/tkFileFilter.c (AddClause): OSType endianness fixes.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.9 2005/11/04 11:52:50 dkf Exp $
d18 3
a20 3
static int		AddClause(Tcl_Interp *interp,
			    FileFilter *filterPtr, Tcl_Obj *patternsObj,
			    Tcl_Obj *ostypesObj, int isWindows);
d24 1
a24 1
static FileFilter *	GetFilter(FileFilterList *flistPtr, CONST char *name);
d172 2
a173 2
	ckfree((char*)toFree->name);
	ckfree((char*)toFree);
d236 1
a236 1
	    CONST char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
d276 2
a277 2
    clausePtr = (FileFilterClause*)ckalloc(sizeof(FileFilterClause));
    clausePtr->patterns     = NULL;
d279 1
a279 1
    clausePtr->macTypes     = NULL;
d292 2
a293 1
	    GlobPattern *globPtr = (GlobPattern*)ckalloc(sizeof(GlobPattern));
d295 1
a296 1
	    CONST char *str = Tcl_GetStringFromObj(globList[i], &len);
a297 1

d303 1
a303 1
		globPtr->pattern = (char*)ckalloc((unsigned int) len+1);
d308 1
a308 1
		    globPtr->pattern = (char*)ckalloc(4 * sizeof(char));
d314 1
a314 1
		     * BUG: "*." actually matches with all files on Win95
d317 1
a317 1
		    globPtr->pattern = (char *) ckalloc(3 * sizeof(char));
d320 1
a320 1
		    globPtr->pattern = (char *) ckalloc((unsigned int) len);
d324 1
a324 1
		globPtr->pattern = (char *) ckalloc((unsigned int) len);
d349 1
a349 1
	    CONST char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
d404 1
a404 1
    CONST char *name)		/* Name of the filter. It is usually displayed
d409 1
d420 3
a422 2
    filterPtr->name = (char *) ckalloc((strlen(name)+1) * sizeof(char));
    strcpy(filterPtr->name, name);
d441 1
a441 1
 *	Frees the malloc'ed file type clause
d460 1
a461 1

d496 1
a496 1
	ckfree((char *) toFree->pattern);
d521 1
a521 1
				 * freed */
d527 1
@


1.10.4.1
log
@Backported some fixes for uninitialized variables identified by das using clang analysis.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.10 2007/05/09 12:51:30 das Exp $
d341 1
a341 1
    if (ostypeList != NULL && ostypeCount > 0) {
@


1.9
log
@ANSIfy
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.8 2005/05/23 23:19:35 hobbs Exp $
d350 1
d358 3
a360 2

	    memcpy(&mfPtr->type, Tcl_DStringValue(&osTypeDS), sizeof(OSType));
@


1.8
log
@	* generic/tkFileFilter.c (FreeGlobPatterns): s/null/NULL/
@
text
@d9 2
a10 2
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.7 2005/05/21 23:29:40 dkf Exp $
d18 1
a18 1
static int		AddClause _ANSI_ARGS_((Tcl_Interp *interp,
d20 5
a24 8
			    Tcl_Obj *ostypesObj, int isWindows));
static void		FreeClauses _ANSI_ARGS_((FileFilter *filterPtr));
static void		FreeGlobPatterns _ANSI_ARGS_((
			    FileFilterClause *clausePtr));
static void		FreeMacFileTypes _ANSI_ARGS_((
			    FileFilterClause *clausePtr));
static FileFilter *	GetFilter _ANSI_ARGS_((FileFilterList *flistPtr,
			    CONST char *name));
d31 3
a33 3
 *	Initializes a FileFilterList data structure. A FileFilterList
 *	must be initialized EXACTLY ONCE before any calls to
 *	TkGetFileFilters() is made. The usual flow of control is:
d45 1
d50 2
a51 2
TkInitFileFilters(flistPtr)
    FileFilterList *flistPtr;	/* The structure to be initialized. */
d63 5
a67 5
 *	This function is called by the Mac and Windows implementation
 *	of tk_getOpenFile and tk_getSaveFile to translate the string
 *	value of the -filetypes option into an easy-to-parse C
 *	structure (flistPtr). The caller of this function will then use
 *	flistPtr to perform filetype matching in a platform specific way.
d76 1
d79 1
d81 5
a85 5
TkGetFileFilters(interp, flistPtr, types, isWindows)
    Tcl_Interp *interp;		/* Interpreter to use for error reporting. */
    FileFilterList *flistPtr;	/* Stores the list of file filters. */
    Tcl_Obj *types;		/* Value of the -filetypes option. */
    int isWindows;		/* True if we are running on Windows. */
d94 1
a94 1
    
d104 3
a106 3
     * Free the filter information that have been allocated the previous
     * time -- the -filefilters option may have been used more than once in
     * the command line.
d112 3
a114 3
	 * Each file type should have two or three elements: the first one
	 * is the name of the type and the second is the filter of the type.
	 * The third is the Mac OSType ID, but we don't care about them here.
d116 1
d121 1
a121 1
	if (Tcl_ListObjGetElements(interp, listObjv[i], &count, 
d125 1
a125 1
	
d127 4
a130 4
	    Tcl_AppendResult(interp, "bad file type \"", 
		Tcl_GetString(listObjv[i]), "\", ",
		"should be \"typeName {extension ?extensions ...?} ",
		"?{macType ?macTypes ...?}?\"",	NULL);
d136 1
a136 1
	if (AddClause(interp, filterPtr, typeInfo[1], 
d157 1
d162 2
a163 2
TkFreeFileFilters(flistPtr)
    FileFilterList *flistPtr;	/* List of file filters to free */
d190 1
d195 9
a203 9
AddClause(interp, filterPtr, patternsObj, ostypesObj, isWindows)
    Tcl_Interp *interp;		/* Interpreter to use for error reporting. */
    FileFilter *filterPtr;	/* Stores the new filter clause */
    Tcl_Obj *patternsObj;	/* A Tcl list of glob patterns. */
    Tcl_Obj *ostypesObj;	/* 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 */
d221 1
d225 1
d228 4
a231 4
	/* 
	 * Might be cleaner to use 'Tcl_GetOSTypeFromObj' but that is
	 * actually static to the MacOS X/Darwin version of Tcl, and
	 * would therefore require further code refactoring.
d233 1
d237 7
a243 6
	    /* 
	     * If len is < 4, it is definitely an error.  If equal or
	     * longer, we need to use the macRoman encoding to determine
	     * the correct length (assuming there may be non-ascii
	     * characters, eg., embedded nulls or accented characters in
	     * the string, the macRoman length will be different).
d245 4
a248 5
	     * If we couldn't load the encoding, then we can't
	     * actually check the correct length.  But here we assume
	     * we're probably operating on unix/windows with a minimal
	     * set of encodings and so don't care about MacOS types.
	     * So we won't signal an error.
d250 1
d253 4
a256 3
		/* 
		 * Convert utf to macRoman, since MacOS types are
		 * defined to be 4 macRoman characters long
d258 1
d273 1
a273 1
     * Add the clause into the list of clauses 
d302 1
d316 2
a317 1
		    globPtr->pattern = (char*)ckalloc(3 * sizeof(char));
d320 1
a320 1
		    globPtr->pattern = (char*)ckalloc((unsigned int) len);
d324 1
a324 1
		globPtr->pattern = (char*)ckalloc((unsigned int) len);
d351 3
a353 3
	    /* 
	     * Convert utf to macRoman, since MacOS types are 
	     * defined to be 4 macRoman characters long
d355 1
d364 1
a375 1

d380 1
a380 1
}	
d394 1
d399 4
a402 4
GetFilter(flistPtr, name)
    FileFilterList *flistPtr;	/* The FileFilterList that contains the
				 * newly created filter */
    CONST char *name;		/* Name of the filter. It is usually displayed
d444 1
d449 2
a450 2
FreeClauses(filterPtr)
    FileFilter * filterPtr;	/* FileFilter whose clauses are to be freed */
d478 1
d483 2
a484 2
FreeGlobPatterns(clausePtr)
    FileFilterClause * clausePtr;/* The clause whose patterns are to be freed*/
d510 1
d515 3
a517 3
FreeMacFileTypes(clausePtr)
    FileFilterClause * clausePtr;  /* The clause whose mac types are to be
				    * freed */
d528 8
@


1.7
log
@Parse all filters, not just the first one. [Bug 1206133]
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.6 2004/12/20 10:34:20 vincentdarley Exp $
d473 1
a473 1
    while (globPtr != null) {
@


1.6
log
@Corrected handling of MacOS filetypes in tk_*file dialogs
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.5 2002/01/27 11:10:50 das Exp $
d18 4
a21 5
static int		AddClause _ANSI_ARGS_((
			    Tcl_Interp * interp, FileFilter * filterPtr,
			    Tcl_Obj * patternsObj, Tcl_Obj * ostypesObj,
			    int isWindows));
static void		FreeClauses _ANSI_ARGS_((FileFilter * filterPtr));
d23 1
a23 1
			    FileFilterClause * clausePtr));
d25 3
a27 3
			    FileFilterClause * clausePtr));
static FileFilter *	GetFilter _ANSI_ARGS_((FileFilterList * flistPtr,
			    CONST char * name));
d53 1
a53 1
    FileFilterList * flistPtr;	/* The structure to be initialized. */
d67 1
a67 1
 *	value of the -filetypes option of into an easy-to-parse C
d83 2
a84 2
    FileFilterList * flistPtr;	/* Stores the list of file filters. */
    Tcl_Obj* types;		/* Value of the -filetypes option. */
d95 2
a96 1
    if (Tcl_ListObjGetElements(interp, types, &listObjc, &listObjv) != TCL_OK) {
d117 2
a118 2
	FileFilter * filterPtr;
	Tcl_Obj ** typeInfo;
d121 1
a121 1
				   &typeInfo) != TCL_OK) {
d135 3
a137 6
	if (count == 2) {
	    return AddClause(interp, filterPtr, typeInfo[1], 
			     NULL, isWindows);
	} else {
	    return AddClause(interp, filterPtr, typeInfo[1], 
			     typeInfo[2], isWindows);
d161 1
a161 1
    FileFilterList * flistPtr;	/* List of file filters to free */
d163 1
a163 1
    FileFilter * filterPtr, *toFree;
d166 1
a166 1
    while (filterPtr) {
d168 1
a168 1
	filterPtr=filterPtr->next;
d191 6
a196 5
static int AddClause(interp, filterPtr, patternsObj, ostypesObj, isWindows)
    Tcl_Interp * interp;	/* Interpreter to use for error reporting. */
    FileFilter * filterPtr;	/* Stores the new filter clause */
    Tcl_Obj * patternsObj;	/* A Tcl list of glob patterns. */
    Tcl_Obj * ostypesObj;	/* A Tcl list of Mac OSType strings. */
d202 3
a204 7
    Tcl_Obj ** globList = NULL;
    int globCount;
    Tcl_Obj ** ostypeList = NULL;
    int ostypeCount;
    FileFilterClause * clausePtr;
    int i;
    int code = TCL_OK;
d206 3
a208 3
    
    if (Tcl_ListObjGetElements(interp, patternsObj, &globCount, &globList)
	    != TCL_OK) {
d213 2
a214 2
	if (Tcl_ListObjGetElements(interp, ostypesObj, &ostypeCount, &ostypeList)
		!= TCL_OK) {
d218 5
d237 6
d244 2
a245 4
	    if (len >= 4) {
		if (macRoman == NULL) {
		    macRoman = Tcl_GetEncoding(NULL, "macRoman");
		}
d247 2
a248 6
		 * If we couldn't load the encoding, then we can't
		 * actually check the correct length.  But here we
		 * assume we're probably operating on unix/windows
		 * with a minimal set of encodings and so don't
		 * care about MacOS types.  So we won't signal
		 * an error.
d250 3
a252 10
		if (macRoman != NULL) {
		    Tcl_DString osTypeDS;
		    /* 
		     * Convert utf to macRoman, since MacOS types are 
		     * defined to be 4 macRoman characters long
		     */
		    Tcl_UtfToExternalDString(macRoman, strType, len, &osTypeDS);
		    len = Tcl_DStringLength(&osTypeDS);
		    Tcl_DStringFree(&osTypeDS);
		}
d256 1
a256 1
		    Tcl_GetString(ostypeList[i]), "\"", NULL);
d283 1
a283 1
	    GlobPattern * globPtr = (GlobPattern*)ckalloc(sizeof(GlobPattern));
d285 1
a285 1
	    
d296 1
a296 2
	    }
	    else if (isWindows) {
d298 1
a298 1
		    globPtr->pattern = (char*)ckalloc(4*sizeof(char));
d300 1
a300 2
		}
		else if (strcmp(str, "") == 0) {
d306 1
a306 1
		    globPtr->pattern = (char*)ckalloc(3*sizeof(char));
d308 1
a308 2
		}
		else {
d337 1
a337 1
	    MacFileType * mfPtr = (MacFileType*)ckalloc(sizeof(MacFileType));
d385 3
a387 2
static FileFilter * GetFilter(flistPtr, name)
    FileFilterList * flistPtr;	/* The FileFilterList that contains the
d389 1
a389 1
    CONST char * name;		/* Name of the filter. It is usually displayed
d393 1
a393 1
    FileFilter * filterPtr;
d395 2
a396 2
    for (filterPtr=flistPtr->filters; filterPtr; filterPtr=filterPtr->next) {
	if (strcmp(filterPtr->name, name)==0) {
d401 1
a401 1
    filterPtr = (FileFilter*)ckalloc(sizeof(FileFilter));
d404 1
a404 1
    filterPtr->name = (char*)ckalloc((strlen(name)+1) * sizeof(char));
d438 5
a442 1
    FileFilterClause * clausePtr, * toFree;
a443 4
    clausePtr = filterPtr->clauses;
    while (clausePtr) {
	toFree = clausePtr;
	clausePtr=clausePtr->next;
d446 1
a446 1
	ckfree((char*)toFree);
d471 1
a471 1
    GlobPattern * globPtr, * toFree;
d473 3
a475 4
    globPtr = clausePtr->patterns;
    while (globPtr) {
	toFree = globPtr;
	globPtr=globPtr->next;
d477 2
a478 2
	ckfree((char*)toFree->pattern);
	ckfree((char*)toFree);
d503 1
a503 1
    MacFileType * mfPtr, * toFree;
d505 4
a508 5
    mfPtr = clausePtr->macTypes;
    while (mfPtr) {
	toFree = mfPtr;
	mfPtr=mfPtr->next;
	ckfree((char*)toFree);
@


1.5
log
@	* generic/tkFileFilter.c:
	* mac/tkMacInit.c:
	* mac/tkMacKeyboard.c:
	* mac/tkMacMenus.c: TIP 27 CONSTification induced changes
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.4 2000/07/06 03:17:43 mo Exp $
d20 1
a20 1
			    CONST char * patternsStr, CONST char * ostypesStr,
d78 1
a78 1
 *	The fields in flistPtr are changed according to string.
d82 1
a82 1
TkGetFileFilters(interp, flistPtr, string, isWindows)
d85 1
a85 1
    char * string;		/* Value of the -filetypes option. */
d88 2
a89 4
    int listArgc;
    CONST char ** listArgv = NULL;
    CONST char ** typeInfo = NULL;
    int code = TCL_OK;
d92 5
a96 1
    if (Tcl_SplitList(interp, string, &listArgc, &listArgv) != TCL_OK) {
d99 2
a100 2
    if (listArgc == 0) {
	goto done;
d110 1
a110 1
    for (i = 0; i<listArgc; i++) {
d118 1
d120 3
a122 3
	if (Tcl_SplitList(interp, listArgv[i], &count, &typeInfo) != TCL_OK) {
	    code = TCL_ERROR;
	    goto done;
d126 2
a127 1
	    Tcl_AppendResult(interp, "bad file type \"", listArgv[i], "\", ",
d130 1
a130 2
	    code = TCL_ERROR;
	    goto done;
d133 1
a133 1
	filterPtr = GetFilter(flistPtr, typeInfo[0]);
d136 2
a137 2
	    code = AddClause(interp, filterPtr, typeInfo[1], NULL,
		isWindows);
d139 2
a140 9
	    code = AddClause(interp, filterPtr, typeInfo[1], typeInfo[2],
		isWindows);
	}
	if (code != TCL_OK) {
	    goto done;
	}

        if (typeInfo) {
	    ckfree((char*)typeInfo);
a141 1
	typeInfo = NULL;
d144 1
a144 8
  done:
    if (typeInfo) {
       ckfree((char*)typeInfo);
    }
    if (listArgv) {
	ckfree((char*)listArgv);
    }
    return code;
d194 1
a194 1
static int AddClause(interp, filterPtr, patternsStr, ostypesStr, isWindows)
d197 2
a198 2
    CONST char * patternsStr;		/* A TCL list of glob patterns. */
    CONST char * ostypesStr;		/* A TCL list of Mac OSType strings. */
d204 1
a204 1
    CONST char ** globList = NULL;
d206 1
a206 1
    CONST char ** ostypeList = NULL;
d211 4
a214 2

    if (Tcl_SplitList(interp, patternsStr, &globCount, &globList)!= TCL_OK) {
d218 2
a219 2
    if (ostypesStr != NULL) {
	if (Tcl_SplitList(interp, ostypesStr, &ostypeCount, &ostypeList)
d224 5
d230 33
a262 1
	    if (strlen(ostypeList[i]) != 4) {
d264 1
a264 1
		    ostypeList[i], "\"", NULL);
d294 2
a295 1
	    len = (strlen(globList[i]) + 1) * sizeof(char);
d297 1
a297 1
	    if (globList[i][0] && globList[i][0] != '*') {
d303 1
a303 1
		strcpy(globPtr->pattern+1, globList[i]);
d306 1
a306 1
		if (strcmp(globList[i], "*") == 0) {
d310 1
a310 1
		else if (strcmp(globList[i], "") == 0) {
d321 1
a321 1
		    strcpy(globPtr->pattern, globList[i]);
d325 1
a325 1
		strcpy(globPtr->pattern, globList[i]);
d342 3
d346 2
d349 7
d357 2
a358 1
	    memcpy(&mfPtr->type, ostypeList[i], sizeof(OSType));
d374 3
a376 5
    if (globList) {
	ckfree((char*)globList);
    }
    if (ostypeList) {
	ckfree((char*)ostypeList);
a377 1

@


1.5.2.1
log
@	* generic/tkFileFilter.c (AddClause): OSType endianness fixes.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.5 2002/01/27 11:10:50 das Exp $
a315 1
	    char *string = ostypeList[i];
d317 1
a317 2
	    mfPtr->type = (OSType) string[0] << 24 | (OSType) string[1] << 16 |
		    (OSType) string[2] <<  8 | (OSType) string[3];
a321 1

@


1.5.2.2
log
@	* generic/tkFileFilter.c (AddClause): fix warning.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.5.2.1 2007/05/09 12:55:57 das Exp $
d316 1
a316 1
	    CONST char *string = ostypeList[i];
@


1.4
log
@	* generic/tkFileFilter.c (AddClause): Cast to match function prototype.
	* win/stubs.c (_XInitImageFuncPtrs): Add return value for function.
	* win/tkWinButton.c (buttonStyles, ButtonBindProc, ComputeStyle):
	Remove unused declarations.
	* win/tkWinColor.c (GetColorByName, GetColorByValue): Remove unused
	function declarations.
	* win/tkWinDialog.c (TrySetDirectory): Remove unused function declaration.
	* win/tkWinEmbed.c (TkWinEmbeddedEventProc): Cast to match function prototype.
	* win/tkWinMenu.c (winMenuMutex, MenuExitProc): Remove unused declaration.
	* win/tkWinWindow.c (StackWindow): Remove unused declaration.
	* win/tkWinWm.c (ConfigureEvent): Remove unused declaration.
	* win/tkWinX.c (winXMutex): Remove unused declaration.
	* xlib/ximage.c (XCreateBitmapFromData): Cast to match function prototype.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.3 1999/04/16 01:51:13 stanton Exp $
d20 1
a20 1
			    char * patternsStr, char * ostypesStr,
d28 1
a28 1
			    char * name));
d89 2
a90 2
    char ** listArgv = NULL;
    char ** typeInfo = NULL;
d209 2
a210 2
    char * patternsStr;		/* A TCL list of glob patterns. */
    char * ostypesStr;		/* A TCL list of Mac OSType strings. */
d216 1
a216 1
    char ** globList = NULL;
d218 1
a218 1
    char ** ostypeList = NULL;
d361 1
a361 1
    char * name;		/* Name of the filter. It is usually displayed
@


1.4.2.1
log
@sync with head
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.5 2002/01/27 11:10:50 das Exp $
d20 1
a20 1
			    CONST char * patternsStr, CONST char * ostypesStr,
d28 1
a28 1
			    CONST char * name));
d89 2
a90 2
    CONST char ** listArgv = NULL;
    CONST char ** typeInfo = NULL;
d209 2
a210 2
    CONST char * patternsStr;		/* A TCL list of glob patterns. */
    CONST char * ostypesStr;		/* A TCL list of Mac OSType strings. */
d216 1
a216 1
    CONST char ** globList = NULL;
d218 1
a218 1
    CONST char ** ostypeList = NULL;
d361 1
a361 1
    CONST char * name;		/* Name of the filter. It is usually displayed
@


1.4.6.1
log
@Merge with current TOT
Added support for the wm stackorder command
Fixed crash when selecting Menu items in the Application menu that we didn't
put there.
Added first bits of the use of CG for low-level drawing.  The line-drawing works,
the rest doesn't yet.  You have to set the file static useCGDrawing to 1 and
rebuild to activate this code.
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.4 2000/07/06 03:17:43 mo Exp $
d20 1
a20 1
			    CONST char * patternsStr, CONST char * ostypesStr,
d28 1
a28 1
			    CONST char * name));
d89 2
a90 2
    CONST char ** listArgv = NULL;
    CONST char ** typeInfo = NULL;
d209 2
a210 2
    CONST char * patternsStr;		/* A TCL list of glob patterns. */
    CONST char * ostypesStr;		/* A TCL list of Mac OSType strings. */
d216 1
a216 1
    CONST char ** globList = NULL;
d218 1
a218 1
    CONST char ** ostypeList = NULL;
d361 1
a361 1
    CONST char * name;		/* Name of the filter. It is usually displayed
@


1.3
log
@* Merged 8.1 branch into the main trunk
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id$
d273 1
a273 1
		globPtr->pattern = (char*)ckalloc(len+1);
d292 1
a292 1
		    globPtr->pattern = (char*)ckalloc(len);
d296 1
a296 1
		globPtr->pattern = (char*)ckalloc(len);
@


1.3.12.1
log
@see ChangeLog for specific file details
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.4 2000/07/06 03:17:43 mo Exp $
d273 1
a273 1
		globPtr->pattern = (char*)ckalloc((unsigned int) len+1);
d292 1
a292 1
		    globPtr->pattern = (char*)ckalloc((unsigned int) len);
d296 1
a296 1
		globPtr->pattern = (char*)ckalloc((unsigned int) len);
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@a12 1
 *
@


1.1
log
@Initial revision
@
text
@d12 1
a12 1
 * SCCS: @@(#) tkFileFilter.c 1.6 97/04/30 15:55:35
@


1.1.4.1
log
@initial tk8.1a2 version
@
text
@d12 2
a13 1
 * SCCS: @@(#) tkFileFilter.c 1.7 97/05/06 13:49:51
@


1.1.4.2
log
@Merged 8.0.3 changes into 8.1
@
text
@d12 1
a12 1
 * RCS: @@(#) $Id: tkFileFilter.c,v 1.2 1998/09/14 18:23:10 stanton Exp $
@


