Skip to content

Commit 57d83e7

Browse files
authored
Fixed SONAR issues (#14)
1 parent a5fcc23 commit 57d83e7

20 files changed

+53
-53
lines changed

scenes/add_new_token/totp_scene_add_new_token.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ typedef struct {
3535
InputTextSceneState* input_state;
3636
uint32_t input_started_at;
3737
int16_t current_token_index;
38-
int32_t screen_y_offset;
38+
int16_t screen_y_offset;
3939
TokenHashAlgo algo;
4040
TokenDigitsCount digits_count;
4141
} SceneState;
4242

43-
void totp_scene_add_new_token_init(PluginState* plugin_state) {
43+
void totp_scene_add_new_token_init(const PluginState* plugin_state) {
4444
UNUSED(plugin_state);
4545
}
4646

@@ -311,6 +311,6 @@ void totp_scene_add_new_token_deactivate(PluginState* plugin_state) {
311311
plugin_state->current_scene_state = NULL;
312312
}
313313

314-
void totp_scene_add_new_token_free(PluginState* plugin_state) {
314+
void totp_scene_add_new_token_free(const PluginState* plugin_state) {
315315
UNUSED(plugin_state);
316316
}

scenes/add_new_token/totp_scene_add_new_token.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ typedef struct {
1010
uint8_t current_token_index;
1111
} TokenAddEditSceneContext;
1212

13-
void totp_scene_add_new_token_init(PluginState* plugin_state);
13+
void totp_scene_add_new_token_init(const PluginState* plugin_state);
1414
void totp_scene_add_new_token_activate(
1515
PluginState* plugin_state,
1616
const TokenAddEditSceneContext* context);
1717
void totp_scene_add_new_token_render(Canvas* const canvas, PluginState* plugin_state);
1818
bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState* plugin_state);
1919
void totp_scene_add_new_token_deactivate(PluginState* plugin_state);
20-
void totp_scene_add_new_token_free(PluginState* plugin_state);
20+
void totp_scene_add_new_token_free(const PluginState* plugin_state);

scenes/app_settings/totp_app_settings.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ typedef struct {
1616
Control selected_control;
1717
} SceneState;
1818

19-
void totp_scene_app_settings_init(PluginState* plugin_state) {
19+
void totp_scene_app_settings_init(const PluginState* plugin_state) {
2020
UNUSED(plugin_state);
2121
}
2222

@@ -53,7 +53,7 @@ static void two_digit_to_str(int8_t num, char* str) {
5353
}
5454

5555
void totp_scene_app_settings_render(Canvas* const canvas, PluginState* plugin_state) {
56-
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
56+
const SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
5757

5858
canvas_set_font(canvas, FontPrimary);
5959
canvas_draw_str_aligned(canvas, 0, 0, AlignLeft, AlignTop, "Timezone offset");
@@ -90,7 +90,7 @@ void totp_scene_app_settings_render(Canvas* const canvas, PluginState* plugin_st
9090
scene_state->selected_control == ConfirmButton);
9191
}
9292

93-
bool totp_scene_app_settings_handle_event(PluginEvent* const event, PluginState* plugin_state) {
93+
bool totp_scene_app_settings_handle_event(const PluginEvent* const event, PluginState* plugin_state) {
9494
if(event->type == EventTypeKey) {
9595
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
9696
if(event->input.type == InputTypePress) {
@@ -171,6 +171,6 @@ void totp_scene_app_settings_deactivate(PluginState* plugin_state) {
171171
plugin_state->current_scene_state = NULL;
172172
}
173173

174-
void totp_scene_app_settings_free(PluginState* plugin_state) {
174+
void totp_scene_app_settings_free(const PluginState* plugin_state) {
175175
UNUSED(plugin_state);
176176
}

scenes/app_settings/totp_app_settings.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ typedef struct {
1010
uint8_t current_token_index;
1111
} AppSettingsSceneContext;
1212

13-
void totp_scene_app_settings_init(PluginState* plugin_state);
13+
void totp_scene_app_settings_init(const PluginState* plugin_state);
1414
void totp_scene_app_settings_activate(
1515
PluginState* plugin_state,
1616
const AppSettingsSceneContext* context);
1717
void totp_scene_app_settings_render(Canvas* const canvas, PluginState* plugin_state);
18-
bool totp_scene_app_settings_handle_event(PluginEvent* const event, PluginState* plugin_state);
18+
bool totp_scene_app_settings_handle_event(const PluginEvent* const event, PluginState* plugin_state);
1919
void totp_scene_app_settings_deactivate(PluginState* plugin_state);
20-
void totp_scene_app_settings_free(PluginState* plugin_state);
20+
void totp_scene_app_settings_free(const PluginState* plugin_state);

scenes/authenticate/totp_scene_authenticate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void totp_scene_authenticate_activate(PluginState* plugin_state) {
2828
}
2929

3030
void totp_scene_authenticate_render(Canvas* const canvas, PluginState* plugin_state) {
31-
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
31+
const SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
3232

3333
int v_shift = 0;
3434
if(scene_state->code_length > 0) {
@@ -73,7 +73,7 @@ void totp_scene_authenticate_render(Canvas* const canvas, PluginState* plugin_st
7373
}
7474
}
7575

76-
bool totp_scene_authenticate_handle_event(PluginEvent* const event, PluginState* plugin_state) {
76+
bool totp_scene_authenticate_handle_event(const PluginEvent* const event, PluginState* plugin_state) {
7777
if(event->type == EventTypeKey) {
7878
if(event->input.type == InputTypeLong && event->input.key == InputKeyBack) {
7979
return false;
@@ -156,6 +156,6 @@ void totp_scene_authenticate_deactivate(PluginState* plugin_state) {
156156
plugin_state->current_scene_state = NULL;
157157
}
158158

159-
void totp_scene_authenticate_free(PluginState* plugin_state) {
159+
void totp_scene_authenticate_free(const PluginState* plugin_state) {
160160
UNUSED(plugin_state);
161161
}

scenes/authenticate/totp_scene_authenticate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
void totp_scene_authenticate_init(PluginState* plugin_state);
1010
void totp_scene_authenticate_activate(PluginState* plugin_state);
1111
void totp_scene_authenticate_render(Canvas* const canvas, PluginState* plugin_state);
12-
bool totp_scene_authenticate_handle_event(PluginEvent* const event, PluginState* plugin_state);
12+
bool totp_scene_authenticate_handle_event(const PluginEvent* const event, PluginState* plugin_state);
1313
void totp_scene_authenticate_deactivate(PluginState* plugin_state);
14-
void totp_scene_authenticate_free(PluginState* plugin_state);
14+
void totp_scene_authenticate_free(const PluginState* plugin_state);

scenes/token_menu/totp_scene_token_menu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ typedef struct {
2121
int16_t current_token_index;
2222
} SceneState;
2323

24-
void totp_scene_token_menu_init(PluginState* plugin_state) {
24+
void totp_scene_token_menu_init(const PluginState* plugin_state) {
2525
UNUSED(plugin_state);
2626
}
2727

@@ -38,7 +38,7 @@ void totp_scene_token_menu_activate(
3838
}
3939

4040
void totp_scene_token_menu_render(Canvas* const canvas, PluginState* plugin_state) {
41-
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
41+
const SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
4242
if(scene_state->current_token_index < 0) {
4343
ui_control_button_render(
4444
canvas,
@@ -84,7 +84,7 @@ void totp_scene_token_menu_render(Canvas* const canvas, PluginState* plugin_stat
8484
}
8585
}
8686

87-
bool totp_scene_token_menu_handle_event(PluginEvent* const event, PluginState* plugin_state) {
87+
bool totp_scene_token_menu_handle_event(const PluginEvent* const event, PluginState* plugin_state) {
8888
if(event->type == EventTypeKey) {
8989
SceneState* scene_state = (SceneState*)plugin_state->current_scene_state;
9090
if(event->input.type == InputTypePress) {
@@ -192,6 +192,6 @@ void totp_scene_token_menu_deactivate(PluginState* plugin_state) {
192192
plugin_state->current_scene_state = NULL;
193193
}
194194

195-
void totp_scene_token_menu_free(PluginState* plugin_state) {
195+
void totp_scene_token_menu_free(const PluginState* plugin_state) {
196196
UNUSED(plugin_state);
197197
}

scenes/token_menu/totp_scene_token_menu.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ typedef struct {
1010
uint8_t current_token_index;
1111
} TokenMenuSceneContext;
1212

13-
void totp_scene_token_menu_init(PluginState* plugin_state);
13+
void totp_scene_token_menu_init(const PluginState* plugin_state);
1414
void totp_scene_token_menu_activate(
1515
PluginState* plugin_state,
1616
const TokenMenuSceneContext* context);
1717
void totp_scene_token_menu_render(Canvas* const canvas, PluginState* plugin_state);
18-
bool totp_scene_token_menu_handle_event(PluginEvent* const event, PluginState* plugin_state);
18+
bool totp_scene_token_menu_handle_event(const PluginEvent* const event, PluginState* plugin_state);
1919
void totp_scene_token_menu_deactivate(PluginState* plugin_state);
20-
void totp_scene_token_menu_free(PluginState* plugin_state);
20+
void totp_scene_token_menu_free(const PluginState* plugin_state);

services/cli/cli.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "commands/timezone/timezone.h"
1010
#include "commands/help/help.h"
1111

12-
static void totp_cli_print_unknown_command(FuriString* unknown_command) {
12+
static void totp_cli_print_unknown_command(const FuriString* unknown_command) {
1313
TOTP_CLI_PRINTF(
1414
"Command \"%s\" is unknown. Use \"" TOTP_CLI_COMMAND_HELP
1515
"\" command to get list of available commands.",

services/cli/cli_helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "cli_helpers.h"
22
#include <cli/cli.h>
33

4-
bool totp_cli_ensure_authenticated(PluginState* plugin_state, Cli* cli) {
4+
bool totp_cli_ensure_authenticated(const PluginState* plugin_state, Cli* cli) {
55
if(plugin_state->current_scene == TotpSceneAuthentication) {
66
TOTP_CLI_PRINTF("Pleases enter PIN on your flipper device\r\n");
77

0 commit comments

Comments
 (0)