X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=macosx%2FHBDVDDetector.m;h=588d32d81e367381158353f54075bd9b9d8e0914;hb=55be7e43ae5f0f29592a0d178856a3f597814c44;hp=2b57237d9feef90550dde9429b60b7647513c1ca;hpb=d7a889c22fc75b2fab972f44b0f54faff9b54760;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/macosx/HBDVDDetector.m b/macosx/HBDVDDetector.m index 2b57237d..588d32d8 100644 --- a/macosx/HBDVDDetector.m +++ b/macosx/HBDVDDetector.m @@ -3,7 +3,7 @@ * 8/17/2007 * * This file is part of the HandBrake source code. - * Homepage: . + * Homepage: . * It may be used under the terms of the GNU General Public License. */ @@ -83,10 +83,10 @@ - (NSString *)bsdNameForPath { OSStatus err; - FSRef ref; - err = FSPathMakeRef( (const UInt8 *) [path fileSystemRepresentation], + FSRef ref; + err = FSPathMakeRef( (const UInt8 *) [path fileSystemRepresentation], &ref, NULL ); - if( err != noErr ) + if( err != noErr ) { return nil; } @@ -101,22 +101,29 @@ } FSVolumeRefNum volRefNum = catalogInfo.volume; - // Mow let's get the device name - GetVolParmsInfoBuffer volumeParms; - HParamBlockRec pb; - pb.ioParam.ioNamePtr = NULL; - pb.ioParam.ioVRefNum = volRefNum; - pb.ioParam.ioBuffer = (Ptr) &volumeParms; - pb.ioParam.ioReqCount = sizeof( volumeParms ); - err = PBHGetVolParmsSync( &pb ); + // Now let's get the device name + GetVolParmsInfoBuffer volumeParms; + err = FSGetVolumeParms ( volRefNum, &volumeParms, sizeof( volumeParms ) ); + if( err != noErr ) { return nil; } - // A version 4 GetVolParmsInfoBuffer contains the BSD node name in the vMDeviceID field. - // It is actually a char * value. This is mentioned in the header CoreServices/CarbonCore/Files.h. - return [NSString stringWithCString:(char *)volumeParms.vMDeviceID]; + // A version 4 GetVolParmsInfoBuffer contains the BSD node name in the vMDeviceID field. + // It is actually a char * value. This is mentioned in the header CoreServices/CarbonCore/Files.h. + if( volumeParms.vMVersion < 4 ) + { + return nil; + } + + // vMDeviceID might be zero as is reported with experimental ZFS (zfs-119) support in Leopard. + if( !volumeParms.vMDeviceID ) + { + return nil; + } + + return [NSString stringWithCString:(const char *)volumeParms.vMDeviceID]; } @@ -150,7 +157,7 @@ - (io_service_t)getIOKitServiceForBSDName { CFMutableDictionaryRef matchingDict; - matchingDict = IOBSDNameMatching( kIOMasterPortDefault, 0, [bsdName cString] ); + matchingDict = IOBSDNameMatching( kIOMasterPortDefault, 0, [bsdName UTF8String] ); if( matchingDict == NULL ) { return IO_OBJECT_NULL;