Hackers,
The current code in checksum_impl.h does not play nice with -Wconversion
on gcc:
warning: conversion to 'uint16 {aka short unsigned int}' from 'uint32
{aka unsigned int}' may alter its value [-Wconversion]
return (checksum % 65535) + 1;
~~~~~~~~~~~~~~~~~~~^~~
It seems like an explicit cast to uint16 would be better?
Regards,
--
-David
da...@pgmasters.net
diff --git a/src/include/storage/checksum_impl.h
b/src/include/storage/checksum_impl.h
index 0f264dfe4c..b5a3e49e95 100644
--- a/src/include/storage/checksum_impl.h
+++ b/src/include/storage/checksum_impl.h
@@ -211,5 +211,5 @@ pg_checksum_page(char *page, BlockNumber blkno)
* Reduce to a uint16 (to fit in the pd_checksum field) with an offset
of
* one. That avoids checksums of zero, which seems like a good idea.
*/
- return (checksum % 65535) + 1;
+ return (uint16)((checksum % 65535) + 1);
}