Cast strlen to int for printf field width

strlen is a size_t, and the * field width takes an int.
Make this an explicit cast.  It's good for 64-bit machines
and squelches warnings from gcc-4.3.
This commit is contained in:
Larry Doolittle 2008-06-20 10:12:17 -07:00 committed by Stephen Williams
parent fe555e4539
commit f60a6561bb
3 changed files with 11 additions and 11 deletions

View File

@ -78,7 +78,7 @@ static PLI_INT32 sys_fopen_compiletf(PLI_BYTE8 *name)
vpi_printf("%s %s takes at most two string arguments.\n",
msg, name);
vpi_printf("%*s Found %u extra argument%s.\n",
strlen(msg), " ", argc, argc == 1 ? "" : "s");
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
vpi_control(vpiFinish, 1);
}
@ -186,7 +186,7 @@ static PLI_INT32 sys_fopen_calltf(PLI_BYTE8*name)
(int)vpi_get(vpiLineNo, callh));
vpi_printf("%s %s's file name argument contains non-"
"printable characters.\n", msg, name);
vpi_printf("%*s \"%s\"\n", strlen(msg), " ", val.value.str);
vpi_printf("%*s \"%s\"\n", (int) strlen(msg), " ", val.value.str);
fail = 1;
if (mode) free(mode_string);
}
@ -251,7 +251,7 @@ static PLI_INT32 sys_fopenrwa_calltf(PLI_BYTE8*name)
(int)vpi_get(vpiLineNo, callh));
vpi_printf("%s %s's file name argument contains non-"
"printable characters.\n", msg, name);
vpi_printf("%*s \"%s\"\n", strlen(msg), " ", val.value.str);
vpi_printf("%*s \"%s\"\n", (int) strlen(msg), " ", val.value.str);
return 0;
}
}
@ -415,7 +415,7 @@ static PLI_INT32 sys_fgets_compiletf(PLI_BYTE8*name)
vpi_printf("%s %s takes two arguments.\n", msg, name);
vpi_printf("%*s Found %u extra argument%s.\n",
strlen(msg), " ", argc, argc == 1 ? "" : "s");
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
vpi_control(vpiFinish, 1);
}
@ -599,7 +599,7 @@ static PLI_INT32 sys_fseek_compiletf(PLI_BYTE8*name)
vpi_printf("%s %s takes three arguments.\n", msg, name);
vpi_printf("%*s Found %u extra argument%s.\n",
strlen(msg), " ", argc, argc == 1 ? "" : "s");
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
vpi_control(vpiFinish, 1);
}

View File

@ -153,7 +153,7 @@ PLI_INT32 sys_no_arg_compiletf(PLI_BYTE8 *name)
vpi_printf("%s %s does not take an argument.\n", msg, name);
vpi_printf("%*s Found %u extra argument%s.\n",
strlen(msg), " ", argc, argc == 1 ? "" : "s");
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
vpi_control(vpiFinish, 1);
}
@ -194,7 +194,7 @@ PLI_INT32 sys_one_numeric_arg_compiletf(PLI_BYTE8 *name)
vpi_printf("%s %s takes a single numeric argument.\n", msg, name);
vpi_printf("%*s Found %u extra argument%s.\n",
strlen(msg), " ", argc, argc == 1 ? "" : "s");
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
vpi_control(vpiFinish, 1);
}
@ -230,7 +230,7 @@ PLI_INT32 sys_one_opt_numeric_arg_compiletf(PLI_BYTE8 *name)
vpi_printf("%s %s takes at most one numeric argument.\n",
msg, name);
vpi_printf("%*s Found %u extra argument%s.\n",
strlen(msg), " ", argc, argc == 1 ? "" : "s");
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
vpi_control(vpiFinish, 1);
}
@ -288,7 +288,7 @@ PLI_INT32 sys_two_numeric_args_compiletf(PLI_BYTE8 *name)
vpi_printf("%s %s takes two numeric arguments.\n", msg, name);
vpi_printf("%*s Found %u extra argument%s.\n",
strlen(msg), " ", argc, argc == 1 ? "" : "s");
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
vpi_control(vpiFinish, 1);
}
@ -328,7 +328,7 @@ PLI_INT32 sys_one_string_arg_compiletf(PLI_BYTE8 *name)
vpi_printf("%s %s takes a single string argument.\n", msg, name);
vpi_printf("%*s Found %u extra argument%s.\n",
strlen(msg), " ", argc, argc == 1 ? "" : "s");
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
vpi_control(vpiFinish, 1);
}

View File

@ -97,7 +97,7 @@ static PLI_INT32 simparam_compiletf(PLI_BYTE8 *name_ext)
vpi_printf("%s $simparam%s takes at most two arguments.\n",
msg, name_ext);
vpi_printf("%*s Found %u extra argument%s.\n",
strlen(msg), " ", argc, argc == 1 ? "" : "s");
(int) strlen(msg), " ", argc, argc == 1 ? "" : "s");
vpi_control(vpiFinish, 1);
}