From 4b7941618a5d0a75e279fc9429abe863cfc7c272 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Tue, 25 Oct 2011 10:34:11 +0200 Subject: [PATCH] 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 Bug 17634 Change-Id: If48a571a01ffe6d135f79872235341a06fb3a75f Sanity-Review: Qt Sanity Bot Reviewed-by: Thiago Macieira --- src/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp index bc617a9..9c49183 100644 --- a/src/qdbus/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/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; -- 2.7.4