+2007-10-12 Ben Pfaff <blp@gnu.org>
+
+ * Smake: Add fprintf-posix, printf-posix, printf-safe,
+ snprintf-posix, sprintf-posix, vasprintf-posxi, vfprintf-posix,
+ vprintf-posix, vsnprintf-posix, and vsprintf-posix modules, which
+ allow us to use C99 format specifiers (e.g. 'z') in *printf.
+ Also, changed many formerly casted arguments in *printf calls to
+ use one of these format specifiers and drop the cast.
+
2007-10-11 Ben Pfaff <blp@gnu.org>
* Smake: Drop alloca, alloca-opt modules as we don't use them
dirname \
exit \
fpieee \
+ fprintf-posix \
full-read \
full-write \
fseeko \
memset \
minmax \
mkstemp \
+ printf-posix \
+ printf-safe \
progname \
relocatable-prog \
snprintf \
+ snprintf-posix \
+ sprintf-posix \
stdarg \
stdbool \
stdint \
tmpfile \
unistd \
unlocked-io \
+ vasprintf-posix \
+ vfprintf-posix \
+ vprintf-posix \
vsnprintf \
+ vsnprintf-posix \
+ vsprintf-posix \
xalloc \
xalloc-die \
xmalloca \
mc_error (mc, "row count (%lu) does not match expected (%zu)",
(unsigned long int) datasheet_get_row_cnt (ds), row_cnt);
else if (column_cnt != datasheet_get_column_cnt (ds))
- mc_error (mc, "column count (%lu) does not match expected (%zu)",
- (unsigned long int) datasheet_get_column_cnt (ds), column_cnt);
+ mc_error (mc, "column count (%zu) does not match expected (%zu)",
+ datasheet_get_column_cnt (ds), column_cnt);
else
{
size_t row, col;
/* Validate file. */
if (strlen (date) != 8)
- error (r, _("Bad date string length %d."), (int) strlen (date));
+ error (r, _("Bad date string length %zu."), strlen (date));
if (strlen (time) != 6)
- error (r, _("Bad time string length %d."), (int) strlen (time));
+ error (r, _("Bad time string length %zu."), strlen (time));
/* Save file info. */
if (info != NULL)
len = read_int (r);
if (len >= sizeof label)
- sys_error (r, _("Variable %s has label of invalid length %u."),
- name, (unsigned int) len);
+ sys_error (r, _("Variable %s has label of invalid length %zu."),
+ name, len);
read_string (r, label, len + 1);
var_set_label (var, label);
bool ok;
if (!fmt_from_io (raw_type, &f.type))
- sys_error (r, _("Unknown variable format %d."), (int) raw_type);
+ sys_error (r, _("Unknown variable format %"PRIu8"."), raw_type);
f.w = w;
f.d = d;
int expected_integer_format;
if (size != 4 || count != 8)
- sys_error (r, _("Bad size (%u) or count (%u) field on record type 7, "
+ sys_error (r, _("Bad size (%zu) or count (%zu) field on record type 7, "
"subtype 3."),
- (unsigned int) size, (unsigned int) count);
+ size, count);
/* Save version info. */
info->version_major = version_major;
double lowest = read_float (r);
if (size != 8 || count != 3)
- sys_error (r, _("Bad size (%u) or count (%u) on extension 4."),
- (unsigned int) size, (unsigned int) count);
+ sys_error (r, _("Bad size (%zu) or count (%zu) on extension 4."),
+ size, count);
if (sysmis != SYSMIS)
sys_warn (r, _("File specifies unexpected value %g as SYSMIS."), sysmis);
int i;
if (count % 3 || n_vars != dict_get_var_cnt (dict))
- sys_error (r, _("Bad size (%u) or count (%u) on extension 11."),
- (unsigned int) size, (unsigned int) count);
+ sys_error (r, _("Bad size (%zu) or count (%zu) on extension 11."),
+ size, count);
for (i = 0; i < n_vars; ++i)
{
var_cnt = read_int (r);
if (var_cnt < 1 || var_cnt > dict_get_var_cnt (dict))
sys_error (r, _("Number of variables associated with a value label (%d) "
- "is not between 1 and the number of variables (%u)."),
- var_cnt, (unsigned int) dict_get_var_cnt (dict));
+ "is not between 1 and the number of variables (%zu)."),
+ var_cnt, dict_get_var_cnt (dict));
/* Read the list of variables. */
var = pool_nalloc (subpool, var_cnt, sizeof *var);
if (cmd.n_lrecl[0] == LONG_MIN)
msg (SE, _("Fixed-length records were specified on /RECFORM, but "
"record length was not specified on /LRECL. "
- "Assuming %u-character records."),
- (unsigned int) properties.record_width);
+ "Assuming %zu-character records."),
+ properties.record_width);
else if (cmd.n_lrecl[0] < 1)
msg (SE, _("Record length (%ld) must be at least one byte. "
- "Assuming %u-character records."),
- cmd.n_lrecl[0], (unsigned int) properties.record_width);
+ "Assuming %zu-character records."),
+ cmd.n_lrecl[0], properties.record_width);
else
properties.record_width = cmd.n_lrecl[0];
break;
goto done;
if (nn != nv)
{
- msg (SE, _("Number of variables on left side of `=' (%d) does not "
- "match number of variables on right side (%d), in "
+ msg (SE, _("Number of variables on left side of `=' (%zu) does not "
+ "match number of variables on right side (%zu), in "
"parenthesized group %d of RENAME subcommand."),
- (unsigned) (nv - old_nv), (unsigned) (nn - old_nv), group);
+ nv - old_nv, nn - old_nv, group);
goto done;
}
if (!lex_force_match (lexer, ')'))
if (assignment_cnt != var_cnt)
{
- msg (SE, _("Number of variables specified (%d) "
- "differs from number of variable formats (%d)."),
- (int) var_cnt, (int) assignment_cnt);
+ msg (SE, _("Number of variables specified (%zu) "
+ "differs from number of variable formats (%zu)."),
+ var_cnt, assignment_cnt);
return false;
}
if ((lc - fc + 1) % var_cnt)
{
msg (SE, _("The %d columns %d-%d "
- "can't be evenly divided into %u fields."),
- lc - fc + 1, fc, lc, (unsigned int) var_cnt);
+ "can't be evenly divided into %zu fields."),
+ lc - fc + 1, fc, lc, var_cnt);
return false;
}
}
if (trns->record_cnt != 0 && trns->record_cnt != record)
- msg (SW, _("Output calls for %d records but %u specified on RECORDS "
+ msg (SW, _("Output calls for %d records but %zu specified on RECORDS "
"subcommand."),
- record, (unsigned int) trns->record_cnt);
+ record, trns->record_cnt);
trns->record_cnt = record;
return true;
if (prev_nv_1 != vm.rename_cnt)
{
msg (SE, _("Differing number of variables in old name list "
- "(%d) and in new name list (%d)."),
- (int) (vm.rename_cnt - prev_nv_2),
- (int) (prev_nv_1 - prev_nv_2));
+ "(%zu) and in new name list (%zu)."),
+ vm.rename_cnt - prev_nv_2, prev_nv_1 - prev_nv_2);
for (i = 0; i < prev_nv_1; i++)
free (vm.new_names[i]);
free (vm.new_names);
size_t i;
msg (SE, _("Differing number of variables in old name list "
- "(%d) and in new name list (%d)."),
- (int) (rename_cnt - prev_nv_2),
- (int) (prev_nv_1 - prev_nv_2));
+ "(%zu) and in new name list (%zu)."),
+ rename_cnt - prev_nv_2, prev_nv_1 - prev_nv_2);
for (i = 0; i < prev_nv_1; i++)
free (rename_new_names[i]);
free (rename_new_names);
: info.float_format == FLOAT_Z_LONG ? _("IBM 390 Hex Long.")
: _("Unknown."));
tab_text (t, 0, 5, TAB_LEFT, _("Variables:"));
- tab_text (t, 1, 5, TAB_LEFT | TAT_PRINTF, "%u",
- (unsigned int) dict_get_var_cnt (d));
+ tab_text (t, 1, 5, TAB_LEFT | TAT_PRINTF, "%zu", dict_get_var_cnt (d));
tab_text (t, 0, 6, TAB_LEFT, _("Cases:"));
tab_text (t, 1, 6, TAB_LEFT | TAT_PRINTF,
info.case_cnt == -1 ? _("Unknown") : "%ld",
}
if (as != AS_NAMES)
{
- tab_text (t, pc, r, TAT_PRINTF, "%d",
- (int) var_get_dict_index (v) + 1);
+ tab_text (t, pc, r, TAT_PRINTF, "%zu",
+ var_get_dict_index (v) + 1);
tab_hline (t, TAL_1, 0, nc - 1, r);
}
r++;
/* Put the name, var label, and position into the first row. */
tab_text (t, 0, r, TAB_LEFT, var_get_name (v));
- tab_text (t, 3, r, TAT_PRINTF, "%d", (int) var_get_dict_index (v) + 1);
+ tab_text (t, 3, r, TAT_PRINTF, "%zu", var_get_dict_index (v) + 1);
if (as == AS_DICTIONARY && var_has_label (v))
{
char fmt_string[FMT_STRING_LEN_MAX + 1];
fmt_to_string (var_get_print_format (var), fmt_string);
- tab_text (t, 1, row, TAB_RIGHT | TAT_PRINTF, "%d", (int) j + 1);
+ tab_text (t, 1, row, TAB_RIGHT | TAT_PRINTF, "%zu", j + 1);
tab_text (t, 2, row, TAB_LEFT, var_get_name (var));
tab_text (t, 3, row, TAB_LEFT, fmt_string);
row++;
byte_cnt = ds_length (&lexer->tokstr) / chars_per_byte;
if (ds_length (&lexer->tokstr) % chars_per_byte)
- msg (SE, _("String of %s digits has %d characters, which is not a "
+ msg (SE, _("String of %s digits has %zu characters, which is not a "
"multiple of %d."),
- base_name, (int) ds_length (&lexer->tokstr), chars_per_byte);
+ base_name, ds_length (&lexer->tokstr), chars_per_byte);
p = ds_cstr (&lexer->tokstr);
for (i = 0; i < byte_cnt; i++)
if (ds_length (&lexer->tokstr) > 255)
{
- msg (SE, _("String exceeds 255 characters in length (%d characters)."),
- (int) ds_length (&lexer->tokstr));
+ msg (SE, _("String exceeds 255 characters in length (%zu characters)."),
+ ds_length (&lexer->tokstr));
ds_truncate (&lexer->tokstr, 255);
}
}
else
{
- msg (SE, _("Missing argument %d to %s."),
- (int) i + 1, function->name);
+ msg (SE, _("Missing argument %zu to %s."),
+ i + 1, function->name);
goto error;
}
like `unknown variable t'. */
if (n_src != n_dest)
{
- msg (SE, _("Number of source variables (%u) does not match "
- "number of target variables (%u)."),
- (unsigned) n_src, (unsigned) n_dest);
+ msg (SE, _("Number of source variables (%zu) does not match "
+ "number of target variables (%zu)."),
+ n_src, n_dest);
goto error;
}
{
size_t i;
- msg (SE, _("Source variable count (%u) does not match "
- "target variable count (%u)."),
- (unsigned) arc.var_cnt, (unsigned) dst_cnt);
+ msg (SE, _("Source variable count (%zu) does not match "
+ "target variable count (%zu)."),
+ arc.var_cnt, dst_cnt);
for (i = 0; i < dst_cnt; i++)
free (arc.dst_names[i]);
{
if ( n_vlist1 != n_vlist2)
msg (SE, _("PAIRED was specified but the number of variables "
- "preceding WITH (%d) did not match the number "
- "following (%d)."), (int) n_vlist1, (int) n_vlist2);
+ "preceding WITH (%zu) did not match the number "
+ "following (%zu)."), n_vlist1, n_vlist2);
test_parameters->n_pairs = n_vlist1 ;
}
sum += subc_list_double_at(&cmd.dl_contrast[i],j);
if ( sum != 0.0 )
- msg(SW,_("Coefficients for contrast %d do not total zero"),
- (int) i + 1);
+ msg(SW,_("Coefficients for contrast %zu do not total zero"), i + 1);
}
if ( stat_tables & STAT_DESC )
{
free (vars);
msg (SE, _("PAIRED was specified but the number of variables "
- "preceding WITH (%d) did not match the number "
- "following (%d)."),
- (int) n_before_WITH, (int) n_after_WITH );
+ "preceding WITH (%zu) did not match the number "
+ "following (%zu)."),
+ n_before_WITH, n_after_WITH);
return 0;
}
n_pairs_local = n_before_WITH;
{
if (length != float_get_size (fp->format))
{
- msg (SE, _("%d-byte string needed but %d-byte string supplied."),
- (int) float_get_size (fp->format), (int) length);
+ msg (SE, _("%zu-byte string needed but %zu-byte string "
+ "supplied."),
+ float_get_size (fp->format), length);
return false;
}
assert (length <= sizeof fp->data);
fprintf (stderr, "W=%.3f", weight);
for (i = 0; i < 4; i++)
{
- fprintf (stderr, " M%d=", (int) i + 1);
+ fprintf (stderr, " M%zu=", i + 1);
if (M[i] == SYSMIS)
fprintf (stderr, "sysmis");
else if (fabs (M[i]) <= 0.0005)
if (name_cnt != trns->var_cnt)
{
- msg (SE, _("%u variable(s) cannot be recoded into "
- "%u variable(s). Specify the same number "
+ msg (SE, _("%zu variable(s) cannot be recoded into "
+ "%zu variable(s). Specify the same number "
"of variables as source and target variables."),
- (unsigned) trns->var_cnt, (unsigned) name_cnt);
+ trns->var_cnt, name_cnt);
return false;
}
src/libpspp/ll.c \
src/libpspp/ll.h \
tests/libpspp/ll-test.c
+tests_libpspp_ll_test_LDADD = gl/libgl.la @LIBINTL@
tests_libpspp_llx_test_SOURCES = \
src/libpspp/ll.c \
src/libpspp/llx.c \
src/libpspp/llx.h \
tests/libpspp/llx-test.c
+tests_libpspp_llx_test_LDADD = gl/libgl.la @LIBINTL@
tests_libpspp_heap_test_SOURCES = \
src/libpspp/heap.c \