[webkit-reviews] review granted: [Bug 213034] Suppress compiler warnings : [Attachment 401555] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 10 10:59:55 PDT 2020


Darin Adler <darin at apple.com> has granted Víctor M. Jáquez L.
<vjaquez at igalia.com>'s request for review:
Bug 213034: Suppress compiler warnings
https://bugs.webkit.org/show_bug.cgi?id=213034

Attachment 401555: Patch

https://bugs.webkit.org/attachment.cgi?id=401555&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 401555
  --> https://bugs.webkit.org/attachment.cgi?id=401555
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=401555&action=review

r=me but please consider moving the cast to size_t and doing a follow-up change
to FileSystem.

> Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp:781
> +    LOG(IndexedDB, "UniqueIDBDatabase::putOrAdd quota check with task size:
%" PRIu64 " key size: %" PRIu64 " value size: %" PRIu64 " index size: %"
PRIu64, taskSize, keySize, valueSize, indexSize);

This is clearly right.

> Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp:154
> +	   if (static_cast<std::size_t>(bytesRead) == salt.size())

Seems to me that this points to a design mistake, and I am not sure that it’s
good to quiet the warning here. Doing the cast here is only safe because we
know the number is small enough to fit into size_t. And since the
FileSystem::readFromFile function reads data into memory, by definition can’t
read a number of bytes that won’t fit into a size_t. But that should be encoded
by making the return type of the function be a size_t, not by adding casts. I
don’t know what other problems there might be if we made that change.

Maybe we should move the static_cast to the line that calls readFromFile and
then file a follow-up bug about changing the return type of that function.

> Source/WebKit/NetworkProcess/cache/NetworkCacheData.cpp:162
> +    bool success = static_cast<std::size_t>(FileSystem::writeToFile(file,
reinterpret_cast<char*>(salt.data()), salt.size())) == salt.size();

Ditto: Here it’s better because the cast is right where we call writeToFile,
but I think we need that follow-up.


More information about the webkit-reviews mailing list