warnings introduced in http://trac.webkit.org/changeset/65135: 32 bit release build: ../../../WebCore/websockets/WebSocketChannel.cpp:218: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘size_t’ WebCore/websockets/WebSocketChannel.cpp:218: m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, String::format("WebSocket frame (at %lu bytes) is too long.", newBufferSize), 0, m_handshake.clientOrigin()); 32 bit debug build: ../../../WebCore/websockets/WebSocketChannel.cpp:205: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘size_t’ ../../../WebCore/websockets/WebSocketChannel.cpp:205: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘size_t’ ../../../WebCore/websockets/WebSocketChannel.cpp:218: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘size_t’ ../../../WebCore/websockets/WebSocketChannel.cpp:258: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘size_t’ ../../../WebCore/websockets/WebSocketChannel.cpp:280: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘size_t’ ../../../WebCore/websockets/WebSocketChannel.cpp:288: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘size_t’ ../../../WebCore/websockets/WebSocketChannel.cpp:294: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 3 has type ‘size_t’ ../../../WebCore/websockets/WebSocketChannel.cpp:294: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘size_t’ ../../../WebCore/websockets/WebSocketChannel.cpp:304: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘size_t’ 205: LOG(Network, "WebSocket buffer overflow (%lu+%lu)", m_bufferSize, len); 258: LOG(Network, "remaining in read buf %lu", m_bufferSize); 280: LOG(Network, "frame length overflow %lu", length); 288: LOG(Network, "frame length overflow %lu+%u", newLength, lengthMsgByte); 294: LOG(Network, "frame length integer wrap %lu->%lu", length, newLength); 304: LOG(Network, "frame buffer pointer wrap %p+%lu->%p", p, length, p + length); The problem is that size_t is unsigned int (4 bytes) and not unsigned long int (8 bytes) on 32 bit systems. Accordingly using %lu on 32 bit systems is incorrect, we have to use %u or %lu depends on sizeof(size_t) instead of hard coded %lu.
My first idea was replace %lu with %zu. But unfortunately Windows can't handle z modifier, but I. We can fix it with #if guards, but in my opinion it is too ugly: #if OS(WINDOWS) LOG( ... %Iu ... ); #else LOG( ... %zu ... ); #endif Have you got any idea how could we fix it correctly?
We could add a macro that expands to either %Iu or %zu, or we could cast the values to unsigned long.
Created attachment 64187 [details] Patch
Committed r65219: <http://trac.webkit.org/changeset/65219>