• Mark Mentovai's avatar
    Remove variable-length arrays in the macOS disk image sniffer · e97cbfb0
    Mark Mentovai authored
    This enables compiling this code with -Wvla.
    
    safe_browsing::DiskImageTypeSnifferMac::AppleDiskImageTrailerSize was a
    non-constexpr function whose implementation was hidden in
    disk_image_type_sniffer_mac.cc, preventing its return value, no matter
    how constant it actually was, from being used to size arrays statically
    at compile time in other translation units, such as
    archive_analyzer_results.cc. This changes it to be a constexpr variable,
    kAppleDiskImageTrailerSize, which can be used to size arrays statically
    at compile time.
    
    Change-Id: I35d4582ce8446c9f90d8a6d8576c9d60115c5de8
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363069Reviewed-by: default avatarDaniel Rubery <drubery@chromium.org>
    Commit-Queue: Mark Mentovai <mark@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#799215}
    e97cbfb0
archive_analyzer_results.cc 7.02 KB