[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:13:23 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f6a275d15095e871bd305e9d32376064c56dffb9
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu May 16 17:45:32 2002 +0000

    	* Plugins.subproj/IFPluginView.mm:
    	(-[IFPluginView IFURLHandleResourceDidFinishLoading:data:]):
    	Use this new getCarbonPath function rather than hardcoding assumptions
    	about "/tmp" being ":private:tmp".
    	(getCarbonPath): New.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1164 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 1277a06..e104c4c 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,13 @@
 2002-05-16  Darin Adler  <darin at apple.com>
 
+	* Plugins.subproj/IFPluginView.mm:
+	(-[IFPluginView IFURLHandleResourceDidFinishLoading:data:]):
+	Use this new getCarbonPath function rather than hardcoding assumptions
+	about "/tmp" being ":private:tmp".
+	(getCarbonPath): New.
+
+2002-05-16  Darin Adler  <darin at apple.com>
+
 	* Plugins.subproj/IFPluginView.mm: (-[IFPluginView mouseUp:]):
 	Fixed log statement so development builds work again.
 
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 1277a06..e104c4c 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,5 +1,13 @@
 2002-05-16  Darin Adler  <darin at apple.com>
 
+	* Plugins.subproj/IFPluginView.mm:
+	(-[IFPluginView IFURLHandleResourceDidFinishLoading:data:]):
+	Use this new getCarbonPath function rather than hardcoding assumptions
+	about "/tmp" being ":private:tmp".
+	(getCarbonPath): New.
+
+2002-05-16  Darin Adler  <darin at apple.com>
+
 	* Plugins.subproj/IFPluginView.mm: (-[IFPluginView mouseUp:]):
 	Fixed log statement so development builds work again.
 
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index c5dce20..76f103e 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -28,7 +28,7 @@
 #import <IFPluginNullEventSender.h>
 #import "IFNullPluginView.h"
 
-static NSString* startupVolumeName(void);
+static NSString *getCarbonPath(NSString *posixPath);
 
 @implementation IFPluginView
 
@@ -606,7 +606,7 @@ static char *newCString(NSString *string)
 - (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
 {
     NPError npErr;
-    NSMutableString *filenameClassic, *path;
+    NSMutableString *path;
     IFPluginStream *stream;
     NSFileManager *fileManager;
     uint16 transferMode;
@@ -619,16 +619,18 @@ static char *newCString(NSString *string)
     filename = [stream filename];
     
     if(transferMode == NP_ASFILE || transferMode == NP_ASFILEONLY) {
-        path = [NSString stringWithFormat:@"%@%@", @"/tmp/", filename];        
+        // FIXME: Need to use something like mkstemp?
+        path = [NSString stringWithFormat:@"/tmp/%@", @"/tmp/", filename];        
         [filesToErase addObject:path];
         
         fileManager = [NSFileManager defaultManager];
         [fileManager removeFileAtPath:path handler:nil];
         [fileManager createFileAtPath:path contents:[stream data] attributes:nil];
         
-        filenameClassic = [NSString stringWithFormat:@"%@%@%@", startupVolumeName(), @":private:tmp:", filename];
-        NPP_StreamAsFile(instance, npStream, [filenameClassic cString]);
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_StreamAsFile: %s\n", [filenameClassic cString]);
+        // FIXME: Will cString use the correct character set?
+        NPP_StreamAsFile(instance, npStream, [getCarbonPath(filename) cString]);
+        
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_StreamAsFile: %s\n", [getCarbonPath(filename) cString]);
     }
     npErr = NPP_DestroyStream(instance, npStream, NPRES_DONE);
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_DestroyStream: %d\n", npErr);
@@ -800,15 +802,50 @@ static char *newCString(NSString *string)
 
 @end
 
-NSString* startupVolumeName(void)
+static NSString *getCarbonPath(NSString *posixPath)
 {
-    NSString* rootName = nil;
-    FSRef rootRef;
-    if (FSPathMakeRef ((const UInt8 *) "/", & rootRef, NULL /*isDirectory*/) == noErr) {         
-        HFSUniStr255  nameString;
-        if (FSGetCatalogInfo (&rootRef, kFSCatInfoNone, NULL /*catalogInfo*/, &nameString, NULL /*fsSpec*/, NULL /*parentRef*/) == noErr) {
-            rootName = [NSString stringWithCharacters:nameString.unicode length:nameString.length];
+    OSStatus error;
+    FSRef ref, rootRef, parentRef;
+    FSCatalogInfo info;
+    NSMutableArray *carbonPathPieces;
+    HFSUniStr255 nameString;
+    
+    // Make an FSRef.
+    error = FSPathMakeRef((const UInt8 *)[[NSFileManager defaultManager] fileSystemRepresentationWithPath:posixPath], &ref, NULL);
+    if (error != noErr) {
+        return nil;
+    }
+    
+    // Get volume refNum.
+    error = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &info, NULL, NULL, NULL);
+    if (error != noErr) {
+        return nil;
+    }
+    
+    // Get root directory FSRef.
+    error = FSGetVolumeInfo(info.volume, 0, NULL, kFSVolInfoNone, NULL, NULL, &rootRef);
+    if (error != noErr) {
+        return nil;
+    }
+    
+    // Get the pieces of the path.
+    carbonPathPieces = [NSMutableArray array];
+    for (;;) {
+        error = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, &nameString, NULL, &parentRef);
+        if (error != noErr) {
+            return nil;
+        }
+        [carbonPathPieces insertObject:[NSString stringWithCharacters:nameString.unicode length:nameString.length] atIndex:0];
+        if (FSCompareFSRefs(&ref, &rootRef) == noErr) {
+            break;
         }
+        ref = parentRef;
     }
-    return rootName;
+    
+    // Volume names need trailing : character.
+    if ([carbonPathPieces count] == 1) {
+        [carbonPathPieces addObject:@""];
+    }
+    
+    return [carbonPathPieces componentsJoinedByString:@":"];
 }
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index c5dce20..76f103e 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -28,7 +28,7 @@
 #import <IFPluginNullEventSender.h>
 #import "IFNullPluginView.h"
 
-static NSString* startupVolumeName(void);
+static NSString *getCarbonPath(NSString *posixPath);
 
 @implementation IFPluginView
 
@@ -606,7 +606,7 @@ static char *newCString(NSString *string)
 - (void)IFURLHandleResourceDidFinishLoading:(IFURLHandle *)sender data: (NSData *)data
 {
     NPError npErr;
-    NSMutableString *filenameClassic, *path;
+    NSMutableString *path;
     IFPluginStream *stream;
     NSFileManager *fileManager;
     uint16 transferMode;
@@ -619,16 +619,18 @@ static char *newCString(NSString *string)
     filename = [stream filename];
     
     if(transferMode == NP_ASFILE || transferMode == NP_ASFILEONLY) {
-        path = [NSString stringWithFormat:@"%@%@", @"/tmp/", filename];        
+        // FIXME: Need to use something like mkstemp?
+        path = [NSString stringWithFormat:@"/tmp/%@", @"/tmp/", filename];        
         [filesToErase addObject:path];
         
         fileManager = [NSFileManager defaultManager];
         [fileManager removeFileAtPath:path handler:nil];
         [fileManager createFileAtPath:path contents:[stream data] attributes:nil];
         
-        filenameClassic = [NSString stringWithFormat:@"%@%@%@", startupVolumeName(), @":private:tmp:", filename];
-        NPP_StreamAsFile(instance, npStream, [filenameClassic cString]);
-        WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_StreamAsFile: %s\n", [filenameClassic cString]);
+        // FIXME: Will cString use the correct character set?
+        NPP_StreamAsFile(instance, npStream, [getCarbonPath(filename) cString]);
+        
+        WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_StreamAsFile: %s\n", [getCarbonPath(filename) cString]);
     }
     npErr = NPP_DestroyStream(instance, npStream, NPRES_DONE);
     WEBKITDEBUGLEVEL(WEBKIT_LOG_PLUGINS, "NPP_DestroyStream: %d\n", npErr);
@@ -800,15 +802,50 @@ static char *newCString(NSString *string)
 
 @end
 
-NSString* startupVolumeName(void)
+static NSString *getCarbonPath(NSString *posixPath)
 {
-    NSString* rootName = nil;
-    FSRef rootRef;
-    if (FSPathMakeRef ((const UInt8 *) "/", & rootRef, NULL /*isDirectory*/) == noErr) {         
-        HFSUniStr255  nameString;
-        if (FSGetCatalogInfo (&rootRef, kFSCatInfoNone, NULL /*catalogInfo*/, &nameString, NULL /*fsSpec*/, NULL /*parentRef*/) == noErr) {
-            rootName = [NSString stringWithCharacters:nameString.unicode length:nameString.length];
+    OSStatus error;
+    FSRef ref, rootRef, parentRef;
+    FSCatalogInfo info;
+    NSMutableArray *carbonPathPieces;
+    HFSUniStr255 nameString;
+    
+    // Make an FSRef.
+    error = FSPathMakeRef((const UInt8 *)[[NSFileManager defaultManager] fileSystemRepresentationWithPath:posixPath], &ref, NULL);
+    if (error != noErr) {
+        return nil;
+    }
+    
+    // Get volume refNum.
+    error = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &info, NULL, NULL, NULL);
+    if (error != noErr) {
+        return nil;
+    }
+    
+    // Get root directory FSRef.
+    error = FSGetVolumeInfo(info.volume, 0, NULL, kFSVolInfoNone, NULL, NULL, &rootRef);
+    if (error != noErr) {
+        return nil;
+    }
+    
+    // Get the pieces of the path.
+    carbonPathPieces = [NSMutableArray array];
+    for (;;) {
+        error = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, &nameString, NULL, &parentRef);
+        if (error != noErr) {
+            return nil;
+        }
+        [carbonPathPieces insertObject:[NSString stringWithCharacters:nameString.unicode length:nameString.length] atIndex:0];
+        if (FSCompareFSRefs(&ref, &rootRef) == noErr) {
+            break;
         }
+        ref = parentRef;
     }
-    return rootName;
+    
+    // Volume names need trailing : character.
+    if ([carbonPathPieces count] == 1) {
+        [carbonPathPieces addObject:@""];
+    }
+    
+    return [carbonPathPieces componentsJoinedByString:@":"];
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list