Skip to content

Commit b43969b

Browse files
committed
CXX-1371 Pass b_timestamp fields to bson_append_timestamp in correct order
1 parent 3ba0d6f commit b43969b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/bsoncxx/builder/core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ void core::append(const types::b_int32& value) {
333333
void core::append(const types::b_timestamp& value) {
334334
stdx::string_view key = _impl->next_key();
335335

336-
bson_append_timestamp(_impl->back(), key.data(), key.length(), value.increment,
337-
value.timestamp);
336+
bson_append_timestamp(_impl->back(), key.data(), static_cast<std::int32_t>(key.length()),
337+
value.timestamp, value.increment);
338338
}
339339

340340
void core::append(const types::b_int64& value) {

src/bsoncxx/test/bson_builder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,13 @@ TEST_CASE("builder appends int32", "[bsoncxx::builder::stream]") {
337337
}
338338

339339
TEST_CASE("builder appends timestamp", "[bsoncxx::builder::stream]") {
340-
bson_t expected;
341-
bson_init(&expected);
342340
builder::stream::document b;
341+
types::b_timestamp foo{100, 1000};
342+
b << "foo" << foo;
343343

344-
bson_append_timestamp(&expected, "foo", -1, 100, 1000);
345-
346-
b << "foo" << types::b_timestamp{100, 1000};
344+
bson_t expected;
345+
bson_init(&expected);
346+
bson_append_timestamp(&expected, "foo", -1, foo.timestamp, foo.increment);
347347

348348
bson_eq_stream(&expected, b);
349349

0 commit comments

Comments
 (0)