|
From: John M M. <jo...@us...> - 2002-08-06 21:40:30
|
Update of /cvsroot/squeak/squeak/platforms/Mac OS/plugins/FilePlugin
In directory usw-pr-cvs1:/tmp/cvs-serv1141/squeak/platforms/Mac OS/plugins/FilePlugin
Modified Files:
sqMacDirectory.c
Log Message:
3.2.8b3 fixes for building as an carbon netscape plugin
Index: sqMacDirectory.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/Mac OS/plugins/FilePlugin/sqMacDirectory.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** sqMacDirectory.c 22 Jan 2002 19:12:33 -0000 1.5
--- sqMacDirectory.c 6 Aug 2002 21:40:26 -0000 1.6
***************
*** 23,26 ****
--- 23,27 ----
3.2.1B6 Jan 2,2002 JMM make lookup faster
3.2.2B1 Jan 18th,2002 JMM check macroman, fix issues with squeak file offset
+ 3.2.8b1 July 24th, 2002 JMM support for os-x plugin under IE 5.x
*/
***************
*** 92,96 ****
sqFilenameFromString((char *) cFileName, (int) pathString, pathStringLength);
! #if defined(__MWERKS__) && JMMFoo
{
CFStringRef filePath,lastFilePath;
--- 93,97 ----
sqFilenameFromString((char *) cFileName, (int) pathString, pathStringLength);
! #if defined(__MWERKS__)
{
CFStringRef filePath,lastFilePath;
***************
*** 103,111 ****
if (filePath == nil)
return false;
! sillyThing = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,filePath,kCFURLPOSIXPathStyle,true);
CFRelease(filePath);
lastFilePath = CFURLCopyLastPathComponent(sillyThing);
tokenLength = CFStringGetLength(lastFilePath);
CFStringGetCharacters(lastFilePath,CFRangeMake(0,tokenLength),buffer);
CFRelease(lastFilePath);
--- 104,114 ----
if (filePath == nil)
return false;
! sillyThing = CFURLCreateWithFileSystemPath (kCFAllocatorDefault,filePath,kCFURLHFSPathStyle,true);
CFRelease(filePath);
lastFilePath = CFURLCopyLastPathComponent(sillyThing);
tokenLength = CFStringGetLength(lastFilePath);
+ if (tokenLength > 1024)
+ return false;
CFStringGetCharacters(lastFilePath,CFRangeMake(0,tokenLength),buffer);
CFRelease(lastFilePath);
***************
*** 137,141 ****
}
! #if defined(__MWERKS__) && JMMFoo
{
/* Delete the existing directory with the given path. */
--- 140,144 ----
}
! #if defined(__MWERKS__)
{
/* Delete the existing directory with the given path. */
***************
*** 333,337 ****
! #if defined(__MWERKS__) && !TARGET_API_MAC_CARBON
int ftruncate(short int file,int offset)
{
--- 336,340 ----
! #if defined(__MWERKS__)
int ftruncate(short int file,int offset)
{
***************
*** 348,352 ****
#endif
! #if defined(__MWERKS__) && !TARGET_API_MAC_CARBON
#include <ansi_files.h>
--- 351,355 ----
#endif
! #if defined(__MWERKS__)
#include <ansi_files.h>
***************
*** 433,436 ****
--- 436,440 ----
int __open_file (const char * name, __std(__file_modes) mode, __std(__file_handle) * handle);
+ OSErr __path2fss(const char * pathName, FSSpecPtr spec);
int __open_file(const char * name, __file_modes mode, __file_handle * handle)
***************
*** 440,443 ****
--- 444,448 ----
HParamBlockRec pb;
+
ioResult = __path2fss(name, &spec);
if (__system7present()) /* mm 980424 */
***************
*** 450,454 ****
return(__io_error);
! #if TARGET_API_MAC_CARBON
if (ioResult) {
CFStringRef filePath;
--- 455,460 ----
return(__io_error);
!
! #if TARGET_API_MAC_CARBON
if (ioResult) {
CFStringRef filePath;
***************
*** 460,463 ****
--- 466,470 ----
long tokenLength;
+
filePath = CFStringCreateWithBytes(kCFAllocatorDefault,(UInt8 *)name,strlen(name),kCFStringEncodingMacRoman,false);
if (filePath == nil)
***************
*** 474,477 ****
--- 481,491 ----
filePath = CFURLCopyLastPathComponent(sillyThing);
tokenLength = CFStringGetLength(filePath);
+ if (tokenLength > 1024) {
+ CFRelease(filePath);
+ CFRelease(sillyThing);
+ CFRelease(sillyThing2);
+ return(__io_error);
+ }
+
CFStringGetCharacters(filePath,CFRangeMake(0,tokenLength),buffer);
***************
*** 484,492 ****
return(__io_error);
! ioResult = FSpOpenDF(&spec,(mode.io_mode == __read) ? fsRdPerm : fsRdWrPerm, &fileRefNum);
if (ioResult)
! return(__io_error);
!
! *handle = fileRefNum;
return(__no_io_error);
--- 498,514 ----
return(__io_error);
! pb.ioParam.ioNamePtr = spec.name;
! pb.ioParam.ioVRefNum = spec.vRefNum;
! pb.ioParam.ioPermssn = (mode.io_mode == __read) ? fsRdPerm : fsRdWrPerm;
! pb.ioParam.ioMisc = 0;
! pb.fileParam.ioFVersNum = 0;
! pb.fileParam.ioDirID = spec.parID;
! set_file_type(&spec, mode.binary_io);
! ioResult = PBHOpenDFSync(&pb); /* HH 10/25/97 was PBHOpenSync */
!
if (ioResult)
! return(__io_error);
!
! *handle = pb.ioParam.ioRefNum;
return(__no_io_error);
|