Unverified Commit 02320e72 authored by Roland Hieber's avatar Roland Hieber Committed by Kevin Albertson
Browse files

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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment