Skip to content

Commit 35d6dda

Browse files
committed
Fix warning of uninitialized variable.
1 parent 06830ac commit 35d6dda

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/protocol/MySQLMessage.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ int MySQLMessage::append(const void *buf, size_t *size)
100100
size_t stream_len;
101101
size_t nleft = *size;
102102
size_t n;
103-
int ret = 0;
103+
int ret;
104104

105105
cur_size_ += *size;
106106
if (cur_size_ > this->size_limit)
@@ -109,7 +109,7 @@ int MySQLMessage::append(const void *buf, size_t *size)
109109
return -1;
110110
}
111111

112-
while (nleft > 0)
112+
do
113113
{
114114
n = nleft;
115115
ret = mysql_stream_write(buf, &n, stream_);
@@ -125,9 +125,9 @@ int MySQLMessage::append(const void *buf, size_t *size)
125125
if (ret < 0)
126126
return -1;
127127

128-
nleft -= n;
129128
buf = (const char *)buf + n;
130-
}
129+
nleft -= n;
130+
} while (nleft > 0);
131131

132132
return ret;
133133
}
@@ -583,7 +583,7 @@ int MySQLRSAAuthRequest::encode(struct iovec vectors[], int max)
583583
EVP_PKEY_CTX *pkey_ctx;
584584
int ret = -1;
585585

586-
bio = BIO_new_mem_buf(public_key_.c_str(), public_key_.size());
586+
bio = BIO_new_mem_buf((void *)public_key_.c_str(), public_key_.size());
587587
if (bio)
588588
{
589589
pkey = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL);

0 commit comments

Comments
 (0)