Skip to content

Commit 724948b

Browse files
committed
CDRIVER-756: Make sure our iovec abstraction is compatible with Windows WSABUF
We cast mongoc_iovec_t to LPWSABUF in our sendmsg() wrapper
1 parent 715e620 commit 724948b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/mongoc/mongoc-iovec.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121

2222
#include <bson.h>
2323

24-
#ifndef _WIN32
24+
#ifdef _WIN32
25+
# include <stddef.h>
26+
#else
2527
# include <sys/uio.h>
2628
#endif
2729

28-
2930
BSON_BEGIN_DECLS
3031

3132

@@ -35,6 +36,11 @@ typedef struct
3536
u_long iov_len;
3637
char *iov_base;
3738
} mongoc_iovec_t;
39+
40+
BSON_STATIC_ASSERT(sizeof(mongoc_iovec_t) == sizeof(WSABUF));
41+
BSON_STATIC_ASSERT(offsetof(mongoc_iovec_t, iov_base) == offsetof(WSABUF, buf));
42+
BSON_STATIC_ASSERT(offsetof(mongoc_iovec_t, iov_len) == offsetof(WSABUF, len));
43+
3844
#else
3945
typedef struct iovec mongoc_iovec_t;
4046
#endif

0 commit comments

Comments
 (0)