Skip to content

Commit

Permalink
Clang format ran
Browse files Browse the repository at this point in the history
  • Loading branch information
akopachov committed Nov 7, 2022
1 parent 44879ec commit 3a111ef
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 31 deletions.
6 changes: 4 additions & 2 deletions scenes/add_new_token/totp_scene_add_new_token.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState
}
break;
}
default: break;
default:
break;
}
break;
case InputKeyBack:
Expand All @@ -295,7 +296,8 @@ bool totp_scene_add_new_token_handle_event(PluginEvent* const event, PluginState
totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken, NULL);
}
break;
default: break;
default:
break;
}

return true;
Expand Down
3 changes: 2 additions & 1 deletion scenes/app_settings/totp_app_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ bool totp_scene_app_settings_handle_event(
}
break;
}
default: break;
default:
break;
}

return true;
Expand Down
3 changes: 2 additions & 1 deletion scenes/authenticate/totp_scene_authenticate.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ bool totp_scene_authenticate_handle_event(
scene_state->code_length--;
}
break;
default: break;
default:
break;
}

return true;
Expand Down
6 changes: 4 additions & 2 deletions scenes/generate_token/totp_scene_generate_token.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ TOTP_ALGO get_totp_algo_impl(TokenHashAlgo algo) {
return TOTP_ALGO_SHA256;
case SHA512:
return TOTP_ALGO_SHA512;
default: break;
default:
break;
}

return NULL;
Expand Down Expand Up @@ -300,7 +301,8 @@ bool totp_scene_generate_token_handle_event(
break;
case InputKeyBack:
break;
default: break;
default:
break;
}

return true;
Expand Down
12 changes: 8 additions & 4 deletions scenes/scene_director.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ void totp_scene_director_activate_scene(
break;
case TotpSceneNone:
break;
default: break;
default:
break;
}

plugin_state->current_scene = scene;
Expand All @@ -56,7 +57,8 @@ void totp_scene_director_deactivate_active_scene(PluginState* const plugin_state
break;
case TotpSceneNone:
break;
default: break;
default:
break;
}
}

Expand Down Expand Up @@ -87,7 +89,8 @@ void totp_scene_director_render(Canvas* const canvas, PluginState* const plugin_
break;
case TotpSceneNone:
break;
default: break;
default:
break;
}
}

Expand Down Expand Up @@ -119,7 +122,8 @@ bool totp_scene_director_handle_event(PluginEvent* const event, PluginState* con
break;
case TotpSceneNone:
break;
default: break;
default:
break;
}

return processing;
Expand Down
6 changes: 4 additions & 2 deletions scenes/token_menu/totp_scene_token_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ bool totp_scene_token_menu_handle_event(const PluginEvent* const event, PluginSt
}
break;
}
default: break;
default:
break;
}
break;
case InputKeyBack: {
Expand All @@ -185,7 +186,8 @@ bool totp_scene_token_menu_handle_event(const PluginEvent* const event, PluginSt
}
break;
}
default: break;
default:
break;
}

return true;
Expand Down
3 changes: 2 additions & 1 deletion services/cli/commands/add/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ static bool token_info_set_digits_from_str(TokenInfo* token_info, const FuriStri
case '8':
token_info->digits = TOTP_8_DIGITS;
return true;
default: break;
default:
break;
}

return false;
Expand Down
6 changes: 4 additions & 2 deletions services/cli/commands/list/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ static char* get_algo_as_cstr(TokenHashAlgo algo) {
return TOTP_CONFIG_TOKEN_ALGO_SHA256_NAME;
case SHA512:
return TOTP_CONFIG_TOKEN_ALGO_SHA512_NAME;
default: break;
default:
break;
}

return "UNKNOWN";
Expand All @@ -25,7 +26,8 @@ static uint8_t get_digits_as_int(TokenDigitsCount digits) {
return 6;
case TOTP_8_DIGITS:
return 8;
default: break;
default:
break;
}

return 6;
Expand Down
9 changes: 6 additions & 3 deletions services/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ static uint8_t token_info_get_digits_as_int(const TokenInfo* token_info) {
return 6;
case TOTP_8_DIGITS:
return 8;
default: break;
default:
break;
}

return 6;
Expand All @@ -30,7 +31,8 @@ static void token_info_set_digits_from_int(TokenInfo* token_info, uint8_t digits
case 8:
token_info->digits = TOTP_8_DIGITS;
break;
default: break;
default:
break;
}
}

Expand All @@ -42,7 +44,8 @@ static char* token_info_get_algo_as_cstr(const TokenInfo* token_info) {
return TOTP_CONFIG_TOKEN_ALGO_SHA256_NAME;
case SHA512:
return TOTP_CONFIG_TOKEN_ALGO_SHA512_NAME;
default: break;
default:
break;
}

return NULL;
Expand Down
14 changes: 7 additions & 7 deletions services/hmac/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,24 +227,24 @@ void sha1_process_block(const void* buffer, size_t len, struct sha1_ctx* ctx) {
words++;
}

for (int i = 0; i < 80; i++) {
for(int i = 0; i < 80; i++) {
uint32_t xx = i < 16 ? x[i] : M(i);
uint32_t ki = i / 20;
switch (ki) {
case 0:
switch(ki) {
case 0:
R(a, b, c, d, e, F1, K1, xx);
break;
case 1:
case 1:
R(a, b, c, d, e, F2, K2, xx);
break;
case 2:
case 2:
R(a, b, c, d, e, F3, K3, xx);
break;
default:
default:
R(a, b, c, d, e, F4, K4, xx);
break;
}

uint32_t tt = a;
a = e;
e = d;
Expand Down
2 changes: 1 addition & 1 deletion services/hmac/sha256.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void sha256_process_block(const void* buffer, size_t len, struct sha256_ctx* ctx
words++;
}

for (int i = 0; i < 64; i++) {
for(int i = 0; i < 64; i++) {
uint32_t xx = i < 16 ? x[i] : M(i);
R(a, b, c, d, e, f, g, h, K(i), xx);
uint32_t tt = a;
Expand Down
2 changes: 1 addition & 1 deletion services/hmac/sha512.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void sha512_process_block(const void* buffer, size_t len, struct sha512_ctx* ctx
words++;
}

for (int i = 0; i < 80; i++) {
for(int i = 0; i < 80; i++) {
u64 xx = i < 16 ? x[i] : M(i);
R(a, b, c, d, e, f, g, h, K(i), xx);
u64 tt = a;
Expand Down
4 changes: 2 additions & 2 deletions services/list/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

ListNode* list_init_head(void* data) {
ListNode* new = malloc(sizeof(ListNode));
if (new == NULL) return NULL;
if(new == NULL) return NULL;
new->data = data;
new->next = NULL;
return new;
}

ListNode* list_add(ListNode* head, void* data) {
ListNode* new = malloc(sizeof(ListNode));
if (new == NULL) return NULL;
if(new == NULL) return NULL;
new->data = data;
new->next = NULL;

Expand Down
2 changes: 1 addition & 1 deletion services/totp/totp.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ uint32_t otp_generate(
size_t plain_secret_length,
uint64_t input) {
uint8_t* hmac = malloc(64);
if (hmac == NULL) return OTP_ERROR;
if(hmac == NULL) return OTP_ERROR;
memset(hmac, 0, 64);

uint64_t input_swapped = swap_uint64(input);
Expand Down
3 changes: 2 additions & 1 deletion types/token_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ uint8_t token_info_get_digits_count(const TokenInfo* token_info) {
return 6;
case TOTP_8_DIGITS:
return 8;
default: break;
default:
break;
}

return 6;
Expand Down

0 comments on commit 3a111ef

Please sign in to comment.