[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/kjs
From: Harri Porten <porten () kde ! org>
Date: 2003-02-24 17:54:26
[Download RAW message or body]
CVS commit by porten:
patch from Darin that removes the need for UString::toUInt32().
M +1 -1 identifier.h 1.4
M +22 -22 property_map.cpp 1.15
M +0 -16 ustring.cpp 1.54
M +0 -4 ustring.h 1.52
--- kdelibs/kjs/identifier.h #1.3:1.4
@@ -50,5 +50,5 @@ namespace KJS {
unsigned long toULong(bool *ok) const { return _ustring.toULong(ok); }
- // uint32_t toUInt32(bool *ok) const { return _ustring.toUInt32(ok); }
+
double toDouble() const { return _ustring.toDouble(); }
--- kdelibs/kjs/property_map.cpp #1.14:1.15
@@ -416,7 +416,7 @@ void PropertyMap::addSparseArrayProperti
if (key) {
UString k(key);
- bool fitsInUInt32;
- k.toUInt32(&fitsInUInt32);
- if (fitsInUInt32)
+ bool fitsInULong;
+ unsigned long i = k.toULong(&fitsInULong);
+ if (fitsInULong && i <= 0xFFFFFFFFU)
list.append(Reference(base, Identifier(key).ustring()));
}
@@ -429,7 +429,7 @@ void PropertyMap::addSparseArrayProperti
if (key) {
UString k(key);
- bool fitsInUInt32;
- k.toUInt32(&fitsInUInt32);
- if (fitsInUInt32)
+ bool fitsInULong;
+ unsigned long i = k.toULong(&fitsInULong);
+ if (fitsInULong && i <= 0xFFFFFFFFU)
list.append(Reference(base, Identifier(key).ustring()));
}
--- kdelibs/kjs/ustring.cpp #1.53:1.54
@@ -556,20 +556,4 @@ unsigned long UString::toULong(bool *ok)
}
-uint32_t UString::toUInt32(bool *ok) const
-{
- double d = toDouble();
- bool b = true;
-
- if (isNaN(d) || d != static_cast<uint32_t>(d)) {
- b = false;
- d = 0;
- }
-
- if (ok)
- *ok = b;
-
- return static_cast<uint32_t>(d);
-}
-
UString UString::toLower() const
{
--- kdelibs/kjs/ustring.h #1.51:1.52
@@ -27,6 +27,4 @@
#include <kjs/global.h>
-#include <stdint.h>
-
/**
* @internal
@@ -390,6 +388,4 @@ _hash; }
*/
unsigned long toULong(bool *ok = 0L) const;
-
- uint32_t toUInt32(bool *ok = 0L) const;
/**
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic