Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/machine/powerpc/vfprintf.c')
-rw-r--r--newlib/libc/machine/powerpc/vfprintf.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c
index d264e2673..2b2cec381 100644
--- a/newlib/libc/machine/powerpc/vfprintf.c
+++ b/newlib/libc/machine/powerpc/vfprintf.c
@@ -253,7 +253,7 @@ __sbprintf_r(rptr, fp, fmt, ap)
/* do the work, then copy any error status */
ret = _VFPRINTF_R(rptr, &fake, fmt, ap);
- if (ret >= 0 && _fflush_r(rptr, &fake))
+ if (ret >= 0 && fflush(&fake))
ret = EOF;
if (fake._flags & __SERR)
fp->_flags |= __SERR;
@@ -368,12 +368,13 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
#ifndef _NO_LONGLONG
#define quad_t long long
#define u_quad_t unsigned long long
-#else
-#define quad_t long
-#define u_quad_t u_long
#endif
+#ifndef _NO_LONGLONG
u_quad_t _uquad; /* integer arguments %[diouxX] */
+#else
+ u_long _uquad;
+#endif
enum { OCT, DEC, HEX } base;/* base for [diouxX] conversion */
int dprec; /* a copy of prec if [diouxX], 0 otherwise */
int realsz; /* field size expanded by dprec */
@@ -540,10 +541,9 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
/*
* Scan the format for conversions (`%' character).
*/
-
for (;;) {
cp = fmt;
- while ((n = _mbtowc_r(data, &wc, fmt, MB_CUR_MAX, &state)) > 0) {
+ while ((n = _mbtowc_r(_REENT, &wc, fmt, MB_CUR_MAX, &state)) > 0) {
fmt += n;
if (wc == '%') {
fmt--;
@@ -754,9 +754,14 @@ reswitch: switch (ch) {
}
#endif /* __ALTIVEC__ */
_uquad = SARG();
+#ifndef _NO_LONGLONG
if ((quad_t)_uquad < 0)
+#else
+ if ((long) _uquad < 0)
+#endif
{
- _uquad = -(quad_t)_uquad;
+
+ _uquad = -_uquad;
old_sign = sign;
sign = '-';
}
@@ -902,11 +907,11 @@ reswitch: switch (ch) {
_uquad = -(quad_t)_uquad;
}
if (flags & SHORTINT)
- _uquad <<= (sizeof(quad_t) - sizeof(short)) * 8 + 1;
+ _uquad <<= 49;
else if (flags & LONGINT)
_uquad <<= 1;
else
- _uquad <<= (sizeof(quad_t) - sizeof(long)) * 8 + 1;
+ _uquad <<= 33;
if (_uquad == 0 && sign)
{
@@ -922,19 +927,15 @@ reswitch: switch (ch) {
flags |= FIXEDPOINT;
_uquad = UFPARG();
if (flags & SHORTINT)
- _uquad <<= (sizeof(quad_t) - sizeof(short)) * 8;
+ _uquad <<= 48;
else if (!(flags & LONGINT))
- _uquad <<= (sizeof(quad_t) - sizeof(long)) * 8;
+ _uquad <<= 32;
fixed_nosign:
if (prec == -1)
prec = DEFPREC;
-#ifndef _NO_LONGLONG
cp = cvt_ufix64 (data, _uquad, prec, &expt, &ndig);
-#else
- cp = cvs_ufix32 (data, _uquad, prec, &expt, &ndig);
-#endif
/* act like %f of format "0.X" */
size = prec + 2;