Skip to content

Commit bc569bc

Browse files
committed
CDRIVER-366: Update examples to compile using C++ compiler
1 parent 0aa9add commit bc569bc

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

examples/example-scram.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ main (int argc,
7171

7272
collection = mongoc_client_get_collection (client, "test", "test");
7373

74-
cursor = mongoc_collection_find (collection, 0, 0, 0, 0, &query, NULL, NULL);
74+
cursor = mongoc_collection_find (collection, (mongoc_query_flags_t)0, 0, 0, 0, &query, NULL, NULL);
7575

7676
mongoc_cursor_next (cursor, &doc);
7777

examples/mongoc-ping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ main (int argc,
5858
bson_init(&ping);
5959
bson_append_int32(&ping, "ping", 4, 1);
6060
database = mongoc_client_get_database(client, "test");
61-
cursor = mongoc_database_command(database, 0, 0, 1, 0, &ping, NULL, NULL);
61+
cursor = mongoc_database_command(database, (mongoc_query_flags_t)0, 0, 1, 0, &ping, NULL, NULL);
6262
if (mongoc_cursor_next(cursor, &reply)) {
6363
str = bson_as_json(reply, NULL);
6464
fprintf(stdout, "%s\n", str);

examples/mongoc-rpc-validate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ validate (const char *name) /* IN */
6767
exit (EXIT_FAILURE);
6868
}
6969

70-
buf = bson_malloc (st.st_size);
70+
buf = (uint8_t *)bson_malloc (st.st_size);
7171
if (buf == NULL) {
7272
fprintf (stderr, "%s: Failed to malloc %d bytes.\n",
7373
name, (int)st.st_size);

examples/mongoc-tail.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ query_collection (mongoc_collection_t *collection,
2626
mongoc_cursor_t *cursor;
2727
bson_t query;
2828
bson_t gt;
29+
int fflags = (MONGOC_QUERY_TAILABLE_CURSOR
30+
| MONGOC_QUERY_AWAIT_DATA
31+
| MONGOC_QUERY_SLAVE_OK);
2932

3033
BSON_ASSERT(collection);
3134

@@ -35,9 +38,7 @@ query_collection (mongoc_collection_t *collection,
3538
bson_append_document_end(&query, &gt);
3639

3740
cursor = mongoc_collection_find(collection,
38-
(MONGOC_QUERY_TAILABLE_CURSOR |
39-
MONGOC_QUERY_AWAIT_DATA |
40-
MONGOC_QUERY_SLAVE_OK),
41+
(mongoc_query_flags_t)fflags,
4142
0,
4243
0,
4344
0,

0 commit comments

Comments
 (0)