diff options
| author | chopps <chopps@NetBSD.org> | 1995-12-30 03:32:18 +0000 |
|---|---|---|
| committer | chopps <chopps@NetBSD.org> | 1995-12-30 03:32:18 +0000 |
| commit | 0dd5a89778dc29795c4f3d4c37b364d76ed71e67 (patch) | |
| tree | 9f141279f0b4b9d2ad0258366d6266baaf1cbb60 /gnu/lib/libg++ | |
| parent | 8f1fa9720d731b46957773af273e89faa40eca51 (diff) | |
fix scoping and other related problems reported in pr#1859
Diffstat (limited to 'gnu/lib/libg++')
| -rw-r--r-- | gnu/lib/libg++/iostream/indstream.C | 8 | ||||
| -rw-r--r-- | gnu/lib/libg++/iostream/strstream.C | 3 | ||||
| -rw-r--r-- | gnu/lib/libg++/libg++/ACG.cc | 3 | ||||
| -rw-r--r-- | gnu/lib/libg++/libg++/Fix.cc | 18 | ||||
| -rw-r--r-- | gnu/lib/libg++/libg++/Fix.h | 9 | ||||
| -rw-r--r-- | gnu/lib/libg++/libg++/Fix16.h | 5 | ||||
| -rw-r--r-- | gnu/lib/libg++/libg++/Fix24.h | 20 | ||||
| -rw-r--r-- | gnu/lib/libg++/libg++/Integer.cc | 3 | ||||
| -rw-r--r-- | gnu/lib/libg++/libg++/Obstack.cc | 5 | ||||
| -rw-r--r-- | gnu/lib/libg++/libg++/String.cc | 10 | ||||
| -rw-r--r-- | gnu/lib/libg++/libg++/dtoa.cc | 9 | ||||
| -rw-r--r-- | gnu/lib/libg++/libg++/error.cc | 2 |
12 files changed, 58 insertions, 37 deletions
diff --git a/gnu/lib/libg++/iostream/indstream.C b/gnu/lib/libg++/iostream/indstream.C index b58e362d4bd..5ed2869d4b3 100644 --- a/gnu/lib/libg++/iostream/indstream.C +++ b/gnu/lib/libg++/iostream/indstream.C @@ -62,8 +62,8 @@ streampos indirectbuf::seekoff(streamoff off, _seek_dir dir, int mode) { int ret_val = 0; int select = mode == 0 ? (ios::in|ios::out) : mode; - streambuf *gbuf = (select & ios::in) ? get_stream() : NULL; - streambuf *pbuf = (select & ios::out) ? put_stream() : NULL; + streambuf *gbuf = (select & ios::in) ? get_stream() : 0; + streambuf *pbuf = (select & ios::out) ? put_stream() : 0; if (gbuf == pbuf) ret_val = gbuf->seekoff(off, dir, mode); else { @@ -79,8 +79,8 @@ streampos indirectbuf::seekpos(streampos pos, int mode) { int ret_val = EOF; int select = mode == 0 ? (ios::in|ios::out) : mode; - streambuf *gbuf = (select & ios::in) ? get_stream() : NULL; - streambuf *pbuf = (select & ios::out) ? put_stream() : NULL; + streambuf *gbuf = (select & ios::in) ? get_stream() : 0; + streambuf *pbuf = (select & ios::out) ? put_stream() : 0; if (gbuf == pbuf) ret_val = gbuf->seekpos(pos, mode); else { diff --git a/gnu/lib/libg++/iostream/strstream.C b/gnu/lib/libg++/iostream/strstream.C index d5a57137d52..d460930bfac 100644 --- a/gnu/lib/libg++/iostream/strstream.C +++ b/gnu/lib/libg++/iostream/strstream.C @@ -144,7 +144,8 @@ void strstreambuf::init_static(char *ptr, int size, char *pstart) // This can lose in pathological cases (ptr near the end // of the address space). A better solution might be to // adjust the size on underflow/overflow. FIXME. - for (int s; s = 2*size, s > 0 && ptr + s > ptr && s < 0x4000000L; ) + int s; + for (; s = 2*size, s > 0 && ptr + s > ptr && s < 0x4000000L; ) size = s; size = s; #else diff --git a/gnu/lib/libg++/libg++/ACG.cc b/gnu/lib/libg++/libg++/ACG.cc index 27e7aa22564..fa556b25ba1 100644 --- a/gnu/lib/libg++/libg++/ACG.cc +++ b/gnu/lib/libg++/libg++/ACG.cc @@ -188,7 +188,8 @@ ACG::ACG(unsigned long seed, int size) // Determine the size of the state table // - for (register int l = 0; + register int l; + for (l = 0; randomStateTable[l][0] != -1 && randomStateTable[l][1] < size; l++); diff --git a/gnu/lib/libg++/libg++/Fix.cc b/gnu/lib/libg++/libg++/Fix.cc index 0a5bc2d793b..45d7246f620 100644 --- a/gnu/lib/libg++/libg++/Fix.cc +++ b/gnu/lib/libg++/libg++/Fix.cc @@ -225,7 +225,8 @@ _Fix add(_Fix x, _Fix y, _Fix r) longer = y, shorter = x; if ( r == NULL ) r = new_Fix(longer->len); - for ( int i=r->siz-1; i >= longer->siz; i-- ) + int i; + for (i=r->siz-1; i >= longer->siz; i-- ) r->s[i] = 0; for ( ; i >= shorter->siz; i-- ) r->s[i] = longer->s[i]; @@ -251,7 +252,8 @@ _Fix subtract(_Fix x, _Fix y, _Fix r) longer = y, shorter = x; if ( r == NULL ) r = new_Fix(longer->len); - for ( int i=r->siz-1; i >= longer->siz; i-- ) + int i; + for (i=r->siz-1; i >= longer->siz; i-- ) r->s[i] = 0; for ( ; i >= shorter->siz; i-- ) r->s[i] = (longer == x ? x->s[i] : -y->s[i]); @@ -279,7 +281,8 @@ _Fix multiply(_Fix x, _Fix y, _Fix r) x = negate(x,X.rep); if ( ysign ) y = negate(y,Y.rep); - for ( int i=0; i < r->siz; i++ ) + int i; + for (i=0; i < r->siz; i++ ) r->s[i] = 0; for ( i=x->siz-1; i >= 0; i-- ) { @@ -310,7 +313,8 @@ _Fix multiply(_Fix x, int y, _Fix r) (*Fix_range_error_handler)("multiply by int -- int too large"); if ( r == NULL ) r = new_Fix(x->len); - for ( int i=r->siz-1; i >= x->siz; i-- ) + int i; + for (i=r->siz-1; i >= x->siz; i-- ) r->s[i] = 0; int32 a, carry = 0; for ( ; i > 0; i-- ) @@ -418,7 +422,8 @@ _Fix shift(_Fix x, int y, _Fix r) int xr = 16 - xl; uint16 xrmask = 0xffffL >> xr; - for ( int i=0; i < ilow; i++, rs+=u, xsl+=u, xsr+=u ) + int i; + for (i=0; i < ilow; i++, rs+=u, xsl+=u, xsr+=u ) *rs = 0; for ( ; i < ihigh; i++, rs+=u, xsl+=u, xsr+=u ) *rs = (*xsl << xl) + ((*xsr >> xr) & xrmask); @@ -434,7 +439,8 @@ _Fix negate(_Fix x, _Fix r) if ( r == NULL ) r = new_Fix(x->len); uint32 carry = 1; - for ( int i=r->siz-1; i >= x->siz; i-- ) + int i; + for (i=r->siz-1; i >= x->siz; i-- ) r->s[i] = 0; for ( ; i >= 0; i-- ) { diff --git a/gnu/lib/libg++/libg++/Fix.h b/gnu/lib/libg++/libg++/Fix.h index 9065c23409c..a815f521b9e 100644 --- a/gnu/lib/libg++/libg++/Fix.h +++ b/gnu/lib/libg++/libg++/Fix.h @@ -1,7 +1,7 @@ // // Fix.h : variable length fixed point data type // -// $Id: Fix.h,v 1.2 1993/08/02 17:23:09 mycroft Exp $ +// $Id: Fix.h,v 1.3 1995/12/30 03:32:26 chopps Exp $ // #ifndef _Fix_h @@ -63,7 +63,7 @@ public: ~Fix(); - Fix operator = (Fix&); + Fix operator = (const Fix&); Fix operator = (double); friend int operator == (const Fix&, const Fix& ); @@ -199,7 +199,8 @@ inline _Fix copy(const _Fix from, _Fix to) { uint16 *ts = to->s, *fs = from->s; int ilim = to->siz < from->siz ? to->siz : from->siz; - for ( int i=0; i < ilim; i++ ) + int i; + for ( i=0; i < ilim; i++ ) *ts++ = *fs++; for ( ; i < to->siz; i++ ) *ts++ = 0; @@ -260,7 +261,7 @@ inline Fix::~Fix() if ( --rep->ref <= 0 ) delete rep; } -inline Fix Fix::operator = (Fix& y) +inline Fix Fix::operator = (const Fix& y) { if ( rep->len == y.rep->len ) { ++y.rep->ref; diff --git a/gnu/lib/libg++/libg++/Fix16.h b/gnu/lib/libg++/libg++/Fix16.h index 8e769245e8f..340d30c8224 100644 --- a/gnu/lib/libg++/libg++/Fix16.h +++ b/gnu/lib/libg++/libg++/Fix16.h @@ -16,7 +16,7 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: Fix16.h,v 1.3 1993/08/02 17:23:11 mycroft Exp $ + $Id: Fix16.h,v 1.4 1995/12/30 03:32:27 chopps Exp $ */ #ifndef _Fix16_h @@ -198,6 +198,8 @@ public: Fix32& operator *= (int g); }; +inline Fix32::~Fix32() {} + // active error handler declarations typedef void (*Fix16_peh)(short&); @@ -498,7 +500,6 @@ inline Fix16& Fix16::operator*=(int g) return *this = *this * g; } -inline Fix32::~Fix32() {} inline long Fix32::round(double d) { diff --git a/gnu/lib/libg++/libg++/Fix24.h b/gnu/lib/libg++/libg++/Fix24.h index 19be284fbee..58d3bc817fe 100644 --- a/gnu/lib/libg++/libg++/Fix24.h +++ b/gnu/lib/libg++/libg++/Fix24.h @@ -16,7 +16,7 @@ You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: Fix24.h,v 1.2 1993/08/02 17:23:13 mycroft Exp $ + $Id: Fix24.h,v 1.3 1995/12/30 03:32:28 chopps Exp $ */ #ifndef _Fix24_h @@ -199,6 +199,15 @@ public: void range_error(twolongs& i) const; }; +/* Fix24 operator*() creates and copies Fix48 so this needs to precede that */ + +inline Fix48::~Fix48() {} + +inline Fix48::Fix48(const Fix48& f) +{ + m = f.m; +} + // active error handler declarations @@ -355,7 +364,7 @@ inline Fix24 operator<<(const Fix24& a, int b) inline Fix24 operator>>(const Fix24& a, int b) { - return (a.m >> b) & 0xffffff00L; + return (long)((a.m >> b) & ~0xffL); } inline Fix24& Fix24:: operator+=(const Fix24& f) @@ -436,8 +445,6 @@ inline ostream& operator<<(ostream& s, const Fix24& f) return s << double(f); } -inline Fix48::~Fix48() {} - inline Fix48::Fix48(twolongs i) { m = i; @@ -460,11 +467,6 @@ inline Fix48::Fix48() m.l = 0; } -inline Fix48::Fix48(const Fix48& f) -{ - m = f.m; -} - inline Fix48::Fix48(const Fix24& f) { m.u = f.m; diff --git a/gnu/lib/libg++/libg++/Integer.cc b/gnu/lib/libg++/libg++/Integer.cc index f4ec47e6699..4d178d2fa68 100644 --- a/gnu/lib/libg++/libg++/Integer.cc +++ b/gnu/lib/libg++/libg++/Integer.cc @@ -1882,7 +1882,8 @@ IntRep* gcd(const IntRep* x, const IntRep* y) long k = 0; int l = (ul <= vl)? ul : vl; int cont = 1; - for (int i = 0; i < l && cont; ++i) + int i; + for (i = 0; i < l && cont; ++i) { unsigned long a = (i < ul)? u->s[i] : 0; unsigned long b = (i < vl)? v->s[i] : 0; diff --git a/gnu/lib/libg++/libg++/Obstack.cc b/gnu/lib/libg++/libg++/Obstack.cc index f748eb4df83..511c11de253 100644 --- a/gnu/lib/libg++/libg++/Obstack.cc +++ b/gnu/lib/libg++/libg++/Obstack.cc @@ -85,8 +85,9 @@ void* Obstack::finish() int Obstack::contains(void* obj) // true if obj somewhere in Obstack { - for (_obstack_chunk* ch = chunk; - ch != 0 && (obj < (void*)ch || obj >= (void*)(ch->limit)); + + _obstack_chunk* ch; + for (ch = chunk; ch != 0 && (obj < (void*)ch || obj >= (void*)(ch->limit)); ch = ch->prev); return ch != 0; diff --git a/gnu/lib/libg++/libg++/String.cc b/gnu/lib/libg++/libg++/String.cc index 6e7a9f87e6c..33b15c5cd43 100644 --- a/gnu/lib/libg++/libg++/String.cc +++ b/gnu/lib/libg++/libg++/String.cc @@ -965,7 +965,9 @@ String join(String src[], int n, const String& separator) return x; { String sep = separator; int xlen = 0; - for (int i = 0; i < n; ++i) + + int i; + for (i = 0; i < n; ++i) xlen += src[i].length(); xlen += (n - 1) * sep.length(); @@ -1117,7 +1119,8 @@ String common_prefix(const String& x, const String& y, int startpos) return r; const char* topx = &(xchars[x.length()]); const char* ys = &(ychars[startpos]); const char* topy = &(ychars[y.length()]); - for (int l = 0; xs < topx && ys < topy && *xs++ == *ys++; ++l); + int l; + for (l = 0; xs < topx && ys < topy && *xs++ == *ys++; ++l); r.rep = Salloc(r.rep, ss, l, l); } @@ -1129,7 +1132,8 @@ String common_suffix(const String& x, const String& y, int startpos) return r; const char* botx = xchars; const char* ys = &(ychars[y.length() + startpos]); const char* boty = ychars; - for (int l = 0; xs >= botx && ys >= boty && *xs == *ys ; --xs, --ys, ++l); + int l; + for (l = 0; xs >= botx && ys >= boty && *xs == *ys ; --xs, --ys, ++l); r.rep = Salloc(r.rep, ++xs, l, l); } diff --git a/gnu/lib/libg++/libg++/dtoa.cc b/gnu/lib/libg++/libg++/dtoa.cc index 81d7551daae..9fe7000c448 100644 --- a/gnu/lib/libg++/libg++/dtoa.cc +++ b/gnu/lib/libg++/libg++/dtoa.cc @@ -115,7 +115,8 @@ char* dtoa(double fpnum, char cvt, int width, int prec) } double ffpart = fpart; double ifpart; - for (int i = 0; i < prec; ++i) + int i; + for (i = 0; i < prec; ++i) { ffpart = modf(ffpart * 10.0, &ifpart); *fw++ = '0' + int(ifpart); @@ -179,7 +180,8 @@ char* dtoa(double fpnum, char cvt, int width, int prec) if (ch > '5') // properly round: unavoidable propagation { int carry = 1; - for (char* p = f - 1; p >= fwork && carry; --p) + char* p; + for (p = f - 1; p >= fwork && carry; --p) { ++*p; if (*p > '9') @@ -313,7 +315,8 @@ char* dtoa(double fpnum, char cvt, int width, int prec) char* fmtbase = (char *) _libgxx_fmtq.alloc(fmtwidth + pad + 1); char* fmt = fmtbase; - for (int i = 0; i < pad; ++i) *fmt++ = ' '; + int i; + for (i = 0; i < pad; ++i) *fmt++ = ' '; if (is_neg) *fmt++ = '-'; diff --git a/gnu/lib/libg++/libg++/error.cc b/gnu/lib/libg++/libg++/error.cc index fc14959c4da..631985feac8 100644 --- a/gnu/lib/libg++/libg++/error.cc +++ b/gnu/lib/libg++/libg++/error.cc @@ -20,7 +20,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #endif #include <builtin.h> -extern "C" _VOLATILE_VOID abort(); +//extern "C" _VOLATILE_VOID abort(); _VOLATILE_VOID default_one_arg_error_handler(const char* msg) { |
