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

Always use string instance to avoid crash risk. 3.0.95

This commit is contained in:
winlin 2020-01-05 22:17:15 +08:00
parent b794c9e4ec
commit 10464a5fbe
15 changed files with 119 additions and 14 deletions

View file

@ -296,7 +296,7 @@ bool srs_config_apply_filter(SrsConfDirective* dvr_apply, SrsRequest* req)
return false;
}
string srs_config_bool2switch(const string& sbool)
string srs_config_bool2switch(string sbool)
{
return sbool == "true"? "on":"off";
}

View file

@ -123,7 +123,7 @@ extern bool srs_stream_caster_is_flv(std::string caster);
extern bool srs_config_apply_filter(SrsConfDirective* dvr_apply, SrsRequest* req);
// Convert bool in str to on/off
extern std::string srs_config_bool2switch(const std::string& sbool);
extern std::string srs_config_bool2switch(std::string sbool);
// Parse loaded vhost directives to compatible mode.
// For exmaple, SRS1/2 use the follow refer style:

View file

@ -81,7 +81,7 @@ int SrsDummyCoroutine::cid()
_ST_THREAD_CREATE_PFN _pfn_st_thread_create = (_ST_THREAD_CREATE_PFN)st_thread_create;
SrsSTCoroutine::SrsSTCoroutine(const string& n, ISrsCoroutineHandler* h, int cid)
SrsSTCoroutine::SrsSTCoroutine(string n, ISrsCoroutineHandler* h, int cid)
{
name = n;
handler = h;

View file

@ -132,7 +132,7 @@ private:
public:
// Create a thread with name n and handler h.
// @remark User can specify a cid for thread to use, or we will allocate a new one.
SrsSTCoroutine(const std::string& n, ISrsCoroutineHandler* h, int cid = 0);
SrsSTCoroutine(std::string n, ISrsCoroutineHandler* h, int cid = 0);
virtual ~SrsSTCoroutine();
public:
// Start the thread.

View file

@ -1157,7 +1157,7 @@ string srs_get_peer_ip(int fd)
return std::string(saddr);
}
bool srs_is_boolean(const string& str)
bool srs_is_boolean(string str)
{
return str == "true" || str == "false";
}

View file

@ -644,7 +644,7 @@ extern std::string srs_get_peer_ip(int fd);
// is_bool("true") == true
// is_bool("false") == true
// otherwise, false.
extern bool srs_is_boolean(const std::string& str);
extern bool srs_is_boolean(std::string str);
// Dump summaries for /api/v1/summaries.
extern void srs_api_dump_summaries(SrsJsonObject* obj);