1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix warning for xcode.

This commit is contained in:
winlin 2015-03-14 13:09:34 +08:00
parent 6d15d0ea99
commit 5c6ef6ded6
4 changed files with 15 additions and 19 deletions

View file

@ -334,7 +334,7 @@ int SrsConfDirective::read_token(SrsConfigBuffer* buffer, vector<string>& 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,

View file

@ -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,

View file

@ -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;
}