X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fsfm-write.c;h=d06a65f5a22334048309de1b90f548f339188aa1;hb=5ff91bd55867848d448c2f09bc7057cc1fb77b18;hp=4f0f9ec18a763abcfb1ca4b7cf8c548c637028b2;hpb=c9e2bf6cb988f8c00d89ccf191a28388cccbd868;p=pspp diff --git a/src/sfm-write.c b/src/sfm-write.c index 4f0f9ec18a..d06a65f5a2 100644 --- a/src/sfm-write.c +++ b/src/sfm-write.c @@ -173,7 +173,7 @@ sfm_open_writer (struct file_handle *fh, struct dictionary *d, w->x = w->y = NULL; w->var_cnt = dict_get_var_cnt (d); - w->vars = xmalloc (sizeof *w->vars * w->var_cnt); + w->vars = xnmalloc (w->var_cnt, sizeof *w->vars); for (i = 0; i < w->var_cnt; i++) { const struct variable *dv = dict_get_var (d, i); @@ -242,7 +242,7 @@ sfm_open_writer (struct file_handle *fh, struct dictionary *d, if (w->compress) { - w->buf = xmalloc (sizeof *w->buf * 128); + w->buf = xnmalloc (128, sizeof *w->buf); w->ptr = w->buf; w->end = &w->buf[128]; w->x = (unsigned char *) w->ptr++; @@ -527,8 +527,8 @@ write_value_labels (struct sfm_writer *w, struct variable *v, int idx) *loc++ = vl->value.f; *(unsigned char *) loc = len; - memcpy (&((unsigned char *) loc)[1], vl->label, len); - memset (&((unsigned char *) loc)[1 + len], ' ', + memcpy (&((char *) loc)[1], vl->label, len); + memset (&((char *) loc)[1 + len], ' ', REM_RND_UP (len + 1, sizeof (flt64))); loc += DIV_RND_UP (len + 1, sizeof (flt64)); }