summaryrefslogtreecommitdiffstats
path: root/mac
diff options
context:
space:
mode:
authordas <das@noemail.net>2002-01-27 11:09:18 (GMT)
committerdas <das@noemail.net>2002-01-27 11:09:18 (GMT)
commit30eca791b646b2d2f2f5a7f817b289d32751b65e (patch)
tree8f740075fb62f904aa60a596cb07aebb02849a6f /mac
parentda60cfbf6311b66574506fff568f0ffcf2165dcc (diff)
downloadtcl-30eca791b646b2d2f2f5a7f817b289d32751b65e.zip
tcl-30eca791b646b2d2f2f5a7f817b289d32751b65e.tar.gz
tcl-30eca791b646b2d2f2f5a7f817b289d32751b65e.tar.bz2
* generic/tclInt.decls:
* generic/tclIntPlatDecls.h: * mac/tclMacChan.c: * mac/tclMacFCmd.c: * mac/tclMacFile.c: * mac/tclMacInit.c: * mac/tclMacLoad.c: * mac/tclMacResource.c: * mac/tclMacSock.c: TIP 27 CONSTification induced changes * tests/event.test: * tests/main.test: added catches/constraints to test that use features that don't exist on the mac. FossilOrigin-Name: 02f6dcb5d2e40852b7e678559c5f3964c826593e
Diffstat (limited to 'mac')
-rw-r--r--mac/tclMacChan.c4
-rw-r--r--mac/tclMacFCmd.c4
-rw-r--r--mac/tclMacFile.c36
-rw-r--r--mac/tclMacInit.c14
-rw-r--r--mac/tclMacLoad.c24
-rw-r--r--mac/tclMacResource.c21
-rw-r--r--mac/tclMacSock.c6
7 files changed, 59 insertions, 50 deletions
diff --git a/mac/tclMacChan.c b/mac/tclMacChan.c
index da74176..90be8a4 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.11 2002/01/18 03:22:36 das Exp $
+ * RCS: @(#) $Id: tclMacChan.c,v 1.12 2002/01/27 11:09:38 das Exp $
*/
#include "tclInt.h"
@@ -1282,7 +1282,7 @@ GetOpenMode(
* "RDONLY CREAT". */
{
int mode, modeArgc, c, i, gotRW;
- char **modeArgv, *flag;
+ CONST char **modeArgv, *flag;
/*
* Check for the simpler fopen-like access modes (e.g. "r"). They
diff --git a/mac/tclMacFCmd.c b/mac/tclMacFCmd.c
index 528f5fc..1a75ce7 100644
--- a/mac/tclMacFCmd.c
+++ b/mac/tclMacFCmd.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: tclMacFCmd.c,v 1.15 2002/01/26 01:10:08 dgp Exp $
+ * RCS: @(#) $Id: tclMacFCmd.c,v 1.16 2002/01/27 11:09:44 das Exp $
*/
#include "tclInt.h"
@@ -1024,7 +1024,7 @@ GetFileSpecs(
Boolean *pathIsDirectoryPtr)/* Set to true if path is itself a directory,
* otherwise false. */
{
- char *dirName;
+ CONST char *dirName;
OSErr err;
int argc;
CONST char **argv;
diff --git a/mac/tclMacFile.c b/mac/tclMacFile.c
index 921ada5..522372a 100644
--- a/mac/tclMacFile.c
+++ b/mac/tclMacFile.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: tclMacFile.c,v 1.15 2002/01/25 20:40:56 dgp Exp $
+ * RCS: @(#) $Id: tclMacFile.c,v 1.16 2002/01/27 11:09:49 das Exp $
*/
/*
@@ -610,25 +610,23 @@ TclpReadlink(
Handle theString = NULL;
int pathSize;
Tcl_DString ds;
- char *native;
- native = Tcl_UtfToExternalDString(NULL, path, -1, &ds);
+ Tcl_UtfToExternalDString(NULL, path, -1, &ds);
/*
* Remove ending colons if they exist.
*/
- while ((strlen(native) != 0) && (path[strlen(native) - 1] == ':')) {
- native[strlen(native) - 1] = NULL;
+ while ((Tcl_DStringLength(&ds) != 0) && (Tcl_DStringValue(&ds)[Tcl_DStringLength(&ds) - 1] == ':')) {
+ Tcl_DStringSetLength(&ds, Tcl_DStringLength(&ds) - 1);
}
- if (strchr(native, ':') == NULL) {
- strcpy(fileName + 1, native);
- native = NULL;
+ end = strrchr(Tcl_DStringValue(&ds), ':');
+ if (end == NULL ) {
+ strcpy(fileName + 1, Tcl_DStringValue(&ds));
} else {
- end = strrchr(native, ':') + 1;
- strcpy(fileName + 1, end);
- *end = NULL;
+ strcpy(fileName + 1, end + 1);
+ Tcl_DStringSetLength(&ds, end + 1 - Tcl_DStringValue(&ds));
}
fileName[0] = (char) strlen(fileName + 1);
@@ -637,8 +635,8 @@ TclpReadlink(
* we want to look at.
*/
- if (native != NULL) {
- err = FSpLocationFromPath(strlen(native), native, &fileSpec);
+ if (end != NULL) {
+ err = FSpLocationFromPath(Tcl_DStringLength(&ds), Tcl_DStringValue(&ds), &fileSpec);
if (err != noErr) {
Tcl_DStringFree(&ds);
errno = EINVAL;
@@ -904,7 +902,7 @@ TclMacFOpenHack(
int size;
FILE * f;
- err = FSpLocationFromPath(strlen(path), (char *) path, &fileSpec);
+ err = FSpLocationFromPath(strlen(path), path, &fileSpec);
if ((err != noErr) && (err != fnfErr)) {
return NULL;
}
@@ -1007,14 +1005,15 @@ TclMacOSErrorToPosixError(
int
TclMacChmod(
- char *path,
+ CONST char *path,
int mode)
{
HParamBlockRec hpb;
OSErr err;
-
- c2pstr(path);
- hpb.fileParam.ioNamePtr = (unsigned char *) path;
+ Str255 pathName;
+ strcpy((char *) pathName + 1, path);
+ pathName[0] = strlen(path);
+ hpb.fileParam.ioNamePtr = pathName;
hpb.fileParam.ioVRefNum = 0;
hpb.fileParam.ioDirID = 0;
@@ -1023,7 +1022,6 @@ TclMacChmod(
} else {
err = PBHSetFLockSync(&hpb);
}
- p2cstr((unsigned char *) path);
if (err != noErr) {
errno = TclMacOSErrorToPosixError(err);
diff --git a/mac/tclMacInit.c b/mac/tclMacInit.c
index 451e377..8cfe2b5 100644
--- a/mac/tclMacInit.c
+++ b/mac/tclMacInit.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: tclMacInit.c,v 1.7 2002/01/25 20:40:56 dgp Exp $
+ * RCS: @(#) $Id: tclMacInit.c,v 1.8 2002/01/27 11:09:54 das Exp $
*/
#include <AppleEvents.h>
@@ -537,7 +537,7 @@ TclpSetVariables(interp)
int minor, major, objc;
Tcl_Obj **objv;
char versStr[2 * TCL_INTEGER_SPACE];
- char *str;
+ CONST char *str;
Tcl_Obj *pathPtr;
Tcl_DString ds;
@@ -781,9 +781,13 @@ Tcl_SourceRCFile(
fileName = Tcl_GetVar(interp, "tcl_rcRsrcName", TCL_GLOBAL_ONLY);
if (fileName != NULL) {
- c2pstr(fileName);
- h = GetNamedResource('TEXT', (StringPtr) fileName);
- p2cstr((StringPtr) fileName);
+ Str255 rezName;
+ Tcl_DString ds;
+ Tcl_UtfToExternalDString(NULL, fileName, -1, &ds);
+ strcpy((char *) rezName + 1, Tcl_DStringValue(&ds));
+ rezName[0] = (unsigned) Tcl_DStringLength(&ds);
+ h = GetNamedResource('TEXT', rezName);
+ Tcl_DStringFree(&ds);
if (h != NULL) {
if (Tcl_MacEvalResource(interp, fileName, 0, NULL) != TCL_OK) {
errChannel = Tcl_GetStdChannel(TCL_STDERR);
diff --git a/mac/tclMacLoad.c b/mac/tclMacLoad.c
index 1082a23..e767651 100644
--- a/mac/tclMacLoad.c
+++ b/mac/tclMacLoad.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: tclMacLoad.c,v 1.11 2002/01/18 03:22:58 das Exp $
+ * RCS: @(#) $Id: tclMacLoad.c,v 1.12 2002/01/27 11:09:58 das Exp $
*/
#include <CodeFragments.h>
@@ -126,11 +126,11 @@ TclpLoadFile(
UInt32 offset = 0;
UInt32 length = kCFragGoesToEOF;
StringPtr fragName=NULL;
- Str255 errName;
+ Str255 errName, symbolName;
Tcl_DString ds;
- char *native;
+ CONST char *native;
- native = (char *) Tcl_FSGetNativePath(pathPtr);
+ native = Tcl_FSGetNativePath(pathPtr);
err = FSpLocationFromPath(strlen(native), native, &fileSpec);
if (err != noErr) {
@@ -145,7 +145,7 @@ TclpLoadFile(
* it to us.
*/
native = Tcl_UtfToExternalDString(NULL, sym1, -1, &ds);
- native[strlen(native) - 5] = 0;
+ Tcl_DStringSetLength(&ds, Tcl_DStringLength(&ds) - 5);
/*
* See if this fragment has a 'cfrg' resource. It will tell us where
@@ -215,9 +215,10 @@ TclpLoadFile(
*unloadProcPtr = &TclpUnloadFile;
- native = Tcl_UtfToExternalDString(NULL, sym1, -1, &ds);
- c2pstr(native);
- err = FindSymbol(connID, (StringPtr) native, (Ptr *) proc1Ptr, &symClass);
+ Tcl_UtfToExternalDString(NULL, sym1, -1, &ds);
+ strcpy((char *) symbolName + 1, Tcl_DStringValue(&ds));
+ symbolName[0] = (unsigned) Tcl_DStringLength(&ds);
+ err = FindSymbol(connID, symbolName, (Ptr *) proc1Ptr, &symClass);
Tcl_DStringFree(&ds);
if (err != fragNoErr || symClass == kDataCFragSymbol) {
Tcl_SetResult(interp,
@@ -226,9 +227,10 @@ TclpLoadFile(
return TCL_ERROR;
}
- native = Tcl_UtfToExternalDString(NULL, sym2, -1, &ds);
- c2pstr(native);
- err = FindSymbol(connID, (StringPtr) native, (Ptr *) proc2Ptr, &symClass);
+ Tcl_UtfToExternalDString(NULL, sym2, -1, &ds);
+ strcpy((char *) symbolName + 1, Tcl_DStringValue(&ds));
+ symbolName[0] = (unsigned) Tcl_DStringLength(&ds);
+ err = FindSymbol(connID, symbolName, (Ptr *) proc2Ptr, &symClass);
Tcl_DStringFree(&ds);
if (err != fragNoErr || symClass == kDataCFragSymbol) {
*proc2Ptr = NULL;
diff --git a/mac/tclMacResource.c b/mac/tclMacResource.c
index 4e29420..671aea1 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.11 2002/01/26 01:10:08 dgp Exp $
+ * RCS: @(#) $Id: tclMacResource.c,v 1.12 2002/01/27 11:10:03 das Exp $
*/
#include <Errors.h>
@@ -496,7 +496,7 @@ resourceRef? resourceType");
return TCL_OK;
case RESOURCE_OPEN: {
Tcl_DString ds, buffer;
- char *str, *native;
+ CONST char *str, *native;
int length;
if (!((objc == 3) || (objc == 4))) {
@@ -1293,9 +1293,12 @@ Tcl_MacEvalResource(
* Load the resource by name or ID
*/
if (resourceName != NULL) {
- strcpy((char *) rezName + 1, resourceName);
- rezName[0] = strlen(resourceName);
+ Tcl_DString ds;
+ Tcl_UtfToExternalDString(NULL, resourceName, -1, &ds);
+ strcpy((char *) rezName + 1, Tcl_DStringValue(&ds));
+ rezName[0] = (unsigned) Tcl_DStringLength(&ds);
sourceText = GetNamedResource('TEXT', rezName);
+ Tcl_DStringFree(&ds);
} else {
sourceText = GetResource('TEXT', (short) resourceNumber);
}
@@ -1462,15 +1465,17 @@ Tcl_MacFindResource(
resource = GetResource(resourceType, resourceNumber);
}
} else {
+ Str255 rezName;
Tcl_DString ds;
- char *native = Tcl_UtfToExternalDString(NULL, resourceName, -1, &ds);
- c2pstr(native);
+ Tcl_UtfToExternalDString(NULL, resourceName, -1, &ds);
+ strcpy((char *) rezName + 1, Tcl_DStringValue(&ds));
+ rezName[0] = (unsigned) Tcl_DStringLength(&ds);
if (limitSearch) {
resource = Get1NamedResource(resourceType,
- (StringPtr) native);
+ rezName);
} else {
resource = GetNamedResource(resourceType,
- (StringPtr) resourceName);
+ rezName);
}
Tcl_DStringFree(&ds);
}
diff --git a/mac/tclMacSock.c b/mac/tclMacSock.c
index 7112ee3..70380b1 100644
--- a/mac/tclMacSock.c
+++ b/mac/tclMacSock.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: tclMacSock.c,v 1.11 2002/01/23 20:46:01 dgp Exp $
+ * RCS: @(#) $Id: tclMacSock.c,v 1.12 2002/01/27 11:10:07 das Exp $
*/
#include "tclInt.h"
@@ -2449,7 +2449,7 @@ GetHostFromString(
}
dnrState.done = 0;
GetCurrentProcess(&(dnrState.psn));
- err = StrToAddr(name, &dnrState.hostInfo, resultUPP, (Ptr) &dnrState);
+ err = StrToAddr((char*)name, &dnrState.hostInfo, resultUPP, (Ptr) &dnrState);
if (err == cacheFault) {
while (!dnrState.done) {
WaitNextEvent(0, &dummy, 1, NULL);
@@ -2464,7 +2464,7 @@ GetHostFromString(
if (dnrState.hostInfo.rtnCode == cacheFault) {
dnrState.done = 0;
- err = StrToAddr(name, &dnrState.hostInfo, resultUPP, (Ptr) &dnrState);
+ err = StrToAddr((char*)name, &dnrState.hostInfo, resultUPP, (Ptr) &dnrState);
if (err == cacheFault) {
while (!dnrState.done) {
WaitNextEvent(0, &dummy, 1, NULL);