summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Sanders <don.sanders@nokia.com>2011-06-06 23:06:51 +0300
committerDon Sanders <don.sanders@nokia.com>2011-06-06 23:06:51 +0300
commit994aaaeabb84119f3d630c342f3fc10607387fbf (patch)
treebcceb0c6b647a61fd4da9d82586210ca3654a854
parent781a79e8838959ad360e230caf4905141227d0f4 (diff)
Qtify brace placement.
-rw-r--r--src/libraries/qmfclient/qmailmessage.cpp92
1 files changed, 42 insertions, 50 deletions
diff --git a/src/libraries/qmfclient/qmailmessage.cpp b/src/libraries/qmfclient/qmailmessage.cpp
index d14ca25d..10c8ce28 100644
--- a/src/libraries/qmfclient/qmailmessage.cpp
+++ b/src/libraries/qmfclient/qmailmessage.cpp
@@ -1913,81 +1913,73 @@ static void outputHeaderPart(QDataStream& out, const QByteArray& inText, int* li
while (true) {
int remaining = maxLineLength - *lineLength;
- if (text.length() <= remaining)
- {
- out << DataString(text);
- *lineLength += text.length();
- return;
- }
- else
- {
- // See if we can find suitable whitespace to break the line
- int wsIndex = -1;
- int lastIndex = -1;
- int preferredIndex = -1;
- bool syntacticBreakUsed = false;
- do
- {
- lastIndex = wsIndex;
- if ((lastIndex > 0)
- && ((text[lastIndex - 1] == ';') || (text[lastIndex - 1] == ','))) {
+ if (text.length() <= remaining) {
+ out << DataString(text);
+ *lineLength += text.length();
+ return;
+ } else {
+ // See if we can find suitable whitespace to break the line
+ int wsIndex = -1;
+ int lastIndex = -1;
+ int preferredIndex = -1;
+ bool syntacticBreakUsed = false;
+ do {
+ lastIndex = wsIndex;
+ if ((lastIndex > 0)
+ && ((text[lastIndex - 1] == ';') || (text[lastIndex - 1] == ','))) {
// Prefer to split after (possible) parameters and commas
preferredIndex = lastIndex;
- }
+ }
- wsIndex = whitespace.indexIn(text, wsIndex + 1);
+ wsIndex = whitespace.indexIn(text, wsIndex + 1);
} while ((wsIndex != -1) && (wsIndex < remaining));
- if (preferredIndex != -1)
+ if (preferredIndex != -1)
lastIndex = preferredIndex;
- if (lastIndex == -1)
- {
- // We couldn't find any suitable whitespace, look for high-level syntactic break
- // allow a maximum of 998 characters excl CRLF on a line without white space
- remaining = 997 - *lineLength;
- int syntacticIn = -1;
- do {
+ if (lastIndex == -1) {
+ // We couldn't find any suitable whitespace, look for high-level syntactic break
+ // allow a maximum of 998 characters excl CRLF on a line without white space
+ remaining = 997 - *lineLength;
+ int syntacticIn = -1;
+ do {
lastIndex = syntacticIn;
syntacticIn = syntacticBreak.indexIn(text, syntacticIn + 1);
- } while ((syntacticIn != -1) && (syntacticIn < remaining - 1));
-
- if (lastIndex != -1) {
+ } while ((syntacticIn != -1) && (syntacticIn < remaining - 1));
+
+ if (lastIndex != -1) {
syntacticBreakUsed = true;
++lastIndex;
- } else {
+ } else {
// We couldn't find any high-level syntactic break either - just break at the last char
//qWarning() << "Unable to break header field at white space or syntactic break";
lastIndex = remaining;
- }
+ }
}
- if (lastIndex == 0)
- {
- out << DataString('\n') << DataString(text[0]);
- *lineLength = 1;
- lastIndex = 1;
- }
- else
- {
- out << DataString(text.left(lastIndex)) << DataString('\n');
+ if (lastIndex == 0) {
+ out << DataString('\n') << DataString(text[0]);
+ *lineLength = 1;
+ lastIndex = 1;
+ } else {
+ out << DataString(text.left(lastIndex)) << DataString('\n');
- if ((lastIndex == remaining) || (syntacticBreakUsed)) {
+ if ((lastIndex == remaining) || (syntacticBreakUsed)) {
// We need to insert some artifical whitespace
out << DataString(' ');
- } else {
+ } else {
// Append the breaking whitespace (ensure it does not get CRLF-ified)
out << DataString(QByteArray(1, text[lastIndex]));
++lastIndex;
- }
+ }
- *lineLength = 1;
+ *lineLength = 1;
}
- text = text.mid(lastIndex);
- if (text.isEmpty()) {
- return;
- }
+ text = text.mid(lastIndex);
+ if (text.isEmpty()) {
+ return;
+ }
}
}
}