mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
fix bugs
This commit is contained in:
parent
fabcc91a0e
commit
5ac8177ce6
6 changed files with 28 additions and 13 deletions
|
@ -356,7 +356,9 @@ vector<string> srs_string_split(string str, string flag)
|
|||
string s = str;
|
||||
|
||||
while ((pos = s.find(flag)) != string::npos) {
|
||||
arr.push_back(s.substr(0, pos));
|
||||
if (pos != 0) {
|
||||
arr.push_back(s.substr(0, pos));
|
||||
}
|
||||
s = s.substr(pos + flag.length());
|
||||
}
|
||||
|
||||
|
@ -406,7 +408,9 @@ vector<string> srs_string_split(string str, vector<string> flags)
|
|||
break;
|
||||
}
|
||||
|
||||
arr.push_back(s.substr(0, pos));
|
||||
if (pos != 0) {
|
||||
arr.push_back(s.substr(0, pos));
|
||||
}
|
||||
s = s.substr(pos + flag.length());
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,8 @@ extern bool srs_string_starts_with(std::string str, std::string flag0, std::stri
|
|||
extern bool srs_string_starts_with(std::string str, std::string flag0, std::string flag1, std::string flag2, std::string flag3);
|
||||
// whether string contains with
|
||||
extern bool srs_string_contains(std::string str, std::string flag);
|
||||
// find the min match in str for flags.
|
||||
extern std::string srs_string_min_match(std::string str, std::vector<std::string> flags);
|
||||
// split the string by flag to array.
|
||||
extern std::vector<std::string> srs_string_split(std::string str, std::string flag);
|
||||
extern std::vector<std::string> srs_string_split(std::string str, std::vector<std::string> flags);
|
||||
|
@ -97,9 +99,9 @@ extern int srs_create_dir_recursively(std::string dir);
|
|||
|
||||
// whether path exists.
|
||||
extern bool srs_path_exists(std::string path);
|
||||
// get the dirname of path, for instance, filename("/live/livestream")="/live"
|
||||
// get the dirname of path, for instance, dirname("/live/livestream")="/live"
|
||||
extern std::string srs_path_dirname(std::string path);
|
||||
// get the basename of path, for instance, filename("/live/livestream")="livestream"
|
||||
// get the basename of path, for instance, basename("/live/livestream")="livestream"
|
||||
extern std::string srs_path_basename(std::string path);
|
||||
// get the filename of path, for instance, filename("livestream.flv")="livestream"
|
||||
extern std::string srs_path_filename(std::string path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue