Skip to content

Commit 4918069

Browse files
committed
MDEV-26195 fixup: Fix -Wconversion in innochecksum
1 parent ca501ff commit 4918069

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

extra/innochecksum.cc

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,14 @@ static void init_page_size(const byte* buf)
257257
+ FSP_SPACE_FLAGS);
258258

259259
if (fil_space_t::full_crc32(flags)) {
260-
const ulong ssize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
260+
const uint32_t ssize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
261261
srv_page_size_shift = UNIV_ZIP_SIZE_SHIFT_MIN - 1 + ssize;
262262
srv_page_size = 512U << ssize;
263263
physical_page_size = srv_page_size;
264264
return;
265265
}
266266

267-
const ulongssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
267+
const uint32_t ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
268268

269269
srv_page_size_shift = ssize
270270
? UNIV_ZIP_SIZE_SHIFT_MIN - 1 + ssize
@@ -428,12 +428,7 @@ static bool is_page_all_zeroes(
428428
with crypt_scheme encrypted
429429
@param[in] flags tablespace flags
430430
@retval true if page is corrupted otherwise false. */
431-
static
432-
bool
433-
is_page_corrupted(
434-
byte* buf,
435-
boolis_encrypted,
436-
ulint flags)
431+
static bool is_page_corrupted(byte *buf, bool is_encrypted, uint32_t flags)
437432
{
438433

439434
/* enable if page is corrupted. */
@@ -589,7 +584,7 @@ Rewrite the checksum for the page.
589584
@retval false : skip the rewrite as checksum stored match with
590585
calculated or page is doublwrite buffer.
591586
*/
592-
static bool update_checksum(byte* page, ulint flags)
587+
static bool update_checksum(byte* page, uint32_t flags)
593588
{
594589
ib_uint32_tchecksum = 0;
595590
byte stored1[4];/* get FIL_PAGE_SPACE_OR_CHKSUM field checksum */
@@ -697,7 +692,7 @@ write_file(
697692
const char* filename,
698693
FILE* file,
699694
byte* buf,
700-
ulintflags,
695+
uint32_tflags,
701696
fpos_t* pos)
702697
{
703698
booldo_update;
@@ -1365,7 +1360,7 @@ static int verify_checksum(
13651360
byte* buf,
13661361
boolis_encrypted,
13671362
unsigned long long* mismatch_count,
1368-
ulintflags)
1363+
uint32_tflags)
13691364
{
13701365
int exit_status = 0;
13711366
if (is_page_corrupted(buf, is_encrypted, flags)) {
@@ -1406,7 +1401,7 @@ rewrite_checksum(
14061401
byte* buf,
14071402
fpos_t* pos,
14081403
boolis_encrypted,
1409-
ulintflags)
1404+
uint32_tflags)
14101405
{
14111406
bool is_compressed = fil_space_t::is_compressed(flags);
14121407

@@ -1443,7 +1438,7 @@ int main(
14431438
/* size of file (has to be 64 bits) */
14441439
unsigned long long intsize = 0;
14451440
/* number of pages in file */
1446-
ulintpages;
1441+
uint32_tpages;
14471442

14481443
off_toffset = 0;
14491444
/* count the no. of page corrupted. */
@@ -1575,7 +1570,7 @@ int main(
15751570
from fsp_flags and encryption metadata from page 0 */
15761571
init_page_size(buf);
15771572

1578-
ulint flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + buf);
1573+
uint32_t flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + buf);
15791574

15801575
if (physical_page_size == UNIV_ZIP_SIZE_MIN) {
15811576
partial_page_read = false;
@@ -1643,19 +1638,16 @@ int main(
16431638
parse_page(buf, xdes, fil_page_type, is_encrypted);
16441639
}
16451640

1646-
pages = (ulint) (size / physical_page_size);
1641+
pages = (uint32_t) (size / physical_page_size);
16471642

16481643
if (just_count) {
1649-
if (read_from_stdin) {
1650-
fprintf(stderr, "Number of pages:" ULINTPF "\n", pages);
1651-
} else {
1652-
printf("Number of pages:" ULINTPF "\n", pages);
1653-
}
1644+
fprintf(read_from_stdin ? stderr : stdout,
1645+
"Number of pages:%u\n", pages);
16541646
continue;
16551647
} else if (verbose && !read_from_stdin) {
16561648
if (is_log_enabled) {
16571649
fprintf(log_file, "file %s = %llu bytes "
1658-
"(" ULINTPF " pages)\n", filename, size, pages);
1650+
"(%u pages)\n", filename, size, pages);
16591651
if (do_one_page) {
16601652
fprintf(log_file, "Innochecksum: "
16611653
"checking page::%llu;\n",
@@ -1850,7 +1842,7 @@ int main(
18501842
fprintf(log_file, "page::%llu "
18511843
"okay: %.3f%% done\n",
18521844
(cur_page_num - 1),
1853-
(float) cur_page_num / pages * 100);
1845+
(double) cur_page_num / pages * 100);
18541846
lastt = now;
18551847
}
18561848
}

0 commit comments

Comments
 (0)