[vlc-commits] darwin/dirs: Use FromCFString
Marvin Scholz
git at videolan.org
Sat Oct 20 20:06:12 CEST 2018
vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Mon Oct 8 10:52:58 2018 +0200| [82c18a3b4b72b677f2576e4cc6197aaad2fc2a61] | committer: Marvin Scholz
darwin/dirs: Use FromCFString
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=82c18a3b4b72b677f2576e4cc6197aaad2fc2a61
---
src/darwin/dirs.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/src/darwin/dirs.c b/src/darwin/dirs.c
index de95ef31dc..6c4c538f6e 100644
--- a/src/darwin/dirs.c
+++ b/src/darwin/dirs.c
@@ -28,6 +28,7 @@
#endif
#include <vlc_common.h>
+#include <vlc_charset.h>
#include "../libvlc.h"
#include <libgen.h>
@@ -175,18 +176,8 @@ static char *getAppDependentDir(vlc_userdir_t type)
CFBundleRef mainBundle = CFBundleGetMainBundle();
if (mainBundle) {
CFStringRef identifierAsNS = CFBundleGetIdentifier(mainBundle);
- if (identifierAsNS) {
- CFIndex len = CFStringGetLength(identifierAsNS);
- CFIndex size = CFStringGetMaximumSizeForEncoding(len, kCFStringEncodingUTF8);
- char *identifier = calloc(len + 1, sizeof(char));
- if (identifier != NULL) {
- Boolean ret = CFStringGetCString(identifierAsNS, identifier, size, kCFStringEncodingUTF8);
- if (ret)
- name = identifier;
- else
- free(identifier);
- }
- }
+ if (identifierAsNS)
+ name = FromCFString(identifierAsNS, kCFStringEncodingUTF8);
}
char *psz_parent = config_GetHomeDir ();
More information about the vlc-commits
mailing list