Bug 213034 - Suppress compiler warnings
Summary: Suppress compiler warnings
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Víctor M. Jáquez L.
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-10 10:34 PDT by Víctor M. Jáquez L.
Modified: 2020-06-15 09:45 PDT (History)
12 users (show)

See Also:


Attachments
Patch (3.91 KB, patch)
2020-06-10 10:38 PDT, Víctor M. Jáquez L.
no flags Details | Formatted Diff | Diff
Patch (4.15 KB, patch)
2020-06-15 08:55 PDT, Víctor M. Jáquez L.
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>