summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/utils.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2014-03-08 18:46:19 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2014-03-20 22:26:23 +0100
commit06a2e7c3bb652bf0eb6a0c9c57801c5b8a449be1 (patch)
tree73c14f899f050755872b91063c104eebc0da1aef /rbutil/rbutilqt/base/utils.cpp
parentf8e3b615657693e6524233b607e11e7de22586a4 (diff)
downloadrockbox-06a2e7c3bb652bf0eb6a0c9c57801c5b8a449be1.tar.gz
rockbox-06a2e7c3bb652bf0eb6a0c9c57801c5b8a449be1.tar.bz2
rockbox-06a2e7c3bb652bf0eb6a0c9c57801c5b8a449be1.zip
OS X: use FSGetVolumeParms when targeting 10.5+.
PBHGetVolParmsSync() is not available when building with 64bit. The replacement FSGetVolumeParms() is available on 10.5+ only. Use the latter when building with target version 10.5+. This requires builds targeting 10.4 to 32bit and allows building as 64bit when targeting 10.5+. Change-Id: Ic53217f3090147bea473613335f9482623a470bd
Diffstat (limited to 'rbutil/rbutilqt/base/utils.cpp')
-rw-r--r--rbutil/rbutilqt/base/utils.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp
index 6a817e86da..d2ed49bae3 100644
--- a/rbutil/rbutilqt/base/utils.cpp
+++ b/rbutil/rbutilqt/base/utils.cpp
@@ -160,13 +160,23 @@ QString Utils::filesystemName(QString path)
if(result == noErr) {
GetVolParmsInfoBuffer volparms;
+ /* PBHGetVolParmsSync() is not available for 64bit while
+ FSGetVolumeParms() is available in 10.5+. Thus we need to use
+ PBHGetVolParmsSync() for 10.4, and that also requires 10.4 to
+ always use 32bit.
+ Qt 4 supports 32bit on 10.6 Cocoa only.
+ */
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
+ if(FSGetVolumeParms(volrefnum, &volparms, sizeof(volparms)) == noErr)
+#else
HParamBlockRec hpb;
hpb.ioParam.ioNamePtr = NULL;
hpb.ioParam.ioVRefNum = volrefnum;
hpb.ioParam.ioBuffer = (Ptr)&volparms;
hpb.ioParam.ioReqCount = sizeof(volparms);
-
- if(PBHGetVolParmsSync(&hpb) == noErr) {
+ if(PBHGetVolParmsSync(&hpb) == noErr)
+#endif
+ {
if(volparms.vMServerAdr == 0) {
if(bsd == (char*)volparms.vMDeviceID) {
name = QString::fromUtf16((const ushort*)volname.unicode,
@@ -798,13 +808,19 @@ bool Utils::ejectDevice(QString device)
kFSVolInfoFSInfo, NULL, NULL, NULL);
if(result == noErr) {
GetVolParmsInfoBuffer volparms;
+ /* See above -- PBHGetVolParmsSync() is not available for 64bit,
+ * and FSGetVolumeParms() on 10.5+ only. */
+#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
+ if(FSGetVolumeParms(volrefnum, &volparms, sizeof(volparms)) == noErr)
+#else
HParamBlockRec hpb;
hpb.ioParam.ioNamePtr = NULL;
hpb.ioParam.ioVRefNum = volrefnum;
hpb.ioParam.ioBuffer = (Ptr)&volparms;
hpb.ioParam.ioReqCount = sizeof(volparms);
-
- if(PBHGetVolParmsSync(&hpb) == noErr) {
+ if(PBHGetVolParmsSync(&hpb) == noErr)
+#endif
+ {
if(volparms.vMServerAdr == 0) {
if(bsd == (char*)volparms.vMDeviceID) {
pid_t dissenter;