Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1498

strnlen in bsoninlines.h ambiguous with system strnlen in context dependent ways

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.7
    • Affects Version/s: 1.5.6
    • Component/s: Internal Client
    • Labels:
      None
    • Environment:
      all with strnlen extension
    • Linux

      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.

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: