| Index: base/native_library_mac.mm
|
| diff --git a/base/native_library_mac.mm b/base/native_library_mac.mm
|
| index 16848858fd09b0cd92df29a3c3abf9080894c596..f7eeba3e7e208057872ced882f5b75e707b2acfd 100644
|
| --- a/base/native_library_mac.mm
|
| +++ b/base/native_library_mac.mm
|
| @@ -27,18 +27,11 @@ static NativeLibraryObjCStatus GetObjCStatusForImage(
|
| // of testing is used in _CFBundleGrokObjcImageInfoFromFile in
|
| // CF-744/CFBundle.c, around lines 2447-2474.
|
| //
|
| - // In 32-bit images, ObjC can be recognized in __OBJC,__image_info, whereas
|
| - // in 64-bit, the data is in __DATA,__objc_imageinfo.
|
| -#if __LP64__
|
| + // In 64-bit images, ObjC can be recognized in __DATA,__objc_imageinfo.
|
| const section_64* section = getsectbynamefromheader_64(
|
| reinterpret_cast<const struct mach_header_64*>(info.dli_fbase),
|
| SEG_DATA, "__objc_imageinfo");
|
| -#else
|
| - const section* section = getsectbynamefromheader(
|
| - reinterpret_cast<const struct mach_header*>(info.dli_fbase),
|
| - SEG_OBJC, "__image_info");
|
| -#endif
|
| - return section == NULL ? OBJC_NOT_PRESENT : OBJC_PRESENT;
|
| + return section ? OBJC_PRESENT : OBJC_NOT_PRESENT;
|
| }
|
|
|
| std::string NativeLibraryLoadError::ToString() const {
|
| @@ -46,7 +39,7 @@ std::string NativeLibraryLoadError::ToString() const {
|
| }
|
|
|
| // static
|
| -NativeLibrary LoadNativeLibrary(const base::FilePath& library_path,
|
| +NativeLibrary LoadNativeLibrary(const FilePath& library_path,
|
| NativeLibraryLoadError* error) {
|
| // dlopen() etc. open the file off disk.
|
| if (library_path.Extension() == "dylib" || !DirectoryExists(library_path)) {
|
| @@ -62,7 +55,7 @@ NativeLibrary LoadNativeLibrary(const base::FilePath& library_path,
|
| native_lib->objc_status = OBJC_UNKNOWN;
|
| return native_lib;
|
| }
|
| - base::ScopedCFTypeRef<CFURLRef> url(CFURLCreateFromFileSystemRepresentation(
|
| + ScopedCFTypeRef<CFURLRef> url(CFURLCreateFromFileSystemRepresentation(
|
| kCFAllocatorDefault,
|
| (const UInt8*)library_path.value().c_str(),
|
| library_path.value().length(),
|
| @@ -103,17 +96,17 @@ void UnloadNativeLibrary(NativeLibrary library) {
|
|
|
| // static
|
| void* GetFunctionPointerFromNativeLibrary(NativeLibrary library,
|
| - const char* name) {
|
| + StringPiece name) {
|
| void* function_pointer = NULL;
|
|
|
| // Get the function pointer using the right API for the type.
|
| if (library->type == BUNDLE) {
|
| - base::ScopedCFTypeRef<CFStringRef> symbol_name(CFStringCreateWithCString(
|
| - kCFAllocatorDefault, name, kCFStringEncodingUTF8));
|
| + ScopedCFTypeRef<CFStringRef> symbol_name(CFStringCreateWithCString(
|
| + kCFAllocatorDefault, name.data(), kCFStringEncodingUTF8));
|
| function_pointer = CFBundleGetFunctionPointerForName(library->bundle,
|
| symbol_name);
|
| } else {
|
| - function_pointer = dlsym(library->dylib, name);
|
| + function_pointer = dlsym(library->dylib, name.data());
|
| }
|
|
|
| // If this library hasn't been tested for having ObjC, use the function
|
| @@ -125,8 +118,8 @@ void* GetFunctionPointerFromNativeLibrary(NativeLibrary library,
|
| }
|
|
|
| // static
|
| -string16 GetNativeLibraryName(const string16& name) {
|
| - return name + ASCIIToUTF16(".dylib");
|
| +string16 GetNativeLibraryName(StringPiece16 name) {
|
| + return name.as_string() + ASCIIToUTF16(".dylib");
|
| }
|
|
|
| } // namespace base
|
|
|