@@ -35,7 +35,7 @@ extern void pq_sendfloat4(StringInfo buf, float4 f);
35
35
extern void pq_sendfloat8 (StringInfo buf , float8 f );
36
36
37
37
/*
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
39
39
* preallocated.
40
40
*
41
41
* 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);
47
47
* overly picky and demanding a * before a restrict.
48
48
*/
49
49
static inline void
50
- pq_writeint8 (StringInfoData * pg_restrict buf , int8 i )
50
+ pq_writeint8 (StringInfoData * pg_restrict buf , uint8 i )
51
51
{
52
- int8 ni = i ;
52
+ uint8 ni = i ;
53
53
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 );
57
57
}
58
58
59
59
/*
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
61
61
* preallocated.
62
62
*/
63
63
static inline void
64
- pq_writeint16 (StringInfoData * pg_restrict buf , int16 i )
64
+ pq_writeint16 (StringInfoData * pg_restrict buf , uint16 i )
65
65
{
66
- int16 ni = pg_hton16 (i );
66
+ uint16 ni = pg_hton16 (i );
67
67
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 );
71
71
}
72
72
73
73
/*
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
75
75
* preallocated.
76
76
*/
77
77
static inline void
78
- pq_writeint32 (StringInfoData * pg_restrict buf , int32 i )
78
+ pq_writeint32 (StringInfoData * pg_restrict buf , uint32 i )
79
79
{
80
- int32 ni = pg_hton32 (i );
80
+ uint32 ni = pg_hton32 (i );
81
81
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 );
85
85
}
86
86
87
87
/*
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
89
89
* preallocated.
90
90
*/
91
91
static inline void
92
- pq_writeint64 (StringInfoData * pg_restrict buf , int64 i )
92
+ pq_writeint64 (StringInfoData * pg_restrict buf , uint64 i )
93
93
{
94
- int64 ni = pg_hton64 (i );
94
+ uint64 ni = pg_hton64 (i );
95
95
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 );
99
99
}
100
100
101
101
/*
@@ -127,41 +127,41 @@ pq_writestring(StringInfoData *pg_restrict buf, const char *pg_restrict str)
127
127
pfree (p );
128
128
}
129
129
130
- /* append a binary int8 to a StringInfo buffer */
130
+ /* append a binary [u] int8 to a StringInfo buffer */
131
131
static inline void
132
- pq_sendint8 (StringInfo buf , int8 i )
132
+ pq_sendint8 (StringInfo buf , uint8 i )
133
133
{
134
- enlargeStringInfo (buf , sizeof (int8 ));
134
+ enlargeStringInfo (buf , sizeof (uint8 ));
135
135
pq_writeint8 (buf , i );
136
136
}
137
137
138
- /* append a binary int16 to a StringInfo buffer */
138
+ /* append a binary [u] int16 to a StringInfo buffer */
139
139
static inline void
140
- pq_sendint16 (StringInfo buf , int16 i )
140
+ pq_sendint16 (StringInfo buf , uint16 i )
141
141
{
142
- enlargeStringInfo (buf , sizeof (int16 ));
142
+ enlargeStringInfo (buf , sizeof (uint16 ));
143
143
pq_writeint16 (buf , i );
144
144
}
145
145
146
- /* append a binary int32 to a StringInfo buffer */
146
+ /* append a binary [u] int32 to a StringInfo buffer */
147
147
static inline void
148
- pq_sendint32 (StringInfo buf , int32 i )
148
+ pq_sendint32 (StringInfo buf , uint32 i )
149
149
{
150
- enlargeStringInfo (buf , sizeof (int32 ));
150
+ enlargeStringInfo (buf , sizeof (uint32 ));
151
151
pq_writeint32 (buf , i );
152
152
}
153
153
154
- /* append a binary int64 to a StringInfo buffer */
154
+ /* append a binary [u] int64 to a StringInfo buffer */
155
155
static inline void
156
- pq_sendint64 (StringInfo buf , int64 i )
156
+ pq_sendint64 (StringInfo buf , uint64 i )
157
157
{
158
- enlargeStringInfo (buf , sizeof (int64 ));
158
+ enlargeStringInfo (buf , sizeof (uint64 ));
159
159
pq_writeint64 (buf , i );
160
160
}
161
161
162
162
/* append a binary byte to a StringInfo buffer */
163
163
static inline void
164
- pq_sendbyte (StringInfo buf , int8 byt )
164
+ pq_sendbyte (StringInfo buf , uint8 byt )
165
165
{
166
166
pq_sendint8 (buf , byt );
167
167
}
@@ -172,18 +172,18 @@ pq_sendbyte(StringInfo buf, int8 byt)
172
172
* This function is deprecated; prefer use of the functions above.
173
173
*/
174
174
static inline void
175
- pq_sendint (StringInfo buf , int i , int b )
175
+ pq_sendint (StringInfo buf , uint32 i , int b )
176
176
{
177
177
switch (b )
178
178
{
179
179
case 1 :
180
- pq_sendint8 (buf , (int8 ) i );
180
+ pq_sendint8 (buf , (uint8 ) i );
181
181
break ;
182
182
case 2 :
183
- pq_sendint16 (buf , (int16 ) i );
183
+ pq_sendint16 (buf , (uint16 ) i );
184
184
break ;
185
185
case 4 :
186
- pq_sendint32 (buf , (int32 ) i );
186
+ pq_sendint32 (buf , (uint32 ) i );
187
187
break ;
188
188
default :
189
189
elog (ERROR , "unsupported integer size %d" , b );
0 commit comments