winlin

fix warning for xcode.

@@ -75,7 +75,6 @@ @@ -75,7 +75,6 @@
75 3C1232ED1AAEA70F00CE8F6C /* libhttp_parser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232EC1AAEA70F00CE8F6C /* libhttp_parser.a */; }; 75 3C1232ED1AAEA70F00CE8F6C /* libhttp_parser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232EC1AAEA70F00CE8F6C /* libhttp_parser.a */; };
76 3C1EE6AE1AB1055800576EE9 /* srs_app_hds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */; }; 76 3C1EE6AE1AB1055800576EE9 /* srs_app_hds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */; };
77 3C1EE6D71AB1367D00576EE9 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6D61AB1367D00576EE9 /* README.md */; }; 77 3C1EE6D71AB1367D00576EE9 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6D61AB1367D00576EE9 /* README.md */; };
78 - 3C663F0E1AB0155100286D8B /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F011AB0155100286D8B /* Makefile */; };  
79 3C663F0F1AB0155100286D8B /* srs_aac_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */; }; 78 3C663F0F1AB0155100286D8B /* srs_aac_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */; };
80 3C663F101AB0155100286D8B /* srs_audio_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */; }; 79 3C663F101AB0155100286D8B /* srs_audio_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */; };
81 3C663F111AB0155100286D8B /* srs_bandwidth_check.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F041AB0155100286D8B /* srs_bandwidth_check.c */; }; 80 3C663F111AB0155100286D8B /* srs_bandwidth_check.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F041AB0155100286D8B /* srs_bandwidth_check.c */; };
@@ -299,8 +298,7 @@ @@ -299,8 +298,7 @@
299 3C1EE6D31AB1367D00576EE9 /* AUTHORS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = AUTHORS.txt; path = ../../../AUTHORS.txt; sourceTree = "<group>"; }; 298 3C1EE6D31AB1367D00576EE9 /* AUTHORS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = AUTHORS.txt; path = ../../../AUTHORS.txt; sourceTree = "<group>"; };
300 3C1EE6D41AB1367D00576EE9 /* DONATIONS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DONATIONS.txt; path = ../../../DONATIONS.txt; sourceTree = "<group>"; }; 299 3C1EE6D41AB1367D00576EE9 /* DONATIONS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DONATIONS.txt; path = ../../../DONATIONS.txt; sourceTree = "<group>"; };
301 3C1EE6D51AB1367D00576EE9 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../../../LICENSE; sourceTree = "<group>"; }; 300 3C1EE6D51AB1367D00576EE9 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../../../LICENSE; sourceTree = "<group>"; };
302 - 3C1EE6D61AB1367D00576EE9 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../../README.md; sourceTree = "<group>"; wrapsLines = 0; };  
303 - 3C663F011AB0155100286D8B /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../../research/librtmp/Makefile; sourceTree = "<group>"; }; 301 + 3C1EE6D61AB1367D00576EE9 /* README.md */ = {isa = PBXFileReference; explicitFileType = net.daringfireball.markdown; fileEncoding = 4; name = README.md; path = ../../../README.md; sourceTree = "<group>"; wrapsLines = 0; };
304 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = srs_aac_raw_publish.c; path = ../../../research/librtmp/srs_aac_raw_publish.c; sourceTree = "<group>"; }; 302 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = srs_aac_raw_publish.c; path = ../../../research/librtmp/srs_aac_raw_publish.c; sourceTree = "<group>"; };
305 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = srs_audio_raw_publish.c; path = ../../../research/librtmp/srs_audio_raw_publish.c; sourceTree = "<group>"; }; 303 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = srs_audio_raw_publish.c; path = ../../../research/librtmp/srs_audio_raw_publish.c; sourceTree = "<group>"; };
306 3C663F041AB0155100286D8B /* srs_bandwidth_check.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = srs_bandwidth_check.c; path = ../../../research/librtmp/srs_bandwidth_check.c; sourceTree = "<group>"; }; 304 3C663F041AB0155100286D8B /* srs_bandwidth_check.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = srs_bandwidth_check.c; path = ../../../research/librtmp/srs_bandwidth_check.c; sourceTree = "<group>"; };
@@ -657,7 +655,6 @@ @@ -657,7 +655,6 @@
657 3C663F001AB014B500286D8B /* research */ = { 655 3C663F001AB014B500286D8B /* research */ = {
658 isa = PBXGroup; 656 isa = PBXGroup;
659 children = ( 657 children = (
660 - 3C663F011AB0155100286D8B /* Makefile */,  
661 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */, 658 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */,
662 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */, 659 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */,
663 3C663F041AB0155100286D8B /* srs_bandwidth_check.c */, 660 3C663F041AB0155100286D8B /* srs_bandwidth_check.c */,
@@ -799,7 +796,6 @@ @@ -799,7 +796,6 @@
799 3C663F141AB0155100286D8B /* srs_flv_parser.c in Sources */, 796 3C663F141AB0155100286D8B /* srs_flv_parser.c in Sources */,
800 3C1232451AAE81A400CE8F6C /* srs_rtmp_io.cpp in Sources */, 797 3C1232451AAE81A400CE8F6C /* srs_rtmp_io.cpp in Sources */,
801 3C1232431AAE81A400CE8F6C /* srs_rtmp_buffer.cpp in Sources */, 798 3C1232431AAE81A400CE8F6C /* srs_rtmp_buffer.cpp in Sources */,
802 - 3C663F0E1AB0155100286D8B /* Makefile in Sources */,  
803 3C1232211AAE814D00CE8F6C /* srs_kernel_buffer.cpp in Sources */, 799 3C1232211AAE814D00CE8F6C /* srs_kernel_buffer.cpp in Sources */,
804 3C1232471AAE81A400CE8F6C /* srs_rtmp_sdk.cpp in Sources */, 800 3C1232471AAE81A400CE8F6C /* srs_rtmp_sdk.cpp in Sources */,
805 3C1232A61AAE81D900CE8F6C /* srs_app_kbps.cpp in Sources */, 801 3C1232A61AAE81D900CE8F6C /* srs_app_kbps.cpp in Sources */,
@@ -334,7 +334,7 @@ int SrsConfDirective::read_token(SrsConfigBuffer* buffer, vector<string>& args, @@ -334,7 +334,7 @@ int SrsConfDirective::read_token(SrsConfigBuffer* buffer, vector<string>& args,
334 } 334 }
335 335
336 if (found) { 336 if (found) {
337 - int len = buffer->pos - pstart; 337 + int len = (int)(buffer->pos - pstart);
338 char* aword = new char[len]; 338 char* aword = new char[len];
339 memcpy(aword, pstart, len); 339 memcpy(aword, pstart, len);
340 aword[len - 1] = 0; 340 aword[len - 1] = 0;
@@ -1471,7 +1471,7 @@ int SrsConfig::check_config() @@ -1471,7 +1471,7 @@ int SrsConfig::check_config()
1471 } else if (n == "http_remux") { 1471 } else if (n == "http_remux") {
1472 for (int j = 0; j < (int)conf->directives.size(); j++) { 1472 for (int j = 0; j < (int)conf->directives.size(); j++) {
1473 string m = conf->at(j)->name.c_str(); 1473 string m = conf->at(j)->name.c_str();
1474 - if (m != "enabled" && m != "mount" && m != "fast_cache" && m != "crss") { 1474 + if (m != "enabled" && m != "mount" && m != "fast_cache" && m != "hstrs") {
1475 ret = ERROR_SYSTEM_CONFIG_INVALID; 1475 ret = ERROR_SYSTEM_CONFIG_INVALID;
1476 srs_error("unsupported vhost http_remux directive %s, ret=%d", m.c_str(), ret); 1476 srs_error("unsupported vhost http_remux directive %s, ret=%d", m.c_str(), ret);
1477 return ret; 1477 return ret;
@@ -1629,7 +1629,7 @@ int SrsConfig::check_config() @@ -1629,7 +1629,7 @@ int SrsConfig::check_config()
1629 int nb_connections = get_max_connections(); 1629 int nb_connections = get_max_connections();
1630 int nb_total = nb_connections + nb_consumed_fds; 1630 int nb_total = nb_connections + nb_consumed_fds;
1631 1631
1632 - int max_open_files = sysconf(_SC_OPEN_MAX); 1632 + int max_open_files = (int)sysconf(_SC_OPEN_MAX);
1633 int nb_canbe = max_open_files - nb_consumed_fds - 1; 1633 int nb_canbe = max_open_files - nb_consumed_fds - 1;
1634 1634
1635 // for each play connections, we open a pipe(2fds) to convert SrsConsumver to io, 1635 // for each play connections, we open a pipe(2fds) to convert SrsConsumver to io,
@@ -57,7 +57,7 @@ int srs_go_http_response_json(ISrsHttpResponseWriter* w, string data) @@ -57,7 +57,7 @@ int srs_go_http_response_json(ISrsHttpResponseWriter* w, string data)
57 w->header()->set_content_length(data.length()); 57 w->header()->set_content_length(data.length());
58 w->header()->set_content_type("application/json"); 58 w->header()->set_content_type("application/json");
59 59
60 - return w->write((char*)data.data(), data.length()); 60 + return w->write((char*)data.data(), (int)data.length());
61 } 61 }
62 62
63 // get the status text of code. 63 // get the status text of code.
@@ -388,7 +388,7 @@ int SrsHttpFileServer::serve_file(ISrsHttpResponseWriter* w, SrsHttpMessage* r, @@ -388,7 +388,7 @@ int SrsHttpFileServer::serve_file(ISrsHttpResponseWriter* w, SrsHttpMessage* r,
388 388
389 // write body. 389 // write body.
390 int64_t left = length; 390 int64_t left = length;
391 - if ((ret = copy(w, &fs, r, left)) != ERROR_SUCCESS) { 391 + if ((ret = copy(w, &fs, r, (int)left)) != ERROR_SUCCESS) {
392 if (!srs_is_client_gracefully_close(ret)) { 392 if (!srs_is_client_gracefully_close(ret)) {
393 srs_error("read file=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret); 393 srs_error("read file=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret);
394 } 394 }
@@ -475,7 +475,7 @@ int SrsHttpFileServer::copy(ISrsHttpResponseWriter* w, SrsFileReader* fs, SrsHtt @@ -475,7 +475,7 @@ int SrsHttpFileServer::copy(ISrsHttpResponseWriter* w, SrsFileReader* fs, SrsHtt
475 } 475 }
476 476
477 left -= nread; 477 left -= nread;
478 - if ((ret = w->write(buf, nread)) != ERROR_SUCCESS) { 478 + if ((ret = w->write(buf, (int)nread)) != ERROR_SUCCESS) {
479 break; 479 break;
480 } 480 }
481 } 481 }
@@ -681,7 +681,7 @@ bool SrsHttpServeMux::path_match(string pattern, string path) @@ -681,7 +681,7 @@ bool SrsHttpServeMux::path_match(string pattern, string path)
681 return false; 681 return false;
682 } 682 }
683 683
684 - int n = pattern.length(); 684 + int n = (int)pattern.length();
685 685
686 // not endswith '/', exactly match. 686 // not endswith '/', exactly match.
687 if (pattern.at(n - 1) != '/') { 687 if (pattern.at(n - 1) != '/') {
@@ -883,7 +883,7 @@ int SrsHttpResponseReader::read(std::string& data) @@ -883,7 +883,7 @@ int SrsHttpResponseReader::read(std::string& data)
883 } 883 }
884 884
885 // read by specified content-length 885 // read by specified content-length
886 - int max = (int)owner->content_length() - nb_read; 886 + int max = (int)owner->content_length() - (int)nb_read;
887 if (max <= 0) { 887 if (max <= 0) {
888 is_eof = true; 888 is_eof = true;
889 return ret; 889 return ret;
@@ -910,7 +910,7 @@ int SrsHttpResponseReader::read_chunked(std::string& data) @@ -910,7 +910,7 @@ int SrsHttpResponseReader::read_chunked(std::string& data)
910 srs_error("chunk header start with CRLF. ret=%d", ret); 910 srs_error("chunk header start with CRLF. ret=%d", ret);
911 return ret; 911 return ret;
912 } 912 }
913 - length = p - start + 2; 913 + length = (int)(p - start + 2);
914 at = buffer->read_slice(length); 914 at = buffer->read_slice(length);
915 break; 915 break;
916 } 916 }
@@ -936,7 +936,7 @@ int SrsHttpResponseReader::read_chunked(std::string& data) @@ -936,7 +936,7 @@ int SrsHttpResponseReader::read_chunked(std::string& data)
936 at[length - 2] = 0; 936 at[length - 2] = 0;
937 937
938 // size is the bytes size, excludes the chunk header and end CRLF. 938 // size is the bytes size, excludes the chunk header and end CRLF.
939 - int ilength = ::strtol(at, NULL, 16); 939 + int ilength = (int)::strtol(at, NULL, 16);
940 if (ilength < 0) { 940 if (ilength < 0) {
941 ret = ERROR_HTTP_INVALID_CHUNK_HEADER; 941 ret = ERROR_HTTP_INVALID_CHUNK_HEADER;
942 srs_error("chunk header negative, length=%d. ret=%d", ilength, ret); 942 srs_error("chunk header negative, length=%d. ret=%d", ilength, ret);
@@ -1317,7 +1317,7 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt) @@ -1317,7 +1317,7 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt)
1317 1317
1318 // consume the parsed bytes. 1318 // consume the parsed bytes.
1319 if (nparsed && nparsed - body_parsed > 0) { 1319 if (nparsed && nparsed - body_parsed > 0) {
1320 - buffer->read_slice(nparsed - body_parsed); 1320 + buffer->read_slice((int)nparsed - (int)body_parsed);
1321 } 1321 }
1322 1322
1323 // ok atleast header completed, 1323 // ok atleast header completed,
@@ -134,7 +134,7 @@ int SrsVodStream::serve_flv_stream(ISrsHttpResponseWriter* w, SrsHttpMessage* r, @@ -134,7 +134,7 @@ int SrsVodStream::serve_flv_stream(ISrsHttpResponseWriter* w, SrsHttpMessage* r,
134 } 134 }
135 135
136 // send data 136 // send data
137 - if ((ret = copy(w, &fs, r, left)) != ERROR_SUCCESS) { 137 + if ((ret = copy(w, &fs, r, (int)left)) != ERROR_SUCCESS) {
138 srs_warn("read flv=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret); 138 srs_warn("read flv=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret);
139 return ret; 139 return ret;
140 } 140 }
@@ -158,7 +158,7 @@ int SrsVodStream::serve_mp4_stream(ISrsHttpResponseWriter* w, SrsHttpMessage* r, @@ -158,7 +158,7 @@ int SrsVodStream::serve_mp4_stream(ISrsHttpResponseWriter* w, SrsHttpMessage* r,
158 158
159 // parse -1 to whole file. 159 // parse -1 to whole file.
160 if (end == -1) { 160 if (end == -1) {
161 - end = fs.filesize(); 161 + end = (int)fs.filesize();
162 } 162 }
163 163
164 if (end > fs.filesize() || start > end) { 164 if (end > fs.filesize() || start > end) {
@@ -187,7 +187,7 @@ int SrsVodStream::serve_mp4_stream(ISrsHttpResponseWriter* w, SrsHttpMessage* r, @@ -187,7 +187,7 @@ int SrsVodStream::serve_mp4_stream(ISrsHttpResponseWriter* w, SrsHttpMessage* r,
187 fs.lseek(start); 187 fs.lseek(start);
188 188
189 // send data 189 // send data
190 - if ((ret = copy(w, &fs, r, left)) != ERROR_SUCCESS) { 190 + if ((ret = copy(w, &fs, r, (int)left)) != ERROR_SUCCESS) {
191 srs_warn("read mp4=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret); 191 srs_warn("read mp4=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret);
192 return ret; 192 return ret;
193 } 193 }