use size_t with strlen instead of casting randomly to ints

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1698 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Mike Frysinger 15 years ago
parent 1310dca184
commit c3dce698ab

@ -8,6 +8,9 @@
* src/cmd/cmd_shell.c (cmd_shell_run): Log non-zero shell exit status.
* src/cmd/cmd_pod.c (cmd_pod_run), src/cmd/cmd_shell.c (cmd_shell_run):
Fix size_t handling with strlen.
2010-01-21 Jie Zhang <jie.zhang@analog.com>
* src/apps/jtag/jtag.c (main): Don't trigger open file error

@ -68,7 +68,7 @@ cmd_pod_run (urj_chain_t *chain, char *params[])
}
urj_pod_sigsel_t it = URJ_POD_CS_NONE;
int n = strlen (params[j]);
size_t n = strlen (params[j]);
if (n > 4 && (strncasecmp (params[j], "tck", 3) == 0))
it = URJ_POD_CS_TCK;

@ -39,7 +39,8 @@
static int
cmd_shell_run (urj_chain_t *chain, char *params[])
{
int i, len, n = urj_cmd_params (params);
int i, n = urj_cmd_params (params);
size_t len;
char *shell_cmd;
if ((n = urj_cmd_params (params)) == 1)
@ -65,8 +66,8 @@ cmd_shell_run (urj_chain_t *chain, char *params[])
shell_cmd = malloc (len);
if (shell_cmd == NULL)
{
urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zd) fails",
(size_t) len);
urj_error_set (URJ_ERROR_OUT_OF_MEMORY, "malloc(%zu) fails",
len);
return URJ_STATUS_FAIL;
}

Loading…
Cancel
Save