Misc sonarcloud fixes

This commit is contained in:
Willy-JL
2023-02-13 00:01:49 +00:00
parent 8812dbc2cd
commit 53780e72ed
5 changed files with 8 additions and 7 deletions

View File

@@ -595,8 +595,6 @@ static int32_t ducky_script_execute_next(BadKbScript* bad_kb, File* script_file)
bad_kb->buf_len = 0; bad_kb->buf_len = 0;
if(bad_kb->file_end) return SCRIPT_STATE_END; if(bad_kb->file_end) return SCRIPT_STATE_END;
} }
return 0;
} }
static void bad_kb_bt_hid_state_callback(BtStatus status, void* context) { static void bad_kb_bt_hid_state_callback(BtStatus status, void* context) {

View File

@@ -88,7 +88,7 @@ void process_input_settings(ProtoViewApp* app, InputEvent input) {
if(input.key == InputKeyUp) { if(input.key == InputKeyUp) {
modid = modid == 0 ? count - 1 : modid - 1; modid = modid == 0 ? count - 1 : modid - 1;
} else if(input.key == InputKeyDown) { } else if(input.key == InputKeyDown) {
modid = (modid + 1) % count; modid = (modid + 1) % (count ? count : 1);
} else { } else {
return; return;
} }

View File

@@ -74,8 +74,8 @@ bool spi_mem_tools_read_chip_info(SPIMemChip* chip) {
bool spi_mem_tools_check_chip_info(SPIMemChip* chip) { bool spi_mem_tools_check_chip_info(SPIMemChip* chip) {
SPIMemChip new_chip_info; SPIMemChip new_chip_info;
spi_mem_tools_read_chip_info(&new_chip_info);
do { do {
if(!spi_mem_tools_read_chip_info(&new_chip_info)) break;
if(chip->vendor_id != new_chip_info.vendor_id) break; if(chip->vendor_id != new_chip_info.vendor_id) break;
if(chip->type_id != new_chip_info.type_id) break; if(chip->type_id != new_chip_info.type_id) break;
if(chip->capacity_id != new_chip_info.capacity_id) break; if(chip->capacity_id != new_chip_info.capacity_id) break;

View File

@@ -291,9 +291,10 @@ static void animation_storage_free_frames(BubbleAnimation* animation) {
const Icon* icon = &animation->icon_animation; const Icon* icon = &animation->icon_animation;
for(int i = 0; i < icon->frame_count; ++i) { for(int i = 0; i < icon->frame_count; ++i) {
if(icon->frames[i]) { if(!icon->frames[i]) {
free((void*)icon->frames[i]); break;
} }
free((void*)icon->frames[i]);
} }
free((void*)icon->frames); free((void*)icon->frames);
@@ -336,6 +337,7 @@ static bool animation_storage_load_frames(
frames_ok = false; frames_ok = false;
furi_string_printf(filename, "%s/%s/frame_%d.bm", ANIMATION_DIR, name, i); furi_string_printf(filename, "%s/%s/frame_%d.bm", ANIMATION_DIR, name, i);
FURI_CONST_ASSIGN_PTR(icon->frames[i], 0);
if(storage_common_stat(storage, furi_string_get_cstr(filename), &file_info) != FSE_OK) if(storage_common_stat(storage, furi_string_get_cstr(filename), &file_info) != FSE_OK)
break; break;
if(file_info.size > max_filesize) { if(file_info.size > max_filesize) {

View File

@@ -194,6 +194,8 @@ class AppBuildset:
return self.appmgr.get(app_name).supports_hardware_target(self.hw_target) return self.appmgr.get(app_name).supports_hardware_target(self.hw_target)
def _get_app_depends(self, app_name: str) -> List[str]: def _get_app_depends(self, app_name: str) -> List[str]:
app_def = self.appmgr.get(app_name)
# Skip app if its target is not supported by the target we are building for # Skip app if its target is not supported by the target we are building for
if not self._check_if_app_target_supported(app_name): if not self._check_if_app_target_supported(app_name):
self._writer( self._writer(
@@ -201,7 +203,6 @@ class AppBuildset:
) )
return [] return []
app_def = self.appmgr.get(app_name)
return list( return list(
filter( filter(
self._check_if_app_target_supported, self._check_if_app_target_supported,