SharedBuffer::m_size should be initialized to 0 when defining it
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2015 08:04:07 +0000 (08:04 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2015 08:04:07 +0000 (08:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144740

Reviewed by Darin Adler.

Setting m_size to 0 when declaring it and updating constructor definitions.

No change in behaviour.

* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::SharedBuffer):
* platform/SharedBuffer.h:
* platform/cf/SharedBufferCF.cpp:
(WebCore::SharedBuffer::SharedBuffer):
* platform/soup/SharedBufferSoup.cpp:
(WebCore::SharedBuffer::SharedBuffer):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/SharedBuffer.cpp
Source/WebCore/platform/SharedBuffer.h
Source/WebCore/platform/cf/SharedBufferCF.cpp
Source/WebCore/platform/soup/SharedBufferSoup.cpp

index 5847552..292d6a6 100644 (file)
@@ -1,3 +1,22 @@
+2015-05-08  Youenn Fablet  <youenn.fablet@crf.canon.fr>
+
+        SharedBuffer::m_size should be initialized to 0 when defining it
+        https://bugs.webkit.org/show_bug.cgi?id=144740
+
+        Reviewed by Darin Adler.
+
+        Setting m_size to 0 when declaring it and updating constructor definitions.
+
+        No change in behaviour.
+
+        * platform/SharedBuffer.cpp:
+        (WebCore::SharedBuffer::SharedBuffer):
+        * platform/SharedBuffer.h:
+        * platform/cf/SharedBufferCF.cpp:
+        (WebCore::SharedBuffer::SharedBuffer):
+        * platform/soup/SharedBufferSoup.cpp:
+        (WebCore::SharedBuffer::SharedBuffer):
+
 2015-05-08  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r183945.
index afbb653..9db7fad 100644 (file)
@@ -61,8 +61,7 @@ static inline void freeSegment(char* p)
 #endif
 
 SharedBuffer::SharedBuffer()
-    : m_size(0)
-    , m_buffer(adoptRef(new DataBuffer))
+    : m_buffer(adoptRef(new DataBuffer))
 {
 }
 
@@ -73,15 +72,13 @@ SharedBuffer::SharedBuffer(unsigned size)
 }
 
 SharedBuffer::SharedBuffer(const char* data, unsigned size)
-    : m_size(0)
-    , m_buffer(adoptRef(new DataBuffer))
+    : m_buffer(adoptRef(new DataBuffer))
 {
     append(data, size);
 }
 
 SharedBuffer::SharedBuffer(const unsigned char* data, unsigned size)
-    : m_size(0)
-    , m_buffer(adoptRef(new DataBuffer))
+    : m_buffer(adoptRef(new DataBuffer))
 {
     append(reinterpret_cast<const char*>(data), size);
 }
index bcf3553..0455d79 100644 (file)
@@ -145,7 +145,7 @@ private:
     void duplicateDataBufferIfNecessary() const;
     void clearDataBuffer();
 
-    unsigned m_size;
+    unsigned m_size { 0 };
     mutable RefPtr<DataBuffer> m_buffer;
 
 #if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
index bbf185e..650b6a8 100644 (file)
@@ -33,8 +33,7 @@
 namespace WebCore {
 
 SharedBuffer::SharedBuffer(CFDataRef cfData)
-    : m_size(0)
-    , m_buffer(adoptRef(new DataBuffer))
+    : m_buffer(adoptRef(new DataBuffer))
     , m_cfData(cfData)
 {
 }
@@ -116,8 +115,7 @@ PassRefPtr<SharedBuffer> SharedBuffer::wrapCFDataArray(CFArrayRef cfDataArray)
 }
 
 SharedBuffer::SharedBuffer(CFArrayRef cfDataArray)
-    : m_size(0)
-    , m_buffer(adoptRef(new DataBuffer))
+    : m_buffer(adoptRef(new DataBuffer))
     , m_cfData(nullptr)
 {
     CFIndex dataArrayCount = CFArrayGetCount(cfDataArray);
index 29bcdb7..06b3aec 100644 (file)
@@ -27,8 +27,7 @@
 namespace WebCore {
 
 SharedBuffer::SharedBuffer(SoupBuffer* soupBuffer)
-    : m_size(0)
-    , m_buffer(adoptRef(new DataBuffer))
+    : m_buffer(adoptRef(new DataBuffer))
     , m_soupBuffer(soupBuffer)
 {
     ASSERT(soupBuffer);