summaryrefslogtreecommitdiffstats
path: root/mac/tclMacResource.c
diff options
context:
space:
mode:
authordas <das>2002-06-05 11:59:18 (GMT)
committerdas <das>2002-06-05 11:59:18 (GMT)
commit24229b74b75e8ef219e5f08228243037b6ee7131 (patch)
treee1fd79f317196368a93f0b09f69169f56c39fc49 /mac/tclMacResource.c
parent6d6b5b0d0e9c53fadc2e50abbd967d516a317486 (diff)
downloadtcl-24229b74b75e8ef219e5f08228243037b6ee7131.zip
tcl-24229b74b75e8ef219e5f08228243037b6ee7131.tar.gz
tcl-24229b74b75e8ef219e5f08228243037b6ee7131.tar.bz2
* 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.
Diffstat (limited to 'mac/tclMacResource.c')
-rw-r--r--mac/tclMacResource.c18
1 files changed, 11 insertions, 7 deletions
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;
}