[SERVER-1498] strnlen in bsoninlines.h ambiguous with system strnlen in context dependent ways Created: 27/Jul/10  Updated: 12/Jul/16  Resolved: 27/Jul/10

Status: Closed
Project: Core Server
Component/s: Internal Client
Affects Version/s: 1.5.6
Fix Version/s: 1.5.7

Type: Bug Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

all with strnlen extension


Operating System: Linux
Participants:

 Description   

Some systems provide strnlen of various forms. On my system, for instance, its signature is:

size_t strnlen(const char *s, size_t maxlen);

util/goodies.h also defines a version of strnlen, presumably to handle platforms where strnlen is not provided. However, its definition conflicts:

inline int strnlen( const char *s, int n ) ...

For some files, like bsoninlines.h, that don't include dependent headers, but reference strnlen, the resolved symbol will be the 'system' strnlen, and when included in other contexts, like where goodies.h is in the include chain, this will resolve as mongo::strnlen. If the intention is to use the mongo definition of strnlen, then the uses in these files should be namespace qualified.



 Comments   
Comment by auto [ 27/Jul/10 ]

Author:

{'login': 'acmorrow', 'name': 'Andrew C. Morrow', 'email': 'andrew.c.morrow@gmail.com'}

Message: SERVER-1498: qualify custom strnlen in bsoninlines, move impl

Comment by Andrew Morrow (Inactive) [ 27/Jul/10 ]

FYI, working on a fix, should have a pull request shortly.

Generated at Thu Feb 08 02:57:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.