diff options
Diffstat (limited to 'storage/innobase/page/page0zip.cc')
-rw-r--r-- | storage/innobase/page/page0zip.cc | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index ade9350dfa0..727e6c21653 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -31,14 +31,17 @@ Created June 2005 by Marko Makela #include "buf0checksum.h" #include "ut0crc32.h" #include "zlib.h" +#include "span.h" -#ifndef UNIV_INNOCHECKSUM +using st_::span; /** A BLOB field reference full of zero, for use in assertions and tests. Initially, BLOB field references are set to zero, in dtuple_convert_big_rec(). */ +alignas(UNIV_PAGE_SIZE_MIN) const byte field_ref_zero[UNIV_PAGE_SIZE_MAX] = { 0, }; +#ifndef UNIV_INNOCHECKSUM #include "mtr0log.h" #include "dict0dict.h" #include "btr0cur.h" @@ -4992,7 +4995,7 @@ page_zip_calc_checksum( @param data ROW_FORMAT=COMPRESSED page @param size size of the page, in bytes @return whether the stored checksum matches innodb_checksum_algorithm */ -bool page_zip_verify_checksum(const void *data, size_t size) +bool page_zip_verify_checksum(const byte *data, size_t size) { const srv_checksum_algorithm_t curr_algo = static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm); @@ -5001,17 +5004,12 @@ bool page_zip_verify_checksum(const void *data, size_t size) return true; } - for (size_t i = 0; i < size; i++) { - if (static_cast<const byte*>(data)[i] != 0) { - goto not_all_zeroes; - } + if (buf_is_zeroes(span<const byte>(data, size))) { + return true; } - return true; - -not_all_zeroes: const uint32_t stored = mach_read_from_4( - static_cast<const byte*>(data) + FIL_PAGE_SPACE_OR_CHKSUM); + data + FIL_PAGE_SPACE_OR_CHKSUM); uint32_t calc = page_zip_calc_checksum(data, size, curr_algo); |