Skip to content

Commit e7cfb26

Browse files
committed
Fix warnings from cpluspluscheck
Fix warnings about "comparison between signed and unsigned integer expressions" in inline functions in header files by adding some casts.
1 parent 066bc21 commit e7cfb26

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/include/libpq/pqformat.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pq_writeint8(StringInfoData *pg_restrict buf, int8 i)
5151
{
5252
int8 ni = i;
5353

54-
Assert(buf->len + sizeof(int8) <= buf->maxlen);
54+
Assert(buf->len + (int) sizeof(int8) <= buf->maxlen);
5555
memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int8));
5656
buf->len += sizeof(int8);
5757
}
@@ -65,7 +65,7 @@ pq_writeint16(StringInfoData *pg_restrict buf, int16 i)
6565
{
6666
int16 ni = pg_hton16(i);
6767

68-
Assert(buf->len + sizeof(int16) <= buf->maxlen);
68+
Assert(buf->len + (int) sizeof(int16) <= buf->maxlen);
6969
memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int16));
7070
buf->len += sizeof(int16);
7171
}
@@ -79,7 +79,7 @@ pq_writeint32(StringInfoData *pg_restrict buf, int32 i)
7979
{
8080
int32 ni = pg_hton32(i);
8181

82-
Assert(buf->len + sizeof(int32) <= buf->maxlen);
82+
Assert(buf->len + (int) sizeof(int32) <= buf->maxlen);
8383
memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int32));
8484
buf->len += sizeof(int32);
8585
}
@@ -93,7 +93,7 @@ pq_writeint64(StringInfoData *pg_restrict buf, int64 i)
9393
{
9494
int64 ni = pg_hton64(i);
9595

96-
Assert(buf->len + sizeof(int64) <= buf->maxlen);
96+
Assert(buf->len + (int) sizeof(int64) <= buf->maxlen);
9797
memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(int64));
9898
buf->len += sizeof(int64);
9999
}

0 commit comments

Comments
 (0)