Newer versions of glibc give annoying warnings on uses of ftell() and
fseek(), so use ftello() and fseeko() instead.
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
va_list args;
ds_init_empty (&text);
va_list args;
ds_init_empty (&text);
- ds_put_format (&text, _("portable file %s corrupt at offset 0x%lx: "),
- fh_get_file_name (r->fh), ftell (r->file));
+ ds_put_format (&text, _("portable file %s corrupt at offset 0x%llx: "),
+ fh_get_file_name (r->fh), (long long int) ftello (r->file));
va_start (args, msg);
ds_put_vformat (&text, msg, args);
va_end (args);
va_start (args, msg);
ds_put_vformat (&text, msg, args);
va_end (args);
va_list args;
ds_init_empty (&text);
va_list args;
ds_init_empty (&text);
- ds_put_format (&text, _("reading portable file %s at offset 0x%lx: "),
- fh_get_file_name (r->fh), ftell (r->file));
+ ds_put_format (&text, _("reading portable file %s at offset 0x%llx: "),
+ fh_get_file_name (r->fh), (long long int) ftello (r->file));
va_start (args, msg);
ds_put_vformat (&text, msg, args);
va_end (args);
va_start (args, msg);
ds_put_vformat (&text, msg, args);
va_end (args);
struct string text;
ds_init_empty (&text);
struct string text;
ds_init_empty (&text);
- ds_put_format (&text, "\"%s\" near offset 0x%lx: ",
- fh_get_file_name (r->fh), (unsigned long) ftell (r->file));
+ ds_put_format (&text, "\"%s\" near offset 0x%llx: ",
+ fh_get_file_name (r->fh), (long long int) ftello (r->file));
ds_put_vformat (&text, format, args);
m.category = msg_class_to_category (class);
ds_put_vformat (&text, format, args);
m.category = msg_class_to_category (class);
/* Seek back to the beginning and update the number of cases.
This is just a courtesy to later readers, so there's no need
to check return values or report errors. */
/* Seek back to the beginning and update the number of cases.
This is just a courtesy to later readers, so there's no need
to check return values or report errors. */
- if (ok && w->case_cnt <= INT32_MAX && !fseek (w->file, 80, SEEK_SET))
+ if (ok && w->case_cnt <= INT32_MAX && !fseeko (w->file, 80, SEEK_SET))
{
write_int (w, w->case_cnt);
clearerr (w->file);
{
write_int (w, w->case_cnt);
clearerr (w->file);
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
output_buf = input_buf + flip->n_vars * case_capacity;
input_file = flip->file;
output_buf = input_buf + flip->n_vars * case_capacity;
input_file = flip->file;
- if (fseek (input_file, 0, SEEK_SET) != 0)
+ if (fseeko (input_file, 0, SEEK_SET) != 0)
{
msg (SE, _("Error rewinding FLIP file: %s."), strerror (errno));
return false;
{
msg (SE, _("Error rewinding FLIP file: %s."), strerror (errno));
return false;
pool_unregister (flip->pool, input_buf);
free (input_buf);
pool_unregister (flip->pool, input_buf);
free (input_buf);
- if (fseek (output_file, 0, SEEK_SET) != 0)
+ if (fseeko (output_file, 0, SEEK_SET) != 0)
{
msg (SE, _("Error rewinding FLIP source file: %s."), strerror (errno));
return false;
{
msg (SE, _("Error rewinding FLIP source file: %s."), strerror (errno));
return false;
char buf[4096];
/* Local file header. */
char buf[4096];
/* Local file header. */
- offset = ftell (zw->file);
+ offset = ftello (zw->file);
put_u32 (zw, 0x04034b50); /* local file header signature */
put_u16 (zw, 10); /* version needed to extract */
put_u16 (zw, 1 << 3); /* general purpose bit flag */
put_u32 (zw, 0x04034b50); /* local file header signature */
put_u16 (zw, 10); /* version needed to extract */
put_u16 (zw, 1 << 3); /* general purpose bit flag */
/* File data. */
size = crc = 0;
/* File data. */
size = crc = 0;
- fseek (file, 0, SEEK_SET);
+ fseeko (file, 0, SEEK_SET);
while ((bytes_read = fread (buf, 1, sizeof buf, file)) > 0)
{
put_bytes (zw, buf, bytes_read);
while ((bytes_read = fread (buf, 1, sizeof buf, file)) > 0)
{
put_bytes (zw, buf, bytes_read);
if (zw == NULL)
return true;
if (zw == NULL)
return true;
- dir_start = ftell (zw->file);
+ dir_start = ftello (zw->file);
for (i = 0; i < zw->n_members; i++)
{
struct zip_member *m = &zw->members[i];
for (i = 0; i < zw->n_members; i++)
{
struct zip_member *m = &zw->members[i];
free (m->name);
}
free (zw->members);
free (m->name);
}
free (zw->members);
- dir_end = ftell (zw->file);
+ dir_end = ftello (zw->file);
/* End of central directory record. */
put_u32 (zw, 0x06054b50); /* end of central dir signature */
/* End of central directory record. */
put_u32 (zw, 0x06054b50); /* end of central dir signature */
sys_error (&r, _("Unrecognized record type %d."), rec_type);
}
}
sys_error (&r, _("Unrecognized record type %d."), rec_type);
}
}
- printf ("%08lx: end-of-dictionary record "
- "(first byte of data at %08lx)\n",
- ftell (r.file), ftell (r.file) + 4);
+ printf ("%08llx: end-of-dictionary record "
+ "(first byte of data at %08llx)\n",
+ (long long int) ftello (r.file),
+ (long long int) ftello (r.file) + 4);
if (r.compressed)
read_compressed_data (&r);
if (r.compressed)
read_compressed_data (&r);
int write_format;
char name[9];
int write_format;
char name[9];
- printf ("%08lx: variable record #%d\n",
- ftell (r->file), r->n_variable_records++);
+ printf ("%08llx: variable record #%d\n",
+ (long long int) ftello (r->file), r->n_variable_records++);
width = read_int (r);
has_variable_label = read_int (r);
width = read_int (r);
has_variable_label = read_int (r);
sys_error (r, _("Variable label indicator field is not 0 or 1."));
if (has_variable_label == 1)
{
sys_error (r, _("Variable label indicator field is not 0 or 1."));
if (has_variable_label == 1)
{
- long int offset = ftell (r->file);
+ long long int offset = ftello (r->file);
size_t len;
char label[255 + 1];
size_t len;
char label[255 + 1];
sys_error (r, _("Variable %s has label of invalid length %zu."),
name, len);
read_string (r, label, len + 1);
sys_error (r, _("Variable %s has label of invalid length %zu."),
name, len);
read_string (r, label, len + 1);
- printf("\t%08lx Variable label: \"%s\"\n", offset, label);
+ printf("\t%08llx Variable label: \"%s\"\n", offset, label);
skip_bytes (r, ROUND_UP (len, 4) - len);
}
skip_bytes (r, ROUND_UP (len, 4) - len);
}
- printf ("\t%08lx Missing values:", ftell (r->file));
+ printf ("\t%08llx Missing values:", (long long int) ftello (r->file));
if (!width)
{
if (missing_value_code < -3 || missing_value_code > 3
if (!width)
{
if (missing_value_code < -3 || missing_value_code > 3
int label_cnt, var_cnt;
int i;
int label_cnt, var_cnt;
int i;
- printf ("%08lx: value labels record\n", ftell (r->file));
+ printf ("%08llx: value labels record\n", (long long int) ftello (r->file));
/* Read number of labels. */
label_cnt = read_int (r);
/* Read number of labels. */
label_cnt = read_int (r);
/* Read number of variables associated with value label from type 4
record. */
/* Read number of variables associated with value label from type 4
record. */
- printf ("\t%08lx: apply to variables", ftell (r->file));
+ printf ("\t%08llx: apply to variables", (long long int) ftello (r->file));
var_cnt = read_int (r);
for (i = 0; i < var_cnt; i++)
printf (" #%d", read_int (r));
var_cnt = read_int (r);
for (i = 0; i < var_cnt; i++)
printf (" #%d", read_int (r));
- printf ("%08lx: document record\n", ftell (r->file));
+ printf ("%08llx: document record\n", (long long int) ftello (r->file));
n_lines = read_int (r);
printf ("\t%d lines of documents\n", n_lines);
for (i = 0; i < n_lines; i++)
{
char line[81];
n_lines = read_int (r);
printf ("\t%d lines of documents\n", n_lines);
for (i = 0; i < n_lines; i++)
{
char line[81];
- printf ("\t%08lx: ", ftell (r->file));
+ printf ("\t%08llx: ", (long long int) ftello (r->file));
read_string (r, line, sizeof line);
trim_spaces (line);
printf ("line %d: \"%s\"\n", i, line);
read_string (r, line, sizeof line);
trim_spaces (line);
printf ("line %d: \"%s\"\n", i, line);
static void
read_extension_record (struct sfm_reader *r)
{
static void
read_extension_record (struct sfm_reader *r)
{
- long int offset = ftell (r->file);
+ long long int offset = ftello (r->file);
int subtype = read_int (r);
size_t size = read_int (r);
size_t count = read_int (r);
size_t bytes = size * count;
int subtype = read_int (r);
size_t size = read_int (r);
size_t count = read_int (r);
size_t bytes = size * count;
- printf ("%08lx: Record 7, subtype %d, size=%zu, count=%zu\n",
+ printf ("%08llx: Record 7, subtype %d, size=%zu, count=%zu\n",
offset, subtype, size, count);
switch (subtype)
offset, subtype, size, count);
switch (subtype)
static void
read_machine_integer_info (struct sfm_reader *r, size_t size, size_t count)
{
static void
read_machine_integer_info (struct sfm_reader *r, size_t size, size_t count)
{
- long int offset = ftell (r->file);
+ long long int offset = ftello (r->file);
int version_major = read_int (r);
int version_minor = read_int (r);
int version_revision = read_int (r);
int version_major = read_int (r);
int version_minor = read_int (r);
int version_revision = read_int (r);
int integer_representation = read_int (r);
int character_code = read_int (r);
int integer_representation = read_int (r);
int character_code = read_int (r);
- printf ("%08lx: machine integer info\n", offset);
+ printf ("%08llx: machine integer info\n", offset);
if (size != 4 || count != 8)
sys_error (r, _("Bad size (%zu) or count (%zu) field on record type 7, "
"subtype 3."),
if (size != 4 || count != 8)
sys_error (r, _("Bad size (%zu) or count (%zu) field on record type 7, "
"subtype 3."),
static void
read_machine_float_info (struct sfm_reader *r, size_t size, size_t count)
{
static void
read_machine_float_info (struct sfm_reader *r, size_t size, size_t count)
{
- long int offset = ftell (r->file);
+ long long int offset = ftello (r->file);
double sysmis = read_float (r);
double highest = read_float (r);
double lowest = read_float (r);
double sysmis = read_float (r);
double highest = read_float (r);
double lowest = read_float (r);
- printf ("%08lx: machine float info\n", offset);
+ printf ("%08llx: machine float info\n", offset);
if (size != 8 || count != 3)
sys_error (r, _("Bad size (%zu) or count (%zu) on extension 4."),
size, count);
if (size != 8 || count != 3)
sys_error (r, _("Bad size (%zu) or count (%zu) on extension 4."),
size, count);
{
struct text_record *text;
{
struct text_record *text;
- printf ("%08lx: multiple response sets\n", ftell (r->file));
+ printf ("%08llx: multiple response sets\n",
+ (long long int) ftello (r->file));
text = open_text_record (r, size * count);
for (;;)
{
text = open_text_record (r, size * count);
for (;;)
{
bool includes_width;
size_t i;
bool includes_width;
size_t i;
- printf ("%08lx: variable display parameters\n", ftell (r->file));
+ printf ("%08llx: variable display parameters\n",
+ (long long int) ftello (r->file));
if (size != 4)
{
sys_warn (r, _("Bad size %zu on extension 11."), size);
if (size != 4)
{
sys_warn (r, _("Bad size %zu on extension 11."), size);
char *var;
char *long_name;
char *var;
char *long_name;
- printf ("%08lx: long variable names (short => long)\n", ftell (r->file));
+ printf ("%08llx: long variable names (short => long)\n",
+ (long long int) ftello (r->file));
text = open_text_record (r, size * count);
while (read_variable_to_value_pair (text, &var, &long_name))
printf ("\t%s => %s\n", var, long_name);
text = open_text_record (r, size * count);
while (read_variable_to_value_pair (text, &var, &long_name))
printf ("\t%s => %s\n", var, long_name);
char *var;
char *length_s;
char *var;
char *length_s;
- printf ("%08lx: very long strings (variable => length)\n", ftell (r->file));
+ printf ("%08llx: very long strings (variable => length)\n",
+ (long long int) ftello (r->file));
text = open_text_record (r, size * count);
while (read_variable_to_value_pair (text, &var, &length_s))
printf ("\t%s => %d\n", var, atoi (length_s));
text = open_text_record (r, size * count);
while (read_variable_to_value_pair (text, &var, &length_s))
printf ("\t%s => %d\n", var, atoi (length_s));
}
unknown = read_int64 (r);
ncases64 = read_int64 (r);
}
unknown = read_int64 (r);
ncases64 = read_int64 (r);
- printf ("%08lx: extended number of cases: "
+ printf ("%08llx: extended number of cases: "
"unknown=%"PRId64", ncases64=%"PRId64"\n",
"unknown=%"PRId64", ncases64=%"PRId64"\n",
- ftell (r->file), unknown, ncases64);
+ (long long int) ftello (r->file), unknown, ncases64);
{
struct text_record *text;
{
struct text_record *text;
- printf ("%08lx: datafile attributes\n", ftell (r->file));
+ printf ("%08llx: datafile attributes\n", (long long int) ftello (r->file));
text = open_text_record (r, size * count);
read_attributes (r, text, "datafile");
close_text_record (text);
text = open_text_record (r, size * count);
read_attributes (r, text, "datafile");
close_text_record (text);
static void
read_character_encoding (struct sfm_reader *r, size_t size, size_t count)
{
static void
read_character_encoding (struct sfm_reader *r, size_t size, size_t count)
{
- const unsigned long int posn = ftell (r->file);
+ long long int posn = ftello (r->file);
char *encoding = xcalloc (size, count + 1);
read_string (r, encoding, count + 1);
char *encoding = xcalloc (size, count + 1);
read_string (r, encoding, count + 1);
- printf ("%08lx: Character Encoding: %s\n", posn, encoding);
+ printf ("%08llx: Character Encoding: %s\n", posn, encoding);
}
static void
read_long_string_value_labels (struct sfm_reader *r, size_t size, size_t count)
{
}
static void
read_long_string_value_labels (struct sfm_reader *r, size_t size, size_t count)
{
- const long start = ftell (r->file);
+ long long int start = ftello (r->file);
- printf ("%08lx: long string value labels\n", start);
- while (ftell (r->file) - start < size * count)
+ printf ("%08llx: long string value labels\n", start);
+ while (ftello (r->file) - start < size * count)
- long posn = ftell (r->file);
+ long long posn = ftello (r->file);
char var_name[VAR_NAME_LEN + 1];
int var_name_len;
int n_values;
char var_name[VAR_NAME_LEN + 1];
int var_name_len;
int n_values;
width = read_int (r);
n_values = read_int (r);
width = read_int (r);
n_values = read_int (r);
- printf ("\t%08lx: %s, width %d, %d values\n",
+ printf ("\t%08llx: %s, width %d, %d values\n",
posn, var_name, width, n_values);
/* Read values. */
posn, var_name, width, n_values);
/* Read values. */
char *label;
int label_length;
char *label;
int label_length;
- posn = ftell (r->file);
+ posn = ftello (r->file);
/* Read value. */
value_length = read_int (r);
/* Read value. */
value_length = read_int (r);
label = xmalloc (label_length + 1);
read_string (r, label, label_length + 1);
label = xmalloc (label_length + 1);
read_string (r, label, label_length + 1);
- printf ("\t\t%08lx: \"%s\" (%d bytes) => \"%s\" (%d bytes)\n",
+ printf ("\t\t%08llx: \"%s\" (%d bytes) => \"%s\" (%d bytes)\n",
posn, value, value_length, label, label_length);
free (value);
posn, value, value_length, label, label_length);
free (value);
{
struct text_record *text;
{
struct text_record *text;
- printf ("%08lx: variable attributes\n", ftell (r->file));
+ printf ("%08llx: variable attributes\n", (long long int) ftello (r->file));
text = open_text_record (r, size * count);
for (;;)
{
text = open_text_record (r, size * count);
for (;;)
{
{
enum { N_OPCODES = 8 };
uint8_t opcodes[N_OPCODES];
{
enum { N_OPCODES = 8 };
uint8_t opcodes[N_OPCODES];
+ long long int opcode_ofs;
int opcode_idx;
int case_num;
int i;
read_int (r);
int opcode_idx;
int case_num;
int i;
read_int (r);
- printf ("\n%08lx: compressed data:\n", ftell (r->file));
+ printf ("\n%08llx: compressed data:\n", (long long int) ftello (r->file));
opcode_idx = N_OPCODES;
case_num = 0;
for (case_num = 0; ; case_num++)
{
opcode_idx = N_OPCODES;
case_num = 0;
for (case_num = 0; ; case_num++)
{
- printf ("%08lx: case %d's uncompressible data begins\n",
- ftell (r->file), case_num);
+ printf ("%08llx: case %d's uncompressible data begins\n",
+ (long long int) ftello (r->file), case_num);
for (i = 0; i < r->n_var_widths; i++)
{
int width = r->var_widths[i];
for (i = 0; i < r->n_var_widths; i++)
{
int width = r->var_widths[i];
if (opcode_idx >= N_OPCODES)
{
if (opcode_idx >= N_OPCODES)
{
- opcode_ofs = ftell (r->file);
+ opcode_ofs = ftello (r->file);
read_bytes (r, opcodes, 8);
opcode_idx = 0;
}
opcode = opcodes[opcode_idx];
read_bytes (r, opcodes, 8);
opcode_idx = 0;
}
opcode = opcodes[opcode_idx];
- printf ("%08lx: variable %d: opcode %d: ",
+ printf ("%08llx: variable %d: opcode %d: ",
opcode_ofs + opcode_idx, i, opcode);
switch (opcode)
opcode_ofs + opcode_idx, i, opcode);
switch (opcode)
static void
sys_msg (struct sfm_reader *r, const char *format, va_list args)
{
static void
sys_msg (struct sfm_reader *r, const char *format, va_list args)
{
- printf ("\"%s\" near offset 0x%lx: ",
- r->file_name, (unsigned long) ftell (r->file));
+ printf ("\"%s\" near offset 0x%llx: ",
+ r->file_name, (long long int) ftello (r->file));
vprintf (format, args);
putchar ('\n');
}
vprintf (format, args);
putchar ('\n');
}