[FL-2811] Fix PVS-Studio warnings (#2142)
Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: gornekich <n.gorbadey@gmail.com>
This commit is contained in:
@@ -32,7 +32,7 @@ static void rpc_command_callback(RpcAppSystemEvent rpc_event, void* context) {
|
||||
}
|
||||
|
||||
static LfRfid* lfrfid_alloc() {
|
||||
LfRfid* lfrfid = malloc(sizeof(LfRfid)); //-V773
|
||||
LfRfid* lfrfid = malloc(sizeof(LfRfid));
|
||||
|
||||
lfrfid->storage = furi_record_open(RECORD_STORAGE);
|
||||
lfrfid->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
@@ -100,7 +100,7 @@ static LfRfid* lfrfid_alloc() {
|
||||
lfrfid->view_dispatcher, LfRfidViewRead, lfrfid_view_read_get_view(lfrfid->read_view));
|
||||
|
||||
return lfrfid;
|
||||
}
|
||||
} //-V773
|
||||
|
||||
static void lfrfid_free(LfRfid* lfrfid) {
|
||||
furi_assert(lfrfid);
|
||||
|
@@ -87,7 +87,7 @@ static void lfrfid_cli_read(Cli* cli, FuriString* args) {
|
||||
uint32_t flags =
|
||||
furi_event_flag_wait(context.event, available_flags, FuriFlagWaitAny, 100);
|
||||
|
||||
if(flags != FuriFlagErrorTimeout) {
|
||||
if(flags != (unsigned)FuriFlagErrorTimeout) {
|
||||
if(FURI_BIT(flags, LFRFIDWorkerReadDone)) {
|
||||
break;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ static bool lfrfid_cli_parse_args(FuriString* args, ProtocolDict* dict, Protocol
|
||||
|
||||
for(ProtocolId i = 0; i < LFRFIDProtocolMax; i++) {
|
||||
printf(
|
||||
"\t%s, %d bytes long\r\n",
|
||||
"\t%s, %zu bytes long\r\n",
|
||||
protocol_dict_get_name(dict, i),
|
||||
protocol_dict_get_data_size(dict, i));
|
||||
}
|
||||
@@ -165,7 +165,7 @@ static bool lfrfid_cli_parse_args(FuriString* args, ProtocolDict* dict, Protocol
|
||||
// check data arg
|
||||
if(!args_read_hex_bytes(data_text, data, data_size)) {
|
||||
printf(
|
||||
"%s data needs to be %d bytes long\r\n",
|
||||
"%s data needs to be %zu bytes long\r\n",
|
||||
protocol_dict_get_name(dict, *protocol),
|
||||
data_size);
|
||||
break;
|
||||
@@ -211,7 +211,7 @@ static void lfrfid_cli_write(Cli* cli, FuriString* args) {
|
||||
|
||||
while(!cli_cmd_interrupt_received(cli)) {
|
||||
uint32_t flags = furi_event_flag_wait(event, available_flags, FuriFlagWaitAny, 100);
|
||||
if(flags != FuriFlagErrorTimeout) {
|
||||
if(flags != (unsigned)FuriFlagErrorTimeout) {
|
||||
if(FURI_BIT(flags, LFRFIDWorkerWriteOK)) {
|
||||
printf("Written!\r\n");
|
||||
break;
|
||||
@@ -309,9 +309,9 @@ static void lfrfid_cli_raw_analyze(Cli* cli, FuriString* args) {
|
||||
warn = true;
|
||||
}
|
||||
|
||||
furi_string_printf(info_string, "[%ld %ld]", pulse, duration);
|
||||
furi_string_printf(info_string, "[%lu %lu]", pulse, duration);
|
||||
printf("%-16s", furi_string_get_cstr(info_string));
|
||||
furi_string_printf(info_string, "[%ld %ld]", pulse, duration - pulse);
|
||||
furi_string_printf(info_string, "[%lu %lu]", pulse, duration - pulse);
|
||||
printf("%-16s", furi_string_get_cstr(info_string));
|
||||
|
||||
if(warn) {
|
||||
@@ -335,7 +335,7 @@ static void lfrfid_cli_raw_analyze(Cli* cli, FuriString* args) {
|
||||
total_pulse += pulse;
|
||||
total_duration += duration;
|
||||
|
||||
if(total_protocol != PROTOCOL_NO) {
|
||||
if(total_protocol != PROTOCOL_NO) { //-V1051
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -346,9 +346,9 @@ static void lfrfid_cli_raw_analyze(Cli* cli, FuriString* args) {
|
||||
|
||||
printf(" Frequency: %f\r\n", (double)frequency);
|
||||
printf(" Duty Cycle: %f\r\n", (double)duty_cycle);
|
||||
printf(" Warns: %ld\r\n", total_warns);
|
||||
printf(" Pulse sum: %ld\r\n", total_pulse);
|
||||
printf("Duration sum: %ld\r\n", total_duration);
|
||||
printf(" Warns: %lu\r\n", total_warns);
|
||||
printf(" Pulse sum: %lu\r\n", total_pulse);
|
||||
printf("Duration sum: %lu\r\n", total_duration);
|
||||
printf(" Average: %f\r\n", (double)((float)total_pulse / (float)total_duration));
|
||||
printf(" Protocol: ");
|
||||
|
||||
@@ -435,7 +435,7 @@ static void lfrfid_cli_raw_read(Cli* cli, FuriString* args) {
|
||||
while(true) {
|
||||
uint32_t flags = furi_event_flag_wait(event, available_flags, FuriFlagWaitAny, 100);
|
||||
|
||||
if(flags != FuriFlagErrorTimeout) {
|
||||
if(flags != (unsigned)FuriFlagErrorTimeout) {
|
||||
if(FURI_BIT(flags, LFRFIDWorkerReadRawFileError)) {
|
||||
printf("File is not RFID raw file\r\n");
|
||||
break;
|
||||
@@ -510,7 +510,7 @@ static void lfrfid_cli_raw_emulate(Cli* cli, FuriString* args) {
|
||||
while(true) {
|
||||
uint32_t flags = furi_event_flag_wait(event, available_flags, FuriFlagWaitAny, 100);
|
||||
|
||||
if(flags != FuriFlagErrorTimeout) {
|
||||
if(flags != (unsigned)FuriFlagErrorTimeout) {
|
||||
if(FURI_BIT(flags, LFRFIDWorkerEmulateRawFileError)) {
|
||||
printf("File is not RFID raw file\r\n");
|
||||
break;
|
||||
@@ -573,4 +573,4 @@ static void lfrfid_cli(Cli* cli, FuriString* args, void* context) {
|
||||
}
|
||||
|
||||
furi_string_free(cmd);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user