|
From: John M M. <jo...@us...> - 2003-12-02 04:52:25
|
Update of /cvsroot/squeak/squeak/platforms/Mac OS/vm
In directory sc8-pr-cvs1:/tmp/cvs-serv14419/squeak/platforms/Mac OS/vm
Modified Files:
sqMacFileLogic.c
Log Message:
3.7.0b2 Changes for file name encoding. Ensure we use current encoding when working with file names. Change logic in vmPath, imageName, shortImageName, documentName to support CFString which we convert to desired encoding at read time.
Index: sqMacFileLogic.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/Mac OS/vm/sqMacFileLogic.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** sqMacFileLogic.c 20 Jun 2003 01:47:37 -0000 1.11
--- sqMacFileLogic.c 2 Dec 2003 04:52:22 -0000 1.12
***************
*** 17,20 ****
--- 17,21 ----
* 5/12/2002 JMM add logic to enable you to put plugins beside macclassic VM
* 3.2.8b1 July 24th, 2002 JMM support for os-x plugin under IE 5.x
+ 3.7.0bx Nov 24th, 2003 JMM gCurrentVMEncoding
*
***************
*** 65,69 ****
OSErr err;
! filePath = CFStringCreateWithBytes(kCFAllocatorDefault,(UInt8 *) pathString,pathStringLength,kCFStringEncodingMacRoman,false);
if (filePath == nil)
return -1000;
--- 66,70 ----
OSErr err;
! filePath = CFStringCreateWithBytes(kCFAllocatorDefault,(UInt8 *) pathString,pathStringLength,gCurrentVMEncoding,false);
if (filePath == nil)
return -1000;
***************
*** 84,95 ****
/* Fill in the given string with the full path from a root volume to the given directory. */
! int PathToDir(char *pathName, int pathNameMax, FSSpec *where) {
CopyCStringToPascal(":",where->name);
! return PathToFile(pathName,pathNameMax,where);
}
/* Fill in the given string with the full path from a root volume to the given file. */
! int PathToFile(char *pathName, int pathNameMax, FSSpec *where) {
CFURLRef sillyThing;
CFStringRef filePath;
--- 85,96 ----
/* Fill in the given string with the full path from a root volume to the given directory. */
! int PathToDir(char *pathName, int pathNameMax, FSSpec *where,UInt32 encoding) {
CopyCStringToPascal(":",where->name);
! return PathToFile(pathName,pathNameMax,where,encoding);
}
/* Fill in the given string with the full path from a root volume to the given file. */
! int PathToFile(char *pathName, int pathNameMax, FSSpec *where,UInt32 encoding) {
CFURLRef sillyThing;
CFStringRef filePath;
***************
*** 118,122 ****
CFRelease(sillyThing);
! CFStringGetCString (filePath,pathName,pathNameMax, kCFStringEncodingMacRoman);
CFRelease(filePath);
--- 119,123 ----
CFRelease(sillyThing);
! CFStringGetCString (filePath,pathName,pathNameMax, encoding);
CFRelease(filePath);
***************
*** 139,143 ****
filePath = CFStringCreateWithBytes(kCFAllocatorDefault,
! (UInt8 *)pathString,pathStringLength,kCFStringEncodingMacRoman,false);
if (filePath == nil)
return -1;
--- 140,144 ----
filePath = CFStringCreateWithBytes(kCFAllocatorDefault,
! (UInt8 *)pathString,pathStringLength,gCurrentVMEncoding,false);
if (filePath == nil)
return -1;
***************
*** 175,179 ****
#if defined(__MWERKS__) && !defined(__APPLE__) && !defined(__MACH__)
! filePath = CFStringCreateWithBytes(kCFAllocatorDefault,(UInt8 *)dst,strlen(dst),kCFStringEncodingMacRoman,false);
if (filePath == nil)
return 2;
--- 176,180 ----
#if defined(__MWERKS__) && !defined(__APPLE__) && !defined(__MACH__)
! filePath = CFStringCreateWithBytes(kCFAllocatorDefault,(UInt8 *)dst,strlen(dst),gCurrentVMEncoding,false);
if (filePath == nil)
return 2;
***************
*** 181,185 ****
CFRelease(filePath);
filePath = CFURLCopyFileSystemPath (sillyThing, kCFURLHFSPathStyle);
! CFStringGetCString (filePath,dst,1000, kCFStringEncodingMacRoman);
CFRelease(sillyThing);
CFRelease(filePath);
--- 182,186 ----
CFRelease(filePath);
filePath = CFURLCopyFileSystemPath (sillyThing, kCFURLHFSPathStyle);
! CFStringGetCString (filePath,dst,1000, gCurrentVMEncoding);
CFRelease(sillyThing);
CFRelease(filePath);
***************
*** 201,205 ****
sillyThing = CFURLCreateFromFSRef(kCFAllocatorDefault,&theFSRef);
filePath = CFURLCopyFileSystemPath (sillyThing, kCFURLHFSPathStyle);
! CFStringGetCString (filePath,dst,1000, kCFStringEncodingMacRoman);
CFRelease(sillyThing);
CFRelease(filePath);
--- 202,206 ----
sillyThing = CFURLCreateFromFSRef(kCFAllocatorDefault,&theFSRef);
filePath = CFURLCopyFileSystemPath (sillyThing, kCFURLHFSPathStyle);
! CFStringGetCString (filePath,dst,1000, gCurrentVMEncoding);
CFRelease(sillyThing);
CFRelease(filePath);
***************
*** 242,246 ****
if (err != noErr)
return;
! filePath = CFStringCreateWithBytes(kCFAllocatorDefault,(UInt8 *)src,num,kCFStringEncodingMacRoman,false);
if (filePath == nil)
return;
--- 243,247 ----
if (err != noErr)
return;
! filePath = CFStringCreateWithBytes(kCFAllocatorDefault,(UInt8 *)src,num,gCurrentVMEncoding,false);
if (filePath == nil)
return;
***************
*** 256,260 ****
filePath = CFURLCopyFileSystemPath (appendedSillyThing, kCFURLPOSIXPathStyle);
#endif
! CFStringGetCString (filePath,dst,1000, kCFStringEncodingMacRoman);
CFRelease(sillyThing);
CFRelease(appendedSillyThing);
--- 257,261 ----
filePath = CFURLCopyFileSystemPath (appendedSillyThing, kCFURLPOSIXPathStyle);
#endif
! CFStringGetCString (filePath,dst,1000, gCurrentVMEncoding);
CFRelease(sillyThing);
CFRelease(appendedSillyThing);
***************
*** 267,271 ****
sillyThing = CFURLCreateFromFSRef(kCFAllocatorDefault,&theFSRef);
filePath = CFURLCopyFileSystemPath (sillyThing, kCFURLHFSPathStyle);
! CFStringGetCString (filePath,dst,1000, kCFStringEncodingMacRoman);
CFRelease(sillyThing);
CFRelease(filePath);
--- 268,272 ----
sillyThing = CFURLCreateFromFSRef(kCFAllocatorDefault,&theFSRef);
filePath = CFURLCopyFileSystemPath (sillyThing, kCFURLHFSPathStyle);
! CFStringGetCString (filePath,dst,1000, gCurrentVMEncoding);
CFRelease(sillyThing);
CFRelease(filePath);
***************
*** 312,323 ****
if (err != noErr)
return err;
! aLevel = CFStringCreateWithCString(kCFAllocatorDefault,token,kCFStringEncodingMacRoman);
if (aLevel == nil)
return -1000;
tokenLength = CFStringGetLength(aLevel);
CFStringGetCharacters(aLevel,CFRangeMake(0,tokenLength),buffer);
! err = FSMakeFSRefUnicode(&parentFSRef,tokenLength,buffer,kCFStringEncodingMacRoman,&childFSRef);
if (err != noErr) {
! CFStringGetPascalString(aLevel,spec->name,64,kCFStringEncodingMacRoman);
CFRelease(aLevel);
return err;
--- 313,324 ----
if (err != noErr)
return err;
! aLevel = CFStringCreateWithCString(kCFAllocatorDefault,token,gCurrentVMEncoding);
if (aLevel == nil)
return -1000;
tokenLength = CFStringGetLength(aLevel);
CFStringGetCharacters(aLevel,CFRangeMake(0,tokenLength),buffer);
! err = FSMakeFSRefUnicode(&parentFSRef,tokenLength,buffer,gCurrentVMEncoding,&childFSRef);
if (err != noErr) {
! CFStringGetPascalString(aLevel,spec->name,64,gCurrentVMEncoding);
CFRelease(aLevel);
return err;
***************
*** 449,461 ****
! int PathToDir(char *pathName, int pathNameMax, FSSpec *where) {
/* Fill in the given string with the full path from a root volume to
to given directory.
*/
CopyCStringToPascal(":",where->name);
! return PathToFile(pathName,pathNameMax,where);
}
! int PathToFile(char *pathName, int pathNameMax, FSSpec *where) {
OSErr error;
short pathLength;
--- 450,462 ----
! int PathToDir(char *pathName, int pathNameMax, FSSpec *where,UInt32 encoding) {
/* Fill in the given string with the full path from a root volume to
to given directory.
*/
CopyCStringToPascal(":",where->name);
! return PathToFile(pathName,pathNameMax,where,encoding);
}
! int PathToFile(char *pathName, int pathNameMax, FSSpec *where,UInt32 encoding) {
OSErr error;
short pathLength;
***************
*** 741,745 ****
theString = CFStringCreateWithCharacters (kCFAllocatorDefault, unicodeName.unicode, (CFIndex) unicodeName.length);
! CFStringGetPascalString(theString,(unsigned char *) name,256, kCFStringEncodingMacRoman);
CFRelease(theString);
return;
--- 742,746 ----
theString = CFStringCreateWithCharacters (kCFAllocatorDefault, unicodeName.unicode, (CFIndex) unicodeName.length);
! CFStringGetPascalString(theString,(unsigned char *) name,256, gCurrentVMEncoding);
CFRelease(theString);
return;
***************
*** 1169,1173 ****
pb->hFileInfo.ioFlLgLen = catalogInfo.dataLogicalSize;
theString = CFStringCreateWithCharacters (nil, unicodeName.unicode, (CFIndex) unicodeName.length);
! CFStringGetCString (theString,name,256, kCFStringEncodingMacRoman);
CopyCStringToPascal(name,name);
CFRelease(theString);
--- 1170,1174 ----
pb->hFileInfo.ioFlLgLen = catalogInfo.dataLogicalSize;
theString = CFStringCreateWithCharacters (nil, unicodeName.unicode, (CFIndex) unicodeName.length);
! CFStringGetCString (theString,name,256, gCurrentVMEncoding);
CopyCStringToPascal(name,name);
CFRelease(theString);
|