Permalink
Browse files

Removing the deprecated calls to _dyld_get_image_header_containing_ad…

…dress and replacing them with calls to dladr instead. The dyld function was deprecated from 10.4 and dladr was added in 10.3

This change also fixes the includes of some mac Foundation framework headers.
I have verified that the firebreath code is still able to compile and produce a working plugin.
  • Loading branch information...
1 parent 4c262f0 commit 2736ecc5c3f53b282c1fd614389697ccb1c70430 Anders Bach Madsen committed Jun 12, 2012
@@ -14,7 +14,6 @@ Copyright 2009 Richard Bateman, Firebreath development team
#ifdef FB_MACOSX
#include <dlfcn.h>
-#include <mach-o/dyld.h>
#endif
#include <cstdio>
#include "NpapiPlugin.h"
@@ -156,7 +155,11 @@ NPError NpapiPluginModule::NPP_New(NPMIMEType pluginType, NPP instance, uint16_t
{
#ifdef FB_MACOSX
// Helps with certain weird embedding cases
- NpapiPluginModule *module = NpapiPluginModule::GetModule(_dyld_get_image_header_containing_address(__builtin_return_address(0)));
+ Dl_info info;
+
+ dladdr(__builtin_return_address(0), &info);
+
+ NpapiPluginModule *module = NpapiPluginModule::GetModule(info.dli_fbase);
#else
NpapiPluginModule *module = NpapiPluginModule::GetModule(0);
#endif
@@ -10,7 +10,6 @@
#include "NpapiPluginModule.h"
#include <dlfcn.h>
-#include <mach-o/dyld.h>
#include <sys/sysctl.h>
#ifndef NDEBUG
@@ -55,7 +54,9 @@ NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs)
{
FBLOG_INFO("NPAPI", "");
initPluginModule();
- NpapiPluginModule *module = NpapiPluginModule::GetModule(_dyld_get_image_header_containing_address(__builtin_return_address(0)));
+ Dl_info info;
+ dladdr(__builtin_return_address(0), &info);
+ NpapiPluginModule *module = NpapiPluginModule::GetModule(info.dli_fbase);
module->getPluginFuncs(pFuncs);
return NPERR_NO_ERROR;
}
@@ -64,7 +65,9 @@ NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs)
{
/* can't use FBLOG_XXX before GetModule returns, as it calls InitLogging */
initPluginModule();
- NpapiPluginModule *module = NpapiPluginModule::GetModule(_dyld_get_image_header_containing_address(__builtin_return_address(0)));
+ Dl_info info;
+ dladdr(__builtin_return_address(0), &info);
+ NpapiPluginModule *module = NpapiPluginModule::GetModule(info.dli_fbase);
module->setNetscapeFuncs(pFuncs);
FBLOG_INFO("NPAPI", "Initialization done");
@@ -74,6 +77,8 @@ NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs)
NPError OSCALL NP_Shutdown()
{
FBLOG_INFO("NPAPI", "");
- NpapiPluginModule::ReleaseModule(_dyld_get_image_header_containing_address(__builtin_return_address(0)));
+ Dl_info info;
+ dladdr(__builtin_return_address(0), &info);
+ NpapiPluginModule::ReleaseModule(info.dli_fbase);
return NPERR_NO_ERROR;
}
@@ -13,9 +13,9 @@
\**********************************************************/
#include "../SystemHelpers.h"
-#import "NSPathUtilities.h"
-#import "NSAutoreleasePool.h"
-#import "NSFileManager.h"
+#import <Foundation/NSPathUtilities.h>
+#import <Foundation/NSAutoreleasePool.h>
+#import <Foundation/NSFileManager.h>
using std::string;

0 comments on commit 2736ecc

Please sign in to comment.