Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Claudio Cambra
VLC
Commits
535112f6
Commit
535112f6
authored
7 years ago
by
Felix Paul Kühne
Browse files
Options
Downloads
Patches
Plain Diff
macosx: replace Carbon implementation with its BSD counter-part
parent
255ded1f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/gui/macosx/VLCStringUtility.m
+15
-63
15 additions, 63 deletions
modules/gui/macosx/VLCStringUtility.m
with
15 additions
and
63 deletions
modules/gui/macosx/VLCStringUtility.m
+
15
−
63
View file @
535112f6
/*****************************************************************************
* VLCStringUtility.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-201
4
VLC authors and VideoLAN
* Copyright (C) 2002-201
8
VLC authors and VideoLAN
* $Id$
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
...
...
@@ -29,6 +29,9 @@
#import "VLCMain.h"
#import "CompatibilityFixes.h"
#import <sys/param.h>
#import <sys/mount.h>
#import <IOKit/storage/IOMedia.h>
#import <IOKit/storage/IOCDMedia.h>
#import <IOKit/storage/IODVDMedia.h>
...
...
@@ -383,77 +386,26 @@ NSString *toNSStr(const char *str) {
-
(
NSString
*
)
getBSDNodeFromMountPath
:(
NSString
*
)
mountPath
{
OSStatus
err
;
FSRef
ref
;
FSVolumeRefNum
actualVolume
;
err
=
FSPathMakeRef
((
const
UInt8
*
)
[
mountPath
fileSystemRepresentation
],
&
ref
,
NULL
);
// get a FSVolumeRefNum from mountPath
if
(
noErr
==
err
)
{
FSCatalogInfo
catalogInfo
;
err
=
FSGetCatalogInfo
(
&
ref
,
kFSCatInfoVolume
,
&
catalogInfo
,
NULL
,
NULL
,
NULL
);
if
(
noErr
==
err
)
actualVolume
=
catalogInfo
.
volume
;
else
return
@""
;
}
else
struct
statfs
stf
;
int
ret
=
statfs
([
mountPath
fileSystemRepresentation
],
&
stf
);
if
(
ret
!=
0
)
{
return
@""
;
GetVolParmsInfoBuffer
volumeParms
;
err
=
FSGetVolumeParms
(
actualVolume
,
&
volumeParms
,
sizeof
(
volumeParms
));
if
(
noErr
==
err
)
{
NSString
*
bsdName
=
[
NSString
stringWithUTF8String
:(
char
*
)
volumeParms
.
vMDeviceID
];
return
[
NSString
stringWithFormat
:
@"/dev/r%@"
,
bsdName
];
}
return
@""
;
return
[
NSString
stringWithFormat
:
@"r%s"
,
stf
.
f_mntfromname
]
;
}
-
(
NSString
*
)
getVolumeTypeFromMountPath
:(
NSString
*
)
mountPath
{
OSStatus
err
;
FSRef
ref
;
FSVolumeRefNum
actualVolume
;
NSString
*
returnValue
;
err
=
FSPathMakeRef
((
const
UInt8
*
)
[
mountPath
fileSystemRepresentation
],
&
ref
,
NULL
);
// get a FSVolumeRefNum from mountPath
if
(
noErr
==
err
)
{
FSCatalogInfo
catalogInfo
;
err
=
FSGetCatalogInfo
(
&
ref
,
kFSCatInfoVolume
,
&
catalogInfo
,
NULL
,
NULL
,
NULL
);
if
(
noErr
==
err
)
actualVolume
=
catalogInfo
.
volume
;
else
goto
out
;
}
else
goto
out
;
GetVolParmsInfoBuffer
volumeParms
;
err
=
FSGetVolumeParms
(
actualVolume
,
&
volumeParms
,
sizeof
(
volumeParms
));
CFMutableDictionaryRef
matchingDict
;
io_service_t
service
;
if
(
!
volumeParms
.
vMDeviceID
)
{
goto
out
;
struct
statfs
stf
;
int
ret
=
statfs
([
mountPath
fileSystemRepresentation
],
&
stf
);
if
(
ret
!=
0
)
{
return
@""
;
}
matchingDict
=
IOBSDNameMatching
(
kIOMasterPortDefault
,
0
,
volumeParms
.
vMDeviceID
);
service
=
IOServiceGetMatchingService
(
kIOMasterPortDefault
,
matchingDict
);
CFMutableDictionaryRef
matchingDict
=
IOBSDNameMatching
(
kIOMasterPortDefault
,
0
,
stf
.
f_mntfromname
);
io_service_t
service
=
IOServiceGetMatchingService
(
kIOMasterPortDefault
,
matchingDict
);
NSString
*
returnValue
;
if
(
IO_OBJECT_NULL
!=
service
)
{
if
(
IOObjectConformsTo
(
service
,
kIOCDMediaClass
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment