diff options
Diffstat (limited to 'libc/stdio-common')
-rw-r--r-- | libc/stdio-common/printf_fp.c | 3 | ||||
-rw-r--r-- | libc/stdio-common/printf_fphex.c | 14 | ||||
-rw-r--r-- | libc/stdio-common/printf_size.c | 12 | ||||
-rw-r--r-- | libc/stdio-common/psiginfo-data.h | 2 | ||||
-rw-r--r-- | libc/stdio-common/tst-long-dbl-fphex.c | 4 | ||||
-rw-r--r-- | libc/stdio-common/vfprintf.c | 12 |
6 files changed, 21 insertions, 26 deletions
diff --git a/libc/stdio-common/printf_fp.c b/libc/stdio-common/printf_fp.c index 940fcc486..340f9977b 100644 --- a/libc/stdio-common/printf_fp.c +++ b/libc/stdio-common/printf_fp.c @@ -354,8 +354,7 @@ ___printf_fp (FILE *fp, int res; if (__isnanl (fpnum.ldbl)) { - union ieee854_long_double u = { .d = fpnum.ldbl }; - is_neg = u.ieee.negative != 0; + is_neg = signbit (fpnum.ldbl); if (isupper (info->spec)) { special = "NAN"; diff --git a/libc/stdio-common/printf_fphex.c b/libc/stdio-common/printf_fphex.c index 9b24168d9..9b0c4f31a 100644 --- a/libc/stdio-common/printf_fphex.c +++ b/libc/stdio-common/printf_fphex.c @@ -94,7 +94,7 @@ __printf_fphex (FILE *fp, union { union ieee754_double dbl; - union ieee854_long_double ldbl; + long double ldbl; } fpnum; @@ -175,12 +175,11 @@ __printf_fphex (FILE *fp, #ifndef __NO_LONG_DOUBLE_MATH if (info->is_long_double && sizeof (long double) > sizeof (double)) { - fpnum.ldbl.d = *(const long double *) args[0]; + fpnum.ldbl = *(const long double *) args[0]; /* Check for special values: not a number or infinity. */ - if (__isnanl (fpnum.ldbl.d)) + if (__isnanl (fpnum.ldbl)) { - negative = fpnum.ldbl.ieee.negative != 0; if (isupper (info->spec)) { special = "NAN"; @@ -194,8 +193,7 @@ __printf_fphex (FILE *fp, } else { - int res = __isinfl (fpnum.ldbl.d); - if (res) + if (__isinfl (fpnum.ldbl)) { if (isupper (info->spec)) { @@ -207,11 +205,9 @@ __printf_fphex (FILE *fp, special = "inf"; wspecial = L"inf"; } - negative = res < 0; } - else - negative = signbit (fpnum.ldbl.d); } + negative = signbit (fpnum.ldbl); } else #endif /* no long double */ diff --git a/libc/stdio-common/printf_size.c b/libc/stdio-common/printf_size.c index 9a764af22..87a9c2da1 100644 --- a/libc/stdio-common/printf_size.c +++ b/libc/stdio-common/printf_size.c @@ -104,7 +104,7 @@ __printf_size (FILE *fp, const struct printf_info *info, union { union ieee754_double dbl; - union ieee854_long_double ldbl; + long double ldbl; } fpnum; const void *ptr = &fpnum; @@ -131,25 +131,25 @@ __printf_size (FILE *fp, const struct printf_info *info, #ifndef __NO_LONG_DOUBLE_MATH if (info->is_long_double && sizeof (long double) > sizeof (double)) { - fpnum.ldbl.d = *(const long double *) args[0]; + fpnum.ldbl = *(const long double *) args[0]; /* Check for special values: not a number or infinity. */ - if (__isnanl (fpnum.ldbl.d)) + if (__isnanl (fpnum.ldbl)) { special = "nan"; wspecial = L"nan"; // fpnum_sign = 0; Already zero } - else if ((res = __isinfl (fpnum.ldbl.d))) + else if ((res = __isinfl (fpnum.ldbl))) { fpnum_sign = res; special = "inf"; wspecial = L"inf"; } else - while (fpnum.ldbl.d >= divisor && tag[1] != '\0') + while (fpnum.ldbl >= divisor && tag[1] != '\0') { - fpnum.ldbl.d /= divisor; + fpnum.ldbl /= divisor; ++tag; } } diff --git a/libc/stdio-common/psiginfo-data.h b/libc/stdio-common/psiginfo-data.h index 02ebf8af2..05bb76c17 100644 --- a/libc/stdio-common/psiginfo-data.h +++ b/libc/stdio-common/psiginfo-data.h @@ -34,7 +34,7 @@ P (TRAP_TRACE, N_("Process trace trap")) #if NOW == SIGCLD P (CLD_EXITED, N_("Child has exited")) P (CLD_KILLED, N_("Child has terminated abnormally and did not create a core file")) -P (CLD_DUMPED, N_("Child hat terminated abnormally and created a core file")) +P (CLD_DUMPED, N_("Child has terminated abnormally and created a core file")) P (CLD_TRAPPED, N_("Traced child has trapped")) P (CLD_STOPPED, N_("Child has stopped")) P (CLD_CONTINUED, N_("Stopped child has continued")) diff --git a/libc/stdio-common/tst-long-dbl-fphex.c b/libc/stdio-common/tst-long-dbl-fphex.c index 0be80cad2..a406a7180 100644 --- a/libc/stdio-common/tst-long-dbl-fphex.c +++ b/libc/stdio-common/tst-long-dbl-fphex.c @@ -28,9 +28,9 @@ do_test (void) int result = 0; const long double x = 24.5; wchar_t a[16]; - swprintf (a, sizeof (a), L"%La\n", x); + swprintf (a, sizeof a / sizeof a[0], L"%La\n", x); wchar_t A[16]; - swprintf (A, sizeof (A) / sizeof (A[0]), L"%LA\n", x); + swprintf (A, sizeof A / sizeof A[0], L"%LA\n", x); /* Here wprintf can return four valid variants. We must accept all of them. */ diff --git a/libc/stdio-common/vfprintf.c b/libc/stdio-common/vfprintf.c index 55632e493..8045bb013 100644 --- a/libc/stdio-common/vfprintf.c +++ b/libc/stdio-common/vfprintf.c @@ -91,13 +91,13 @@ do { \ if (width > 0) \ { \ - unsigned int d = _IO_padn (s, (Padchar), width); \ - if (__glibc_unlikely (d == EOF)) \ + _IO_ssize_t written = _IO_padn (s, (Padchar), width); \ + if (__glibc_unlikely (written != width)) \ { \ done = -1; \ goto all_done; \ } \ - done_add (d); \ + done_add (written); \ } \ } while (0) # define PUTC(C, F) _IO_putc_unlocked (C, F) @@ -120,13 +120,13 @@ do { \ if (width > 0) \ { \ - unsigned int d = _IO_wpadn (s, (Padchar), width); \ - if (__glibc_unlikely (d == EOF)) \ + _IO_ssize_t written = _IO_wpadn (s, (Padchar), width); \ + if (__glibc_unlikely (written != width)) \ { \ done = -1; \ goto all_done; \ } \ - done_add (d); \ + done_add (written); \ } \ } while (0) # define PUTC(C, F) _IO_putwc_unlocked (C, F) |