CDRIVER-4789 libbson: prevent -Werror=conversion with GCC 12 (#1479)
* libbson: prevent -Werror=conversion with GCC 12
Building fails with GCC 12.3:
bson-iter.h:434:33: error: conversion from 'int64_t' {aka 'long long int'} to '__suseconds_t' {aka 'long int'} may change value [-Werror=conversion]
434 | tv->tv_usec = (value % 1000) * 1000;
| ~~~~~~~~~~~~~~~^~~~~~
cc1plus: all warnings being treated as errors
Do the same as with tv->tv_sec, and explicitely cast it to suseconds_t
on non-Win32 systems and to long on Win32.
* use `time_t` in assignment to `tv_sec`
This matches specificiation in POSIX 2008.
parent
842f67b9
Please register or sign in to comment