Correct scanf format specifier
Rather than casting here, use PRIu32 - as in "%" PRIu32 ".%" PRIu32 - it's undefined behaviour and quite illegal to do the cast as, depending on platform, you'll end up with only some of the bytes in units and tenths written and which ones and what that means will depend on endianess.
This commit is contained in:
parent
02d2ba98d5
commit
fcae730bf8
|
@ -412,7 +412,7 @@ uint32_t platform_target_voltage_sense(void)
|
|||
uint32_t units = 0, tenths = 0 ;
|
||||
result = remote_target_voltage() ;
|
||||
if (result != NULL) {
|
||||
sscanf(result,"%u.%u", (unsigned int *) &units, (unsigned int *) &tenths) ;
|
||||
sscanf(result,"%"PRIu32".%"PRIu32, &units, &tenths) ;
|
||||
targetVoltage = (units * 10) + tenths ;
|
||||
}
|
||||
break ;
|
||||
|
|
Loading…
Reference in New Issue