[vlc-commits] auhal: Use FromCFString

Marvin Scholz git at videolan.org
Sat Oct 20 20:06:10 CEST 2018


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Mon Oct  8 10:52:45 2018 +0200| [43663467cb534b97c01c6d7828b4b942741a4529] | committer: Marvin Scholz

auhal: Use FromCFString

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=43663467cb534b97c01c6d7828b4b942741a4529
---

 modules/audio_output/auhal.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 377c0f1b02..8005e27954 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -28,6 +28,7 @@
 
 #import <vlc_plugin.h>
 #import <vlc_dialog.h>                      // vlc_dialog_display_error
+#import <vlc_charset.h>                     // FromCFString
 
 #import <CoreAudio/CoreAudio.h>             // AudioDeviceID
 #import <CoreServices/CoreServices.h>
@@ -505,16 +506,7 @@ RebuildDeviceList(audio_output_t * p_aout, UInt32 *p_id_exists)
             continue;
         }
 
-        length = CFStringGetLength(device_name_ref);
-        length++;
-        psz_name = malloc(length);
-        if (!psz_name)
-        {
-            CFRelease(device_name_ref);
-            return;
-        }
-        CFStringGetCString(device_name_ref, psz_name, length,
-                           kCFStringEncodingUTF8);
+        psz_name = FromCFString(device_name_ref, kCFStringEncodingUTF8);
         CFRelease(device_name_ref);
 
         msg_Dbg(p_aout, "DevID: %i DevName: %s", i_id, psz_name);



More information about the vlc-commits mailing list