diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | generic/tclFileName.c | 14 | ||||
-rw-r--r-- | mac/tclMacChan.c | 10 | ||||
-rw-r--r-- | mac/tclMacPort.h | 11 | ||||
-rw-r--r-- | mac/tclMacResource.c | 18 | ||||
-rw-r--r-- | tests/macFCmd.test | 8 |
6 files changed, 52 insertions, 19 deletions
@@ -1,3 +1,13 @@ +2002-06-05 Daniel Steffen <das@users.sourceforge.net> + + * 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 <dgp@users.sourceforge.net> * 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 <float.h> #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 <Errors.h> @@ -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<size; i++) { - if ((*resource)[i] == '\r') { + if (resultStr[i] == '\r') { resultStr[i] = '\n'; - } else { - resultStr[i] = (*resource)[i]; } } - - resultStr[size] = '\0'; return resultStr; } diff --git a/tests/macFCmd.test b/tests/macFCmd.test index 275c466..dbe1fef 100644 --- a/tests/macFCmd.test +++ b/tests/macFCmd.test @@ -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: macFCmd.test,v 1.8 2001/11/23 01:26:14 das Exp $ +# RCS: @(#) $Id: macFCmd.test,v 1.9 2002/06/05 11:59:21 das Exp $ # if {[lsearch [namespace children] ::tcltest] == -1} { @@ -36,9 +36,9 @@ test macFCmd-1.1 {GetFileFinderAttributes - no file} {macOnly} { test macFCmd-1.2 {GetFileFinderAttributes - creator} {macOnly} { catch {file delete -force foo.file} catch {close [open foo.file w]} - list [catch {file attributes foo.file -creator} msg] $msg \ - [file delete -force foo.file] -} {0 {MPW } {}} + list [catch {file attributes foo.file -creator} msg] \ + [regexp {MPW |CWIE} $msg] [file delete -force foo.file] +} {0 1 {}} test macFCmd-1.3 {GetFileFinderAttributes - type} {macOnly} { catch {file delete -force foo.file} catch {close [open foo.file w]} |