Skip to content

Commit dcd4a6d

Browse files
committed
Use INT32 limit constants instead of INT/LONG
1 parent ba63cee commit dcd4a6d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

phongo_compat.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
# define ADD_ASSOC_INT64(zval, key, value) add_assoc_long(zval, key, value)
188188
#elif SIZEOF_PHONGO_LONG == 4
189189
# define ADD_INDEX_INT64(zval, index, value) \
190-
if (value > LONG_MAX || value < LONG_MIN) { \
190+
if (value > INT32_MAX || value < INT32_MIN) { \
191191
char *tmp; \
192192
int tmp_len; \
193193
mongoc_log(MONGOC_LOG_LEVEL_WARNING, MONGOC_LOG_DOMAIN, "Integer overflow detected on your platform: %lld", value); \
@@ -198,7 +198,7 @@
198198
add_index_long(zval, index, val); \
199199
}
200200
# define ADD_ASSOC_INT64(zval, key, value) \
201-
if (value > LONG_MAX || value < LONG_MIN) { \
201+
if (value > INT32_MAX || value < INT32_MIN) { \
202202
char *tmp; \
203203
int tmp_len; \
204204
mongoc_log(MONGOC_LOG_LEVEL_WARNING, MONGOC_LOG_DOMAIN, "Integer overflow detected on your platform: %lld", value); \

src/bson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
#if SIZEOF_PHONGO_LONG == 8
4545
# define BSON_APPEND_INT(b, key, keylen, val) \
46-
if (val > INT_MAX || val < INT_MIN) { \
46+
if (val > INT32_MAX || val < INT32_MIN) { \
4747
bson_append_int64(b, key, keylen, val); \
4848
} else { \
4949
bson_append_int32(b, key, keylen, val); \

0 commit comments

Comments
 (0)