Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2

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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 0.2
    • None
    • None
    • None
    • ubuntu server 32bit

    Description

      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.

      Attachments

        Activity

          People

            mathias@mongodb.com Mathias Stearn
            orlandov Orlando Vazquez
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: