From 5c6ef6ded65afd67451252f8c307cbe54e5cc42f Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 14 Mar 2015 13:09:34 +0800 Subject: [PATCH] fix warning for xcode. --- .../srs_xcode.xcodeproj/project.pbxproj | 6 +----- trunk/src/app/srs_app_config.cpp | 6 +++--- trunk/src/app/srs_app_http.cpp | 16 ++++++++-------- trunk/src/app/srs_app_http_conn.cpp | 6 +++--- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj b/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj index 3d4c0fcd1..cef6a41c8 100644 --- a/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj +++ b/trunk/ide/srs_xcode/srs_xcode.xcodeproj/project.pbxproj @@ -75,7 +75,6 @@ 3C1232ED1AAEA70F00CE8F6C /* libhttp_parser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232EC1AAEA70F00CE8F6C /* libhttp_parser.a */; }; 3C1EE6AE1AB1055800576EE9 /* srs_app_hds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */; }; 3C1EE6D71AB1367D00576EE9 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6D61AB1367D00576EE9 /* README.md */; }; - 3C663F0E1AB0155100286D8B /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F011AB0155100286D8B /* Makefile */; }; 3C663F0F1AB0155100286D8B /* srs_aac_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */; }; 3C663F101AB0155100286D8B /* srs_audio_raw_publish.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */; }; 3C663F111AB0155100286D8B /* srs_bandwidth_check.c in Sources */ = {isa = PBXBuildFile; fileRef = 3C663F041AB0155100286D8B /* srs_bandwidth_check.c */; }; @@ -299,8 +298,7 @@ 3C1EE6D31AB1367D00576EE9 /* AUTHORS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = AUTHORS.txt; path = ../../../AUTHORS.txt; sourceTree = ""; }; 3C1EE6D41AB1367D00576EE9 /* DONATIONS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DONATIONS.txt; path = ../../../DONATIONS.txt; sourceTree = ""; }; 3C1EE6D51AB1367D00576EE9 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../../../LICENSE; sourceTree = ""; }; - 3C1EE6D61AB1367D00576EE9 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../../README.md; sourceTree = ""; wrapsLines = 0; }; - 3C663F011AB0155100286D8B /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../../research/librtmp/Makefile; sourceTree = ""; }; + 3C1EE6D61AB1367D00576EE9 /* README.md */ = {isa = PBXFileReference; explicitFileType = net.daringfireball.markdown; fileEncoding = 4; name = README.md; path = ../../../README.md; sourceTree = ""; wrapsLines = 0; }; 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 = ""; }; 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 = ""; }; 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 = ""; }; @@ -657,7 +655,6 @@ 3C663F001AB014B500286D8B /* research */ = { isa = PBXGroup; children = ( - 3C663F011AB0155100286D8B /* Makefile */, 3C663F021AB0155100286D8B /* srs_aac_raw_publish.c */, 3C663F031AB0155100286D8B /* srs_audio_raw_publish.c */, 3C663F041AB0155100286D8B /* srs_bandwidth_check.c */, @@ -799,7 +796,6 @@ 3C663F141AB0155100286D8B /* srs_flv_parser.c in Sources */, 3C1232451AAE81A400CE8F6C /* srs_rtmp_io.cpp in Sources */, 3C1232431AAE81A400CE8F6C /* srs_rtmp_buffer.cpp in Sources */, - 3C663F0E1AB0155100286D8B /* Makefile in Sources */, 3C1232211AAE814D00CE8F6C /* srs_kernel_buffer.cpp in Sources */, 3C1232471AAE81A400CE8F6C /* srs_rtmp_sdk.cpp in Sources */, 3C1232A61AAE81D900CE8F6C /* srs_app_kbps.cpp in Sources */, diff --git a/trunk/src/app/srs_app_config.cpp b/trunk/src/app/srs_app_config.cpp index a9cbfe911..faff46002 100644 --- a/trunk/src/app/srs_app_config.cpp +++ b/trunk/src/app/srs_app_config.cpp @@ -334,7 +334,7 @@ int SrsConfDirective::read_token(SrsConfigBuffer* buffer, vector& args, } if (found) { - int len = buffer->pos - pstart; + int len = (int)(buffer->pos - pstart); char* aword = new char[len]; memcpy(aword, pstart, len); aword[len - 1] = 0; @@ -1471,7 +1471,7 @@ int SrsConfig::check_config() } else if (n == "http_remux") { for (int j = 0; j < (int)conf->directives.size(); j++) { string m = conf->at(j)->name.c_str(); - if (m != "enabled" && m != "mount" && m != "fast_cache" && m != "crss") { + if (m != "enabled" && m != "mount" && m != "fast_cache" && m != "hstrs") { ret = ERROR_SYSTEM_CONFIG_INVALID; srs_error("unsupported vhost http_remux directive %s, ret=%d", m.c_str(), ret); return ret; @@ -1629,7 +1629,7 @@ int SrsConfig::check_config() int nb_connections = get_max_connections(); int nb_total = nb_connections + nb_consumed_fds; - int max_open_files = sysconf(_SC_OPEN_MAX); + int max_open_files = (int)sysconf(_SC_OPEN_MAX); int nb_canbe = max_open_files - nb_consumed_fds - 1; // for each play connections, we open a pipe(2fds) to convert SrsConsumver to io, diff --git a/trunk/src/app/srs_app_http.cpp b/trunk/src/app/srs_app_http.cpp index 074ff33ee..16409aef3 100644 --- a/trunk/src/app/srs_app_http.cpp +++ b/trunk/src/app/srs_app_http.cpp @@ -57,7 +57,7 @@ int srs_go_http_response_json(ISrsHttpResponseWriter* w, string data) w->header()->set_content_length(data.length()); w->header()->set_content_type("application/json"); - return w->write((char*)data.data(), data.length()); + return w->write((char*)data.data(), (int)data.length()); } // get the status text of code. @@ -388,7 +388,7 @@ int SrsHttpFileServer::serve_file(ISrsHttpResponseWriter* w, SrsHttpMessage* r, // write body. int64_t left = length; - if ((ret = copy(w, &fs, r, left)) != ERROR_SUCCESS) { + if ((ret = copy(w, &fs, r, (int)left)) != ERROR_SUCCESS) { if (!srs_is_client_gracefully_close(ret)) { srs_error("read file=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret); } @@ -475,7 +475,7 @@ int SrsHttpFileServer::copy(ISrsHttpResponseWriter* w, SrsFileReader* fs, SrsHtt } left -= nread; - if ((ret = w->write(buf, nread)) != ERROR_SUCCESS) { + if ((ret = w->write(buf, (int)nread)) != ERROR_SUCCESS) { break; } } @@ -681,7 +681,7 @@ bool SrsHttpServeMux::path_match(string pattern, string path) return false; } - int n = pattern.length(); + int n = (int)pattern.length(); // not endswith '/', exactly match. if (pattern.at(n - 1) != '/') { @@ -883,7 +883,7 @@ int SrsHttpResponseReader::read(std::string& data) } // read by specified content-length - int max = (int)owner->content_length() - nb_read; + int max = (int)owner->content_length() - (int)nb_read; if (max <= 0) { is_eof = true; return ret; @@ -910,7 +910,7 @@ int SrsHttpResponseReader::read_chunked(std::string& data) srs_error("chunk header start with CRLF. ret=%d", ret); return ret; } - length = p - start + 2; + length = (int)(p - start + 2); at = buffer->read_slice(length); break; } @@ -936,7 +936,7 @@ int SrsHttpResponseReader::read_chunked(std::string& data) at[length - 2] = 0; // size is the bytes size, excludes the chunk header and end CRLF. - int ilength = ::strtol(at, NULL, 16); + int ilength = (int)::strtol(at, NULL, 16); if (ilength < 0) { ret = ERROR_HTTP_INVALID_CHUNK_HEADER; srs_error("chunk header negative, length=%d. ret=%d", ilength, ret); @@ -1317,7 +1317,7 @@ int SrsHttpParser::parse_message_imp(SrsStSocket* skt) // consume the parsed bytes. if (nparsed && nparsed - body_parsed > 0) { - buffer->read_slice(nparsed - body_parsed); + buffer->read_slice((int)nparsed - (int)body_parsed); } // ok atleast header completed, diff --git a/trunk/src/app/srs_app_http_conn.cpp b/trunk/src/app/srs_app_http_conn.cpp index 0c7f8627b..c9ccee95e 100644 --- a/trunk/src/app/srs_app_http_conn.cpp +++ b/trunk/src/app/srs_app_http_conn.cpp @@ -134,7 +134,7 @@ int SrsVodStream::serve_flv_stream(ISrsHttpResponseWriter* w, SrsHttpMessage* r, } // send data - if ((ret = copy(w, &fs, r, left)) != ERROR_SUCCESS) { + if ((ret = copy(w, &fs, r, (int)left)) != ERROR_SUCCESS) { srs_warn("read flv=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret); return ret; } @@ -158,7 +158,7 @@ int SrsVodStream::serve_mp4_stream(ISrsHttpResponseWriter* w, SrsHttpMessage* r, // parse -1 to whole file. if (end == -1) { - end = fs.filesize(); + end = (int)fs.filesize(); } if (end > fs.filesize() || start > end) { @@ -187,7 +187,7 @@ int SrsVodStream::serve_mp4_stream(ISrsHttpResponseWriter* w, SrsHttpMessage* r, fs.lseek(start); // send data - if ((ret = copy(w, &fs, r, left)) != ERROR_SUCCESS) { + if ((ret = copy(w, &fs, r, (int)left)) != ERROR_SUCCESS) { srs_warn("read mp4=%s size=%d failed, ret=%d", fullpath.c_str(), left, ret); return ret; }