candidate foundation改为string类型

This commit is contained in:
ziyue
2021-03-29 12:28:47 +08:00
parent ba06def4d8
commit 9d2498a694
4 changed files with 16 additions and 12 deletions

View File

@@ -689,14 +689,16 @@ string SdpAttrSctpMap::toString() const {
}
void SdpAttrCandidate::parse(const string &str) {
char foundation_buf[32] = {0};
char transport_buf[16] = {0};
char address_buf[32] = {0};
char type_buf[16] = {0};
if (7 != sscanf(str.data(), "%" SCNu32 " %" SCNu32 " %15[^ ] %" SCNu32 " %31[^ ] %" SCNu16 " typ %15[^ ]",
&foundation, &component, transport_buf, &priority, address_buf, &port, type_buf)) {
if (7 != sscanf(str.data(), "%31[^ ] %" SCNu32 " %15[^ ] %" SCNu32 " %31[^ ] %" SCNu16 " typ %15[^ ]",
foundation_buf, &component, transport_buf, &priority, address_buf, &port, type_buf)) {
SDP_THROW();
}
foundation = foundation_buf;
transport = transport_buf;
address = address_buf;
type = type_buf;
@@ -720,7 +722,7 @@ void SdpAttrCandidate::parse(const string &str) {
string SdpAttrCandidate::toString() const {
if (value.empty()) {
value = to_string(foundation) + " " + to_string(component) + " " + transport + " " + to_string(priority) +
value = foundation + " " + to_string(component) + " " + transport + " " + to_string(priority) +
" " + address + " " + to_string(port) + " typ " + type;
for (auto &pr : arr) {
value += ' ';