mirror of
https://protopirate.net/ProtoPirate/ProtoPirate.git
synced 2026-10-26 07:54:16 +00:00
fix potential UB with conversion
This commit is contained in:
1 parent
de1dcbd07f
commit
d22d533616
1 file changed
+3
-5
+3
-5
@@ -66,11 +66,9 @@ void protopirate_get_frequency_modulation(
|
||||
FuriString* modulation) {
|
||||
furi_assert(app);
|
||||
if(frequency != NULL) {
|
||||
furi_string_printf(
|
||||
frequency,
|
||||
"%03ld.%02ld",
|
||||
app->txrx->preset->frequency / 1000000 % 1000,
|
||||
app->txrx->preset->frequency / 10000 % 100);
|
||||
unsigned long mhz = (unsigned long)((app->txrx->preset->frequency / 1000000UL) % 1000UL);
|
||||
unsigned long khz = (unsigned long)((app->txrx->preset->frequency / 10000UL) % 100UL);
|
||||
furi_string_printf(frequency, "%03lu.%02lu", mhz, khz);
|
||||
}
|
||||
if(modulation != NULL) {
|
||||
furi_string_printf(modulation, "%.2s", furi_string_get_cstr(app->txrx->preset->name));
|
||||
|
||||
Reference in new issue
Block a user