Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-1145

Fix development build warnings for numeric type conversions

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.0
    • Affects Version/s: 1.3.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      PHP 5.5, clang compiler

      Most of these likely date back to 1.3.0 (APM files) or earlier:

      /Users/katherinewalker/drivers/driver-mongo-php/src/bson.c:191:161: error: format specifies type 'unsigned char' but the argument has type
            'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
        ...TSRMLS_CC, "Detected unknown BSON type 0x%02hhx for field path \"%s\". Are you using the latest driver?", v_type_code, path_string);
                                                    ~~~~~~                                                           ^~~~~~~~~~~
                                                    %02x
      
      /Users/katherinewalker/drivers/driver-mongo-php/src/BSON/DBPointer.c:40:18: error: comparison of integers of different signs: 'unsigned long'
            and 'int' [-Werror,-Wsign-compare]
              if (strlen(ref) != ref_len) {
                  ~~~~~~~~~~~ ^  ~~~~~~~
      
      /Users/katherinewalker/drivers/driver-mongo-php/src/BSON/Javascript.c:45:19: error: comparison of integers of different signs: 'unsigned long'
            and 'int' [-Werror,-Wsign-compare]
              if (strlen(code) != code_len) {
      
      /Users/katherinewalker/drivers/driver-mongo-php/src/BSON/Regex.c:49:22: error: comparison of integers of different signs: 'unsigned long' and
            'int' [-Werror,-Wsign-compare]
              if (strlen(pattern) != pattern_len) {
                  ~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/BSON/Regex.c:57:21: error: comparison of integers of different signs: 'unsigned long' and
            'int' [-Werror,-Wsign-compare]
                      if (strlen(flags) != flags_len) {
                          ~~~~~~~~~~~~~ ^  ~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/BSON/Timestamp.c:40:153: error: format specifies type 'long' but the argument has type
            'int64_t' (aka 'long long') [-Werror,-Wformat]
        ...TSRMLS_CC, "Expected increment to be an unsigned 32-bit integer, %" PHONGO_LONG_FORMAT " given", increment);
                                                                            ~~~                             ^~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/BSON/Timestamp.c:45:153: error: format specifies type 'long' but the argument has type
            'int64_t' (aka 'long long') [-Werror,-Wformat]
        ...TSRMLS_CC, "Expected timestamp to be an unsigned 32-bit integer, %" PHONGO_LONG_FORMAT " given", timestamp);
                                                                            ~~~                             ^~~~~~~~~
      
      /Users/katherinewalker/drivers/driver-mongo-php/src/BSON/Symbol.c:40:21: error: comparison of integers of different signs: 'unsigned long' and
            'int' [-Werror,-Wsign-compare]
              if (strlen(symbol) != symbol_len) {
                  ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~
      
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandFailedEvent.c:99:49: error: format specifies type 'long' but the
            argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->operation_id);
                                      ~~~                    ^~~~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandFailedEvent.c:118:49: error: format specifies type 'long' but the
            argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->request_id);
                                      ~~~                    ^~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandFailedEvent.c:229:48: error: format specifies type 'long' but the
            argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(operation_id, "%" PHONGO_LONG_FORMAT, intern->operation_id);
                                     ~~~                    ^~~~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandFailedEvent.c:232:46: error: format specifies type 'long' but the
            argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(request_id, "%" PHONGO_LONG_FORMAT, intern->request_id);
                                   ~~~                    ^~~~~~~~~~~~~~~~~~
      
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandStartedEvent.c:101:49: error: format specifies type 'long' but
            the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->operation_id);
                                      ~~~                    ^~~~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandStartedEvent.c:120:49: error: format specifies type 'long' but
            the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->request_id);
                                      ~~~                    ^~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandStartedEvent.c:233:48: error: format specifies type 'long' but
            the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(operation_id, "%" PHONGO_LONG_FORMAT, intern->operation_id);
                                     ~~~                    ^~~~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandStartedEvent.c:236:46: error: format specifies type 'long' but
            the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(request_id, "%" PHONGO_LONG_FORMAT, intern->request_id);
                                   ~~~                    ^~~~~~~~~~~~~~~~~~
      
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandSucceededEvent.c:78:49: error: format specifies type 'long' but
            the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->operation_id);
                                      ~~~                    ^~~~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandSucceededEvent.c:120:49: error: format specifies type 'long' but
            the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->request_id);
                                      ~~~                    ^~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandSucceededEvent.c:223:48: error: format specifies type 'long' but
            the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(operation_id, "%" PHONGO_LONG_FORMAT, intern->operation_id);
                                     ~~~                    ^~~~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandSucceededEvent.c:233:46: error: format specifies type 'long' but
            the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(request_id, "%" PHONGO_LONG_FORMAT, intern->request_id);
                                   ~~~                    ^~~~~~~~~~~~~~~~~~
      
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandFailedEvent.c:99:49: error: format specifies type 'long' but the
            argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->operation_id);
                                      ~~~                    ^~~~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandFailedEvent.c:118:49: error: format specifies type 'long' but the
            argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->request_id);
                                      ~~~                    ^~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandFailedEvent.c:229:48: error: format specifies type 'long' but the
            argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(operation_id, "%" PHONGO_LONG_FORMAT, intern->operation_id);
                                     ~~~                    ^~~~~~~~~~~~~~~~~~~~
      /Users/katherinewalker/drivers/driver-mongo-php/src/MongoDB/Monitoring/CommandFailedEvent.c:232:46: error: format specifies type 'long' but the
            argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
              sprintf(request_id, "%" PHONGO_LONG_FORMAT, intern->request_id);
      

            Assignee:
            katherine.walker@mongodb.com Katherine Walker (Inactive)
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: