|
From: John M M. <jo...@us...> - 2002-05-13 20:08:08
|
Update of /cvsroot/squeak/squeak/platforms/Mac OS/plugins/DropPlugin
In directory usw-pr-cvs1:/tmp/cvs-serv4627/squeak/platforms/Mac OS/plugins/DropPlugin
Modified Files:
sqMacDragDrop.c
Log Message:
3.2.7b5 Use new file open with security flag
Index: sqMacDragDrop.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/Mac OS/plugins/DropPlugin/sqMacDragDrop.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sqMacDragDrop.c 9 Jan 2002 06:42:12 -0000 1.3
--- sqMacDragDrop.c 13 May 2002 19:49:47 -0000 1.4
***************
*** 43,46 ****
--- 43,48 ----
9/9/99 by John Montbriand
+ May 8th,2002,JMM - Bert Freudenberg published some changes to make file opening easier without security
+
*/
/*
***************
*** 59,63 ****
#include "sqVirtualMachine.h"
- #include "FilePlugin.h"
#include "sqMacFileLogic.h"
--- 61,64 ----
***************
*** 90,94 ****
Boolean gApprovedDrag = false; /* set to true if the drag is approved */
Boolean gInIconBox = false; /* set true if the drag is inside our drop box */
- long gSecurityCallbackToDisableSecurity = 0;
extern struct VirtualMachine *interpreterProxy;
--- 91,94 ----
***************
*** 174,190 ****
}
! int sqSetFileAccessCallback(void *function) {
! gSecurityCallbackToDisableSecurity = (long) function;
! }
!
! /* Return a pointer to the first byte of of the file record within the given Smalltalk object, or nil if objectPointer is not a file record. */
!
! static SQFile * fileValueOf(int objectPointer) {
! if (!((interpreterProxy->isBytes(objectPointer)) && ((interpreterProxy->byteSizeOf(objectPointer)) == ( sizeof(SQFile))))) {
! interpreterProxy->primitiveFail();
! return null;
! }
! return interpreterProxy->firstIndexableField(objectPointer);
! }
//Primitive to get file name
--- 174,179 ----
}
! int sqSecFileAccessCallback(void *function) {
! }
//Primitive to get file name
***************
*** 202,217 ****
int dropRequestFileHandle(int dropIndex) {
! int fileHandle,fn,iHFAfn;
! int size,classPointer;
char *dropName = dropRequestFileName(dropIndex);
! Boolean needToFlipFlagBack=false;
!
if(!dropName)
return interpreterProxy->nilObject();
! size = sizeof(SQFile);
! classPointer = interpreterProxy->classByteArray();
! fileHandle = interpreterProxy->instantiateClassindexableSize(classPointer, size);
! fn = interpreterProxy->ioLoadFunctionFrom("fileOpennamesizewrite", "FilePlugin");
if (fn == 0) {
/* begin primitiveFail */
--- 191,201 ----
int dropRequestFileHandle(int dropIndex) {
! int fileOop,fn;
char *dropName = dropRequestFileName(dropIndex);
!
if(!dropName)
return interpreterProxy->nilObject();
! fn = interpreterProxy->ioLoadFunctionFrom("fileOpenNamesizewritesecure", "FilePlugin");
if (fn == 0) {
/* begin primitiveFail */
***************
*** 219,234 ****
return null;
}
! if (gSecurityCallbackToDisableSecurity != 0 ) {
! iHFAfn = interpreterProxy->ioLoadFunctionFrom("secHasFileAccess", "SecurityPlugin");
! if ((iHFAfn != 0) && !((int (*) (void)) iHFAfn)()){
! ((int (*) (int)) gSecurityCallbackToDisableSecurity)(true);
! needToFlipFlagBack = true;
! }
! }
! ((int (*) (SQFile *, int, int,int)) fn)(fileValueOf(fileHandle),(int)dropName, strlen(dropName), 0);
! if (needToFlipFlagBack)
! ((int (*) (int)) gSecurityCallbackToDisableSecurity)(false);
! return fileHandle;
}
--- 203,209 ----
return null;
}
! fileOop = ((int (*) (int, int, int, int)) fn)((int)dropName, strlen(dropName), 0,0);
! return fileOop;
}
|