X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fdata-out.c;h=b7ee5314d93c095993429de721d187b72d4f439e;hb=a55b554c0479168ef3e4879fe0fa517f7ca4def7;hp=79c7042446abb453c2c1722b118303805dd5b217;hpb=a19b858e0ac3c69e4a28c0ca6d8674427268a863;p=pspp-builds.git diff --git a/src/data/data-out.c b/src/data/data-out.c index 79c70424..b7ee5314 100644 --- a/src/data/data-out.c +++ b/src/data/data-out.c @@ -36,8 +36,6 @@ #include "gettext.h" #define _(msgid) gettext (msgid) - -#include /* Public functions. */ @@ -397,7 +395,7 @@ convert_Z (char *dst, const struct fmt_spec *fp, double number) static int convert_A (char *dst, const struct fmt_spec *fp, const char *string) { - memcpy (dst, string, fp->w); + copy_demangle(dst, fp->w, string, fp->w); return 1; } @@ -1065,6 +1063,7 @@ try_F (char *dst, const struct fmt_spec *fp, double number) avoids wasting too much time formatting more decimal places on the first try. */ int result = format_and_round (dst, number, fp, fp->d + 2); + if (result >= 0) return result; @@ -1145,7 +1144,7 @@ format_and_round (char *dst, double number, const struct fmt_spec *fp, digits of the fraction. Right-justify the integer part and sign. */ dst[0] = ' '; - memcpy (dst + 1, buf, fp->w); + memcpy (dst + 1, buf, fp->w - 1); return 1; }