mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-14 04:49:43 +01:00
Change device name string handling to use safe conversion to CString (Was causing issues on OSX 10.6.5 Japanese)
(cherry picked from commit 17fb7abb8c88bf9ae45bff349d473e9224e8174e)
This commit is contained in:
parent
b45c254081
commit
a87868c1f5
@ -558,7 +558,14 @@ RtAudio::DeviceInfo RtApiCore :: getDeviceInfo( unsigned int device )
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *mname = CFStringGetCStringPtr( cfname, CFStringGetSystemEncoding() );
|
CFIndex numbytes_cfname = CFStringGetMaximumSizeOfFileSystemRepresentation( cfname );
|
||||||
|
if( numbytes_cfname == 0 )
|
||||||
|
numbytes_cfname=256;
|
||||||
|
char mname[numbytes_cfname];
|
||||||
|
|
||||||
|
if(! CFStringGetCString( cfname, mname,numbytes_cfname,CFStringGetSystemEncoding() ) )
|
||||||
|
strcpy(mname,"");
|
||||||
|
|
||||||
info.name.append( (const char *)mname, strlen(mname) );
|
info.name.append( (const char *)mname, strlen(mname) );
|
||||||
info.name.append( ": " );
|
info.name.append( ": " );
|
||||||
CFRelease( cfname );
|
CFRelease( cfname );
|
||||||
@ -572,7 +579,13 @@ RtAudio::DeviceInfo RtApiCore :: getDeviceInfo( unsigned int device )
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *name = CFStringGetCStringPtr( cfname, CFStringGetSystemEncoding() );
|
numbytes_cfname = CFStringGetMaximumSizeOfFileSystemRepresentation( cfname );
|
||||||
|
if( numbytes_cfname == 0 )
|
||||||
|
numbytes_cfname=256;
|
||||||
|
char name[numbytes_cfname];
|
||||||
|
if(! CFStringGetCString( cfname, name,numbytes_cfname,CFStringGetSystemEncoding() ) )
|
||||||
|
strcpy(mname,"");
|
||||||
|
|
||||||
info.name.append( (const char *)name, strlen(name) );
|
info.name.append( (const char *)name, strlen(name) );
|
||||||
CFRelease( cfname );
|
CFRelease( cfname );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user