Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8cfeaec

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 ab89e46 commit 8cfeaec

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/backend/access/transam/xlog.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5044,7 +5044,7 @@ BootStrapXLOG(void)
50445044
record->xl_rmid = RM_XLOG_ID;
50455045
recptr += SizeOfXLogRecord;
50465046
/* fill the XLogRecordDataHeaderShort struct */
5047-
*(recptr++) = XLR_BLOCK_ID_DATA_SHORT;
5047+
*(recptr++) = (char) XLR_BLOCK_ID_DATA_SHORT;
50485048
*(recptr++) = sizeof(checkPoint);
50495049
memcpy(recptr, &checkPoint, sizeof(checkPoint));
50505050
recptr += sizeof(checkPoint);

src/backend/access/transam/xloginsert.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
739739
if ((curinsert_flags & XLOG_INCLUDE_ORIGIN) &&
740740
replorigin_session_origin != InvalidRepOriginId)
741741
{
742-
*(scratch++) = XLR_BLOCK_ID_ORIGIN;
742+
*(scratch++) = (char) XLR_BLOCK_ID_ORIGIN;
743743
memcpy(scratch, &replorigin_session_origin, sizeof(replorigin_session_origin));
744744
scratch += sizeof(replorigin_session_origin);
745745
}
@@ -749,13 +749,13 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
749749
{
750750
if (mainrdata_len > 255)
751751
{
752-
*(scratch++) = XLR_BLOCK_ID_DATA_LONG;
752+
*(scratch++) = (char) XLR_BLOCK_ID_DATA_LONG;
753753
memcpy(scratch, &mainrdata_len, sizeof(uint32));
754754
scratch += sizeof(uint32);
755755
}
756756
else
757757
{
758-
*(scratch++) = XLR_BLOCK_ID_DATA_SHORT;
758+
*(scratch++) = (char) XLR_BLOCK_ID_DATA_SHORT;
759759
*(scratch++) = (uint8) mainrdata_len;
760760
}
761761
rdt_datas_last->next = mainrdata_head;

src/bin/pg_resetwal/pg_resetwal.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ WriteEmptyXLOG(void)
10951095
record->xl_rmid = RM_XLOG_ID;
10961096

10971097
recptr += SizeOfXLogRecord;
1098-
*(recptr++) = XLR_BLOCK_ID_DATA_SHORT;
1098+
*(recptr++) = (char) XLR_BLOCK_ID_DATA_SHORT;
10991099
*(recptr++) = sizeof(CheckPoint);
11001100
memcpy(recptr, &ControlFile.checkPointCopy,
11011101
sizeof(CheckPoint));

0 commit comments

Comments
 (0)