Skip to content

Commit 14726af

Browse files
committed
Merge pull request #788
2 parents c01b2d8 + 225c0aa commit 14726af

File tree

9 files changed

+20
-20
lines changed

9 files changed

+20
-20
lines changed

src/BSON/DBPointer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ zend_class_entry* php_phongo_dbpointer_ce;
3737
* be thrown on error. */
3838
static bool php_phongo_dbpointer_init(php_phongo_dbpointer_t* intern, const char* ref, phongo_zpp_char_len ref_len, const char* id, phongo_zpp_char_len id_len TSRMLS_DC) /* {{{ */
3939
{
40-
if (strlen(ref) != ref_len) {
40+
if (strlen(ref) != (size_t) ref_len) {
4141
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Ref cannot contain null bytes");
4242
return false;
4343
}

src/BSON/Javascript.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static bool php_phongo_javascript_init(php_phongo_javascript_t* intern, const ch
4242
return false;
4343
}
4444

45-
if (strlen(code) != code_len) {
45+
if (strlen(code) != (size_t) code_len) {
4646
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Code cannot contain null bytes");
4747
return false;
4848
}

src/BSON/Regex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ static int php_phongo_regex_compare_flags(const void* f1, const void* f2) /* {{{
4646
* be thrown on error. */
4747
static bool php_phongo_regex_init(php_phongo_regex_t* intern, const char* pattern, phongo_zpp_char_len pattern_len, const char* flags, phongo_zpp_char_len flags_len TSRMLS_DC) /* {{{ */
4848
{
49-
if (strlen(pattern) != pattern_len) {
49+
if (strlen(pattern) != (size_t) pattern_len) {
5050
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Pattern cannot contain null bytes");
5151
return false;
5252
}
5353
intern->pattern = estrndup(pattern, pattern_len);
5454
intern->pattern_len = pattern_len;
5555

5656
if (flags) {
57-
if (strlen(flags) != flags_len) {
57+
if (strlen(flags) != (size_t) flags_len) {
5858
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Flags cannot contain null bytes");
5959
return false;
6060
}

src/BSON/Symbol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ zend_class_entry* php_phongo_symbol_ce;
3737
* be thrown on error. */
3838
static bool php_phongo_symbol_init(php_phongo_symbol_t* intern, const char* symbol, phongo_zpp_char_len symbol_len TSRMLS_DC) /* {{{ */
3939
{
40-
if (strlen(symbol) != symbol_len) {
40+
if (strlen(symbol) != (size_t) symbol_len) {
4141
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Symbol cannot contain null bytes");
4242
return false;
4343
}

src/BSON/Timestamp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ zend_class_entry* php_phongo_timestamp_ce;
3737
static bool php_phongo_timestamp_init(php_phongo_timestamp_t* intern, int64_t increment, int64_t timestamp TSRMLS_DC) /* {{{ */
3838
{
3939
if (increment < 0 || increment > UINT32_MAX) {
40-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected increment to be an unsigned 32-bit integer, %" PHONGO_LONG_FORMAT " given", increment);
40+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected increment to be an unsigned 32-bit integer, %" PRId64 " given", increment);
4141
return false;
4242
}
4343

4444
if (timestamp < 0 || timestamp > UINT32_MAX) {
45-
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected timestamp to be an unsigned 32-bit integer, %" PHONGO_LONG_FORMAT " given", timestamp);
45+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC, "Expected timestamp to be an unsigned 32-bit integer, %" PRId64 " given", timestamp);
4646
return false;
4747
}
4848

src/MongoDB/Monitoring/CommandFailedEvent.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ PHP_METHOD(CommandFailedEvent, getOperationId)
9696
return;
9797
}
9898

99-
sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->operation_id);
99+
sprintf(int_as_string, "%" PRIu64, intern->operation_id);
100100
PHONGO_RETVAL_STRING(int_as_string);
101101
} /* }}} */
102102

@@ -115,7 +115,7 @@ PHP_METHOD(CommandFailedEvent, getRequestId)
115115
return;
116116
}
117117

118-
sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->request_id);
118+
sprintf(int_as_string, "%" PRIu64, intern->request_id);
119119
PHONGO_RETVAL_STRING(int_as_string);
120120
} /* }}} */
121121

@@ -226,10 +226,10 @@ static HashTable* php_phongo_commandfailedevent_get_debug_info(zval* object, int
226226
Z_ADDREF_P(intern->z_error);
227227
#endif
228228

229-
sprintf(operation_id, "%" PHONGO_LONG_FORMAT, intern->operation_id);
229+
sprintf(operation_id, "%" PRIu64, intern->operation_id);
230230
ADD_ASSOC_STRING(&retval, "operationId", operation_id);
231231

232-
sprintf(request_id, "%" PHONGO_LONG_FORMAT, intern->request_id);
232+
sprintf(request_id, "%" PRIu64, intern->request_id);
233233
ADD_ASSOC_STRING(&retval, "requestId", request_id);
234234

235235
{

src/MongoDB/Monitoring/CommandStartedEvent.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ PHP_METHOD(CommandStartedEvent, getOperationId)
9898
return;
9999
}
100100

101-
sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->operation_id);
101+
sprintf(int_as_string, "%" PRIu64, intern->operation_id);
102102
PHONGO_RETVAL_STRING(int_as_string);
103103
} /* }}} */
104104

@@ -117,7 +117,7 @@ PHP_METHOD(CommandStartedEvent, getRequestId)
117117
return;
118118
}
119119

120-
sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->request_id);
120+
sprintf(int_as_string, "%" PRIu64, intern->request_id);
121121
PHONGO_RETVAL_STRING(int_as_string);
122122
} /* }}} */
123123

@@ -230,10 +230,10 @@ static HashTable* php_phongo_commandstartedevent_get_debug_info(zval* object, in
230230
ADD_ASSOC_STRING(&retval, "commandName", intern->command_name);
231231
ADD_ASSOC_STRING(&retval, "databaseName", intern->database_name);
232232

233-
sprintf(operation_id, "%" PHONGO_LONG_FORMAT, intern->operation_id);
233+
sprintf(operation_id, "%" PRIu64, intern->operation_id);
234234
ADD_ASSOC_STRING(&retval, "operationId", operation_id);
235235

236-
sprintf(request_id, "%" PHONGO_LONG_FORMAT, intern->request_id);
236+
sprintf(request_id, "%" PRIu64, intern->request_id);
237237
ADD_ASSOC_STRING(&retval, "requestId", request_id);
238238

239239
{

src/MongoDB/Monitoring/CommandSucceededEvent.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ PHP_METHOD(CommandSucceededEvent, getOperationId)
7575
return;
7676
}
7777

78-
sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->operation_id);
78+
sprintf(int_as_string, "%" PRIu64, intern->operation_id);
7979
PHONGO_RETVAL_STRING(int_as_string);
8080
} /* }}} */
8181

@@ -117,7 +117,7 @@ PHP_METHOD(CommandSucceededEvent, getRequestId)
117117
return;
118118
}
119119

120-
sprintf(int_as_string, "%" PHONGO_LONG_FORMAT, intern->request_id);
120+
sprintf(int_as_string, "%" PRIu64, intern->request_id);
121121
PHONGO_RETVAL_STRING(int_as_string);
122122
} /* }}} */
123123

@@ -220,7 +220,7 @@ static HashTable* php_phongo_commandsucceededevent_get_debug_info(zval* object,
220220
ADD_ASSOC_STRING(&retval, "commandName", intern->command_name);
221221
ADD_ASSOC_INT64(&retval, "durationMicros", (int64_t) intern->duration_micros);
222222

223-
sprintf(operation_id, "%" PHONGO_LONG_FORMAT, intern->operation_id);
223+
sprintf(operation_id, "%" PRIu64, intern->operation_id);
224224
ADD_ASSOC_STRING(&retval, "operationId", operation_id);
225225

226226
php_phongo_bson_to_zval_ex(bson_get_data(intern->reply), intern->reply->len, &reply_state);
@@ -230,7 +230,7 @@ static HashTable* php_phongo_commandsucceededevent_get_debug_info(zval* object,
230230
ADD_ASSOC_ZVAL(&retval, "reply", reply_state.zchild);
231231
#endif
232232

233-
sprintf(request_id, "%" PHONGO_LONG_FORMAT, intern->request_id);
233+
sprintf(request_id, "%" PRIu64, intern->request_id);
234234
ADD_ASSOC_STRING(&retval, "requestId", request_id);
235235

236236
{

src/bson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static void php_phongo_bson_visit_unsupported_type(const bson_iter_t* iter ARG_U
188188
php_phongo_field_path_write_item_at_current_level(state->field_path, key);
189189
path_string = php_phongo_field_path_as_string(state->field_path);
190190

191-
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Detected unknown BSON type 0x%02hhx for field path \"%s\". Are you using the latest driver?", v_type_code, path_string);
191+
phongo_throw_exception(PHONGO_ERROR_UNEXPECTED_VALUE TSRMLS_CC, "Detected unknown BSON type 0x%02hhx for field path \"%s\". Are you using the latest driver?", (unsigned char) v_type_code, path_string);
192192

193193
efree(path_string);
194194
} /* }}} */

0 commit comments

Comments
 (0)