<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[29045] trunk/JavaScriptCore</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/29045">29045</a></dd>
<dt>Author</dt> <dd>eric@webkit.org</dd>
<dt>Date</dt> <dd>2007-12-30 23:02:26 -0800 (Sun, 30 Dec 2007)</dd>
</dl>

<h3>Log Message</h3>
<pre>        Reviewed by Sam.

        Remove maxInt/minInt, replacing with std:max/min&lt;int&gt;()

        * kjs/array_object.cpp:
        (KJS::ArrayProtoFuncSplice::callAsFunction):
        * kjs/operations.cpp:
        * kjs/operations.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkJavaScriptCoreChangeLog">trunk/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkJavaScriptCorekjsarray_objectcpp">trunk/JavaScriptCore/kjs/array_object.cpp</a></li>
<li><a href="#trunkJavaScriptCorekjsoperationscpp">trunk/JavaScriptCore/kjs/operations.cpp</a></li>
<li><a href="#trunkJavaScriptCorekjsoperationsh">trunk/JavaScriptCore/kjs/operations.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/ChangeLog (29044 => 29045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/ChangeLog        2007-12-31 07:02:05 UTC (rev 29044)
+++ trunk/JavaScriptCore/ChangeLog        2007-12-31 07:02:26 UTC (rev 29045)
</span><span class="lines">@@ -1,6 +1,17 @@
</span><span class="cx"> 2007-12-30  Eric Seidel  &lt;eric@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Sam.
</span><ins>+
+        Remove maxInt/minInt, replacing with std:max/min&lt;int&gt;()
+
+        * kjs/array_object.cpp:
+        (KJS::ArrayProtoFuncSplice::callAsFunction):
+        * kjs/operations.cpp:
+        * kjs/operations.h:
+
+2007-12-30  Eric Seidel  &lt;eric@webkit.org&gt;
+
+        Reviewed by Sam.
</ins><span class="cx">         
</span><span class="cx">         Update Number.toString to properly throw exceptions.
</span><span class="cx">         Cleanup code in Number.toString implementation.
</span></span></pre></div>
<a id="trunkJavaScriptCorekjsarray_objectcpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/kjs/array_object.cpp (29044 => 29045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/kjs/array_object.cpp        2007-12-31 07:02:05 UTC (rev 29044)
+++ trunk/JavaScriptCore/kjs/array_object.cpp        2007-12-31 07:02:26 UTC (rev 29045)
</span><span class="lines">@@ -32,6 +32,8 @@
</span><span class="cx"> #include &lt;wtf/Assertions.h&gt;
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> 
</span><ins>+#include &lt;algorithm&gt; // for std::min
+
</ins><span class="cx"> namespace KJS {
</span><span class="cx"> 
</span><span class="cx"> // ------------------------------ ArrayPrototype ----------------------------
</span><span class="lines">@@ -448,25 +450,24 @@
</span><span class="cx"> 
</span><span class="cx"> JSValue* ArrayProtoFuncSplice::callAsFunction(ExecState* exec, JSObject* thisObj, const List&amp; args)
</span><span class="cx"> {
</span><del>-    // 15.4.4.12 - oh boy this is huge
</del><ins>+    // 15.4.4.12
</ins><span class="cx">     JSObject *resObj = static_cast&lt;JSObject *&gt;(exec-&gt;lexicalGlobalObject()-&gt;arrayConstructor()-&gt;construct(exec, List::empty()));
</span><span class="cx">     JSValue* result = resObj;
</span><span class="cx">     unsigned length = thisObj-&gt;get(exec, exec-&gt;propertyNames().length)-&gt;toUInt32(exec);
</span><span class="cx">     int begin = args[0]-&gt;toUInt32(exec);
</span><del>-    if ( begin &lt; 0 )
-      begin = maxInt( begin + length, 0 );
</del><ins>+    if (begin &lt; 0)
+        begin = std::max&lt;int&gt;(begin + length, 0);
</ins><span class="cx">     else
</span><del>-      begin = minInt( begin, length );
-    unsigned int deleteCount = minInt( maxInt( args[1]-&gt;toUInt32(exec), 0 ), length - begin );
</del><ins>+        begin = std::min&lt;int&gt;(begin, length);
+    unsigned int deleteCount = std::min&lt;int&gt;(std::max&lt;int&gt;(args[1]-&gt;toUInt32(exec), 0), length - begin);
</ins><span class="cx"> 
</span><del>-    //printf( &quot;Splicing from %d, deleteCount=%d \n&quot;, begin, deleteCount );
</del><span class="cx">     for(unsigned int k = 0; k &lt; deleteCount; k++) {
</span><span class="cx">       if (JSValue *v = getProperty(exec, thisObj, k+begin))
</span><span class="cx">         resObj-&gt;put(exec, k, v);
</span><span class="cx">     }
</span><span class="cx">     resObj-&gt;put(exec, exec-&gt;propertyNames().length, jsNumber(deleteCount), DontEnum | DontDelete);
</span><span class="cx"> 
</span><del>-    unsigned int additionalArgs = maxInt( args.size() - 2, 0 );
</del><ins>+    unsigned int additionalArgs = std::max&lt;int&gt;(args.size() - 2, 0);
</ins><span class="cx">     if ( additionalArgs != deleteCount )
</span><span class="cx">     {
</span><span class="cx">       if ( additionalArgs &lt; deleteCount )
</span></span></pre></div>
<a id="trunkJavaScriptCorekjsoperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/kjs/operations.cpp (29044 => 29045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/kjs/operations.cpp        2007-12-31 07:02:05 UTC (rev 29044)
+++ trunk/JavaScriptCore/kjs/operations.cpp        2007-12-31 07:02:26 UTC (rev 29045)
</span><span class="lines">@@ -125,14 +125,4 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int maxInt(int d1, int d2)
-{
-    return (d1 &gt; d2) ? d1 : d2;
</del><span class="cx"> }
</span><del>-
-int minInt(int d1, int d2)
-{
-    return (d1 &lt; d2) ? d1 : d2;
-}
-
-}
</del></span></pre></div>
<a id="trunkJavaScriptCorekjsoperationsh"></a>
<div class="modfile"><h4>Modified: trunk/JavaScriptCore/kjs/operations.h (29044 => 29045)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/JavaScriptCore/kjs/operations.h        2007-12-31 07:02:05 UTC (rev 29044)
+++ trunk/JavaScriptCore/kjs/operations.h        2007-12-31 07:02:26 UTC (rev 29045)
</span><span class="lines">@@ -30,9 +30,6 @@
</span><span class="cx"> 
</span><span class="cx">   bool equal(ExecState *exec, JSValue *v1, JSValue *v2);
</span><span class="cx">   bool strictEqual(ExecState *exec, JSValue *v1, JSValue *v2);
</span><del>-  int maxInt(int d1, int d2);
-  int minInt(int d1, int d2);
-
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>