[webkit-reviews] review granted: [Bug 225971] Drop "get" prefix from SQLiteStatement member functions as well as out-parameters : [Attachment 429056] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed May 19 11:22:14 PDT 2021


Darin Adler <darin at apple.com> has granted Chris Dumez <cdumez at apple.com>'s
request for review:
Bug 225971: Drop "get" prefix from SQLiteStatement member functions as well as
out-parameters
https://bugs.webkit.org/show_bug.cgi?id=225971

Attachment 429056: Patch

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




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

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

> Source/WebCore/platform/sql/SQLiteStatement.cpp:287
> +    Vector<uint8_t> result;

I think we should declare this later and just return { } in earlier return
statements.

> Source/WebCore/platform/sql/SQLiteStatement.cpp:304
> +    result.resize(static_cast<size_t>(blobSize));
> +    memcpy(result.data(), blob, static_cast<size_t>(blobSize));
> +    return result;

To construct a vector with a copy of the data, we shouldn’t use resize. I wish
there was a suitable Vector constructor so you could write this:

    return { blob, static_cast<size_t>(blobSize) };

But instead we need to write this:

    Vector<uint8_t> result;
    result.reserveInitialCapacity(blobSize);
    result.append(blob, blobSize);
    return result;

Also maybe we should consider having this return FixedVector in the future?


More information about the webkit-reviews mailing list