Skip to content

Commit 8433e0b

Browse files
committed
Suppress implicit-conversion warnings seen with newer clang versions.
We were assigning values near 255 through "char *" pointers. On machines where char is signed, that's not entirely kosher, and it's reasonable for compilers to warn about it. A better solution would be to change the pointer type to "unsigned char *", but that would be vastly more invasive. For the moment, let's just apply this simple backpatchable solution. Aleksander Alekseev Discussion: https://postgr.es/m/20170220141239.GD12278@e733.localdomain Discussion: https://postgr.es/m/2839.1490714708@sss.pgh.pa.us
1 parent c804c00 commit 8433e0b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4878,7 +4878,7 @@ BootStrapXLOG(void)
48784878
record->xl_rmid = RM_XLOG_ID;
48794879
recptr += SizeOfXLogRecord;
48804880
/* fill the XLogRecordDataHeaderShort struct */
4881-
*(recptr++) = XLR_BLOCK_ID_DATA_SHORT;
4881+
*(recptr++) = (char) XLR_BLOCK_ID_DATA_SHORT;
48824882
*(recptr++) = sizeof(checkPoint);
48834883
memcpy(recptr, &checkPoint, sizeof(checkPoint));
48844884
recptr += sizeof(checkPoint);

src/backend/access/transam/xloginsert.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
703703
/* followed by the record's origin, if any */
704704
if (include_origin && replorigin_session_origin != InvalidRepOriginId)
705705
{
706-
*(scratch++) = XLR_BLOCK_ID_ORIGIN;
706+
*(scratch++) = (char) XLR_BLOCK_ID_ORIGIN;
707707
memcpy(scratch, &replorigin_session_origin, sizeof(replorigin_session_origin));
708708
scratch += sizeof(replorigin_session_origin);
709709
}
@@ -713,13 +713,13 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
713713
{
714714
if (mainrdata_len > 255)
715715
{
716-
*(scratch++) = XLR_BLOCK_ID_DATA_LONG;
716+
*(scratch++) = (char) XLR_BLOCK_ID_DATA_LONG;
717717
memcpy(scratch, &mainrdata_len, sizeof(uint32));
718718
scratch += sizeof(uint32);
719719
}
720720
else
721721
{
722-
*(scratch++) = XLR_BLOCK_ID_DATA_SHORT;
722+
*(scratch++) = (char) XLR_BLOCK_ID_DATA_SHORT;
723723
*(scratch++) = (uint8) mainrdata_len;
724724
}
725725
rdt_datas_last->next = mainrdata_head;

src/bin/pg_resetxlog/pg_resetxlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ WriteEmptyXLOG(void)
11001100
record->xl_rmid = RM_XLOG_ID;
11011101

11021102
recptr += SizeOfXLogRecord;
1103-
*(recptr++) = XLR_BLOCK_ID_DATA_SHORT;
1103+
*(recptr++) = (char) XLR_BLOCK_ID_DATA_SHORT;
11041104
*(recptr++) = sizeof(CheckPoint);
11051105
memcpy(recptr, &ControlFile.checkPointCopy,
11061106
sizeof(CheckPoint));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy