[Win] Warning fixes.
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Aug 2016 13:29:31 +0000 (13:29 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Aug 2016 13:29:31 +0000 (13:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161077

Reviewed by Brent Fulgham.

* css/CSSGrammar.y.includes:
* css/RuleFeature.cpp:
(WebCore::makeAttributeSelectorKey):
* editing/TextIterator.cpp:
(WebCore::SearchBuffer::SearchBuffer):
* html/HTMLElement.cpp:
(WebCore::HTMLElement::textToFragment):
* html/MediaElementSession.h:
* platform/URL.cpp:
* platform/graphics/ca/GraphicsLayerCA.cpp:
* platform/network/HTTPParsers.cpp:
(WebCore::parseHTTPHeader):
* rendering/InlineIterator.h:
(WebCore::InlineIterator::clear):
* rendering/RenderDeprecatedFlexibleBox.cpp:
(WebCore::FlexBoxIterator::reset):
* rendering/RenderText.cpp:
(WebCore::RenderText::secureText):
* rendering/mathml/RenderMathMLToken.cpp:
(WebCore::mathVariant):
* style/InlineTextBoxStyle.cpp:
(WebCore::visualOverflowForDecorations):
* xml/XPathGrammar.y:

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

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/CSSGrammar.y.includes
Source/WebCore/css/RuleFeature.cpp
Source/WebCore/editing/TextIterator.cpp
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/MediaElementSession.h
Source/WebCore/platform/URL.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/network/HTTPParsers.cpp
Source/WebCore/rendering/InlineIterator.h
Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/mathml/RenderMathMLToken.cpp
Source/WebCore/style/InlineTextBoxStyle.cpp
Source/WebCore/xml/XPathGrammar.y

index 3ae2b7a..ea53b41 100644 (file)
@@ -1,3 +1,34 @@
+2016-08-26  Per Arne Vollan  <pvollan@apple.com>
+
+        [Win] Warning fixes.
+        https://bugs.webkit.org/show_bug.cgi?id=161077
+
+        Reviewed by Brent Fulgham.
+
+        * css/CSSGrammar.y.includes:
+        * css/RuleFeature.cpp:
+        (WebCore::makeAttributeSelectorKey):
+        * editing/TextIterator.cpp:
+        (WebCore::SearchBuffer::SearchBuffer):
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::textToFragment):
+        * html/MediaElementSession.h:
+        * platform/URL.cpp:
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        * platform/network/HTTPParsers.cpp:
+        (WebCore::parseHTTPHeader):
+        * rendering/InlineIterator.h:
+        (WebCore::InlineIterator::clear):
+        * rendering/RenderDeprecatedFlexibleBox.cpp:
+        (WebCore::FlexBoxIterator::reset):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::secureText):
+        * rendering/mathml/RenderMathMLToken.cpp:
+        (WebCore::mathVariant):
+        * style/InlineTextBoxStyle.cpp:
+        (WebCore::visualOverflowForDecorations):
+        * xml/XPathGrammar.y:
+
 2016-08-26  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
 
         Make custom constructors consistent with generated bindings code
index 7f8e881..3c17ee9 100644 (file)
 using namespace WebCore;
 using namespace HTMLNames;
 
+#if COMPILER(MSVC)
+// See https://msdn.microsoft.com/en-us/library/1wea5zwe.aspx
+#pragma warning(disable: 4701)
+#endif
+
 #define YYMALLOC fastMalloc
 #define YYFREE fastFree
 
index 6f4ffad..c2589af 100644 (file)
@@ -87,7 +87,7 @@ void RuleFeatureSet::recursivelyCollectFeaturesFromSelector(SelectorFeatures& se
 static RuleFeatureSet::AttributeRules::SelectorKey makeAttributeSelectorKey(const CSSSelector& selector)
 {
     bool caseInsensitive = selector.attributeValueMatchingIsCaseInsensitive();
-    unsigned matchAndCase = static_cast<unsigned>(selector.match()) << 1 | caseInsensitive;
+    unsigned matchAndCase = static_cast<unsigned>(selector.match()) << 1 | (caseInsensitive ? 1 : 0);
     return std::make_pair(selector.attributeCanonicalLocalName().impl(), std::make_pair(selector.value().impl(), matchAndCase));
 }
 
index 633edc5..af9a353 100644 (file)
@@ -2004,7 +2004,7 @@ inline SearchBuffer::SearchBuffer(const String& target, FindOptions options)
 
     if ((m_options & AtWordStarts) && targetLength) {
         UChar32 targetFirstCharacter;
-        U16_GET(m_target, 0, 0, targetLength, targetFirstCharacter);
+        U16_GET(m_target, 0, 0u, targetLength, targetFirstCharacter);
         // Characters in the separator category never really occur at the beginning of a word,
         // so if the target begins with such a character, we just ignore the AtWordStart option.
         if (isSeparator(targetFirstCharacter)) {
index 1d0639e..35ddb7c 100644 (file)
@@ -434,7 +434,7 @@ Ref<DocumentFragment> HTMLElement::textToFragment(const String& text, ExceptionC
     for (unsigned start = 0, length = text.length(); start < length; ) {
 
         // Find next line break.
-        UChar c;
+        UChar c = 0;
         unsigned i;
         for (i = start; i < length; i++) {
             c = text[i];
index b802dcb..da8d158 100644 (file)
@@ -79,7 +79,7 @@ public:
     void mediaEngineUpdated(const HTMLMediaElement&);
 
     // Restrictions to modify default behaviors.
-    enum BehaviorRestrictionFlags {
+    enum BehaviorRestrictionFlags : unsigned {
         NoRestrictions = 0,
         RequireUserGestureForLoad = 1 << 0,
         RequireUserGestureForVideoRateChange = 1 << 1,
index c24925b..c8d6e6d 100644 (file)
@@ -396,7 +396,7 @@ static void appendASCII(const String& base, const char* rel, size_t len, CharBuf
 // Returns the index of the first index in string |s| of any of the characters
 // in |toFind|. |toFind| should be a null-terminated string, all characters up
 // to the null will be searched. Returns int if not found.
-const unsigned notFoundUnsigned = -1;
+const unsigned notFoundUnsigned = std::numeric_limits<unsigned>::max();
 static unsigned findFirstOf(StringView string, unsigned startPosition, const char* target)
 {
     unsigned length = string.length();
index 60b5457..37788f5 100644 (file)
 #include "PlatformCALayerWin.h"
 #endif
 
+#if COMPILER(MSVC)
+// See https://msdn.microsoft.com/en-us/library/1wea5zwe.aspx
+#pragma warning(disable: 4701)
+#endif
+
 namespace WebCore {
 
 // The threshold width or height above which a tiled layer will be used. This should be
index 58f07af..0c8ea46 100644 (file)
@@ -670,7 +670,7 @@ size_t parseHTTPHeader(const char* start, size_t length, String& failureReason,
     Vector<char> value;
 
     bool foundFirstNameChar = false;
-    const char* namePtr;
+    const char* namePtr = nullptr;
     size_t nameSize = 0;
 
     nameStr = StringView();
index bc6163c..b3cd9a7 100644 (file)
@@ -68,7 +68,7 @@ public:
     {
         setRenderer(nullptr);
         setOffset(0);
-        setNextBreakablePosition(-1);
+        setNextBreakablePosition(std::numeric_limits<unsigned>::max());
     }
     void moveToStartOf(RenderObject& object)
     {
index e4f0780..82adbcd 100644 (file)
@@ -60,7 +60,7 @@ public:
     void reset()
     {
         m_currentChild = nullptr;
-        m_ordinalIteration = -1;
+        m_ordinalIteration = std::numeric_limits<unsigned>::max();
     }
 
     RenderBox* first()
index b037f82..a6b5217 100644 (file)
@@ -1201,7 +1201,7 @@ void RenderText::secureText(UChar maskingCharacter)
         return;
 
     UChar characterToReveal = 0;
-    unsigned revealedCharactersOffset;
+    unsigned revealedCharactersOffset = 0;
 
     if (SecureTextTimer* timer = secureTextTimers().get(this)) {
         // We take the offset out of the timer to make this one-shot. We count on this being called only once.
index 17e928e..1179884 100644 (file)
@@ -325,7 +325,7 @@ static UChar32 mathVariant(UChar32 codePoint, MathMLElement::MathVariant mathvar
 
     // The Unicode mathematical blocks are divided into four segments: Latin, Greek, numbers and Arabic.
     // In the case of the first three baseChar represents the relative order in which the characters are encoded in the Unicode mathematical block, normalised to the first character of that sequence.
-    UChar32 baseChar;
+    UChar32 baseChar = 0;
     enum CharacterType {
         Latin,
         Greekish,
@@ -446,7 +446,7 @@ static UChar32 mathVariant(UChar32 codePoint, MathMLElement::MathVariant mathvar
         return baseChar + mathBoldUpperAlpha + multiplier * (mathItalicUpperAlpha - mathBoldUpperAlpha);
     }
 
-    UChar32 tempChar;
+    UChar32 tempChar = 0;
     UChar32 newChar;
     if (varType == Arabic) {
         // The Arabic mathematical block is not continuous, nor does it have a monotonic mapping to the unencoded characters, requiring the use of a lookup table.
index 8453e78..b411c08 100644 (file)
@@ -113,9 +113,9 @@ GlyphOverflow visualOverflowForDecorations(const RenderStyle& lineStyle, const I
         return GlyphOverflow();
     
     float strokeThickness = textDecorationStrokeThickness(lineStyle.fontSize());
-    float controlPointDistance;
+    float controlPointDistance = 0;
     float step;
-    float wavyOffset;
+    float wavyOffset = 0;
         
     TextDecorationStyle decorationStyle = lineStyle.textDecorationStyle();
     float height = lineStyle.fontCascade().fontMetrics().floatHeight();
index 356e118..01c6fe0 100644 (file)
 #include "XPathPath.h"
 #include "XPathVariableReference.h"
 
+#if COMPILER(MSVC)
+// See https://msdn.microsoft.com/en-us/library/1wea5zwe.aspx
+#pragma warning(disable: 4701)
+#endif
+
 #define YYMALLOC fastMalloc
 #define YYFREE fastFree