From 24229b74b75e8ef219e5f08228243037b6ee7131 Mon Sep 17 00:00:00 2001 From: das Date: Wed, 5 Jun 2002 11:59:18 +0000 Subject: * generic/tclFileName.c (TclGlob): mac specific fix to recent changes in 'glob -tails' handling. * mac/tclMacPort.h: * mac/tclMacChan.c: fixed TIP#91 bustage. * mac/tclMacResource.c (Tcl_MacConvertTextResource): added utf conversion of text resource contents. * tests/macFCmd.test (macFCmd-1.2): allow CWIE creator. --- ChangeLog | 10 ++++++++++ generic/tclFileName.c | 14 ++++++++++++-- mac/tclMacChan.c | 10 +++++----- mac/tclMacPort.h | 11 ++++++++++- mac/tclMacResource.c | 18 +++++++++++------- tests/macFCmd.test | 8 ++++---- 6 files changed, 52 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d2dd3b..c564c71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-06-05 Daniel Steffen + + * generic/tclFileName.c (TclGlob): mac specific fix to + recent changes in 'glob -tails' handling. + * mac/tclMacPort.h: + * mac/tclMacChan.c: fixed TIP#91 bustage. + * mac/tclMacResource.c (Tcl_MacConvertTextResource): added utf + conversion of text resource contents. + * tests/macFCmd.test (macFCmd-1.2): allow CWIE creator. + 2002-06-04 Don Porter * library/tcltest/tcltest.tcl: diff --git a/generic/tclFileName.c b/generic/tclFileName.c index e7dedf0..f5e7970 100644 --- a/generic/tclFileName.c +++ b/generic/tclFileName.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclFileName.c,v 1.36 2002/05/30 09:27:11 vincentdarley Exp $ + * RCS: @(#) $Id: tclFileName.c,v 1.37 2002/06/05 11:59:33 das Exp $ */ #include "tclInt.h" @@ -2083,7 +2083,6 @@ TclGlob(interp, pattern, unquotedPrefix, globFlags, types) Tcl_ResetResult(interp); result = TclDoGlob(interp, separators, &buffer, tail, types); - Tcl_DStringFree(&buffer); if (result != TCL_OK) { if (globFlags & TCL_GLOBMODE_NO_COMPLAIN) { @@ -2116,6 +2115,16 @@ TclGlob(interp, pattern, unquotedPrefix, globFlags, types) Tcl_ListObjGetElements(NULL, Tcl_GetObjResult(interp), &objc, &objv); +#ifdef MAC_TCL + /* adjust prefixLen if TclDoGlob prepended a ':' */ + if ((prefixLen > 0) && (objc > 0) + && (Tcl_DStringValue(&buffer)[0] != ':')) { + char *str = Tcl_GetStringFromObj(objv[0],NULL); + if (str[0] == ':') { + prefixLen++; + } + } +#endif for (i = 0; i< objc; i++) { Tcl_Obj* elt; if (globFlags & TCL_GLOBMODE_TAILS) { @@ -2145,6 +2154,7 @@ TclGlob(interp, pattern, unquotedPrefix, globFlags, types) * end here so we free our reference. */ Tcl_DecrRefCount(oldResult); + Tcl_DStringFree(&buffer); return result; } diff --git a/mac/tclMacChan.c b/mac/tclMacChan.c index d29c80e..0407a59 100644 --- a/mac/tclMacChan.c +++ b/mac/tclMacChan.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: tclMacChan.c,v 1.15 2002/05/24 21:19:06 dkf Exp $ + * RCS: @(#) $Id: tclMacChan.c,v 1.16 2002/06/05 11:59:38 das Exp $ */ #include "tclInt.h" @@ -131,8 +131,8 @@ static int StdIOInput _ANSI_ARGS_((ClientData instanceData, char *buf, int toRead, int *errorCode)); static int StdIOOutput _ANSI_ARGS_((ClientData instanceData, CONST char *buf, int toWrite, int *errorCode)); -static Tcl_WideInt StdIOSeek _ANSI_ARGS_((ClientData instanceData, - Tcl_WideInt offset, int mode, int *errorCode)); +static int StdIOSeek _ANSI_ARGS_((ClientData instanceData, + long offset, int mode, int *errorCode)); static int StdReady _ANSI_ARGS_((ClientData instanceData, int mask)); @@ -590,10 +590,10 @@ StdIOOutput( *---------------------------------------------------------------------- */ -static Tcl_WideInt +static int StdIOSeek( ClientData instanceData, /* Unused. */ - Tcl_WideInt offset, /* Offset to seek to. */ + long offset, /* Offset to seek to. */ int mode, /* Relative to where should we seek? */ int *errorCodePtr) /* To store error code. */ { diff --git a/mac/tclMacPort.h b/mac/tclMacPort.h index abc30aa..5df25b7 100644 --- a/mac/tclMacPort.h +++ b/mac/tclMacPort.h @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacPort.h,v 1.14 2001/11/23 01:28:12 das Exp $ + * RCS: @(#) $Id: tclMacPort.h,v 1.15 2002/06/05 11:59:44 das Exp $ */ @@ -29,6 +29,15 @@ */ #include "tclErrno.h" + +#ifndef EOVERFLOW +# ifdef EFBIG +# define EOVERFLOW EFBIG /* The object couldn't fit in the datatype */ +# else /* !EFBIG */ +# define EOVERFLOW EINVAL /* Better than nothing! */ +# endif /* EFBIG */ +#endif /* !EOVERFLOW */ + #include #ifdef THINK_C diff --git a/mac/tclMacResource.c b/mac/tclMacResource.c index 7052f2b..78f0bc5 100644 --- a/mac/tclMacResource.c +++ b/mac/tclMacResource.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacResource.c,v 1.13 2002/04/08 09:02:52 das Exp $ + * RCS: @(#) $Id: tclMacResource.c,v 1.14 2002/06/05 11:59:49 das Exp $ */ #include @@ -1387,20 +1387,24 @@ Tcl_MacConvertTextResource( { int i, size; char *resultStr; + Tcl_DString dstr; size = GetResourceSizeOnDisk(resource); - resultStr = ckalloc(size + 1); + Tcl_ExternalToUtfDString(NULL, *resource, size, &dstr); + + size = Tcl_DStringLength(&dstr) + 1; + resultStr = (char *) ckalloc((unsigned) size); + + memcpy((VOID *) resultStr, (VOID *) Tcl_DStringValue(&dstr), (size_t) size); + + Tcl_DStringFree(&dstr); for (i=0; i