Bug 213034

Summary: Suppress compiler warnings
Product: WebKit Reporter: Víctor M. Jáquez L. <vjaquez>
Component: New BugsAssignee: Víctor M. Jáquez L. <vjaquez>
Status: RESOLVED FIXED    
Severity: Normal CC: alecflett, aperez, beidson, cdumez, cgarcia, darin, ews-watchlist, ggaren, Hironori.Fujii, jsbell, ross.kirsling, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Víctor M. Jáquez L. 2020-06-10 10:34:11 PDT
Suppress some clang++ warnings.

This is also an update of https://bugs.webkit.org/show_bug.cgi?id=206235
Comment 1 Víctor M. Jáquez L. 2020-06-10 10:38:29 PDT
Created attachment 401555 [details]
Patch
Comment 2 Darin Adler 2020-06-10 10:59:55 PDT
Comment on attachment 401555 [details]
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.
Comment 3 Víctor M. Jáquez L. 2020-06-15 08:55:03 PDT
Created attachment 401900 [details]
Patch
Comment 4 EWS 2020-06-15 09:44:06 PDT
Committed r263041: <https://trac.webkit.org/changeset/263041>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 401900 [details].
Comment 5 Radar WebKit Bug Importer 2020-06-15 09:45:17 PDT
<rdar://problem/64366435>