projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Read and ignore author field in portable files.
[pspp-builds.git]
/
src
/
pfm-read.c
diff --git
a/src/pfm-read.c
b/src/pfm-read.c
index 52e32325ff450c6259bc37cba15fd28bdeaa45e8..0d5fbcc98000079c4739d8ec6d84ac89b5d6f5ea 100644
(file)
--- a/
src/pfm-read.c
+++ b/
src/pfm-read.c
@@
-16,8
+16,8
@@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 5
9 Temple Place - Suite 330
, Boston, MA
- 0211
1-1307
, USA. */
+ Foundation, Inc., 5
1 Franklin Street, Fifth Floor
, Boston, MA
+ 0211
0-1301
, USA. */
#include <config.h>
#include "pfm-read.h"
#include <config.h>
#include "pfm-read.h"
@@
-396,8
+396,11
@@
read_header (struct pfm_reader *r)
/* Skip and verify signature. */
for (i = 0; i < 8; i++)
/* Skip and verify signature. */
for (i = 0; i < 8; i++)
- if (!match (r, "SPSSPORT"[i]))
- error (r, _("Missing SPSSPORT signature."));
+ if (!match (r, "SPSSPORT"[i]))
+ {
+ msg (SE, _("%s: Not a portable file."), handle_get_filename (r->fh));
+ longjmp (r->bail_out, 1);
+ }
}
/* Reads the version and date info record, as well as product and
}
/* Reads the version and date info record, as well as product and
@@
-405,7
+408,7
@@
read_header (struct pfm_reader *r)
static void
read_version_data (struct pfm_reader *r, struct pfm_read_info *info)
{
static void
read_version_data (struct pfm_reader *r, struct pfm_read_info *info)
{
- char *date, *time, *product, *subproduct;
+ char *date, *time, *product, *
author, *
subproduct;
int i;
/* Read file. */
int i;
/* Read file. */
@@
-414,6
+417,7
@@
read_version_data (struct pfm_reader *r, struct pfm_read_info *info)
date = read_pool_string (r);
time = read_pool_string (r);
product = match (r, '1') ? read_pool_string (r) : (unsigned char *) "";
date = read_pool_string (r);
time = read_pool_string (r);
product = match (r, '1') ? read_pool_string (r) : (unsigned char *) "";
+ author = match (r, '2') ? read_pool_string (r) : (unsigned char *) "";
subproduct
= match (r, '3') ? read_pool_string (r) : (unsigned char *) "";
subproduct
= match (r, '3') ? read_pool_string (r) : (unsigned char *) "";
@@
-445,8
+449,8
@@
read_version_data (struct pfm_reader *r, struct pfm_read_info *info)
info->creation_time[8] = 0;
/* Product. */
info->creation_time[8] = 0;
/* Product. */
- st
_trim_copy (info->product, product, sizeof info->
product);
- st
_trim_copy (info->subproduct, subproduct, sizeof info->
subproduct);
+ st
r_copy_trunc (info->product, sizeof info->product,
product);
+ st
r_copy_trunc (info->subproduct, sizeof info->subproduct,
subproduct);
}
}
}
}
@@
-494,7
+498,7
@@
read_variables (struct pfm_reader *r, struct dictionary *dict)
if (match (r, '6'))
{
weight_name = read_pool_string (r);
if (match (r, '6'))
{
weight_name = read_pool_string (r);
- if (strlen (weight_name) >
8
)
+ if (strlen (weight_name) >
SHORT_NAME_LEN
)
error (r, _("Weight variable name (%s) truncated."), weight_name);
}
error (r, _("Weight variable name (%s) truncated."), weight_name);
}
@@
-518,9
+522,9
@@
read_variables (struct pfm_reader *r, struct dictionary *dict)
for (j = 0; j < 6; j++)
fmt[j] = read_int (r);
for (j = 0; j < 6; j++)
fmt[j] = read_int (r);
- if (!var_is_valid_name (name, false) || *name == '#'
)
+ if (!var_is_valid_name (name, false) || *name == '#'
|| *name == '$')
error (r, _("position %d: Invalid variable name `%s'."), name);
error (r, _("position %d: Invalid variable name `%s'."), name);
- st_uppercase (name);
+ st
r
_uppercase (name);
if (width < 0 || width > 255)
error (r, "Bad width %d for variable %s.", width, name);
if (width < 0 || width > 255)
error (r, "Bad width %d for variable %s.", width, name);
@@
-602,7
+606,7
@@
parse_value (struct pfm_reader *r, struct variable *vv)
{
char string[256];
read_string (r, string);
{
char string[256];
read_string (r, string);
-
st_bare_pad_copy (v.s, string, 8
);
+
buf_copy_str_rpad (v.s, 8, string
);
}
else
v.f = read_float (r);
}
else
v.f = read_float (r);
@@
-696,7
+700,7
@@
pfm_read_case (struct pfm_reader *r, struct ccase *c)
{
char string[256];
read_string (r, string);
{
char string[256];
read_string (r, string);
-
st_bare_pad_copy (case_data_rw (c, idx)->s, string, width
);
+
buf_copy_str_rpad (case_data_rw (c, idx)->s, width, string
);
idx += DIV_RND_UP (width, MAX_SHORT_STRING);
}
}
idx += DIV_RND_UP (width, MAX_SHORT_STRING);
}
}