Diff
Modified: trunk/Source/WTF/ChangeLog (160385 => 160386)
--- trunk/Source/WTF/ChangeLog 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Source/WTF/ChangeLog 2013-12-10 21:48:06 UTC (rev 160386)
@@ -1,3 +1,16 @@
+2013-12-10 Laszlo Vidacs <[email protected]>
+
+ Use std::array when computing MD5 checksum
+ https://bugs.webkit.org/show_bug.cgi?id=125509
+
+ Reviewed by Anders Carlsson.
+
+ Added MD5::Digest type and MD5::hashSize for computing MD5 checksum.
+
+ * wtf/MD5.cpp:
+ (WTF::MD5::checksum):
+ * wtf/MD5.h:
+
2013-12-10 Martin Robinson <[email protected]>
Various fixes for the CMake GTK+ build
Modified: trunk/Source/WTF/wtf/MD5.cpp (160385 => 160386)
--- trunk/Source/WTF/wtf/MD5.cpp 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Source/WTF/wtf/MD5.cpp 2013-12-10 21:48:06 UTC (rev 160386)
@@ -219,7 +219,7 @@
memcpy(m_in, buf, length);
}
-void MD5::checksum(Vector<uint8_t, 16>& digest)
+void MD5::checksum(Digest& digest)
{
// Compute number of bytes mod 64
unsigned count = (m_bits[0] >> 3) & 0x3F;
@@ -256,9 +256,9 @@
reverseBytes(reinterpret_cast<uint8_t*>(m_buf), 4);
// Now, m_buf contains checksum result.
- if (!digest.isEmpty())
- digest.clear();
- digest.append(reinterpret_cast<uint8_t*>(m_buf), 16);
+ uint8_t* mBufUInt8 = reinterpret_cast<uint8_t*>(m_buf);
+ for (size_t i = 0; i < hashSize; ++i)
+ digest[i] = mBufUInt8[i];
// In case it's sensitive
memset(m_buf, 0, sizeof(m_buf));
Modified: trunk/Source/WTF/wtf/MD5.h (160385 => 160386)
--- trunk/Source/WTF/wtf/MD5.h 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Source/WTF/wtf/MD5.h 2013-12-10 21:48:06 UTC (rev 160386)
@@ -31,6 +31,7 @@
#ifndef WTF_MD5_h
#define WTF_MD5_h
+#include <array>
#include <wtf/Vector.h>
namespace WTF {
@@ -45,8 +46,14 @@
}
WTF_EXPORT_PRIVATE void addBytes(const uint8_t* input, size_t length);
+ // Size of the SHA1 hash
+ WTF_EXPORT_PRIVATE static const size_t hashSize = 16;
+
+ // type for computing MD5 hash
+ typedef std::array<uint8_t, hashSize> Digest;
+
// checksum has a side effect of resetting the state of the object.
- WTF_EXPORT_PRIVATE void checksum(Vector<uint8_t, 16>&);
+ WTF_EXPORT_PRIVATE void checksum(Digest&);
private:
uint32_t m_buf[4];
Modified: trunk/Source/WebCore/ChangeLog (160385 => 160386)
--- trunk/Source/WebCore/ChangeLog 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Source/WebCore/ChangeLog 2013-12-10 21:48:06 UTC (rev 160386)
@@ -1,3 +1,15 @@
+2013-12-10 Laszlo Vidacs <[email protected]>
+
+ Use std::array when computing MD5 checksum
+ https://bugs.webkit.org/show_bug.cgi?id=125509
+
+ Reviewed by Anders Carlsson.
+
+ Use MD5::Digest type and MD5::hashSize when computing MD5 checksum.
+
+ * platform/network/curl/CurlCacheEntry.cpp:
+ (WebCore::CurlCacheEntry::generateBaseFilename):
+
2013-12-10 Mario Sanchez Prada <[email protected]>
[ATK] Expose splitter elements with ATK_ROLE_SEPARATOR
Modified: trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp (160385 => 160386)
--- trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Source/WebCore/platform/network/curl/CurlCacheEntry.cpp 2013-12-10 21:48:06 UTC (rev 160386)
@@ -206,11 +206,11 @@
MD5 md5;
md5.addBytes(reinterpret_cast<const uint8_t*>(url.data()), url.length());
- Vector<uint8_t, 16> sum;
+ MD5::Digest sum;
md5.checksum(sum);
uint8_t* rawdata = sum.data();
- for (unsigned i = 0; i < 16; i++)
+ for (size_t i = 0; i < MD5::hasSize; i++)
appendByteAsHex(rawdata[i], m_basename, Lowercase);
}
Modified: trunk/Tools/ChangeLog (160385 => 160386)
--- trunk/Tools/ChangeLog 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Tools/ChangeLog 2013-12-10 21:48:06 UTC (rev 160386)
@@ -1,3 +1,23 @@
+2013-12-10 Laszlo Vidacs <[email protected]>
+
+ Use std::array when computing MD5 checksum
+ https://bugs.webkit.org/show_bug.cgi?id=125509
+
+ Reviewed by Anders Carlsson.
+
+ Use MD5::Digest type and MD5::hashSize when computing MD5 checksum.
+
+ * DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp:
+ (computeMD5HashStringForBitmapContext):
+ * DumpRenderTree/cairo/PixelDumpSupportCairo.cpp:
+ (computeMD5HashStringForBitmapContext):
+ * TestWebKitAPI/Tests/WTF/MD5.cpp:
+ (TestWebKitAPI::expectMD5):
+ * WebKitTestRunner/cairo/TestInvocationCairo.cpp:
+ (WTR::computeMD5HashStringForCairoSurface):
+ * WebKitTestRunner/cg/TestInvocationCG.cpp:
+ (WTR::computeMD5HashStringForContext):
+
2013-12-10 Mario Sanchez Prada <[email protected]>
[ATK] Expose splitter elements with ATK_ROLE_SEPARATOR
Modified: trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp (160385 => 160386)
--- trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp 2013-12-10 21:48:06 UTC (rev 160386)
@@ -84,11 +84,11 @@
pixelData += bytesPerRow;
}
- Vector<uint8_t, 16> hash;
+ MD5::Digest hash;
md5.checksum(hash);
hashString[0] = '\0';
- for (int i = 0; i < 16; ++i)
+ for (size_t i = 0; i < MD5::hashSize; ++i)
snprintf(hashString, 33, "%s%02x", hashString, hash[i]);
}
Modified: trunk/Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp (160385 => 160386)
--- trunk/Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp 2013-12-10 21:48:06 UTC (rev 160386)
@@ -78,7 +78,7 @@
md5Context.addBytes(bitmapData, 4 * pixelsWide);
bitmapData += bytesPerRow;
}
- Vector<uint8_t, 16> hash;
+ MD5::Digest hash;
md5Context.checksum(hash);
snprintf(hashString, 33, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/MD5.cpp (160385 => 160386)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/MD5.cpp 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/MD5.cpp 2013-12-10 21:48:06 UTC (rev 160386)
@@ -21,12 +21,12 @@
{
MD5 md5;
md5.addBytes(reinterpret_cast<const uint8_t*>(input.data()), input.length());
- Vector<uint8_t, 16> digest;
+ MD5::Digest digest;
md5.checksum(digest);
char* buf = 0;
CString actual = CString::newUninitialized(32, buf);
- for (size_t i = 0; i < 16; i++, buf += 2)
- snprintf(buf, 3, "%02x", digest.at(i));
+ for (size_t i = 0; i < MD5::hashSize; i++, buf += 2)
+ snprintf(buf, 3, "%02x", digest[i]);
ASSERT_EQ(expected.length(), actual.length());
ASSERT_STREQ(expected.data(), actual.data());
Modified: trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp (160385 => 160386)
--- trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp 2013-12-10 21:48:06 UTC (rev 160386)
@@ -55,7 +55,7 @@
md5Context.addBytes(bitmapData, 4 * pixelsWide);
bitmapData += bytesPerRow;
}
- Vector<uint8_t, 16> hash;
+ MD5::Digest hash;
md5Context.checksum(hash);
snprintf(hashString, 33, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
Modified: trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp (160385 => 160386)
--- trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp 2013-12-10 21:39:59 UTC (rev 160385)
+++ trunk/Tools/WebKitTestRunner/cg/TestInvocationCG.cpp 2013-12-10 21:48:06 UTC (rev 160386)
@@ -99,11 +99,11 @@
}
}
- Vector<uint8_t, 16> hash;
+ MD5::Digest hash;
md5.checksum(hash);
-
+
hashString[0] = '\0';
- for (int i = 0; i < 16; i++)
+ for (size_t i = 0; i < MD5::hashSize; i++)
snprintf(hashString, 33, "%s%02x", hashString, hash[i]);
}