RTC: Fix warnings

pull/2104/head
winlin 4 years ago
parent 5309dbe18b
commit c7c6d8778a

@ -687,7 +687,7 @@ srs_error_t SrsSslConnection::read(void* plaintext, size_t nn_plaintext, ssize_t
// OK, got data.
if (r0 > 0) {
srs_assert(r0 <= nn_plaintext);
srs_assert(r0 <= (int)nn_plaintext);
if (nread) {
*nread = r0;
}

@ -753,7 +753,7 @@ srs_error_t SrsDtlsClientImpl::cycle()
srs_error_t err = srs_success;
// Limit the max retry for ARQ.
for (int i = 0; i < sizeof(arq_to_ratios) / sizeof(int); i++) {
for (int i = 0; i < (int)(sizeof(arq_to_ratios) / sizeof(int)); i++) {
srs_utime_t arq_to = arq_interval * arq_to_ratios[i];
srs_usleep(arq_to);

@ -1191,12 +1191,12 @@ namespace {
bool has_plus = false;
int i = 0;
// Count %, check that they're well-formed.
while(i < s.length()) {
while(i < (int)s.length()) {
switch (s.at(i)) {
case '%':
{
n++;
if((i+2) >= s.length() || !ishex(s.at(i+1)) || !ishex(s.at(i+2))) {
if((i+2) >= (int)s.length() || !ishex(s.at(i+1)) || !ishex(s.at(i+2))) {
string msg = s.substr(i);
if(msg.length() > 3) {
msg = msg.substr(0, 3);
@ -1250,7 +1250,7 @@ namespace {
value.clear();
//value.resize(s.length() - 2*n);
for(int i = 0; i < s.length(); ++i) {
for(int i = 0; i < (int)s.length(); ++i) {
switch(s.at(i)) {
case '%':
value += (hex_to_num(s.at(i+1))<<4 | hex_to_num(s.at(i+2)));
@ -1275,7 +1275,7 @@ namespace {
string escape(string s, EncodeMode mode) {
int space_count = 0;
int hex_count = 0;
for(int i = 0; i < s.length(); ++i) {
for(int i = 0; i < (int)s.length(); ++i) {
uint8_t c = s.at(i);
if(should_escape(c, mode)) {
if(' ' == c && encodeQueryComponent == mode) {
@ -1293,7 +1293,7 @@ namespace {
string value;
if(0 == hex_count) {
value = s;
for(int i = 0; i < s.length(); ++i) {
for(int i = 0; i < (int)s.length(); ++i) {
if(' ' == s.at(i)) {
value[i] = '+';
}
@ -1304,7 +1304,7 @@ namespace {
//value.resize(s.length() + 2*hex_count);
const char escape_code[] = "0123456789ABCDEF";
//int j = 0;
for(int i = 0; i < s.length(); ++i) {
for(int i = 0; i < (int)s.length(); ++i) {
uint8_t c = s.at(i);
if(' ' == c && encodeQueryComponent == mode) {
value += '+';

@ -199,7 +199,7 @@ srs_error_t SrsSslClient::read(void* plaintext, size_t nn_plaintext, ssize_t* nr
// OK, got data.
if (r0 > 0) {
srs_assert(r0 <= nn_plaintext);
srs_assert(r0 <= (int)nn_plaintext);
if (nread) {
*nread = r0;
}

Loading…
Cancel
Save