mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-22 15:39:57 -05:00
Use QString::toLatin1() rather than ::toAscii()
The toAscii (and fromAscii) are removed from Qt5 in favor of Latin1.
This commit is contained in:
parent
03e4b2d13c
commit
66b3d22041
@ -141,7 +141,7 @@ QString imageReaderFilter()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
formatsStringList.append("*." + QString::fromAscii(format).toLower());
|
formatsStringList.append("*." + QString::fromLatin1(format).toLower());
|
||||||
}
|
}
|
||||||
|
|
||||||
return formatsStringList.join(" ");
|
return formatsStringList.join(" ");
|
||||||
|
@ -42,12 +42,12 @@ Uuid Uuid::random()
|
|||||||
|
|
||||||
QString Uuid::toBase64() const
|
QString Uuid::toBase64() const
|
||||||
{
|
{
|
||||||
return QString::fromAscii(m_data.toBase64());
|
return QString::fromLatin1(m_data.toBase64());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Uuid::toHex() const
|
QString Uuid::toHex() const
|
||||||
{
|
{
|
||||||
return QString::fromAscii(m_data.toHex());
|
return QString::fromLatin1(m_data.toHex());
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray Uuid::toByteArray() const
|
QByteArray Uuid::toByteArray() const
|
||||||
@ -85,7 +85,7 @@ bool Uuid::operator!=(const Uuid& other) const
|
|||||||
|
|
||||||
Uuid Uuid::fromBase64(const QString& str)
|
Uuid Uuid::fromBase64(const QString& str)
|
||||||
{
|
{
|
||||||
QByteArray data = QByteArray::fromBase64(str.toAscii());
|
QByteArray data = QByteArray::fromBase64(str.toLatin1());
|
||||||
return Uuid(data);
|
return Uuid(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ void KeePass2XmlReader::parseEntryString(Entry* entry)
|
|||||||
|
|
||||||
if (isProtected && !value.isEmpty()) {
|
if (isProtected && !value.isEmpty()) {
|
||||||
if (m_randomStream) {
|
if (m_randomStream) {
|
||||||
value = QString::fromUtf8(m_randomStream->process(QByteArray::fromBase64(value.toAscii())));
|
value = QString::fromUtf8(m_randomStream->process(QByteArray::fromBase64(value.toLatin1())));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
raiseError("Unable to decrypt entry string");
|
raiseError("Unable to decrypt entry string");
|
||||||
@ -1053,7 +1053,7 @@ Uuid KeePass2XmlReader::readUuid()
|
|||||||
|
|
||||||
QByteArray KeePass2XmlReader::readBinary()
|
QByteArray KeePass2XmlReader::readBinary()
|
||||||
{
|
{
|
||||||
return QByteArray::fromBase64(readString().toAscii());
|
return QByteArray::fromBase64(readString().toLatin1());
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray KeePass2XmlReader::readCompressedBinary()
|
QByteArray KeePass2XmlReader::readCompressedBinary()
|
||||||
|
@ -192,7 +192,7 @@ void KeePass2XmlWriter::writeBinaries()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!data.isEmpty()) {
|
if (!data.isEmpty()) {
|
||||||
m_xml.writeCharacters(QString::fromAscii(data.toBase64()));
|
m_xml.writeCharacters(QString::fromLatin1(data.toBase64()));
|
||||||
}
|
}
|
||||||
m_xml.writeEndElement();
|
m_xml.writeEndElement();
|
||||||
}
|
}
|
||||||
@ -341,7 +341,7 @@ void KeePass2XmlWriter::writeEntry(const Entry* entry)
|
|||||||
if (m_randomStream) {
|
if (m_randomStream) {
|
||||||
m_xml.writeAttribute("Protected", "True");
|
m_xml.writeAttribute("Protected", "True");
|
||||||
QByteArray rawData = m_randomStream->process(entry->attributes()->value(key).toUtf8());
|
QByteArray rawData = m_randomStream->process(entry->attributes()->value(key).toUtf8());
|
||||||
value = QString::fromAscii(rawData.toBase64());
|
value = QString::fromLatin1(rawData.toBase64());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_xml.writeAttribute("ProtectInMemory", "True");
|
m_xml.writeAttribute("ProtectInMemory", "True");
|
||||||
@ -485,7 +485,7 @@ void KeePass2XmlWriter::writeUuid(const QString& qualifiedName, const Entry* ent
|
|||||||
|
|
||||||
void KeePass2XmlWriter::writeBinary(const QString& qualifiedName, const QByteArray& ba)
|
void KeePass2XmlWriter::writeBinary(const QString& qualifiedName, const QByteArray& ba)
|
||||||
{
|
{
|
||||||
writeString(qualifiedName, QString::fromAscii(ba.toBase64()));
|
writeString(qualifiedName, QString::fromLatin1(ba.toBase64()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeePass2XmlWriter::writeColor(const QString& qualifiedName, const QColor& color)
|
void KeePass2XmlWriter::writeColor(const QString& qualifiedName, const QColor& color)
|
||||||
|
@ -122,7 +122,7 @@ void FileKey::create(QIODevice* device)
|
|||||||
xmlWriter.writeStartElement("Key");
|
xmlWriter.writeStartElement("Key");
|
||||||
|
|
||||||
QByteArray data = randomGen()->randomArray(32);
|
QByteArray data = randomGen()->randomArray(32);
|
||||||
xmlWriter.writeTextElement("Data", QString::fromAscii(data.toBase64()));
|
xmlWriter.writeTextElement("Data", QString::fromLatin1(data.toBase64()));
|
||||||
|
|
||||||
xmlWriter.writeEndElement();
|
xmlWriter.writeEndElement();
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ QByteArray FileKey::loadXmlKey(QXmlStreamReader& xmlReader)
|
|||||||
while (!xmlReader.error() && xmlReader.readNextStartElement()) {
|
while (!xmlReader.error() && xmlReader.readNextStartElement()) {
|
||||||
if (xmlReader.name() == "Data") {
|
if (xmlReader.name() == "Data") {
|
||||||
// TODO: do we need to enforce a specific data.size()?
|
// TODO: do we need to enforce a specific data.size()?
|
||||||
data = QByteArray::fromBase64(xmlReader.readElementText().toAscii());
|
data = QByteArray::fromBase64(xmlReader.readElementText().toLatin1());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ void TestCryptoHash::test()
|
|||||||
QCOMPARE(cryptoHash1.result(),
|
QCOMPARE(cryptoHash1.result(),
|
||||||
QByteArray::fromHex("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"));
|
QByteArray::fromHex("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"));
|
||||||
|
|
||||||
QByteArray source2 = QString("KeePassX").toAscii();
|
QByteArray source2 = QString("KeePassX").toLatin1();
|
||||||
QByteArray result2 = CryptoHash::hash(source2, CryptoHash::Sha256);
|
QByteArray result2 = CryptoHash::hash(source2, CryptoHash::Sha256);
|
||||||
QCOMPARE(result2, QByteArray::fromHex("0b56e5f65263e747af4a833bd7dd7ad26a64d7a4de7c68e52364893dca0766b4"));
|
QCOMPARE(result2, QByteArray::fromHex("0b56e5f65263e747af4a833bd7dd7ad26a64d7a4de7c68e52364893dca0766b4"));
|
||||||
|
|
||||||
CryptoHash cryptoHash3(CryptoHash::Sha256);
|
CryptoHash cryptoHash3(CryptoHash::Sha256);
|
||||||
cryptoHash3.addData(QString("KeePa").toAscii());
|
cryptoHash3.addData(QString("KeePa").toLatin1());
|
||||||
cryptoHash3.addData(QString("ssX").toAscii());
|
cryptoHash3.addData(QString("ssX").toLatin1());
|
||||||
QCOMPARE(cryptoHash3.result(),
|
QCOMPARE(cryptoHash3.result(),
|
||||||
QByteArray::fromHex("0b56e5f65263e747af4a833bd7dd7ad26a64d7a4de7c68e52364893dca0766b4"));
|
QByteArray::fromHex("0b56e5f65263e747af4a833bd7dd7ad26a64d7a4de7c68e52364893dca0766b4"));
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ namespace QTest {
|
|||||||
char* toString(const Uuid& uuid)
|
char* toString(const Uuid& uuid)
|
||||||
{
|
{
|
||||||
QByteArray ba = "Uuid(";
|
QByteArray ba = "Uuid(";
|
||||||
ba += uuid.toBase64().toAscii().constData();
|
ba += uuid.toBase64().toLatin1().constData();
|
||||||
ba += ")";
|
ba += ")";
|
||||||
return qstrdup(ba.constData());
|
return qstrdup(ba.constData());
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ void TestKeePass2XmlReader::testEntry2()
|
|||||||
QVERIFY(attrs.isEmpty());
|
QVERIFY(attrs.isEmpty());
|
||||||
|
|
||||||
QCOMPARE(entry->attachments()->keys().size(), 1);
|
QCOMPARE(entry->attachments()->keys().size(), 1);
|
||||||
QCOMPARE(QString::fromAscii(entry->attachments()->value("myattach.txt")), QString("abcdefghijk"));
|
QCOMPARE(QString::fromLatin1(entry->attachments()->value("myattach.txt")), QString("abcdefghijk"));
|
||||||
|
|
||||||
QCOMPARE(entry->autoTypeEnabled(), true);
|
QCOMPARE(entry->autoTypeEnabled(), true);
|
||||||
QCOMPARE(entry->autoTypeObfuscation(), 1);
|
QCOMPARE(entry->autoTypeObfuscation(), 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user