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:
authorJeff Johnston <jjohnstn@redhat.com>2008-02-12 21:07:55 +0300
committerJeff Johnston <jjohnstn@redhat.com>2008-02-12 21:07:55 +0300
commitde20111eba5768f4ebb7dcf1d59b1528302a0043 (patch)
tree74a0d902afcf1663b6b2c62373dcea036fc36443
parentf46f40b54e6993356a87a258abca4cb570cbed59 (diff)
2008-02-12 Jeff Johnston <jjohnstn@redhat.com>
* libc/machine/powerpc/vfprintf.c (_VFPRINTF_R): Prepare for user specifying --disable-newlib-io-long-long on configure. Call _fflush_r instead of fflush. For _mbtowc_r, pass the reentrant pointer passed in rather than _REENT.
-rw-r--r--newlib/ChangeLog7
-rw-r--r--newlib/libc/machine/powerpc/vfprintf.c31
2 files changed, 22 insertions, 16 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index bf077bf62..acac5dcf7 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,10 @@
+2008-02-12 Jeff Johnston <jjohnstn@redhat.com>
+
+ * libc/machine/powerpc/vfprintf.c (_VFPRINTF_R): Prepare
+ for user specifying --disable-newlib-io-long-long on configure.
+ Call _fflush_r instead of fflush. For _mbtowc_r, pass the
+ reentrant pointer passed in rather than _REENT.
+
2008-02-12 Peter Rosin <peda@lysator.liu.se>
* libc/stdlib/getopt.c (getopt_internal): Handle optional
diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c
index 2b2cec381..d264e2673 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(&fake))
+ if (ret >= 0 && _fflush_r(rptr, &fake))
ret = EOF;
if (fake._flags & __SERR)
fp->_flags |= __SERR;
@@ -368,13 +368,12 @@ _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 */
@@ -541,9 +540,10 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
/*
* Scan the format for conversions (`%' character).
*/
+
for (;;) {
cp = fmt;
- while ((n = _mbtowc_r(_REENT, &wc, fmt, MB_CUR_MAX, &state)) > 0) {
+ while ((n = _mbtowc_r(data, &wc, fmt, MB_CUR_MAX, &state)) > 0) {
fmt += n;
if (wc == '%') {
fmt--;
@@ -754,14 +754,9 @@ reswitch: switch (ch) {
}
#endif /* __ALTIVEC__ */
_uquad = SARG();
-#ifndef _NO_LONGLONG
if ((quad_t)_uquad < 0)
-#else
- if ((long) _uquad < 0)
-#endif
{
-
- _uquad = -_uquad;
+ _uquad = -(quad_t)_uquad;
old_sign = sign;
sign = '-';
}
@@ -907,11 +902,11 @@ reswitch: switch (ch) {
_uquad = -(quad_t)_uquad;
}
if (flags & SHORTINT)
- _uquad <<= 49;
+ _uquad <<= (sizeof(quad_t) - sizeof(short)) * 8 + 1;
else if (flags & LONGINT)
_uquad <<= 1;
else
- _uquad <<= 33;
+ _uquad <<= (sizeof(quad_t) - sizeof(long)) * 8 + 1;
if (_uquad == 0 && sign)
{
@@ -927,15 +922,19 @@ reswitch: switch (ch) {
flags |= FIXEDPOINT;
_uquad = UFPARG();
if (flags & SHORTINT)
- _uquad <<= 48;
+ _uquad <<= (sizeof(quad_t) - sizeof(short)) * 8;
else if (!(flags & LONGINT))
- _uquad <<= 32;
+ _uquad <<= (sizeof(quad_t) - sizeof(long)) * 8;
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;