[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:
@@ -39,9 +39,9 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
|
||||
furi_assert(!rpc_app->last_id);
|
||||
furi_assert(!rpc_app->last_data);
|
||||
|
||||
FURI_LOG_D(TAG, "StartProcess: id %ld", request->command_id);
|
||||
FURI_LOG_D(TAG, "StartProcess: id %lu", request->command_id);
|
||||
|
||||
PB_CommandStatus result = PB_CommandStatus_ERROR_APP_CANT_START;
|
||||
PB_CommandStatus result;
|
||||
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
const char* app_name = request->content.app_start_request.name;
|
||||
@@ -62,7 +62,7 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
|
||||
} else if(status == LoaderStatusOk) {
|
||||
result = PB_CommandStatus_OK;
|
||||
} else {
|
||||
furi_crash("Programming Error");
|
||||
furi_crash(NULL);
|
||||
}
|
||||
} else {
|
||||
result = PB_CommandStatus_ERROR_INVALID_PARAMETERS;
|
||||
@@ -70,7 +70,7 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
|
||||
|
||||
furi_record_close(RECORD_LOADER);
|
||||
|
||||
FURI_LOG_D(TAG, "StartProcess: response id %ld, result %d", request->command_id, result);
|
||||
FURI_LOG_D(TAG, "StartProcess: response id %lu, result %d", request->command_id, result);
|
||||
rpc_send_and_release_empty(session, request->command_id, result);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ static void rpc_system_app_exit_request(const PB_Main* request, void* context) {
|
||||
PB_CommandStatus status;
|
||||
|
||||
if(rpc_app->app_callback) {
|
||||
FURI_LOG_D(TAG, "ExitRequest: id %ld", request->command_id);
|
||||
FURI_LOG_D(TAG, "ExitRequest: id %lu", request->command_id);
|
||||
furi_assert(!rpc_app->last_id);
|
||||
furi_assert(!rpc_app->last_data);
|
||||
rpc_app->last_id = request->command_id;
|
||||
@@ -125,7 +125,7 @@ static void rpc_system_app_exit_request(const PB_Main* request, void* context) {
|
||||
} else {
|
||||
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
|
||||
FURI_LOG_E(
|
||||
TAG, "ExitRequest: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
|
||||
TAG, "ExitRequest: APP_NOT_RUNNING, id %lu, status: %d", request->command_id, status);
|
||||
rpc_send_and_release_empty(session, request->command_id, status);
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ static void rpc_system_app_load_file(const PB_Main* request, void* context) {
|
||||
|
||||
PB_CommandStatus status;
|
||||
if(rpc_app->app_callback) {
|
||||
FURI_LOG_D(TAG, "LoadFile: id %ld", request->command_id);
|
||||
FURI_LOG_D(TAG, "LoadFile: id %lu", request->command_id);
|
||||
furi_assert(!rpc_app->last_id);
|
||||
furi_assert(!rpc_app->last_data);
|
||||
rpc_app->last_id = request->command_id;
|
||||
@@ -151,7 +151,7 @@ static void rpc_system_app_load_file(const PB_Main* request, void* context) {
|
||||
} else {
|
||||
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
|
||||
FURI_LOG_E(
|
||||
TAG, "LoadFile: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
|
||||
TAG, "LoadFile: APP_NOT_RUNNING, id %lu, status: %d", request->command_id, status);
|
||||
rpc_send_and_release_empty(session, request->command_id, status);
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ static void rpc_system_app_button_press(const PB_Main* request, void* context) {
|
||||
} else {
|
||||
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
|
||||
FURI_LOG_E(
|
||||
TAG, "ButtonPress: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
|
||||
TAG, "ButtonPress: APP_NOT_RUNNING, id %lu, status: %d", request->command_id, status);
|
||||
rpc_send_and_release_empty(session, request->command_id, status);
|
||||
}
|
||||
}
|
||||
@@ -202,7 +202,7 @@ static void rpc_system_app_button_release(const PB_Main* request, void* context)
|
||||
} else {
|
||||
status = PB_CommandStatus_ERROR_APP_NOT_RUNNING;
|
||||
FURI_LOG_E(
|
||||
TAG, "ButtonRelease: APP_NOT_RUNNING, id %ld, status: %d", request->command_id, status);
|
||||
TAG, "ButtonRelease: APP_NOT_RUNNING, id %lu, status: %d", request->command_id, status);
|
||||
rpc_send_and_release_empty(session, request->command_id, status);
|
||||
}
|
||||
}
|
||||
@@ -300,7 +300,7 @@ void rpc_system_app_confirm(RpcAppSystem* rpc_app, RpcAppSystemEvent event, bool
|
||||
free(rpc_app->last_data);
|
||||
rpc_app->last_data = NULL;
|
||||
}
|
||||
FURI_LOG_D(TAG, "AppConfirm: event %d last_id %ld status %d", event, last_id, status);
|
||||
FURI_LOG_D(TAG, "AppConfirm: event %d last_id %lu status %d", event, last_id, status);
|
||||
rpc_send_and_release_empty(session, last_id, status);
|
||||
break;
|
||||
default:
|
||||
|
@@ -44,7 +44,7 @@ void rpc_cli_command_start_session(Cli* cli, FuriString* args, void* context) {
|
||||
Rpc* rpc = context;
|
||||
|
||||
uint32_t mem_before = memmgr_get_free_heap();
|
||||
FURI_LOG_D(TAG, "Free memory %ld", mem_before);
|
||||
FURI_LOG_D(TAG, "Free memory %lu", mem_before);
|
||||
|
||||
furi_hal_usb_lock();
|
||||
RpcSession* rpc_session = rpc_session_open(rpc);
|
||||
|
@@ -10,7 +10,7 @@ static size_t rpc_debug_print_file_msg(
|
||||
for(size_t i = 0; i < msg_files_size; ++i, ++msg_file) {
|
||||
furi_string_cat_printf(
|
||||
str,
|
||||
"%s[%c] size: %5ld",
|
||||
"%s[%c] size: %5lu",
|
||||
prefix,
|
||||
msg_file->type == PB_Storage_File_FileType_DIR ? 'd' : 'f',
|
||||
msg_file->size);
|
||||
@@ -40,7 +40,7 @@ void rpc_debug_print_data(const char* prefix, uint8_t* buffer, size_t size) {
|
||||
str = furi_string_alloc();
|
||||
furi_string_reserve(str, 100 + size * 5);
|
||||
|
||||
furi_string_cat_printf(str, "\r\n%s DEC(%d): {", prefix, size);
|
||||
furi_string_cat_printf(str, "\r\n%s DEC(%zu): {", prefix, size);
|
||||
for(size_t i = 0; i < size; ++i) {
|
||||
furi_string_cat_printf(str, "%d, ", buffer[i]);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ void rpc_debug_print_data(const char* prefix, uint8_t* buffer, size_t size) {
|
||||
furi_string_reset(str);
|
||||
furi_string_reserve(str, 100 + size * 3);
|
||||
|
||||
furi_string_cat_printf(str, "%s HEX(%d): {", prefix, size);
|
||||
furi_string_cat_printf(str, "%s HEX(%zu): {", prefix, size);
|
||||
for(size_t i = 0; i < size; ++i) {
|
||||
furi_string_cat_printf(str, "%02X", buffer[i]);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ void rpc_debug_print_message(const PB_Main* message) {
|
||||
|
||||
furi_string_cat_printf(
|
||||
str,
|
||||
"PB_Main: {\r\n\tresult: %d cmd_id: %ld (%s)\r\n",
|
||||
"PB_Main: {\r\n\tresult: %d cmd_id: %lu (%s)\r\n",
|
||||
message->command_status,
|
||||
message->command_id,
|
||||
message->has_next ? "has_next" : "last");
|
||||
@@ -110,9 +110,9 @@ void rpc_debug_print_message(const PB_Main* message) {
|
||||
}
|
||||
case PB_Main_storage_md5sum_response_tag: {
|
||||
furi_string_cat_printf(str, "\tmd5sum_response {\r\n");
|
||||
const char* path = message->content.storage_md5sum_response.md5sum;
|
||||
if(path) {
|
||||
furi_string_cat_printf(str, "\t\tmd5sum: %s\r\n", path);
|
||||
const char* md5sum = message->content.storage_md5sum_response.md5sum;
|
||||
if(md5sum) { //-V547
|
||||
furi_string_cat_printf(str, "\t\tmd5sum: %s\r\n", md5sum);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@@ -597,7 +597,7 @@ static void rpc_system_storage_md5sum_process(const PB_Main* request, void* cont
|
||||
char* md5sum = response.content.storage_md5sum_response.md5sum;
|
||||
size_t md5sum_size = sizeof(response.content.storage_md5sum_response.md5sum);
|
||||
(void)md5sum_size;
|
||||
furi_assert(hash_size <= ((md5sum_size - 1) / 2));
|
||||
furi_assert(hash_size <= ((md5sum_size - 1) / 2)); //-V547
|
||||
for(uint8_t i = 0; i < hash_size; i++) {
|
||||
md5sum += snprintf(md5sum, md5sum_size, "%02x", hash[i]);
|
||||
}
|
||||
|
@@ -30,7 +30,6 @@ static void rpc_system_system_ping_process(const PB_Main* request, void* context
|
||||
}
|
||||
|
||||
PB_Main response = PB_Main_init_default;
|
||||
response.has_next = false;
|
||||
response.command_status = PB_CommandStatus_OK;
|
||||
response.command_id = request->command_id;
|
||||
response.which_content = PB_Main_system_ping_response_tag;
|
||||
|
Reference in New Issue
Block a user