Fixed release build, fixed accidental infinite recursion due to
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jun 2006 23:10:02 +0000 (23:10 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jun 2006 23:10:02 +0000 (23:10 +0000)
        last minute global replace gone awry.

        * API/APICast.h:
        (toRef):
        * API/testapi.c:
        (assertEqualsAsBoolean):
        (assertEqualsAsNumber):
        (assertEqualsAsUTF8String):
        (assertEqualsAsCharactersPtr):
        * JavaScriptCore.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14954 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/API/APICast.h
JavaScriptCore/API/testapi.c
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

index 49d44393263a31861948e39497826a03585714f7..5c9b0c3fc6194da7a5b595a1cc327e6dc60412d2 100644 (file)
@@ -66,7 +66,7 @@ inline KJS::ReferenceList* toJS(JSPropertyListRef l)
 
 inline JSValueRef toRef(KJS::JSValue* v)
 {
-    return toRef(v);
+    return reinterpret_cast<JSValueRef>(v);
 }
 
 inline JSCharBufferRef toRef(KJS::UString::Rep* s)
@@ -76,12 +76,12 @@ inline JSCharBufferRef toRef(KJS::UString::Rep* s)
 
 inline JSObjectRef toRef(KJS::JSObject* o)
 {
-    return toRef(o);
+    return reinterpret_cast<JSObjectRef>(o);
 }
 
 inline JSObjectRef toRef(const KJS::JSObject* o)
 {
-    return toRef(const_cast<KJS::JSObject*>(o));
+    return reinterpret_cast<JSObjectRef>(const_cast<KJS::JSObject*>(o));
 }
 
 inline JSPropertyListRef toRef(KJS::ReferenceList* l)
index 86fd9b5e66d18112acb1246e1c8f7405c90befed..0f1a9fb63509a68da4783c230112188977b8797a 100644 (file)
@@ -38,13 +38,15 @@ static JSContextRef context = 0;
 
 static void assertEqualsAsBoolean(JSValueRef value, bool expectedValue)
 {
-    assert(JSValueToBoolean(context, value) == expectedValue);
+    if (JSValueToBoolean(context, value) != expectedValue)
+        fprintf(stderr, "assertEqualsAsBoolean failed: %p, %d\n", value, expectedValue);
 }
 
 static void assertEqualsAsNumber(JSValueRef value, double expectedValue)
 {
     double number = JSValueToNumber(context, value);
-    assert(number == expectedValue || (isnan(number) && isnan(expectedValue)));
+    if (number != expectedValue && !(isnan(number) && isnan(expectedValue)))
+        fprintf(stderr, "assertEqualsAsNumber failed: %p, %lf\n", value, expectedValue);
 }
 
 static void assertEqualsAsUTF8String(JSValueRef value, const char* expectedValue)
@@ -55,8 +57,11 @@ static void assertEqualsAsUTF8String(JSValueRef value, const char* expectedValue
     char jsBuffer[jsSize];
     JSCharBufferGetCharactersUTF8(valueAsString, jsBuffer, jsSize);
     
-    assert(strcmp(jsBuffer, expectedValue) == 0);
-    assert(jsSize >= strlen(jsBuffer) + 1);
+    if (strcmp(jsBuffer, expectedValue) != 0)
+        fprintf(stderr, "assertEqualsAsUTF8String strcmp failed: %s != %s\n", jsBuffer, expectedValue);
+        
+    if (jsSize < strlen(jsBuffer) + 1)
+        fprintf(stderr, "assertEqualsAsUTF8String failed: jsSize was too small\n");
 
     JSCharBufferRelease(valueAsString);
 }
@@ -77,8 +82,11 @@ static void assertEqualsAsCharactersPtr(JSValueRef value, const char* expectedVa
     CFStringGetCharacters(expectedValueAsCFString, CFRangeMake(0, cfLength), cfBuffer);
     CFRelease(expectedValueAsCFString);
 
-    assert(memcmp(jsBuffer, cfBuffer, cfLength * sizeof(UniChar)) == 0);
-    assert(jsLength == (size_t)cfLength);
+    if (memcmp(jsBuffer, cfBuffer, cfLength * sizeof(UniChar)) != 0)
+        fprintf(stderr, "assertEqualsAsCharactersPtr failed: jsBuffer != cfBuffer\n");
+    
+    if (jsLength != (size_t)cfLength)
+        fprintf(stderr, "assertEqualsAsCharactersPtr failed: jsLength(%ld) != cfLength(%ld)\n", jsLength, cfLength);
     
     JSCharBufferRelease(valueAsString);
 }
index 9f41a83d21f7fc814d315e3dc7455b7eb5d7f6ae..7fa2f451882dba1554596c7e6328c2fb861962c2 100644 (file)
@@ -1,3 +1,17 @@
+2006-06-21  Geoffrey Garen  <ggaren@apple.com>
+
+        Fixed release build, fixed accidental infinite recursion due to
+        last minute global replace gone awry.
+        
+        * API/APICast.h:
+        (toRef):
+        * API/testapi.c:
+        (assertEqualsAsBoolean):
+        (assertEqualsAsNumber):
+        (assertEqualsAsUTF8String):
+        (assertEqualsAsCharactersPtr):
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+
 2006-06-21  Geoffrey Garen  <ggaren@apple.com>
 
         Reviewed by Anders.
index cef3488ad34c0ef6165222d00e6e6c8199b87d81..cb55eea4523050bc9e1ff4d86bb71fe7e0cb42fd 100644 (file)
@@ -36,8 +36,8 @@
                141211310A48794D00480255 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 932F5BD90822A1C700736975 /* JavaScriptCore.framework */; };
                141211340A48795800480255 /* minidom.c in Sources */ = {isa = PBXBuildFile; fileRef = 141211020A48780900480255 /* minidom.c */; };
                142711390A460BBB0080EEEA /* JSBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 142711380A460BBB0080EEEA /* JSBase.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               143A97E60A4A06E200456B66 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6560A4CF04B3B3E7008AE952 /* CoreFoundation.framework */; };
                14760864099C633800437128 /* JSImmediate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14760863099C633800437128 /* JSImmediate.cpp */; };
-               147FE3B80A3F637E00A1F3F4 /* testapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A2D0A3E91F600BAF59C /* testapi.c */; };
                1482B6EB0A4300B300517CFC /* JSValueRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B6EA0A4300B300517CFC /* JSValueRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1482B74D0A43032800517CFC /* JSCharBufferRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 1482B74B0A43032800517CFC /* JSCharBufferRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1482B74E0A43032800517CFC /* JSCharBufferRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1482B74C0A43032800517CFC /* JSCharBufferRef.cpp */; };
                        isa = PBXFrameworksBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
+                               143A97E60A4A06E200456B66 /* CoreFoundation.framework in Frameworks */,
                                14BD59C50A3E8F9F00BAF59C /* JavaScriptCore.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                        isa = PBXSourcesBuildPhase;
                        buildActionMask = 2147483647;
                        files = (
-                               147FE3B80A3F637E00A1F3F4 /* testapi.c in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };