Changeset 29045 in webkit for trunk/JavaScriptCore/kjs/array_object.cpp
- Timestamp:
- Dec 30, 2007, 11:02:26 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/array_object.cpp
r28468 r29045 32 32 #include <wtf/Assertions.h> 33 33 #include <wtf/HashSet.h> 34 35 #include <algorithm> // for std::min 34 36 35 37 namespace KJS { … … 449 451 JSValue* ArrayProtoFuncSplice::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) 450 452 { 451 // 15.4.4.12 - oh boy this is huge453 // 15.4.4.12 452 454 JSObject *resObj = static_cast<JSObject *>(exec->lexicalGlobalObject()->arrayConstructor()->construct(exec, List::empty())); 453 455 JSValue* result = resObj; 454 456 unsigned length = thisObj->get(exec, exec->propertyNames().length)->toUInt32(exec); 455 457 int begin = args[0]->toUInt32(exec); 456 if ( begin < 0)457 begin = maxInt( begin + length, 0);458 if (begin < 0) 459 begin = std::max<int>(begin + length, 0); 458 460 else 459 begin = minInt( begin, length ); 460 unsigned int deleteCount = minInt( maxInt( args[1]->toUInt32(exec), 0 ), length - begin ); 461 462 //printf( "Splicing from %d, deleteCount=%d \n", begin, deleteCount ); 461 begin = std::min<int>(begin, length); 462 unsigned int deleteCount = std::min<int>(std::max<int>(args[1]->toUInt32(exec), 0), length - begin); 463 463 464 for(unsigned int k = 0; k < deleteCount; k++) { 464 465 if (JSValue *v = getProperty(exec, thisObj, k+begin)) … … 467 468 resObj->put(exec, exec->propertyNames().length, jsNumber(deleteCount), DontEnum | DontDelete); 468 469 469 unsigned int additionalArgs = maxInt( args.size() - 2, 0);470 unsigned int additionalArgs = std::max<int>(args.size() - 2, 0); 470 471 if ( additionalArgs != deleteCount ) 471 472 {
Note:
See TracChangeset
for help on using the changeset viewer.