[CDRIVER-968] Bugs and typos on tutorial examples Created: 28/Oct/15 Updated: 19/Oct/16 Resolved: 30/Oct/15 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | docs |
| Affects Version/s: | 1.2.0 |
| Fix Version/s: | 1.3.0 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Iago Rubio | Assignee: | Hannes Magnusson |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
As for my conversation with Hannes on the dev group - https://groups.google.com/forum/#!topic/mongodb-dev/GmBettxisD4 - I am going to post here typos and gliches on the Tutorial examples at http://api.mongodb.org/c/1.2.0/tutorial.html . Some are bugs that break compilation, and other are quite pedantic warnings that break compilation only if using -Wall -Werror. I am going to identify them in my description - as Bug or Warning - so if you want to avoid the warnings you can easily identify them. Attached there are a set of files with the original file "fname.c.orig", the proposed fix "fname.c", and a patch "fname.patch" with the differences to easily check them. "Bug on 'connect' Example" The variable insert is declared as bson_t and then assigned the return value of BCON_NEW that returns a pointer. connect.c: In function ‘main’: connect.c:51:11: error: incompatible types when assigning to type ‘bson_t’ from type ‘struct bson_t *’ Fixed by declaring the "insert" variable as a pointer. "Bug in 'appending bson'
The variable "b" at line 34 should be "document". 'Bug in "Using BCON"'
The "str" variable should be declared as char *. 'Warnings on "BCON from json"'
The second argument to main is a pointer to char. It should be a pointer to a char array.
There is a non-issue signedness problem on bson_new_from_json. Just pointing it here as it breaks on -Werror. Non-issue Warning on "insert" and "delete". Unused variable cursor. 'Bugs and warnings on "count"' Appart for the signedness warning on bson_new_from_json, there are some missing parameters on that function.
The API reference shows the signature:
It should be:
'Bug - wrong parameter - on bson_as_json'
The argument in that function should be "doc". To check the attached tarball would be easier than to follow this description. Hope this helps. Note: Looks like I have no permission to make attachments so I temporary uploaded the tarball https://iagorubio.com/~mongo/tutorial.tgz |
| Comments |
| Comment by Hannes Magnusson [ 30/Oct/15 ] |
|
Thanks for the review, and the fixes! We really appreciate the help. |
| Comment by Githook User [ 30/Oct/15 ] |
|
Author: {u'username': u'iagorubio', u'name': u'Iago Rubio', u'email': u'iago@iagorubio.com'}Message: |