diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2015-02-16 13:35:53 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2015-02-16 13:35:53 +0000 |
commit | 9cf135dd2c2544a8c1f889b5de38136aa3ec1d4d (patch) | |
tree | 4cbc412f2f6b1ab2e11ba871d92fb68ac7e32015 /src/tools | |
parent | 7354c6d3939440803d0d0d884baec48040c02bb3 (diff) | |
parent | 89aaf528c96072dd93505284b9a8fc268e0acd6e (diff) |
Merge "Merge remote-tracking branch 'origin/5.4' into dev" into refs/staging/dev
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/sdpscanner/main.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/tools/sdpscanner/main.cpp b/src/tools/sdpscanner/main.cpp index 35c08e0c..1efb6de2 100644 --- a/src/tools/sdpscanner/main.cpp +++ b/src/tools/sdpscanner/main.cpp @@ -141,9 +141,13 @@ static void parseAttributeValues(sdp_data_t *data, int indentation, QByteArray & QByteArray text = QByteArray::fromRawData(data->val.str, data->unitSize); bool hasNonPrintableChar = false; - for (int i = 0; i < text.count() && !hasNonPrintableChar; i++) { - if (!isprint(text[i])) { + for (int i = 0; i < text.count(); i++) { + if (text[i] == '\0') { + text.resize(i); // cut trailing content + break; + } else if (!isprint(text[i])) { hasNonPrintableChar = true; + text.resize(text.indexOf('\0')); // cut trailing content break; } } @@ -152,10 +156,10 @@ static void parseAttributeValues(sdp_data_t *data, int indentation, QByteArray & xmlOutput.append("encoding=\"hex\" value=\""); xmlOutput.append(text.toHex()); } else { - text.replace("&", "&"); - text.replace("<", "<"); - text.replace(">", ">"); - text.replace("\"", """); + text.replace('&', "&"); + text.replace('<', "<"); + text.replace('>', ">"); + text.replace('"', """); xmlOutput.append("value=\""); xmlOutput.append(text); |