mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Fix build warning
This commit is contained in:
parent
ef3e35f173
commit
f1ab8fecac
4 changed files with 27 additions and 26 deletions
|
@ -27,7 +27,7 @@
|
|||
// current release version
|
||||
#define VERSION_MAJOR 3
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 44
|
||||
#define VERSION_REVISION 45
|
||||
|
||||
// generated by configure, only macros.
|
||||
#include <srs_auto_headers.hpp>
|
||||
|
|
|
@ -76,7 +76,7 @@ srs_error_t srs_avc_nalu_read_uev(SrsBitBuffer* stream, int32_t& v)
|
|||
}
|
||||
|
||||
v = (1 << leadingZeroBits) - 1;
|
||||
for (int i = 0; i < leadingZeroBits; i++) {
|
||||
for (int i = 0; i < (int)leadingZeroBits; i++) {
|
||||
int32_t b = stream->read_bit();
|
||||
v += b << (leadingZeroBits - 1 - i);
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ uint64_t __crc32_reflect(uint64_t data, int width)
|
|||
{
|
||||
uint64_t res = data & 0x01;
|
||||
|
||||
for (int i = 0; i < width - 1; i++) {
|
||||
for (int i = 0; i < (int)width - 1; i++) {
|
||||
data >>= 1;
|
||||
res = (res << 1) | (data & 0x01);
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ void __crc32_make_table(uint32_t t[256], uint32_t poly, bool reflect_in)
|
|||
int tbl_idx_width = 8; // table index size.
|
||||
int tbl_width = 0x01 << tbl_idx_width; // table size: 256
|
||||
|
||||
for (int i = 0; i < tbl_width; i++) {
|
||||
for (int i = 0; i < (int)tbl_width; i++) {
|
||||
uint64_t reg = uint64_t(i);
|
||||
|
||||
if (reflect_in) {
|
||||
|
@ -757,14 +757,14 @@ uint32_t __crc32_table_driven(uint32_t* t, const void* buf, int size, uint32_t p
|
|||
if (!reflect_in) {
|
||||
reg = xor_in;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
for (int i = 0; i < (int)size; i++) {
|
||||
uint8_t tblidx = (uint8_t)((reg >> (width - tbl_idx_width)) ^ p[i]);
|
||||
reg = t[tblidx] ^ (reg << tbl_idx_width);
|
||||
}
|
||||
} else {
|
||||
reg = previous ^ __crc32_reflect(xor_in, width);
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
for (int i = 0; i < (int)size; i++) {
|
||||
uint8_t tblidx = (uint8_t)(reg ^ p[i]);
|
||||
reg = t[tblidx] ^ (reg >> tbl_idx_width);
|
||||
}
|
||||
|
@ -870,7 +870,7 @@ srs_error_t srs_av_base64_decode(string cipher, string& plaintext)
|
|||
uint8_t decodeMap[256];
|
||||
memset(decodeMap, 0xff, sizeof(decodeMap));
|
||||
|
||||
for (int i = 0; i < encoder.length(); i++) {
|
||||
for (int i = 0; i < (int)encoder.length(); i++) {
|
||||
decodeMap[(uint8_t)encoder.at(i)] = uint8_t(i);
|
||||
}
|
||||
|
||||
|
@ -880,19 +880,20 @@ srs_error_t srs_av_base64_decode(string cipher, string& plaintext)
|
|||
int si = 0;
|
||||
|
||||
// skip over newlines
|
||||
for (; si < cipher.length() && (cipher.at(si) == '\n' || cipher.at(si) == '\r'); si++) {
|
||||
for (; si < (int)cipher.length() && (cipher.at(si) == '\n' || cipher.at(si) == '\r'); si++) {
|
||||
}
|
||||
|
||||
for (bool end = false; si < cipher.length() && !end;) {
|
||||
for (bool end = false; si < (int)cipher.length() && !end;) {
|
||||
// Decode quantum using the base64 alphabet
|
||||
uint8_t dbuf[4];
|
||||
memset(dbuf, 0x00, sizeof(dbuf));
|
||||
|
||||
int dinc = 3;
|
||||
int dlen = 4;
|
||||
srs_assert(dinc > 0);
|
||||
|
||||
for (int j = 0; j < sizeof(dbuf); j++) {
|
||||
if (si == cipher.length()) {
|
||||
for (int j = 0; j < (int)sizeof(dbuf); j++) {
|
||||
if (si == (int)cipher.length()) {
|
||||
if (padding != -1 || j < 2) {
|
||||
return srs_error_new(ERROR_BASE64_DECODE, "corrupt input at %d", si);
|
||||
}
|
||||
|
@ -907,7 +908,7 @@ srs_error_t srs_av_base64_decode(string cipher, string& plaintext)
|
|||
|
||||
si++;
|
||||
// skip over newlines
|
||||
for (; si < cipher.length() && (cipher.at(si) == '\n' || cipher.at(si) == '\r'); si++) {
|
||||
for (; si < (int)cipher.length() && (cipher.at(si) == '\n' || cipher.at(si) == '\r'); si++) {
|
||||
}
|
||||
|
||||
if (in == padding) {
|
||||
|
@ -919,7 +920,7 @@ srs_error_t srs_av_base64_decode(string cipher, string& plaintext)
|
|||
return srs_error_new(ERROR_BASE64_DECODE, "corrupt input at %d", si);
|
||||
case 2:
|
||||
// "==" is expected, the first "=" is already consumed.
|
||||
if (si == cipher.length()) {
|
||||
if (si == (int)cipher.length()) {
|
||||
return srs_error_new(ERROR_BASE64_DECODE, "corrupt input at %d", si);
|
||||
}
|
||||
if (cipher.at(si) != padding) {
|
||||
|
@ -929,11 +930,11 @@ srs_error_t srs_av_base64_decode(string cipher, string& plaintext)
|
|||
|
||||
si++;
|
||||
// skip over newlines
|
||||
for (; si < cipher.length() && (cipher.at(si) == '\n' || cipher.at(si) == '\r'); si++) {
|
||||
for (; si < (int)cipher.length() && (cipher.at(si) == '\n' || cipher.at(si) == '\r'); si++) {
|
||||
}
|
||||
}
|
||||
|
||||
if (si < cipher.length()) {
|
||||
if (si < (int)cipher.length()) {
|
||||
// trailing garbage
|
||||
err = srs_error_new(ERROR_BASE64_DECODE, "corrupt input at %d", si);
|
||||
}
|
||||
|
@ -1013,7 +1014,7 @@ int srs_hex_to_data(uint8_t* data, const char* p, int size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < size / 2; i++) {
|
||||
for (int i = 0; i < (int)size / 2; i++) {
|
||||
uint8_t a = srs_from_hex_char(p[i*2]);
|
||||
if (a == (uint8_t)-1) {
|
||||
return -1;
|
||||
|
|
|
@ -1700,7 +1700,7 @@ SrsJsonAny* srs_json_parse_tree(json_value* node)
|
|||
return SrsJsonAny::boolean(node->u.boolean != 0);
|
||||
case json_object: {
|
||||
SrsJsonObject* obj = SrsJsonAny::object();
|
||||
for (int i = 0; i < node->u.object.length; i++) {
|
||||
for (int i = 0; i < (int)node->u.object.length; i++) {
|
||||
json_object_entry& entry = node->u.object.values[i];
|
||||
SrsJsonAny* value = srs_json_parse_tree(entry.value);
|
||||
|
||||
|
@ -1715,7 +1715,7 @@ SrsJsonAny* srs_json_parse_tree(json_value* node)
|
|||
}
|
||||
case json_array: {
|
||||
SrsJsonArray* arr = SrsJsonAny::array();
|
||||
for (int i = 0; i < node->u.array.length; i++) {
|
||||
for (int i = 0; i < (int)node->u.array.length; i++) {
|
||||
json_value* p = node->u.array.values[i];
|
||||
SrsJsonAny* value = srs_json_parse_tree(p);
|
||||
|
||||
|
|
|
@ -4862,14 +4862,14 @@ VOID TEST(ProtocolStackTest, ProtocolSendSrsFMLEStartResPacket)
|
|||
args->set("start" , SrsAmf0Any::number(0));
|
||||
|
||||
EXPECT_TRUE(ERROR_SUCCESS == proto.send_and_free_packet(pkt, 0));
|
||||
char buf[] = {
|
||||
uint8_t buf[] = {
|
||||
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x14,
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x09, 0x46,
|
||||
0x4d, 0x4c, 0x45, 0x53, 0x74, 0x61, 0x72, 0x74,
|
||||
0x00, 0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x05, 0x06
|
||||
};
|
||||
EXPECT_TRUE(srs_bytes_equals(bio.out_buffer.bytes(), buf, sizeof(buf)));
|
||||
EXPECT_TRUE(srs_bytes_equals(bio.out_buffer.bytes(), (char*)buf, sizeof(buf)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4887,7 +4887,7 @@ VOID TEST(ProtocolStackTest, ProtocolSendSrsPublishPacket)
|
|||
pkt->type = "live";
|
||||
|
||||
EXPECT_TRUE(ERROR_SUCCESS == proto.send_and_free_packet(pkt, 0));
|
||||
char buf[] = {
|
||||
uint8_t buf[] = {
|
||||
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x14,
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x07, 0x70,
|
||||
0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x00, 0x00,
|
||||
|
@ -4896,7 +4896,7 @@ VOID TEST(ProtocolStackTest, ProtocolSendSrsPublishPacket)
|
|||
0x74, 0x72, 0x65, 0x61, 0x6d, 0x02, 0x00, 0x04,
|
||||
0x6c, 0x69, 0x76, 0x65
|
||||
};
|
||||
EXPECT_TRUE(srs_bytes_equals(bio.out_buffer.bytes(), buf, sizeof(buf)));
|
||||
EXPECT_TRUE(srs_bytes_equals(bio.out_buffer.bytes(), (char*)buf, sizeof(buf)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5097,7 +5097,7 @@ VOID TEST(ProtocolStackTest, ProtocolSendSrsOnMetaDataPacket)
|
|||
pkt->metadata = args;
|
||||
|
||||
EXPECT_TRUE(ERROR_SUCCESS == proto.send_and_free_packet(pkt, 0));
|
||||
char buf[] = {
|
||||
uint8_t buf[] = {
|
||||
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x12,
|
||||
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x6f,
|
||||
0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74,
|
||||
|
@ -5107,7 +5107,7 @@ VOID TEST(ProtocolStackTest, ProtocolSendSrsOnMetaDataPacket)
|
|||
0x68, 0x74, 0x00, 0x40, 0x82, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x09
|
||||
};
|
||||
EXPECT_TRUE(srs_bytes_equals(bio.out_buffer.bytes(), buf, sizeof(buf)));
|
||||
EXPECT_TRUE(srs_bytes_equals(bio.out_buffer.bytes(), (char*)buf, sizeof(buf)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5122,11 +5122,11 @@ VOID TEST(ProtocolStackTest, ProtocolSendSrsSetWindowAckSizePacket)
|
|||
pkt->ackowledgement_window_size = 102400;
|
||||
|
||||
EXPECT_TRUE(ERROR_SUCCESS == proto.send_and_free_packet(pkt, 0));
|
||||
char buf[] = {
|
||||
uint8_t buf[] = {
|
||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x05,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x90, 0x00
|
||||
};
|
||||
EXPECT_TRUE(srs_bytes_equals(bio.out_buffer.bytes(), buf, sizeof(buf)));
|
||||
EXPECT_TRUE(srs_bytes_equals(bio.out_buffer.bytes(), (char*)buf, sizeof(buf)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue