From f60a6561bb6e05f07c8f137622d452659962b0c9 Mon Sep 17 00:00:00 2001 From: Larry Doolittle Date: Fri, 20 Jun 2008 10:12:17 -0700 Subject: [PATCH] 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. --- vpi/sys_fileio.c | 10 +++++----- vpi/sys_priv.c | 10 +++++----- vpi/vams_simparam.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/vpi/sys_fileio.c b/vpi/sys_fileio.c index 3d666a9d2..b763bb776 100644 --- a/vpi/sys_fileio.c +++ b/vpi/sys_fileio.c @@ -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); } diff --git a/vpi/sys_priv.c b/vpi/sys_priv.c index 283528d91..5e1dcba4b 100644 --- a/vpi/sys_priv.c +++ b/vpi/sys_priv.c @@ -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); } diff --git a/vpi/vams_simparam.c b/vpi/vams_simparam.c index 2aea5deb6..169eade8e 100644 --- a/vpi/vams_simparam.c +++ b/vpi/vams_simparam.c @@ -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); }