[Tclresource-commits] Source tclResourceOSX.c,1.9,1.10
Status: Beta
Brought to you by:
bdesgraupes
From: Bernard D. <bde...@us...> - 2004-09-04 16:29:12
|
Update of /cvsroot/tclresource/Source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2788/Source Modified Files: tclResourceOSX.c Log Message: Fixed refnums stored in long instead of short Index: tclResourceOSX.c =================================================================== RCS file: /cvsroot/tclresource/Source/tclResourceOSX.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- tclResourceOSX.c 3 Sep 2004 08:21:57 -0000 1.9 +++ tclResourceOSX.c 4 Sep 2004 16:29:03 -0000 1.10 @@ -13,7 +13,7 @@ * With this extension, it is available with the following instruction: * package require resource * - * (c) Copyright : Bernard Desgraupes, 2003 + * (c) Copyright : Bernard Desgraupes, 2003-2004 * All rights reserved. * This software is free software with BSD licence. * Versions history: see the Changes.Log file. @@ -449,7 +449,7 @@ } saveRef = CurResFile(); - UseResFile((short) resourceRef->fileRef); + UseResFile(resourceRef->fileRef); if (gotInt == true) { // Don't load the resource in memory @@ -513,7 +513,7 @@ /* * Setting the resource attributes */ - theAttrs = GetResFileAttrs((short) resourceRef->fileRef); + theAttrs = GetResFileAttrs(resourceRef->fileRef); if (theAttrs & mapReadOnly) { Tcl_AppendStringsToObj(resultPtr, "cannot set the attributes, resource map is read only", @@ -589,7 +589,7 @@ Tcl_Obj *resultPtr) /* Pointer to store the result. */ { int length; - long fileRef; + short fileRef; char *stringPtr; if (objc != 3) { @@ -600,7 +600,7 @@ fileRef = TclMacUnRegisterResourceFork(stringPtr, resultPtr); if (fileRef >= 0) { - CloseResFile((short) fileRef); + CloseResFile(fileRef); return TCL_OK; } else { return TCL_ERROR; @@ -1107,7 +1107,7 @@ } saveRef = CurResFile(); - UseResFile((short) resourceRef->fileRef); + UseResFile(resourceRef->fileRef); limitSearch = true; } @@ -1267,7 +1267,7 @@ { int index, length, mode; int fromFork, foundFork = from_unspecified, filenameIdx = 2; - long fileRef; + short refnum; char *stringPtr; SInt8 macPermision; CONST char *str; @@ -1409,7 +1409,7 @@ * If path was invalid, don't even bother trying to open a resource map */ if (err == fnfErr) { - fileRef = -1; + refnum = -1; goto openforkDone; } @@ -1433,11 +1433,9 @@ /* * Try to open the file as a datafork resource file */ - short refnum; SetResLoad(false); err = FSOpenResourceFile( &fileFSRef, 0, nil, macPermision, &refnum ); SetResLoad(true); - fileRef = (long) refnum; if (err == noErr) { foundFork = from_datafork; goto openforkDone; @@ -1448,7 +1446,7 @@ * Now try to open as a resourcefork resource file */ SetResLoad(false); - fileRef = (long) FSpOpenResFile( &fileSpec, macPermision); + refnum = FSpOpenResFile( &fileSpec, macPermision); SetResLoad(true); err = ResError(); if (err == noErr) { @@ -1457,7 +1455,7 @@ } openforkDone: - if (fileRef == -1) { + if (refnum == -1) { if (((err == fnfErr) || (err == eofErr)) && (macPermision == fsRdWrShPerm)) { /* @@ -1467,7 +1465,7 @@ switch (fromFork) { case from_rezfork: HCreateResFile(fileSpec.vRefNum, fileSpec.parID, fileSpec.name); - fileRef = (long) FSpOpenResFile(&fileSpec, macPermision); + refnum = FSpOpenResFile(&fileSpec, macPermision); break; default: { @@ -1512,11 +1510,11 @@ err = FSCreateResourceFile(&parentFSRef, numChars, uniString, kFSCatInfoNone, NULL, 0, NULL, &fileFSRef, &fileSpec); - err = FSOpenResourceFile( &fileFSRef, 0, NULL, macPermision, &fileRef ); + err = FSOpenResourceFile( &fileFSRef, 0, NULL, macPermision, &refnum ); break; } } - if (fileRef == -1) { + if (refnum == -1) { goto openError; } else { foundFork = fromFork; @@ -1561,13 +1559,13 @@ */ if (macPermision == fsRdPerm) { - SetResFileAttrs(fileRef, mapReadOnly); + SetResFileAttrs(refnum, mapReadOnly); } Tcl_SetStringObj(resultPtr, "", 0); - if (TclMacRegisterResourceFork(fileRef, resultPtr, foundFork, + if (TclMacRegisterResourceFork(refnum, resultPtr, foundFork, TCL_RESOURCE_CHECK_IF_OPEN) != TCL_OK) { - CloseResFile(fileRef); + CloseResFile(refnum); return TCL_ERROR; } return TCL_OK; @@ -1697,7 +1695,7 @@ } saveRef = CurResFile(); - UseResFile((short) resourceRef->fileRef); + UseResFile(resourceRef->fileRef); limitSearch = true; } @@ -1898,7 +1896,7 @@ } if (limitSearch) { saveRef = CurResFile(); - UseResFile((short) resourceRef->fileRef); + UseResFile(resourceRef->fileRef); } if (gotInt == false) { if (limitSearch) { |