Commit d5ab9df7 authored by Peter Eisentraut's avatar Peter Eisentraut

Remove unnecessary casts from size_t to int

We can use the %zu format specifier directly, no need to cast to int.
parent 6a1cd8b9
......@@ -36,7 +36,7 @@ ECPG: stmtExecuteStmt block
/* It must be cut off double quotation because new_variable() double-quotes. */
str[strlen(str) - 1] = '\0';
sprintf(length, "%d", (int) strlen(str));
sprintf(length, "%zu", strlen(str));
add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
}
output_statement(cat_str(3, mm_strdup("execute"), mm_strdup("$0"), $1.type), 0, ECPGst_exec_with_exprlist);
......@@ -63,7 +63,7 @@ ECPG: stmtPrepareStmt block
/* It must be cut off double quotation because new_variable() double-quotes. */
str[strlen(str) - 1] = '\0';
sprintf(length, "%d", (int) strlen(str));
sprintf(length, "%zu", strlen(str));
add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
}
output_statement(cat_str(5, mm_strdup("prepare"), mm_strdup("$0"), $1.type, mm_strdup("as"), $1.stmt), 0, ECPGst_prepare);
......
......@@ -1099,7 +1099,7 @@ UsingValue: UsingConst
{
char *length = mm_alloc(32);
sprintf(length, "%d", (int) strlen($1));
sprintf(length, "%zu", strlen($1));
add_variable_to_head(&argsinsert, new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
}
| civar { $$ = EMPTY; }
......@@ -1226,7 +1226,7 @@ IntConstVar: Iconst
{
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
sprintf(length, "%d", (int) strlen($1));
sprintf(length, "%zu", strlen($1));
new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = $1;
}
......@@ -1272,7 +1272,7 @@ AllConstVar: ecpg_fconst
{
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
sprintf(length, "%d", (int) strlen($1));
sprintf(length, "%zu", strlen($1));
new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = $1;
}
......@@ -1287,7 +1287,7 @@ AllConstVar: ecpg_fconst
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *var = cat2_str(mm_strdup("-"), $2);
sprintf(length, "%d", (int) strlen(var));
sprintf(length, "%zu", strlen(var));
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var;
}
......@@ -1297,7 +1297,7 @@ AllConstVar: ecpg_fconst
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *var = cat2_str(mm_strdup("-"), $2);
sprintf(length, "%d", (int) strlen(var));
sprintf(length, "%zu", strlen(var));
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var;
}
......@@ -1308,7 +1308,7 @@ AllConstVar: ecpg_fconst
char *var = $1 + 1;
var[strlen(var) - 1] = '\0';
sprintf(length, "%d", (int) strlen(var));
sprintf(length, "%zu", strlen(var));
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment