mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
OP-845: *fix code style
This commit is contained in:
parent
e4f98b31c6
commit
8c5cded61a
@ -276,18 +276,18 @@ QString pjrc_rawhid::getserial(int num) {
|
||||
{
|
||||
//Note: I'm not sure it will always succeed if encoded as MacRoman but that
|
||||
//is a superset of UTF8 so I think this is fine
|
||||
CFStringRef str = (CFStringRef)serialnum;
|
||||
// const char * buf = CFStringGetCStringPtr(str, kCFStringEncodingMacRoman);
|
||||
//return QString(buf);
|
||||
CFStringRef str = static_cast<CFStringRef*>(serialnum);
|
||||
int length = CFStringGetLength(str);
|
||||
if( length == 0 )
|
||||
if (length == 0) {
|
||||
return "";
|
||||
char* ptr = (char*)malloc( length+1 );
|
||||
Boolean ret = CFStringGetCString( str, ptr, length+1, kCFStringEncodingMacRoman );
|
||||
}
|
||||
char* ptr = (char*)malloc(length+1);
|
||||
Boolean ret = CFStringGetCString(str, ptr, length+1, kCFStringEncodingMacRoman);
|
||||
QString strResult;
|
||||
if( ret == true )
|
||||
if (ret == true) {
|
||||
strResult = ptr;
|
||||
free( ptr );
|
||||
}
|
||||
free(ptr);
|
||||
return strResult;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user