projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
431127d
)
Be more careful with some macOS API calls.
author
Carl Hetherington
<cth@carlh.net>
Fri, 5 Mar 2021 15:39:06 +0000
(16:39 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Mon, 8 Mar 2021 23:30:07 +0000
(
00:30
+0100)
src/lib/cross_osx.cc
patch
|
blob
|
history
diff --git
a/src/lib/cross_osx.cc
b/src/lib/cross_osx.cc
index 8f057c2bfc5cf38307f721142e860e217bd034f0..6c00afb973bf442b60073f3d94a20e278837ecdf 100644
(file)
--- a/
src/lib/cross_osx.cc
+++ b/
src/lib/cross_osx.cc
@@
-275,7
+275,12
@@
get_vendor (CFDictionaryRef& description)
return {};
}
return {};
}
- string s = CFStringGetCStringPtr ((CFStringRef) str, kCFStringEncodingUTF8);
+ auto c_str = CFStringGetCStringPtr ((CFStringRef) str, kCFStringEncodingUTF8);
+ if (!c_str) {
+ return {};
+ }
+
+ string s (c_str);
boost::algorithm::trim (s);
return s;
}
boost::algorithm::trim (s);
return s;
}
@@
-288,7
+293,12
@@
get_model (CFDictionaryRef& description)
return {};
}
return {};
}
- string s = CFStringGetCStringPtr ((CFStringRef) str, kCFStringEncodingUTF8);
+ auto c_str = CFStringGetCStringPtr ((CFStringRef) str, kCFStringEncodingUTF8);
+ if (!c_str) {
+ return {};
+ }
+
+ string s (c_str);
boost::algorithm::trim (s);
return s;
}
boost::algorithm::trim (s);
return s;
}
@@
-415,6
+425,7
@@
disk_appeared (DADiskRef disk, void* context)
{
auto bsd_name = DADiskGetBSDName (disk);
if (!bsd_name) {
{
auto bsd_name = DADiskGetBSDName (disk);
if (!bsd_name) {
+ LOG_DISK_NC("Disk with no BSDName appeared");
return;
}
LOG_DISK("%1 appeared", bsd_name);
return;
}
LOG_DISK("%1 appeared", bsd_name);
@@
-422,6
+433,7
@@
disk_appeared (DADiskRef disk, void* context)
Disk this_disk;
this_disk.mount_point = string("/dev/") + bsd_name;
Disk this_disk;
this_disk.mount_point = string("/dev/") + bsd_name;
+ LOG_DISK("Mount point is %1", this_disk.mount_point);
CFDictionaryRef description = DADiskCopyDescription (disk);
CFDictionaryRef description = DADiskCopyDescription (disk);