X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fdata%2Fsys-file-writer.c;h=517cf416607419c45612be23df38da0386963683;hb=65e61cc92b48297625bc71cf31b8a19e301eb6c1;hp=1b18e1ed08ffbf824aa7fc52dc7cad0e643a803a;hpb=e7d0a9f16192ceeff9243f0ede8e399ee1ef0d44;p=pspp diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c index 1b18e1ed08..517cf41660 100644 --- a/src/data/sys-file-writer.c +++ b/src/data/sys-file-writer.c @@ -1,5 +1,5 @@ /* PSPP - computes sample statistics. - Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. Written by Ben Pfaff . This program is free software; you can redistribute it and/or @@ -18,31 +18,35 @@ 02110-1301, USA. */ #include + #include "sys-file-writer.h" #include "sfm-private.h" -#include -#include + #include #include #include +#include #include #include #include + #include -#include "case.h" -#include "dictionary.h" -#include -#include "file-handle-def.h" #include #include +#include #include -#include "settings.h" -#include "stat-macros.h" #include +#include + +#include "case.h" +#include "dictionary.h" +#include "file-handle-def.h" +#include "settings.h" #include "value-labels.h" #include "variable.h" -#include -#include + +#include "stat-macros.h" +#include "minmax.h" #include "gettext.h" #define _(msgid) gettext (msgid) @@ -437,8 +441,8 @@ write_header (struct sfm_writer *w, const struct dictionary *d) static inline void write_format_spec (const struct fmt_spec *src, int32_t *dest) { - assert(check_output_specifier(src, true)); - *dest = (formats[src->type].spss << 16) | (src->w << 8) | src->d; + assert (fmt_check_output (src)); + *dest = (fmt_to_io (src->type) << 16) | (src->w << 8) | src->d; } /* Write the variable record(s) for primary variable P and secondary @@ -454,7 +458,7 @@ write_variable (struct sfm_writer *w, const struct variable *v) int nm; /* Number of missing values, possibly negative. */ sv.rec_type = 2; - sv.type = min(v->width, MAX_LONG_STRING); + sv.type = MIN(v->width, MAX_LONG_STRING); sv.has_var_label = (v->label != NULL); mv_copy (&mv, &v->miss); @@ -496,7 +500,7 @@ write_variable (struct sfm_writer *w, const struct variable *v) int ext_len; - l.label_len = min (strlen (v->label), 255); + l.label_len = MIN (strlen (v->label), 255); ext_len = ROUND_UP (l.label_len, sizeof l.label_len); memcpy (l.label, v->label, l.label_len); memset (&l.label[l.label_len], ' ', ext_len - l.label_len); @@ -519,7 +523,7 @@ write_variable (struct sfm_writer *w, const struct variable *v) memset (&sv.write, 0, sizeof sv.write); memset (&sv.name, 0, sizeof sv.name); - pad_count = DIV_RND_UP (min(v->width, MAX_LONG_STRING), + pad_count = DIV_RND_UP (MIN(v->width, MAX_LONG_STRING), (int) sizeof (flt64)) - 1; for (i = 0; i < pad_count; i++) buf_write (w, &sv, sizeof sv); @@ -835,7 +839,7 @@ buf_write (struct sfm_writer *w, const void *buf, size_t nbytes) static char * append_string_max (char *dest, const char *src, const char *end) { - int nbytes = min (end - dest, (int) strlen (src)); + int nbytes = MIN (end - dest, (int) strlen (src)); memcpy (dest, src, nbytes); return dest + nbytes; }