]> granicus.if.org Git - transmission/commitdiff
#4422 On Mac, tr_getWebClientDir() uses incorrect encoding for creating the web conte...
authorMitchell Livingston <livings124@transmissionbt.com>
Mon, 15 Aug 2011 00:10:06 +0000 (00:10 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Mon, 15 Aug 2011 00:10:06 +0000 (00:10 +0000)
libtransmission/platform.c

index 10048c5b924b8deabb64a623a36e3bd9432b132d..093309b8ad66f894e23f793951f3954a771476ab 100644 (file)
@@ -571,14 +571,10 @@ tr_getWebClientDir( const tr_session * session UNUSED )
                 CFURLRef appURL = CFBundleCopyBundleURL( CFBundleGetMainBundle( ) );
                 CFStringRef appRef = CFURLCopyFileSystemPath( appURL,
                                                               kCFURLPOSIXPathStyle );
-                CFIndex appLength = CFStringGetMaximumSizeForEncoding( CFStringGetLength(appRef),
-                                                                       CFStringGetFastestEncoding( appRef ));
-
-                char * appString = tr_malloc( appLength + 1 );
-                bool success = CFStringGetCString( appRef,
-                                              appString,
-                                              appLength + 1,
-                                              CFStringGetFastestEncoding( appRef ));
+                const CFIndex appStringLength = CFStringGetMaximumSizeOfFileSystemRepresentation(appRef);
+
+                char * appString = tr_malloc( appStringLength );
+                const bool success = CFStringGetFileSystemRepresentation( appRef, appString, appStringLength );
                 assert( success );
 
                 CFRelease( appURL );