RESOLVED FIXED 201476
Fix implicit conversion that loses precision
https://bugs.webkit.org/show_bug.cgi?id=201476
Summary Fix implicit conversion that loses precision
Keith Rollin
Reported 2019-09-04 16:01:56 PDT
Building for watchOS results in the following error: .../Source/WebCore/fileapi/NetworkSendQueue.cpp:66:42: error: implicit conversion loses integer precision: 'unsigned long long' to 'unsigned int' [-Werror,-Wshorten-64-to-32] enqueue(JSC::ArrayBuffer::create(byteLength, 1), 0, 0); Fix this with an ASSERT(isInBounds()) and a static_cast.
Attachments
Patch (2.01 KB, patch)
2019-09-04 16:05 PDT, Keith Rollin
no flags
Patch (2.04 KB, patch)
2019-09-05 02:44 PDT, Keith Rollin
no flags
Radar WebKit Bug Importer
Comment 1 2019-09-04 16:02:09 PDT
Keith Rollin
Comment 2 2019-09-04 16:05:49 PDT
Alex Christensen
Comment 3 2019-09-04 18:39:39 PDT
Comment on attachment 378023 [details] Patch WebKit style prefers "unsigned" over "unsigned int" I think it would look nicer if we instead changed the line before this: unsigned byteLength = blob.size();
youenn fablet
Comment 4 2019-09-04 23:04:02 PDT
Comment on attachment 378023 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=378023&action=review > Source/WebCore/fileapi/NetworkSendQueue.cpp:68 > + enqueue(JSC::ArrayBuffer::create(static_cast<unsigned int>(byteLength), 1), 0, 0); The ASSERT is unneeded, since byteLength is equal to 0. We could write it as: enqueue(JSC::ArrayBuffer::create(0, 1), 0, 0); But then the compiler will not know which ArrayBuffer::create to use. I guess typing 0 as unsigned will make things clearer.
Keith Rollin
Comment 5 2019-09-05 02:43:08 PDT
Youenn, I think you're saying to use the following? JSC::ArrayBuffer::create(0U, 1) I'm taking this route rather than Alex's suggestion, since his will still require a static_cast<>() at the point where byteLength is assigned. I also removed the ASSERT().
Keith Rollin
Comment 6 2019-09-05 02:44:02 PDT
WebKit Commit Bot
Comment 7 2019-09-05 03:53:42 PDT
Comment on attachment 378070 [details] Patch Clearing flags on attachment: 378070 Committed r249527: <https://trac.webkit.org/changeset/249527>
WebKit Commit Bot
Comment 8 2019-09-05 03:53:43 PDT
All reviewed patches have been landed. Closing bug.
Alex Christensen
Comment 9 2019-09-06 10:16:49 PDT
Comment on attachment 378070 [details] Patch Wow, this change is much better.
Note You need to log in before you can comment on or make changes to this bug.