Remove else statement after return

Suggested by clang tidy
pull/1425/head
Rosen Penev 7 years ago
parent 496fc309fe
commit 0555613305

@ -34,7 +34,8 @@ void *hc_dlsym (void *module, const char *symbol);
if (noerr == 1) { \
event_log_error (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return -1; \
} else { \
} \
if (noerr != 1) { \
event_log_warning (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return 0; \
} \
@ -48,7 +49,8 @@ void *hc_dlsym (void *module, const char *symbol);
if (noerr == 1) { \
event_log_error (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return -1; \
} else { \
} \
if (noerr != 1) { \
event_log_warning (hashcat_ctx, "%s is missing from %s shared library.", #name, #libname); \
return 0; \
} \
@ -61,7 +63,8 @@ void *hc_dlsym (void *module, const char *symbol);
if (noerr == 1) { \
event_log_error (hashcat_ctx, "%s at address %08x is missing from %s shared library.", #name, addr, #libname); \
return -1; \
} else { \
} \
if (noerr != 1) { \
event_log_warning (hashcat_ctx, "%s at address %08x is missing from %s shared library.", #name, addr, #libname); \
return 0; \
} \

@ -213,8 +213,8 @@ u8 hex_to_u8 (const u8 hex[2])
{
u8 v = 0;
v |= ((u8) hex_convert (hex[1]) << 0);
v |= ((u8) hex_convert (hex[0]) << 4);
v |= (hex_convert (hex[1]) << 0);
v |= (hex_convert (hex[0]) << 4);
return (v);
}
@ -328,8 +328,8 @@ u8 int_to_base32 (const u8 c)
u8 base32_to_int (const u8 c)
{
if ((c >= 'A') && (c <= 'Z')) return c - 'A';
else if ((c >= '2') && (c <= '7')) return c - '2' + 26;
if ((c >= 'A') && (c <= 'Z')) return c - 'A';
if ((c >= '2') && (c <= '7')) return c - '2' + 26;
return 0;
}
@ -347,8 +347,8 @@ u8 int_to_itoa32 (const u8 c)
u8 itoa32_to_int (const u8 c)
{
if ((c >= '0') && (c <= '9')) return c - '0';
else if ((c >= 'a') && (c <= 'v')) return c - 'a' + 10;
if ((c >= '0') && (c <= '9')) return c - '0';
if ((c >= 'a') && (c <= 'v')) return c - 'a' + 10;
return 0;
}
@ -469,23 +469,22 @@ u8 bf64_to_int (const u8 c)
u8 int_to_lotus64 (const u8 c)
{
if (c < 10) return '0' + c;
else if (c < 36) return 'A' + c - 10;
else if (c < 62) return 'a' + c - 36;
else if (c == 62) return '+';
else if (c == 63) return '/';
if (c < 10) return '0' + c;
if (c < 36) return 'A' + c - 10;
if (c < 62) return 'a' + c - 36;
if (c == 62) return '+';
if (c == 63) return '/';
return 0;
}
u8 lotus64_to_int (const u8 c)
{
if ((c >= '0') && (c <= '9')) return c - '0';
else if ((c >= 'A') && (c <= 'Z')) return c - 'A' + 10;
else if ((c >= 'a') && (c <= 'z')) return c - 'a' + 36;
else if (c == '+') return 62;
else if (c == '/') return 63;
else
if ((c >= '0') && (c <= '9')) return c - '0';
if ((c >= 'A') && (c <= 'Z')) return c - 'A' + 10;
if ((c >= 'a') && (c <= 'z')) return c - 'a' + 36;
if (c == '+') return 62;
if (c == '/') return 63;
return 0;
}

@ -125,7 +125,7 @@ int count_dictionaries (char **dictionary_files)
char *first_file_in_directory (const char *path)
{
DIR *d = NULL;
DIR *d;
if ((d = opendir (path)) != NULL)
{
@ -165,10 +165,6 @@ char *first_file_in_directory (const char *path)
return first_file;
}
else if (errno == ENOTDIR)
{
return NULL;
}
return NULL;
}

@ -501,7 +501,8 @@ static int outer_loop (hashcat_ctx_t *hashcat_ctx)
return 0;
}
else if (user_options->left == true)
if (user_options->left == true)
{
outfile_write_open (hashcat_ctx);

@ -111,28 +111,16 @@ bool class_alpha (const u8 c)
int conv_ctoi (const u8 c)
{
if (class_num (c))
{
return c - '0';
}
else if (class_upper (c))
{
return c - 'A' + 10;
}
if (class_num (c)) return c - '0';
if (class_upper (c)) return c - 'A' + 10;
return -1;
}
int conv_itoc (const u8 c)
{
if (c < 10)
{
return c + '0';
}
else if (c < 37)
{
return c + 'A' - 10;
}
if (c < 10) return c + '0';
if (c < 37) return c + 'A' - 10;
return -1;
}
@ -878,7 +866,7 @@ int kernel_rules_generate (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf,
{
memset (rule_buf, 0, RP_RULE_SIZE);
int rule_len = (int) generate_random_rule (rule_buf, user_options->rp_gen_func_min, user_options->rp_gen_func_max);
int rule_len = generate_random_rule (rule_buf, user_options->rp_gen_func_min, user_options->rp_gen_func_max);
if (cpu_rule_to_kernel_rule (rule_buf, rule_len, &kernel_rules_buf[kernel_rules_cnt]) == -1) continue;
}

@ -607,7 +607,8 @@ char *status_get_guess_mod (const hashcat_ctx_t *hashcat_ctx)
{
return status_get_rules_file (hashcat_ctx);
}
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
const combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
@ -620,17 +621,20 @@ char *status_get_guess_mod (const hashcat_ctx_t *hashcat_ctx)
return strdup (combinator_ctx->dict1);
}
}
else if (user_options->attack_mode == ATTACK_MODE_BF)
if (user_options->attack_mode == ATTACK_MODE_BF)
{
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
if (user_options->attack_mode == ATTACK_MODE_HYBRID1)
{
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
return strdup (mask_ctx->mask);
}
else if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
if (user_options->attack_mode == ATTACK_MODE_HYBRID2)
{
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{

@ -239,13 +239,15 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
continue;
}
else if ((user_options_extra->attack_kern == ATTACK_KERN_COMBI) && (kernel_loops > KERNEL_COMBS))
if ((user_options_extra->attack_kern == ATTACK_KERN_COMBI) && (kernel_loops > KERNEL_COMBS))
{
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num);
continue;
}
else if ((user_options_extra->attack_kern == ATTACK_KERN_BF) && (kernel_loops > KERNEL_BFS))
if ((user_options_extra->attack_kern == ATTACK_KERN_BF) && (kernel_loops > KERNEL_BFS))
{
event_log_warning (hashcat_ctx, "Tuning-db: Invalid kernel_loops '%d' in Line '%d'", kernel_loops, line_num);

@ -742,7 +742,8 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
else if (user_options->left == true)
if (user_options->left == true)
{
event_log_error (hashcat_ctx, "Combining --left with --keyspace is not allowed.");
@ -970,7 +971,8 @@ int user_options_sanity (hashcat_ctx_t *hashcat_ctx)
return -1;
}
else if (user_options->attack_mode == ATTACK_MODE_COMBI)
if (user_options->attack_mode == ATTACK_MODE_COMBI)
{
event_log_error (hashcat_ctx, "Custom charsets re not supported in attack mode 1 (combination).");

Loading…
Cancel
Save