[CDRIVER-1033] dbpointer not handled in bson-json.c Created: 03/Dec/15  Updated: 04/Dec/15  Resolved: 04/Dec/15

Status: Closed
Project: C Driver
Component/s: libbson
Affects Version/s: 1.3.0-rc0
Fix Version/s: 1.3.0

Type: Improvement Priority: Major - P3
Reporter: Hannes Magnusson Assignee: Hannes Magnusson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-973 JSON DBRef objects are incorrectly co... Closed

 Description   

src/bson/bson-json.c: In function '_bson_json_read_end_map':
src/bson/bson-json.c:836:7: warning: enumeration value 'BSON_TYPE_DBPOINTER' not handled in switch [-Wswitch-enum]
       switch (bson->bson_type) {
       ^

This appears to be legit warning?
Not sure what to do with dbpointers there.



 Comments   
Comment by Githook User [ 04/Dec/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-1033: dbpointer not handled in bson-json.c
Branch: master
https://github.com/mongodb/libbson/commit/769cc0818796ba4cadc419d152ccf0b48bf223ee

Comment by Hannes Magnusson [ 03/Dec/15 ]

Ok. If there is nothing to do for it, then yes, adding a case for it above default is sufficient

Comment by A. Jesse Jiryu Davis [ 03/Dec/15 ]

DBPointer has been deprecated for many years, and therefore there's no Extended JSON representation for DBPointers. The bson type will never be BSON_TYPE_DBPOINTER in that switch statement.

(Until I fixed CDRIVER-973, we did create DBPointers from Extended JSON, but that was a bug.)

Will this silence the warning?:

case BSON_TYPE_DBPOINTER:
default:
    /* ... default action ... */

Generated at Wed Feb 07 21:11:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.