Skip to content
This repository has been archived by the owner on Aug 5, 2024. It is now read-only.

Upgraded C++ code to Qt5 #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/diff_match_patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ QList<Diff> diff_match_patch::diff_fromDelta(const QString &text1,
// Each token begins with a one character parameter which specifies the
// operation of this token (delete, insert, equality).
QString param = safeMid(token, 1);
switch (token[0].toAscii()) {
switch (token[0].toLatin1()) {
case '+':
param = QUrl::fromPercentEncoding(qPrintable(param));
diffs.append(Diff(INSERT, param));
Expand Down Expand Up @@ -2074,7 +2074,7 @@ QList<Patch> diff_match_patch::patch_fromText(const QString &textline) {
text.removeFirst();
continue;
}
sign = text.front()[0].toAscii();
sign = text.front()[0].toLatin1();
line = safeMid(text.front(), 1);
line = line.replace("+", "%2B"); // decode would change all "+" to " "
line = QUrl::fromPercentEncoding(qPrintable(line));
Expand Down
8 changes: 4 additions & 4 deletions cpp/diff_match_patch_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

// Code known to compile and run with Qt 4.3 through Qt 4.7.
// Code known to compile and run with Qt 5
#include <QtCore>
#include "diff_match_patch.h"
#include "diff_match_patch_test.h"
Expand Down Expand Up @@ -1055,21 +1055,21 @@ void diff_match_patch_test::assertEquals(const QString &strCase, const QMap<QCha
i2.next();
if (i1.key() != i2.key() || i1.value() != i2.value()) {
qDebug("%s FAIL\nExpected: (%c, %d)\nActual: (%c, %d)", qPrintable(strCase),
i1.key().toAscii(), i1.value(), i2.key().toAscii(), i2.value());
i1.key().toLatin1(), i1.value(), i2.key().toLatin1(), i2.value());
throw strCase;
}
}

if (i1.hasNext()) {
i1.next();
qDebug("%s FAIL\nExpected: (%c, %d)\nActual: none",
qPrintable(strCase), i1.key().toAscii(), i1.value());
qPrintable(strCase), i1.key().toLatin1(), i1.value());
throw strCase;
}
if (i2.hasNext()) {
i2.next();
qDebug("%s FAIL\nExpected: none\nActual: (%c, %d)",
qPrintable(strCase), i2.key().toAscii(), i2.value());
qPrintable(strCase), i2.key().toLatin1(), i2.value());
throw strCase;
}
qDebug("%s OK", qPrintable(strCase));
Expand Down