Modified: trunk/Tools/ChangeLog (235928 => 235929)
--- trunk/Tools/ChangeLog 2018-09-12 02:42:35 UTC (rev 235928)
+++ trunk/Tools/ChangeLog 2018-09-12 04:50:09 UTC (rev 235929)
@@ -1,3 +1,14 @@
+2018-09-11 Fujii Hironori <[email protected]>
+
+ [Win][Clang][ImageDiff] Fix compilation error and warning of PlatformImageCairo.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=189496
+
+ Reviewed by Alex Christensen.
+
+ * ImageDiff/cairo/PlatformImageCairo.cpp:
+ (ImageDiff::PlatformImage::createFromStdin): Removed unnecessary ReadContext struct.
+ (ImageDiff::PlatformImage::writeAsPNGToStdout): Use '%lu' format type specifier for unsigned long.
+
2018-09-07 Dean Jackson <[email protected]>
Add and expose Internal features from WebKit
Modified: trunk/Tools/ImageDiff/cairo/PlatformImageCairo.cpp (235928 => 235929)
--- trunk/Tools/ImageDiff/cairo/PlatformImageCairo.cpp 2018-09-12 02:42:35 UTC (rev 235928)
+++ trunk/Tools/ImageDiff/cairo/PlatformImageCairo.cpp 2018-09-12 04:50:09 UTC (rev 235929)
@@ -29,30 +29,15 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef _WIN32
-#define FORMAT_SIZE_T "Iu"
-#else
-#define FORMAT_SIZE_T "zu"
-#endif
-
namespace ImageDiff {
std::unique_ptr<PlatformImage> PlatformImage::createFromStdin(size_t imageSize)
{
- struct ReadContext {
- char buffer[2048];
- unsigned long incomingBytes;
- unsigned long readBytes;
- } context { { }, imageSize, 0 };
-
cairo_surface_t* surface = cairo_image_surface_create_from_png_stream(
- [](void* closure, unsigned char* data, unsigned length) -> cairo_status_t {
- auto& context = *static_cast<ReadContext*>(closure);
- context.readBytes += length;
-
+ [](void*, unsigned char* data, unsigned length) -> cairo_status_t {
size_t readBytes = fread(data, 1, length, stdin);
return readBytes == length ? CAIRO_STATUS_SUCCESS : CAIRO_STATUS_READ_ERROR;
- }, &context);
+ }, nullptr);
if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
cairo_surface_destroy(surface);
@@ -122,7 +107,7 @@
context.writtenBytes += length;
return CAIRO_STATUS_SUCCESS;
}, &context);
- fprintf(stdout, "Content-Length: %" FORMAT_SIZE_T "\n", context.writtenBytes);
+ fprintf(stdout, "Content-Length: %lu\n", context.writtenBytes);
cairo_surface_write_to_png_stream(m_image,
[](void*, const unsigned char* data, unsigned length) -> cairo_status_t {
size_t writtenBytes = fwrite(data, 1, length, stdout);