JavaScriptCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Jan 2009 18:25:30 +0000 (18:25 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Jan 2009 18:25:30 +0000 (18:25 +0000)
2009-01-20  Darin Adler  <darin@apple.com>

        Reviewed by Mark Rowe.

        Bug 23352: Turn on more compiler warnings in the Mac build
        https://bugs.webkit.org/show_bug.cgi?id=23352

        First patch: Fix some simple cases of various warnings.

        * pcre/pcre_compile.cpp:
        (jsRegExpCompile): Use const_cast to change const-ness.

        * runtime/StringPrototype.cpp:
        (JSC::substituteBackreferences): Remove unneeded initialization and
        use UChar instead of unsigned short for UTF-16 values.

        * wtf/dtoa.cpp:
        (WTF::strtod): Use const_cast to change const-ness.

WebCore:

2009-01-20  Darin Adler  <darin@apple.com>

        Reviewed by Mark Rowe.

        Bug 23352: Turn on more compiler warnings in the Mac build
        https://bugs.webkit.org/show_bug.cgi?id=23352

        First patch: Fix some simple cases of various warnings.

        * platform/DeprecatedPtrListImpl.cpp:
        (WebCore::DeprecatedPtrListImpl::insert): Use const_cast to change const-ness.
        * platform/graphics/mac/SimpleFontDataMac.mm:
        (WebCore::SimpleFontData::containsCharacters): Ditto.

        * platform/text/PlatformString.h: Overload for short and unsigned short to avoid
        ambiguity leading to warnings.
        * platform/text/String.cpp:
        (WebCore::String::number): Implemented overloads.

        * platform/text/TextStream.cpp:
        (WebCore::TextStream::operator<<): Overload for bool to avoid ambiguity leading
        to warnings.
        * platform/text/TextStream.h: Ditto.

        * rendering/InlineFlowBox.h: Fix declaration that was specifying the wrong type.

        * svg/graphics/filters/cg/WKLinearTransferFilter.m: Fix stray characters after
        #endif that should be a comment instead.
        * svg/graphics/filters/cg/WKSpecularLightingFilter.h: Ditto.

        * xml/XPathPath.h: Remove unneeded redundant declaration.

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

15 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/pcre/pcre_compile.cpp
JavaScriptCore/runtime/StringPrototype.cpp
JavaScriptCore/wtf/dtoa.cpp
WebCore/ChangeLog
WebCore/platform/DeprecatedPtrListImpl.cpp
WebCore/platform/graphics/mac/SimpleFontDataMac.mm
WebCore/platform/text/PlatformString.h
WebCore/platform/text/String.cpp
WebCore/platform/text/TextStream.cpp
WebCore/platform/text/TextStream.h
WebCore/rendering/InlineFlowBox.h
WebCore/svg/graphics/filters/cg/WKLinearTransferFilter.m
WebCore/svg/graphics/filters/cg/WKSpecularLightingFilter.h
WebCore/xml/XPathPath.h

index 85b44a4..30679cb 100644 (file)
@@ -1,3 +1,22 @@
+2009-01-20  Darin Adler  <darin@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        Bug 23352: Turn on more compiler warnings in the Mac build
+        https://bugs.webkit.org/show_bug.cgi?id=23352
+
+        First patch: Fix some simple cases of various warnings.
+
+        * pcre/pcre_compile.cpp:
+        (jsRegExpCompile): Use const_cast to change const-ness.
+
+        * runtime/StringPrototype.cpp:
+        (JSC::substituteBackreferences): Remove unneeded initialization and
+        use UChar instead of unsigned short for UTF-16 values.
+
+        * wtf/dtoa.cpp:
+        (WTF::strtod): Use const_cast to change const-ness.
+
 2009-01-20  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by NOBODY (build fix).
index f162d18..18c54ff 100644 (file)
@@ -2607,7 +2607,7 @@ JSRegExp* jsRegExpCompile(const UChar* pattern, int patternLength,
     
     const UChar* ptr = (const UChar*)pattern;
     const UChar* patternEnd = pattern + patternLength;
-    unsigned char* code = (unsigned char*)codeStart;
+    unsigned char* code = const_cast<unsigned char*>(codeStart);
     int firstByte, reqByte;
     int bracketCount = 0;
     if (!cd.needOuterBracket)
index 2041329..df81536 100644 (file)
@@ -135,12 +135,12 @@ static inline UString substituteBackreferences(const UString& replacement, const
 {
     UString substitutedReplacement;
     int offset = 0;
-    int i = -1;
+    int i;
     while ((i = replacement.find('$', i + 1)) != -1) {
         if (i + 1 == replacement.size())
             break;
 
-        unsigned short ref = replacement[i + 1];
+        UChar ref = replacement[i + 1];
         if (ref == '$') {
             // "$$" -> "$"
             ++i;
index adbb115..c9e8d30 100644 (file)
@@ -1721,7 +1721,7 @@ retfree:
     Bfree(delta);
 ret:
     if (se)
-        *se = (char*)s;
+        *se = const_cast<char*>(s);
     return sign ? -dval(rv) : dval(rv);
 }
 
index bab8b90..628aebe 100644 (file)
@@ -1,3 +1,35 @@
+2009-01-20  Darin Adler  <darin@apple.com>
+
+        Reviewed by Mark Rowe.
+
+        Bug 23352: Turn on more compiler warnings in the Mac build
+        https://bugs.webkit.org/show_bug.cgi?id=23352
+
+        First patch: Fix some simple cases of various warnings.
+
+        * platform/DeprecatedPtrListImpl.cpp:
+        (WebCore::DeprecatedPtrListImpl::insert): Use const_cast to change const-ness.
+        * platform/graphics/mac/SimpleFontDataMac.mm:
+        (WebCore::SimpleFontData::containsCharacters): Ditto.
+
+        * platform/text/PlatformString.h: Overload for short and unsigned short to avoid
+        ambiguity leading to warnings.
+        * platform/text/String.cpp:
+        (WebCore::String::number): Implemented overloads.
+
+        * platform/text/TextStream.cpp:
+        (WebCore::TextStream::operator<<): Overload for bool to avoid ambiguity leading
+        to warnings.
+        * platform/text/TextStream.h: Ditto.
+
+        * rendering/InlineFlowBox.h: Fix declaration that was specifying the wrong type.
+
+        * svg/graphics/filters/cg/WKLinearTransferFilter.m: Fix stray characters after
+        #endif that should be a comment instead.
+        * svg/graphics/filters/cg/WKSpecularLightingFilter.h: Ditto.
+
+        * xml/XPathPath.h: Remove unneeded redundant declaration.
+
 2009-01-20  Nikolas Zimmermann  <nikolas.zimmermann@torchmobile.com>
 
         Build fix for WML enabled builds, not reviewed.
index b3badc2..6d6112e 100644 (file)
@@ -143,7 +143,7 @@ bool DeprecatedPtrListImpl::insert(unsigned n, const void *item)
         return false;
     }
 
-    DeprecatedListNode *node = new DeprecatedListNode((void *)item);
+    DeprecatedListNode *node = new DeprecatedListNode(const_cast<void*>(item));
 
     if (n == 0) {
         // inserting at head
index 762bc07..27c0091 100644 (file)
@@ -324,7 +324,7 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes
 
 bool SimpleFontData::containsCharacters(const UChar* characters, int length) const
 {
-    NSString *string = [[NSString alloc] initWithCharactersNoCopy:(UniChar*)characters length:length freeWhenDone:NO];
+    NSString *string = [[NSString alloc] initWithCharactersNoCopy:const_cast<unichar*>(characters) length:length freeWhenDone:NO];
     NSCharacterSet *set = [[m_font.font() coveredCharacterSet] invertedSet];
     bool result = set && [string rangeOfCharacterFromSet:set].location == NSNotFound;
     [string release];
index 2baa191..35d3079 100644 (file)
@@ -147,6 +147,8 @@ public:
     // Return the string with case folded for case insensitive comparison.
     String foldCase() const;
 
+    static String number(short);
+    static String number(unsigned short);
     static String number(int);
     static String number(unsigned);
     static String number(long);
index e40c3c6..2b547b7 100644 (file)
@@ -378,6 +378,16 @@ String String::format(const char *format, ...)
 #endif
 }
 
+String String::number(short n)
+{
+    return String::format("%hd", n);
+}
+
+String String::number(unsigned short n)
+{
+    return String::format("%hu", n);
+}
+
 String String::number(int n)
 {
     return String::format("%d", n);
index 5b7a0c7..eb4bae7 100644 (file)
@@ -33,6 +33,11 @@ namespace WebCore {
 
 static const size_t printBufferSize = 100; // large enough for any integer or floating point value in string format, including trailing null character
 
+TextStream& TextStream::operator<<(bool b)
+{
+    return *this << (b ? "1" : "0");
+}
+
 TextStream& TextStream::operator<<(int i)
 {
     char buffer[printBufferSize];
index 6fb3f4b..71034f3 100644 (file)
@@ -35,6 +35,7 @@ class String;
 
 class TextStream {
 public:
+    TextStream& operator<<(bool);
     TextStream& operator<<(int);
     TextStream& operator<<(unsigned);
     TextStream& operator<<(long);
index 30dad38..da5fd8a 100644 (file)
@@ -165,7 +165,7 @@ inline void InlineFlowBox::setHasBadChildList()
 
 #ifndef NDEBUG
 // Outside the WebCore namespace for ease of invocation from gdb.
-void showTree(const WebCore::InlineBox*);
+void showTree(const WebCore::InlineFlowBox*);
 #endif
 
 #endif // InlineFlowBox_h
index ecfed53..6582f9f 100644 (file)
@@ -77,4 +77,4 @@ static CIKernel *linearTransferFilter = nil;
 
 @end
 
-#endif ENABLE(SVG) && ENABLE(SVG_FILTERS)
+#endif // ENABLE(SVG) && ENABLE(SVG_FILTERS)
index 97692b2..46e57ff 100644 (file)
@@ -32,8 +32,6 @@
 #include "XPathExpressionNode.h"
 #include "XPathNodeSet.h"
 
-int xpathyyparse(void*);
-
 namespace WebCore {
 
     namespace XPath {