platform_hacks.h functions require a cast from void * to char * in C++ compilers

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 0.2
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      ubuntu server 32bit
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Compiling the drivers causes a compiler error on c++ compilers (or at least, g++):

      In file included from /home/orlando/projects/node-mongodb/mongo-c-driver/src/bson.h:6,
      from ../bson.cc:4:
      /home/orlando/projects/node-mongodb/mongo-c-driver/src/platform_hacks.h:24:2: error: #error must have a 64bit int type
      In file included from /home/orlando/projects/node-mongodb/mongo-c-driver/src/bson.h:6,
      from ../bson.cc:4:
      /home/orlando/projects/node-mongodb/mongo-c-driver/src/platform_hacks.h: In function 'void bson_swap_endian64(void*, const void*)':
      /home/orlando/projects/node-mongodb/mongo-c-driver/src/platform_hacks.h:50: error: invalid conversion from 'const void*' to 'const char*'
      /home/orlando/projects/node-mongodb/mongo-c-driver/src/platform_hacks.h:51: error: invalid conversion from 'void*' to 'char*'
      /home/orlando/projects/node-mongodb/mongo-c-driver/src/platform_hacks.h: In function 'void bson_swap_endian32(void*, const void*)':
      /home/orlando/projects/node-mongodb/mongo-c-driver/src/platform_hacks.h:64: error: invalid conversion from 'const void*' to 'const char*'
      /home/orlando/projects/node-mongodb/mongo-c-driver/src/platform_hacks.h:65: error: invalid conversion from 'void*' to 'char*'

      Explicitly casting the arguments of these functions to (char *) seems to make it work.

            Assignee:
            Mathias Stearn
            Reporter:
            Orlando Vazquez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: