mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
whitespace/minor cleanup for nsPluginsDirDarwin.cpp, no bug
This commit is contained in:
parent
c5d2c43d02
commit
70f9b5f422
@ -75,29 +75,29 @@ typedef NS_NPAPIPLUGIN_CALLBACK(OSErr, BP_GETSUPPORTEDMIMETYPES) (BPSupportedMIM
|
|||||||
*/
|
*/
|
||||||
static CFBundleRef getPluginBundle(const char* path)
|
static CFBundleRef getPluginBundle(const char* path)
|
||||||
{
|
{
|
||||||
CFBundleRef bundle = NULL;
|
CFBundleRef bundle = NULL;
|
||||||
CFStringRef pathRef = CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8);
|
CFStringRef pathRef = ::CFStringCreateWithCString(NULL, path, kCFStringEncodingUTF8);
|
||||||
if (pathRef) {
|
if (pathRef) {
|
||||||
CFURLRef bundleURL = CFURLCreateWithFileSystemPath(NULL, pathRef, kCFURLPOSIXPathStyle, true);
|
CFURLRef bundleURL = ::CFURLCreateWithFileSystemPath(NULL, pathRef, kCFURLPOSIXPathStyle, true);
|
||||||
if (bundleURL) {
|
if (bundleURL) {
|
||||||
bundle = CFBundleCreate(NULL, bundleURL);
|
bundle = ::CFBundleCreate(NULL, bundleURL);
|
||||||
CFRelease(bundleURL);
|
::CFRelease(bundleURL);
|
||||||
}
|
|
||||||
CFRelease(pathRef);
|
|
||||||
}
|
}
|
||||||
return bundle;
|
::CFRelease(pathRef);
|
||||||
|
}
|
||||||
|
return bundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
static OSErr toFSSpec(nsIFile* file, FSSpec& outSpec)
|
static OSErr toFSSpec(nsIFile* file, FSSpec& outSpec)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsILocalFileMac> lfm = do_QueryInterface(file);
|
nsCOMPtr<nsILocalFileMac> lfm = do_QueryInterface(file);
|
||||||
if (!lfm)
|
if (!lfm)
|
||||||
return -1;
|
return -1;
|
||||||
FSSpec foo;
|
FSSpec foo;
|
||||||
lfm->GetFSSpec(&foo);
|
lfm->GetFSSpec(&foo);
|
||||||
outSpec = foo;
|
outSpec = foo;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsresult toCFURLRef(nsIFile* file, CFURLRef& outURL)
|
static nsresult toCFURLRef(nsIFile* file, CFURLRef& outURL)
|
||||||
@ -166,10 +166,10 @@ PRBool nsPluginsDir::IsPluginFile(nsIFile* file)
|
|||||||
CFURLRef executableURL = CFBundleCopyExecutableURL(pluginBundle);
|
CFURLRef executableURL = CFBundleCopyExecutableURL(pluginBundle);
|
||||||
if (executableURL) {
|
if (executableURL) {
|
||||||
isPluginFile = IsLoadablePlugin(executableURL);
|
isPluginFile = IsLoadablePlugin(executableURL);
|
||||||
CFRelease(executableURL);
|
::CFRelease(executableURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CFRelease(pluginBundle);
|
::CFRelease(pluginBundle);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LSItemInfoRecord info;
|
LSItemInfoRecord info;
|
||||||
@ -183,7 +183,7 @@ PRBool nsPluginsDir::IsPluginFile(nsIFile* file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CFRelease(pluginURL);
|
::CFRelease(pluginURL);
|
||||||
return isPluginFile;
|
return isPluginFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,35 +279,35 @@ nsPluginFile::~nsPluginFile() {}
|
|||||||
*/
|
*/
|
||||||
nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
|
nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
|
||||||
{
|
{
|
||||||
const char* path;
|
const char* path;
|
||||||
|
|
||||||
if (!mPlugin)
|
if (!mPlugin)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsCAutoString temp;
|
nsCAutoString temp;
|
||||||
mPlugin->GetNativePath(temp);
|
mPlugin->GetNativePath(temp);
|
||||||
path = temp.get();
|
path = temp.get();
|
||||||
|
|
||||||
outLibrary = PR_LoadLibrary(path);
|
outLibrary = PR_LoadLibrary(path);
|
||||||
pLibrary = outLibrary;
|
pLibrary = outLibrary;
|
||||||
if (!outLibrary) {
|
if (!outLibrary) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("[loaded plugin %s]\n", path);
|
printf("[loaded plugin %s]\n", path);
|
||||||
#endif
|
#endif
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* p2cstrdup(StringPtr pstr)
|
static char* p2cstrdup(StringPtr pstr)
|
||||||
{
|
{
|
||||||
int len = pstr[0];
|
int len = pstr[0];
|
||||||
char* cstr = static_cast<char*>(NS_Alloc(len + 1));
|
char* cstr = static_cast<char*>(NS_Alloc(len + 1));
|
||||||
if (cstr) {
|
if (cstr) {
|
||||||
::BlockMoveData(pstr + 1, cstr, len);
|
::BlockMoveData(pstr + 1, cstr, len);
|
||||||
cstr[len] = '\0';
|
cstr[len] = '\0';
|
||||||
}
|
}
|
||||||
return cstr;
|
return cstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* GetNextPluginStringFromHandle(Handle h, short *index)
|
static char* GetNextPluginStringFromHandle(Handle h, short *index)
|
||||||
@ -319,9 +319,9 @@ static char* GetNextPluginStringFromHandle(Handle h, short *index)
|
|||||||
|
|
||||||
static char* GetPluginString(short id, short index)
|
static char* GetPluginString(short id, short index)
|
||||||
{
|
{
|
||||||
Str255 str;
|
Str255 str;
|
||||||
::GetIndString(str, id, index);
|
::GetIndString(str, id, index);
|
||||||
return p2cstrdup(str);
|
return p2cstrdup(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens the resource fork for the plugin
|
// Opens the resource fork for the plugin
|
||||||
@ -339,7 +339,7 @@ static short OpenPluginResourceFork(nsIFile *pluginFile)
|
|||||||
CFBundleRef bundle = getPluginBundle(path.get());
|
CFBundleRef bundle = getPluginBundle(path.get());
|
||||||
if (bundle) {
|
if (bundle) {
|
||||||
refNum = CFBundleOpenBundleResourceMap(bundle);
|
refNum = CFBundleOpenBundleResourceMap(bundle);
|
||||||
CFRelease(bundle);
|
::CFRelease(bundle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return refNum;
|
return refNum;
|
||||||
|
Loading…
Reference in New Issue
Block a user