Fixed GCC incompatibilities

git-svn-id: svn://10.0.0.236/trunk@61361 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
waldemar%netscape.com 2000-02-19 09:26:59 +00:00
parent afbb008cab
commit 8e4b3e1aed
8 changed files with 30 additions and 16 deletions

View File

@ -63,7 +63,7 @@ JS::HashNumber JS::hashString(const String &s)
//
static const int minLgNBuckets = 4;
const uint minLgNBuckets = 4;
JS::GenericHashTableIterator::GenericHashTableIterator(GenericHashTable &ht):
@ -164,7 +164,7 @@ void JS::GenericHashTable::rehash()
bucketsEnd = newBucketsEnd;
} catch (std::bad_alloc) {
// Out of memory. Ignore the error and just relax the resizing boundaries.
if (JS_BIT(newLgNBuckets) > bucketsEnd - buckets)
if (buckets + JS_BIT(newLgNBuckets) > bucketsEnd)
maxNEntries >>= 1;
else
minNEntries <<= 1;

View File

@ -1914,8 +1914,7 @@ static char *doubleToAscii(double d, int mode, bool biasUp, int ndigits,
if ((word0(d) & Exp_mask) == Exp_mask) {
// Infinity or NaN
*decpt = 9999;
s = !word1(d) && !(word0(d) & Frac_mask) ? "Infinity" : "NaN";
strcpy(buf, s);
strcpy(buf, !word1(d) && !(word0(d) & Frac_mask) ? "Infinity" : "NaN");
return buf[3] ? buf + 8 : buf + 3;
}
if (!d) {

View File

@ -61,11 +61,17 @@ typedef float float32;
// Use wchar_t on platforms on which wchar_t has 16 bits; otherwise use int16.
// Note that in C++ wchar_t is a distinct type rather than a typedef for some integral type.
// Like char, a char16 can be either signed or unsigned at the implementation's discretion.
typedef wchar_t char16;
#ifndef _WIN32 // Microsoft VC6 bug: wchar_t should be a built-in type, not a typedef
typedef unsigned wchar_t uchar16;
#ifdef __GNUC__
// GCC's wchar_t is 32 bits, so we can't use it.
typedef uint16 char16;
typedef uint16 uchar16;
#else
typedef wchar_t uchar16;
typedef wchar_t char16;
#ifndef _WIN32 // Microsoft VC6 bug: wchar_t should be a built-in type, not a typedef
typedef unsigned wchar_t uchar16;
#else
typedef wchar_t uchar16;
#endif
#endif
#ifdef _WIN32

View File

@ -356,9 +356,11 @@ namespace JavaScript {
// A class to remember the format of an ostream so that a function may modify it internally
// without changing it for the caller.
class SaveFormat {
#ifndef __GNUC__ // The GCC libraries don't support ios_base yet.
ostream &o;
std::ios_base::fmtflags flags;
char fill;
#endif
public:
explicit SaveFormat(ostream &out);
~SaveFormat();

View File

@ -63,7 +63,7 @@ JS::HashNumber JS::hashString(const String &s)
//
static const int minLgNBuckets = 4;
const uint minLgNBuckets = 4;
JS::GenericHashTableIterator::GenericHashTableIterator(GenericHashTable &ht):
@ -164,7 +164,7 @@ void JS::GenericHashTable::rehash()
bucketsEnd = newBucketsEnd;
} catch (std::bad_alloc) {
// Out of memory. Ignore the error and just relax the resizing boundaries.
if (JS_BIT(newLgNBuckets) > bucketsEnd - buckets)
if (buckets + JS_BIT(newLgNBuckets) > bucketsEnd)
maxNEntries >>= 1;
else
minNEntries <<= 1;

View File

@ -1914,8 +1914,7 @@ static char *doubleToAscii(double d, int mode, bool biasUp, int ndigits,
if ((word0(d) & Exp_mask) == Exp_mask) {
// Infinity or NaN
*decpt = 9999;
s = !word1(d) && !(word0(d) & Frac_mask) ? "Infinity" : "NaN";
strcpy(buf, s);
strcpy(buf, !word1(d) && !(word0(d) & Frac_mask) ? "Infinity" : "NaN");
return buf[3] ? buf + 8 : buf + 3;
}
if (!d) {

View File

@ -61,11 +61,17 @@ typedef float float32;
// Use wchar_t on platforms on which wchar_t has 16 bits; otherwise use int16.
// Note that in C++ wchar_t is a distinct type rather than a typedef for some integral type.
// Like char, a char16 can be either signed or unsigned at the implementation's discretion.
typedef wchar_t char16;
#ifndef _WIN32 // Microsoft VC6 bug: wchar_t should be a built-in type, not a typedef
typedef unsigned wchar_t uchar16;
#ifdef __GNUC__
// GCC's wchar_t is 32 bits, so we can't use it.
typedef uint16 char16;
typedef uint16 uchar16;
#else
typedef wchar_t uchar16;
typedef wchar_t char16;
#ifndef _WIN32 // Microsoft VC6 bug: wchar_t should be a built-in type, not a typedef
typedef unsigned wchar_t uchar16;
#else
typedef wchar_t uchar16;
#endif
#endif
#ifdef _WIN32

View File

@ -356,9 +356,11 @@ namespace JavaScript {
// A class to remember the format of an ostream so that a function may modify it internally
// without changing it for the caller.
class SaveFormat {
#ifndef __GNUC__ // The GCC libraries don't support ios_base yet.
ostream &o;
std::ios_base::fmtflags flags;
char fill;
#endif
public:
explicit SaveFormat(ostream &out);
~SaveFormat();