Skip to content

Commit 7a743b6

Browse files
paulmelnikowhanumantmk
authored andcommitted
Clear warnings 'Implicit conversion loses integer precision'
Closes #150
1 parent f34fe0b commit 7a743b6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/mongoc/mongoc-scram.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ _mongoc_scram_buf_write (const char *src,
100100
uint32_t *outbuflen)
101101
{
102102
if (src_len < 0) {
103-
src_len = strlen (src);
103+
src_len = (int32_t) strlen (src);
104104
}
105105

106106
if (*outbuflen + src_len >= outbufmax) {
@@ -455,9 +455,9 @@ _mongoc_scram_step2 (mongoc_scram_t *scram,
455455
next_comma = memchr (ptr, ',', (inbuf + inbuflen) - ptr);
456456

457457
if (next_comma) {
458-
*current_val_len = next_comma - ptr;
458+
*current_val_len = (uint32_t) (next_comma - ptr);
459459
} else {
460-
*current_val_len = (inbuf + inbuflen) - ptr;
460+
*current_val_len = (uint32_t) ((inbuf + inbuflen) - ptr);
461461
}
462462

463463
*current_val = bson_malloc (*current_val_len + 1);
@@ -550,7 +550,7 @@ _mongoc_scram_step2 (mongoc_scram_t *scram,
550550
goto FAIL;
551551
}
552552

553-
iterations = bson_ascii_strtoll ((char *)val_i, &tmp, 10);
553+
iterations = (int) bson_ascii_strtoll ((char *)val_i, &tmp, 10);
554554
/* tmp holds the location of the failed to parse character. So if it's
555555
* null, we got to the end of the string and didn't have a parse error */
556556

@@ -562,7 +562,7 @@ _mongoc_scram_step2 (mongoc_scram_t *scram,
562562
goto FAIL;
563563
}
564564

565-
_mongoc_scram_salt_password (scram, hashed_password, strlen (
565+
_mongoc_scram_salt_password (scram, hashed_password, (uint32_t) strlen (
566566
hashed_password), decoded_salt, decoded_salt_len,
567567
iterations);
568568

@@ -703,9 +703,9 @@ _mongoc_scram_step3 (mongoc_scram_t *scram,
703703
next_comma = memchr (ptr, ',', (inbuf + inbuflen) - ptr);
704704

705705
if (next_comma) {
706-
*current_val_len = next_comma - ptr;
706+
*current_val_len = (uint32_t) (next_comma - ptr);
707707
} else {
708-
*current_val_len = (inbuf + inbuflen) - ptr;
708+
*current_val_len = (uint32_t) ((inbuf + inbuflen) - ptr);
709709
}
710710

711711
*current_val = bson_malloc (*current_val_len + 1);

src/mongoc/mongoc-socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ _mongoc_socket_try_sendv_slow (mongoc_socket_t *sock, /* IN */
811811
{
812812
ssize_t ret = 0;
813813
size_t i;
814-
int wrote;
814+
ssize_t wrote;
815815

816816
ENTRY;
817817

0 commit comments

Comments
 (0)