зеркало из https://github.com/mozilla/pjs.git
Various 64-bit fixes for Mac OS X widget and plugin code. b=509947 r=mstange
This commit is contained in:
Родитель
8a1d48b424
Коммит
b799c5f197
|
@ -508,18 +508,24 @@ nsNPAPIPlugin::CreatePlugin(const char* aFilePath, PRLibrary* aLibrary,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(XP_MACOSX)
|
#if defined(XP_MACOSX)
|
||||||
|
#ifndef __LP64__
|
||||||
short appRefNum = ::CurResFile();
|
short appRefNum = ::CurResFile();
|
||||||
short pluginRefNum;
|
short pluginRefNum;
|
||||||
|
#endif
|
||||||
|
|
||||||
nsCOMPtr<nsILocalFile> pluginPath;
|
nsCOMPtr<nsILocalFile> pluginPath;
|
||||||
NS_NewNativeLocalFile(nsDependentCString(aFilePath), PR_TRUE,
|
NS_NewNativeLocalFile(nsDependentCString(aFilePath), PR_TRUE,
|
||||||
getter_AddRefs(pluginPath));
|
getter_AddRefs(pluginPath));
|
||||||
|
|
||||||
nsPluginFile pluginFile(pluginPath);
|
nsPluginFile pluginFile(pluginPath);
|
||||||
|
|
||||||
|
#ifndef __LP64__
|
||||||
pluginRefNum = pluginFile.OpenPluginResource();
|
pluginRefNum = pluginFile.OpenPluginResource();
|
||||||
|
#endif
|
||||||
|
|
||||||
nsNPAPIPlugin* plugin = new nsNPAPIPlugin(nsnull, aLibrary, nsnull);
|
nsNPAPIPlugin* plugin = new nsNPAPIPlugin(nsnull, aLibrary, nsnull);
|
||||||
|
#ifndef __LP64__
|
||||||
::UseResFile(appRefNum);
|
::UseResFile(appRefNum);
|
||||||
|
#endif
|
||||||
if (!plugin)
|
if (!plugin)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
@ -531,8 +537,10 @@ nsNPAPIPlugin::CreatePlugin(const char* aFilePath, PRLibrary* aLibrary,
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __LP64__
|
||||||
plugin->SetPluginRefNum(pluginRefNum);
|
plugin->SetPluginRefNum(pluginRefNum);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef XP_BEOS
|
#ifdef XP_BEOS
|
||||||
// I just copied UNIX version.
|
// I just copied UNIX version.
|
||||||
|
@ -2110,8 +2118,7 @@ _setvalue(NPP npp, NPPVariable variable, void *result)
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
case NPPVpluginDrawingModel: {
|
case NPPVpluginDrawingModel: {
|
||||||
if (inst) {
|
if (inst) {
|
||||||
int dModelValue = (int)result;
|
inst->SetDrawingModel((NPDrawingModel)NS_PTR_TO_INT32(result));
|
||||||
inst->SetDrawingModel((NPDrawingModel)dModelValue);
|
|
||||||
return NPERR_NO_ERROR;
|
return NPERR_NO_ERROR;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -305,6 +305,7 @@ static char* GetNextPluginStringFromHandle(Handle h, short *index)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __LP64__
|
||||||
static char* GetPluginString(short id, short index)
|
static char* GetPluginString(short id, short index)
|
||||||
{
|
{
|
||||||
Str255 str;
|
Str255 str;
|
||||||
|
@ -359,6 +360,7 @@ public:
|
||||||
private:
|
private:
|
||||||
short mRefNum;
|
short mRefNum;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtains all of the information currently available for this plugin.
|
* Obtains all of the information currently available for this plugin.
|
||||||
|
@ -372,9 +374,12 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||||
|
|
||||||
// First open up resource we can use to get plugin info.
|
// First open up resource we can use to get plugin info.
|
||||||
|
|
||||||
|
#ifndef __LP64__
|
||||||
// Try to open a resource fork.
|
// Try to open a resource fork.
|
||||||
nsAutoCloseResourceObject resourceObject(mPlugin);
|
nsAutoCloseResourceObject resourceObject(mPlugin);
|
||||||
bool resourceOpened = resourceObject.ResourceOpened();
|
bool resourceOpened = resourceObject.ResourceOpened();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Try to get a bundle reference.
|
// Try to get a bundle reference.
|
||||||
nsCAutoString path;
|
nsCAutoString path;
|
||||||
if (NS_FAILED(rv = mPlugin->GetNativePath(path)))
|
if (NS_FAILED(rv = mPlugin->GetNativePath(path)))
|
||||||
|
@ -400,10 +405,12 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||||
if (name && ::CFGetTypeID(name) == ::CFStringGetTypeID())
|
if (name && ::CFGetTypeID(name) == ::CFStringGetTypeID())
|
||||||
info.fName = CFStringRefToUTF8Buffer(static_cast<CFStringRef>(name));
|
info.fName = CFStringRefToUTF8Buffer(static_cast<CFStringRef>(name));
|
||||||
}
|
}
|
||||||
|
#ifndef __LP64__
|
||||||
if (!info.fName && resourceOpened) {
|
if (!info.fName && resourceOpened) {
|
||||||
// 'STR#', 126, 2 => plugin name.
|
// 'STR#', 126, 2 => plugin name.
|
||||||
info.fName = GetPluginString(126, 2);
|
info.fName = GetPluginString(126, 2);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Get fDescription
|
// Get fDescription
|
||||||
if (bundle) {
|
if (bundle) {
|
||||||
|
@ -411,10 +418,12 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||||
if (description && ::CFGetTypeID(description) == ::CFStringGetTypeID())
|
if (description && ::CFGetTypeID(description) == ::CFStringGetTypeID())
|
||||||
info.fDescription = CFStringRefToUTF8Buffer(static_cast<CFStringRef>(description));
|
info.fDescription = CFStringRefToUTF8Buffer(static_cast<CFStringRef>(description));
|
||||||
}
|
}
|
||||||
|
#ifndef __LP64__
|
||||||
if (!info.fDescription && resourceOpened) {
|
if (!info.fDescription && resourceOpened) {
|
||||||
// 'STR#', 126, 1 => plugin description.
|
// 'STR#', 126, 1 => plugin description.
|
||||||
info.fDescription = GetPluginString(126, 1);
|
info.fDescription = GetPluginString(126, 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Get fVersion
|
// Get fVersion
|
||||||
if (bundle) {
|
if (bundle) {
|
||||||
|
@ -465,6 +474,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __LP64__
|
||||||
// Try to get data from the resource fork
|
// Try to get data from the resource fork
|
||||||
if (!info.fVariantCount && resourceObject.ResourceOpened()) {
|
if (!info.fVariantCount && resourceObject.ResourceOpened()) {
|
||||||
mi.typeStrings = ::Get1Resource('STR#', 128);
|
mi.typeStrings = ::Get1Resource('STR#', 128);
|
||||||
|
@ -483,6 +493,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||||
::HLock(mi.infoStrings);
|
::HLock(mi.infoStrings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Fill in the info struct based on the data in the BPSupportedMIMETypes struct
|
// Fill in the info struct based on the data in the BPSupportedMIMETypes struct
|
||||||
int variantCount = info.fVariantCount;
|
int variantCount = info.fVariantCount;
|
||||||
|
|
|
@ -382,7 +382,7 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect &aRect,
|
||||||
contentRect.origin.y -= (newWindowFrame.size.height - aRect.size.height);
|
contentRect.origin.y -= (newWindowFrame.size.height - aRect.size.height);
|
||||||
|
|
||||||
if (mWindowType != eWindowType_popup)
|
if (mWindowType != eWindowType_popup)
|
||||||
contentRect.origin.y -= ::GetMBarHeight();
|
contentRect.origin.y -= [[NSApp mainMenu] menuBarHeight];
|
||||||
}
|
}
|
||||||
|
|
||||||
// NSLog(@"Top-level window being created at Cocoa rect: %f, %f, %f, %f\n",
|
// NSLog(@"Top-level window being created at Cocoa rect: %f, %f, %f, %f\n",
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
NS_DECL_NSITOOLKIT
|
NS_DECL_NSITOOLKIT
|
||||||
|
|
||||||
// Returns the OS X version as returned from Gestalt(gestaltSystemVersion, ...)
|
// Returns the OS X version as returned from Gestalt(gestaltSystemVersion, ...)
|
||||||
static long OSXVersion();
|
static PRInt32 OSXVersion();
|
||||||
|
|
||||||
// Convenience functions to check the OS version
|
// Convenience functions to check the OS version
|
||||||
static PRBool OnLeopardOrLater();
|
static PRBool OnLeopardOrLater();
|
||||||
|
|
|
@ -381,15 +381,15 @@ NS_IMETHODIMP NS_GetCurrentToolkit(nsIToolkit* *aResult)
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
long nsToolkit::OSXVersion()
|
PRInt32 nsToolkit::OSXVersion()
|
||||||
{
|
{
|
||||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||||
|
|
||||||
static long gOSXVersion = 0x0;
|
static PRInt32 gOSXVersion = 0x0;
|
||||||
if (gOSXVersion == 0x0) {
|
if (gOSXVersion == 0x0) {
|
||||||
OSErr err = ::Gestalt(gestaltSystemVersion, &gOSXVersion);
|
OSErr err = ::Gestalt(gestaltSystemVersion, (SInt32*)&gOSXVersion);
|
||||||
if (err != noErr) {
|
if (err != noErr) {
|
||||||
//This should probably be changed when our minimum version changes
|
// This should probably be changed when our minimum version changes
|
||||||
NS_ERROR("Couldn't determine OS X version, assuming 10.4");
|
NS_ERROR("Couldn't determine OS X version, assuming 10.4");
|
||||||
gOSXVersion = MAC_OS_X_VERSION_10_4_HEX;
|
gOSXVersion = MAC_OS_X_VERSION_10_4_HEX;
|
||||||
}
|
}
|
||||||
|
@ -441,9 +441,13 @@ nsresult nsToolkit::SwizzleMethods(Class aClass, SEL orgMethod, SEL posedMethod,
|
||||||
if (!original || !posed)
|
if (!original || !posed)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
#ifdef __LP64__
|
||||||
|
method_exchangeImplementations(original, posed);
|
||||||
|
#else
|
||||||
IMP aMethodImp = original->method_imp;
|
IMP aMethodImp = original->method_imp;
|
||||||
original->method_imp = posed->method_imp;
|
original->method_imp = posed->method_imp;
|
||||||
posed->method_imp = aMethodImp;
|
posed->method_imp = aMethodImp;
|
||||||
|
#endif
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче