More int32 etc. fixes

git-svn-id: svn://10.0.0.236/trunk@143062 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com
2003-05-29 22:51:03 +00:00
parent 0c30ac4a1e
commit d15be1cc1d
4 changed files with 17 additions and 14 deletions

View File

@@ -148,7 +148,10 @@ static js2val Array_toString(JS2Metadata *meta, const js2val thisValue, js2val *
&& !JS2VAL_IS_NULL(result) )
s->append(*meta->toString(result));
if (i < (length - 1))
s->append(widenCString(","));
if (meta->version == JS2VERSION_1_2)
s->append(widenCString(", "));
else
s->append(widenCString(","));
}
if (meta->version == JS2VERSION_1_2)
s->append(widenCString("]"));

View File

@@ -3953,7 +3953,7 @@ static const uint8 urlCharType[256] =
JS2Object *obj = JS2VAL_TO_OBJECT(thisValue);
ArrayInstance *arrInst = checked_cast<ArrayInstance *>(obj);
uint32 newLength = meta->valToUint32(argv[0]);
uint32 newLength = meta->valToUInt32(argv[0]);
if (newLength < arrInst->length) {
// need to delete all the elements above the new length
bool deleteResult;

View File

@@ -92,7 +92,7 @@
b = pop();
a = pop();
a = meta->toGeneralNumber(a);
int32 count = meta->toInt32(b);
int32 count = meta->valToInt32(b);
if (JS2VAL_IS_LONG(a)) {
int64 r;
JSLL_SHL(r, *JS2VAL_TO_LONG(a), count & 0x3F);
@@ -113,7 +113,7 @@
b = pop();
a = pop();
a = meta->toGeneralNumber(a);
int32 count = meta->toInt32(b);
int32 count = meta->valToInt32(b);
if (JS2VAL_IS_LONG(a)) {
int64 r;
JSLL_SHR(r, *JS2VAL_TO_LONG(a), count & 0x3F);
@@ -134,7 +134,7 @@
b = pop();
a = pop();
a = meta->toGeneralNumber(a);
int32 count = meta->toInt32(b);
int32 count = meta->valToInt32(b);
if (JS2VAL_IS_LONG(a)) {
int64 r;
JSLL_SHR(r, *JS2VAL_TO_LONG(a), count & 0x3F);
@@ -147,7 +147,7 @@
pushULong(r);
}
else
pushNumber(meta->toUInt32(a) >> (count & 0x1F));
pushNumber(meta->valToUInt32(a) >> (count & 0x1F));
}
break;
case eBitwiseAnd:

View File

@@ -411,7 +411,7 @@ static js2val String_split(JS2Metadata *meta, const js2val thisValue, js2val *ar
if (JS2VAL_IS_UNDEFINED(limitV))
lim = JS2Engine::float64toUInt32(two32minus1);
else
lim = meta->toUInt32(limitV);
lim = meta->valToUInt32(limitV);
uint32 s = S->size();
uint32 p = 0;
@@ -495,7 +495,7 @@ static js2val String_charAt(JS2Metadata *meta, const js2val thisValue, js2val *a
uint32 pos = 0;
if (argc > 0)
pos = meta->toUInt32(argv[0]);
pos = meta->valToUInt32(argv[0]);
if ((pos < 0) || (pos >= str->size()))
return STRING_TO_JS2VAL(meta->engine->Empty_StringAtom);
@@ -509,14 +509,14 @@ static js2val String_charCodeAt(JS2Metadata *meta, const js2val thisValue, js2va
const String *str = meta->toString(thisValue);
DEFINE_ROOTKEEPER(rk, str);
uint32 pos = 0;
float64 posd = 0.0;
if (argc > 0)
pos = meta->toUInt32(argv[0]);
posd = meta->toInteger(argv[0]);
if ((pos < 0) || (pos >= str->size()))
if ((posd < 0) || (posd >= str->size()))
return meta->engine->nanValue;
else
return meta->engine->allocNumber((float64)(*str)[pos]);
return meta->engine->allocNumber((float64)(*str)[toUInt32(posd)]);
}
static js2val String_concat(JS2Metadata *meta, const js2val thisValue, js2val *argv, uint32 argc)
@@ -656,7 +656,7 @@ static js2val String_slice(JS2Metadata *meta, const js2val thisValue, js2val *ar
uint32 start, end;
if (argc > 0) {
int32 arg0 = meta->toInt32(argv[0]);
int32 arg0 = meta->valToInt32(argv[0]);
if (arg0 < 0) {
arg0 += sourceLength;
if (arg0 < 0)
@@ -675,7 +675,7 @@ static js2val String_slice(JS2Metadata *meta, const js2val thisValue, js2val *ar
start = 0; // XXX argc must be > 1 since the length of the function is 1
if (argc > 1) {
int32 arg1 = meta->toInt32(argv[1]);
int32 arg1 = meta->valToInt32(argv[1]);
if (arg1 < 0) {
arg1 += sourceLength;
if (arg1 < 0)