Fix some missing sign conversions

pull/526/head
jsteube 8 years ago
parent dad97abed1
commit 299edf5170

@ -150,13 +150,13 @@ void *thread_calc_stdin (void *p)
if (line_buf == NULL) break;
uint line_len = in_superchop (line_buf);
u32 line_len = (u32) in_superchop (line_buf);
line_len = convert_from_hex (line_buf, line_len, user_options);
// post-process rule engine
if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l))
if (run_rule_engine ((int) user_options_extra->rule_len_l, user_options->rule_buf_l))
{
char rule_buf_out[BLOCK_SIZE] = { 0 };
@ -164,13 +164,13 @@ void *thread_calc_stdin (void *p)
if (line_len < BLOCK_SIZE)
{
rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, line_buf, line_len, rule_buf_out);
rule_len_out = _old_apply_rule (user_options->rule_buf_l, (int) user_options_extra->rule_len_l, line_buf, (int) line_len, rule_buf_out);
}
if (rule_len_out < 0) continue;
line_buf = rule_buf_out;
line_len = rule_len_out;
line_len = (u32) rule_len_out;
}
if (line_len > PW_MAX)
@ -197,7 +197,7 @@ void *thread_calc_stdin (void *p)
}
}
pw_add (device_param, (u8 *) line_buf, line_len);
pw_add (device_param, (u8 *) line_buf, (int) line_len);
words_cur++;
@ -401,7 +401,7 @@ void *thread_calc (void *p)
// post-process rule engine
if (run_rule_engine (user_options_extra->rule_len_l, user_options->rule_buf_l))
if (run_rule_engine ((int) user_options_extra->rule_len_l, user_options->rule_buf_l))
{
char rule_buf_out[BLOCK_SIZE] = { 0 };
@ -409,13 +409,13 @@ void *thread_calc (void *p)
if (line_len < BLOCK_SIZE)
{
rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, line_buf, line_len, rule_buf_out);
rule_len_out = _old_apply_rule (user_options->rule_buf_l, (int) user_options_extra->rule_len_l, line_buf, (int) line_len, rule_buf_out);
}
if (rule_len_out < 0) continue;
line_buf = rule_buf_out;
line_len = rule_len_out;
line_len = (u32) rule_len_out;
}
if (attack_kern == ATTACK_KERN_STRAIGHT)
@ -458,7 +458,7 @@ void *thread_calc (void *p)
}
}
pw_add (device_param, (u8 *) line_buf, line_len);
pw_add (device_param, (u8 *) line_buf, (int) line_len);
if (status_ctx->run_thread_level1 == false) break;
}

@ -85,7 +85,7 @@ void adl_close (ADL_PTR *adl)
void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize)
{
return mymalloc (iSize);
return mymalloc ((size_t) iSize);
}
int hm_ADL_Main_Control_Destroy (ADL_PTR *adl)

@ -28,7 +28,7 @@ int sort_by_stringptr (const void *p1, const void *p2)
char *get_exec_path ()
{
int exec_path_len = 1024;
size_t exec_path_len = 1024;
char *exec_path = (char *) mymalloc (exec_path_len);
@ -46,7 +46,7 @@ char *get_exec_path ()
#elif defined (__APPLE__)
uint size = exec_path_len;
size_t size = exec_path_len;
if (_NSGetExecutablePath (exec_path, &size) != 0)
{
@ -55,11 +55,12 @@ char *get_exec_path ()
exit (-1);
}
const int len = strlen (exec_path);
const size_t len = strlen (exec_path);
#elif defined (__FreeBSD__)
int mib[4];
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PATHNAME;
@ -68,7 +69,8 @@ char *get_exec_path ()
char tmp[32] = { 0 };
size_t size = exec_path_len;
sysctl(mib, 4, exec_path, &size, NULL, 0);
sysctl (mib, 4, exec_path, &size, NULL, 0);
const int len = readlink (tmp, exec_path, exec_path_len - 1);
@ -186,7 +188,7 @@ char **scan_directory (const char *path)
if ((strcmp (de->d_name, ".") == 0) || (strcmp (de->d_name, "..") == 0)) continue;
int path_size = strlen (tmp_path) + 1 + strlen (de->d_name);
size_t path_size = strlen (tmp_path) + 1 + strlen (de->d_name);
char *path_file = (char *) mymalloc (path_size + 1);
@ -204,7 +206,7 @@ char **scan_directory (const char *path)
}
else
{
files = (char **) myrealloc (files, num_files * sizeof (char *), sizeof (char *));
files = (char **) myrealloc (files, (size_t) num_files * sizeof (char *), sizeof (char *));
num_files++;
@ -216,14 +218,14 @@ char **scan_directory (const char *path)
}
else if (errno == ENOTDIR)
{
files = (char **) myrealloc (files, num_files * sizeof (char *), sizeof (char *));
files = (char **) myrealloc (files, (size_t) num_files * sizeof (char *), sizeof (char *));
num_files++;
files[num_files - 1] = mystrdup (path);
}
files = (char **) myrealloc (files, num_files * sizeof (char *), sizeof (char *));
files = (char **) myrealloc (files, (size_t) num_files * sizeof (char *), sizeof (char *));
num_files++;

Loading…
Cancel
Save