From 70c1e9589bf390bc3010663f133d87a789f17c3e Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Wed, 30 Nov 2011 20:21:24 +0100 Subject: fixed error generating wrong introspection string in header output file When using dbus introspection files with CRLF encoding the CR is not handled and results into a CR code at a wrong location in the output file Task-number: QTBUG-17634 Merge-request: 1478 Reviewed-by: thiago --- tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp index bc617a9..9c49183 100644 --- a/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/tools/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -466,11 +466,13 @@ static QString stringify(const QString &data) int i; for (i = 0; i < data.length(); ++i) { retval += QLatin1Char('\"'); - for ( ; i < data.length() && data[i] != QLatin1Char('\n'); ++i) + for ( ; i < data.length() && data[i] != QLatin1Char('\n') && data[i] != QLatin1Char('\r'); ++i) if (data[i] == QLatin1Char('\"')) retval += QLatin1String("\\\""); else retval += data[i]; + if (data[i] == QLatin1Char('\r') && data[i+1] == QLatin1Char('\n')) + i++; retval += QLatin1String("\\n\"\n"); } return retval; -- cgit v0.12