@@ -35,7 +35,7 @@ extern void pq_sendfloat4(StringInfo buf, float4 f);
3535extern void pq_sendfloat8 (StringInfo buf , float8 f );
3636
3737/*
38- * Append an int8 to a StringInfo buffer, which already has enough space
38+ * Append a [u] int8 to a StringInfo buffer, which already has enough space
3939 * preallocated.
4040 *
4141 * The use of pg_restrict allows the compiler to optimize the code based on
@@ -47,55 +47,55 @@ extern void pq_sendfloat8(StringInfo buf, float8 f);
4747 * overly picky and demanding a * before a restrict.
4848 */
4949static inline void
50- pq_writeint8 (StringInfoData * pg_restrict buf , int8 i )
50+ pq_writeint8 (StringInfoData * pg_restrict buf , uint8 i )
5151{
52- int8 ni = i ;
52+ uint8 ni = i ;
5353
54- Assert (buf -> len + (int ) sizeof (int8 ) <= buf -> maxlen );
55- memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (int8 ));
56- buf -> len += sizeof (int8 );
54+ Assert (buf -> len + (int ) sizeof (uint8 ) <= buf -> maxlen );
55+ memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (uint8 ));
56+ buf -> len += sizeof (uint8 );
5757}
5858
5959/*
60- * Append an int16 to a StringInfo buffer, which already has enough space
60+ * Append a [u] int16 to a StringInfo buffer, which already has enough space
6161 * preallocated.
6262 */
6363static inline void
64- pq_writeint16 (StringInfoData * pg_restrict buf , int16 i )
64+ pq_writeint16 (StringInfoData * pg_restrict buf , uint16 i )
6565{
66- int16 ni = pg_hton16 (i );
66+ uint16 ni = pg_hton16 (i );
6767
68- Assert (buf -> len + (int ) sizeof (int16 ) <= buf -> maxlen );
69- memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (int16 ));
70- buf -> len += sizeof (int16 );
68+ Assert (buf -> len + (int ) sizeof (uint16 ) <= buf -> maxlen );
69+ memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (uint16 ));
70+ buf -> len += sizeof (uint16 );
7171}
7272
7373/*
74- * Append an int32 to a StringInfo buffer, which already has enough space
74+ * Append a [u] int32 to a StringInfo buffer, which already has enough space
7575 * preallocated.
7676 */
7777static inline void
78- pq_writeint32 (StringInfoData * pg_restrict buf , int32 i )
78+ pq_writeint32 (StringInfoData * pg_restrict buf , uint32 i )
7979{
80- int32 ni = pg_hton32 (i );
80+ uint32 ni = pg_hton32 (i );
8181
82- Assert (buf -> len + (int ) sizeof (int32 ) <= buf -> maxlen );
83- memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (int32 ));
84- buf -> len += sizeof (int32 );
82+ Assert (buf -> len + (int ) sizeof (uint32 ) <= buf -> maxlen );
83+ memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (uint32 ));
84+ buf -> len += sizeof (uint32 );
8585}
8686
8787/*
88- * Append an int64 to a StringInfo buffer, which already has enough space
88+ * Append a [u] int64 to a StringInfo buffer, which already has enough space
8989 * preallocated.
9090 */
9191static inline void
92- pq_writeint64 (StringInfoData * pg_restrict buf , int64 i )
92+ pq_writeint64 (StringInfoData * pg_restrict buf , uint64 i )
9393{
94- int64 ni = pg_hton64 (i );
94+ uint64 ni = pg_hton64 (i );
9595
96- Assert (buf -> len + (int ) sizeof (int64 ) <= buf -> maxlen );
97- memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (int64 ));
98- buf -> len += sizeof (int64 );
96+ Assert (buf -> len + (int ) sizeof (uint64 ) <= buf -> maxlen );
97+ memcpy ((char * pg_restrict ) (buf -> data + buf -> len ), & ni , sizeof (uint64 ));
98+ buf -> len += sizeof (uint64 );
9999}
100100
101101/*
@@ -127,41 +127,41 @@ pq_writestring(StringInfoData *pg_restrict buf, const char *pg_restrict str)
127127 pfree (p );
128128}
129129
130- /* append a binary int8 to a StringInfo buffer */
130+ /* append a binary [u] int8 to a StringInfo buffer */
131131static inline void
132- pq_sendint8 (StringInfo buf , int8 i )
132+ pq_sendint8 (StringInfo buf , uint8 i )
133133{
134- enlargeStringInfo (buf , sizeof (int8 ));
134+ enlargeStringInfo (buf , sizeof (uint8 ));
135135 pq_writeint8 (buf , i );
136136}
137137
138- /* append a binary int16 to a StringInfo buffer */
138+ /* append a binary [u] int16 to a StringInfo buffer */
139139static inline void
140- pq_sendint16 (StringInfo buf , int16 i )
140+ pq_sendint16 (StringInfo buf , uint16 i )
141141{
142- enlargeStringInfo (buf , sizeof (int16 ));
142+ enlargeStringInfo (buf , sizeof (uint16 ));
143143 pq_writeint16 (buf , i );
144144}
145145
146- /* append a binary int32 to a StringInfo buffer */
146+ /* append a binary [u] int32 to a StringInfo buffer */
147147static inline void
148- pq_sendint32 (StringInfo buf , int32 i )
148+ pq_sendint32 (StringInfo buf , uint32 i )
149149{
150- enlargeStringInfo (buf , sizeof (int32 ));
150+ enlargeStringInfo (buf , sizeof (uint32 ));
151151 pq_writeint32 (buf , i );
152152}
153153
154- /* append a binary int64 to a StringInfo buffer */
154+ /* append a binary [u] int64 to a StringInfo buffer */
155155static inline void
156- pq_sendint64 (StringInfo buf , int64 i )
156+ pq_sendint64 (StringInfo buf , uint64 i )
157157{
158- enlargeStringInfo (buf , sizeof (int64 ));
158+ enlargeStringInfo (buf , sizeof (uint64 ));
159159 pq_writeint64 (buf , i );
160160}
161161
162162/* append a binary byte to a StringInfo buffer */
163163static inline void
164- pq_sendbyte (StringInfo buf , int8 byt )
164+ pq_sendbyte (StringInfo buf , uint8 byt )
165165{
166166 pq_sendint8 (buf , byt );
167167}
@@ -172,18 +172,18 @@ pq_sendbyte(StringInfo buf, int8 byt)
172172 * This function is deprecated; prefer use of the functions above.
173173 */
174174static inline void
175- pq_sendint (StringInfo buf , int i , int b )
175+ pq_sendint (StringInfo buf , uint32 i , int b )
176176{
177177 switch (b )
178178 {
179179 case 1 :
180- pq_sendint8 (buf , (int8 ) i );
180+ pq_sendint8 (buf , (uint8 ) i );
181181 break ;
182182 case 2 :
183- pq_sendint16 (buf , (int16 ) i );
183+ pq_sendint16 (buf , (uint16 ) i );
184184 break ;
185185 case 4 :
186- pq_sendint32 (buf , (int32 ) i );
186+ pq_sendint32 (buf , (uint32 ) i );
187187 break ;
188188 default :
189189 elog (ERROR , "unsupported integer size %d" , b );
0 commit comments