Do not use the fromAscii() and toAscii() functions.

They are deprecated in Qt 5. Use fromLatin1() and toLatin1() instead. In
Qt 5, these always do the same thing as their "Ascii" counterparts. The
same goes for Qt 4, provided QTextCodec::setCodecForCStrings has not
been set, which it hasn't.

Change-Id: I04edeb376762b6671eff8156094f0d5e2cb8e1ea
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Christian Kandeler
2012-09-21 13:54:38 +02:00
parent 903281b352
commit 3d9e492860
44 changed files with 60 additions and 60 deletions
+1 -1
View File
@@ -2368,7 +2368,7 @@ static void qDumpQObjectProperty(QDumper &d)
if (dotPos == -1)
return;
iname.remove(0, dotPos + 1);
const int index = mob->indexOfProperty(iname.toAscii());
const int index = mob->indexOfProperty(iname.toLatin1());
if (index == -1)
return;
const QMetaProperty mop = mob->property(index);
+2 -2
View File
@@ -585,10 +585,10 @@ int main(int argc, char *argv[])
// find all QMetaObjects reachable when the specified module is imported
if (action != Path) {
importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toAscii();
importCode += QString("import %0 %1\n").arg(pluginImportUri, pluginImportVersion).toLatin1();
} else {
// pluginImportVersion can be empty
importCode += QString("import \".\" %2\n").arg(pluginImportVersion).toAscii();
importCode += QString("import \".\" %2\n").arg(pluginImportVersion).toLatin1();
}
// create a component with these imports to make sure the imports are valid
+1 -1
View File
@@ -339,7 +339,7 @@ void SshConnectionPrivate::handleIncomingData()
e.errorString);
} catch (Botan::Exception &e) {
closeConnection(SSH_DISCONNECT_BY_APPLICATION, SshInternalError, "",
tr("Botan library exception: %1").arg(QString::fromAscii(e.what())));
tr("Botan library exception: %1").arg(QString::fromLatin1(e.what())));
}
}
+1 -1
View File
@@ -77,7 +77,7 @@ bool SshKeyGenerator::generateKeys(KeyType type, PrivateKeyFormat format, int ke
}
return true;
} catch (Botan::Exception &e) {
m_error = tr("Error generating key: %1").arg(QString::fromAscii(e.what()));
m_error = tr("Error generating key: %1").arg(QString::fromLatin1(e.what()));
return false;
}
}
+1 -1
View File
@@ -207,7 +207,7 @@ void SshRemoteProcess::sendSignal(Signal signal)
d->m_sendFacility.sendChannelSignalPacket(d->remoteChannel(), signalString);
}
} catch (Botan::Exception &e) {
setErrorString(QString::fromAscii(e.what()));
setErrorString(QString::fromLatin1(e.what()));
d->closeChannel();
}
}
+1 -1
View File
@@ -125,7 +125,7 @@ QString ConsoleProcess::msgCannotCreateTempDir(const QString & dir, const QStrin
QString ConsoleProcess::msgUnexpectedOutput(const QByteArray &what)
{
return tr("Unexpected output from helper program (%1).").arg(QString::fromAscii(what));
return tr("Unexpected output from helper program (%1).").arg(QString::fromLatin1(what));
}
QString ConsoleProcess::msgCannotChangeToWorkDir(const QString & dir, const QString &why)
+1 -1
View File
@@ -389,7 +389,7 @@ bool PersistentSettingsWriter::save(const QVariantMap &data, QWidget *parent) co
w.setAutoFormattingIndent(1); // Historical, used to be QDom.
w.writeStartDocument();
w.writeDTD(QLatin1String("<!DOCTYPE ") + m_docType + QLatin1Char('>'));
w.writeComment(QString::fromAscii(" Written by %1 %2, %3. ").
w.writeComment(QString::fromLatin1(" Written by %1 %2, %3. ").
arg(QCoreApplication::applicationName(),
QCoreApplication::applicationVersion(),
QDateTime::currentDateTime().toString(Qt::ISODate)));
+1 -1
View File
@@ -117,7 +117,7 @@ private:
}
bool atEnd() const { return m_pos == m_portsSpec.length(); }
char nextChar() const { return m_portsSpec.at(m_pos).toAscii(); }
char nextChar() const { return m_portsSpec.at(m_pos).toLatin1(); }
PortList m_portList;
int m_pos;
+1 -1
View File
@@ -279,7 +279,7 @@ QStringList QtcProcess::splitArgs(const QString &_args, bool abortOnMeta, SplitE
inline static bool isQuoteMeta(QChar cUnicode)
{
char c = cUnicode.toAscii();
char c = cUnicode.toLatin1();
return c == '\\' || c == '\'' || c == '"' || c == '$';
}
+1 -1
View File
@@ -129,7 +129,7 @@ public:
logger->appendError(ErrorMessage::NoteLevel,
ZConfLib::tr("%1: log of previous daemon run is: '%2'.\n")
.arg(name())
.arg(QString::fromAscii(logBA.constData(), logBA.size())));
.arg(QString::fromLatin1(logBA.constData(), logBA.size())));
qDebug()<<logBA.size()<<oldLog.error()<<oldLog.errorString();
}
oldLog.close();
+2 -2
View File
@@ -85,7 +85,7 @@ void AndroidRunner::checkPID()
qint64 pid = -1;
QList<QByteArray> procs = psProc.readAll().split('\n');
foreach (const QByteArray &proc, procs) {
if (proc.trimmed().endsWith(m_packageName.toAscii())) {
if (proc.trimmed().endsWith(m_packageName.toLatin1())) {
QRegExp rx(QLatin1String("(\\d+)"));
if (rx.indexIn(QLatin1String(proc), proc.indexOf(' ')) > 0) {
pid = rx.cap(1).toLongLong();
@@ -259,7 +259,7 @@ void AndroidRunner::logcatReadStandardOutput()
m_logcat += m_adbLogcatProcess.readAllStandardOutput();
bool keepLastLine = m_logcat.endsWith('\n');
QByteArray line;
QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toAscii());
QByteArray pid(QString::fromLatin1("%1):").arg(m_processPID).toLatin1());
foreach (line, m_logcat.split('\n')) {
if (!line.contains(pid))
continue;
+1 -1
View File
@@ -153,7 +153,7 @@ static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c)
{
return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
}
// ------------- ClearCasePlugin
@@ -1149,7 +1149,7 @@ void CMakeCbpParser::parseAdd()
compilerOption[assignIndex] = ' ';
}
m_defines.append("#define ");
m_defines.append(compilerOption.mid(macroNameIndex).toAscii());
m_defines.append(compilerOption.mid(macroNameIndex).toLatin1());
m_defines.append('\n');
}
}
@@ -141,7 +141,7 @@ bool CommandsFile::exportCommands(const QList<ShortcutItem *> &items)
w.setAutoFormattingIndent(1); // Historical, used to be QDom.
w.writeStartDocument();
w.writeDTD(QLatin1String("<!DOCTYPE KeyboardMappingScheme>"));
w.writeComment(QString::fromAscii(" Written by Qt Creator %1, %2. ").
w.writeComment(QString::fromLatin1(" Written by Qt Creator %1, %2. ").
arg(QLatin1String(Core::Constants::IDE_VERSION_LONG),
QDateTime::currentDateTime().toString(Qt::ISODate)));
w.writeStartElement(ctx.mappingElement);
+1 -1
View File
@@ -1094,7 +1094,7 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString
case ParseComment: {
// comments have locale attributes. We want the default, English one
QString locale = atts.value(QLatin1String(localeAttributeC)).toString();
const QString comment = QCoreApplication::translate("MimeType", reader.readElementText().toAscii());
const QString comment = QCoreApplication::translate("MimeType", reader.readElementText().toLatin1());
if (locale.isEmpty()) {
data.comment = comment;
} else {
+3 -3
View File
@@ -158,7 +158,7 @@ void CodePasterProtocol::pasteFinished()
qWarning("Error pasting: %s", qPrintable(m_pasteReply->errorString()));
} else {
// Cut out the href-attribute
QString contents = QString::fromAscii(m_pasteReply->readAll());
QString contents = QString::fromLatin1(m_pasteReply->readAll());
int hrefPos = contents.indexOf(QLatin1String("href=\""));
if (hrefPos != -1) {
hrefPos += 6;
@@ -189,7 +189,7 @@ void CodePasterProtocol::fetchFinished()
if (error) {
content = m_fetchReply->errorString();
} else {
content = QString::fromAscii(m_fetchReply->readAll()); // Codepaster does not support special characters.
content = QString::fromLatin1(m_fetchReply->readAll()); // Codepaster does not support special characters.
if (debug)
qDebug() << content;
if (content.contains(QLatin1String("<B>No such paste!</B>"))) {
@@ -209,7 +209,7 @@ void CodePasterProtocol::listFinished()
Core::ICore::messageManager()->printToOutputPane(m_listReply->errorString(), true);
} else {
const QByteArray data = m_listReply->readAll();
const QStringList lines = QString::fromAscii(data).split(QLatin1Char('\n'));
const QStringList lines = QString::fromLatin1(data).split(QLatin1Char('\n'));
emit listDone(name(), lines);
}
m_listReply->deleteLater();
@@ -119,7 +119,7 @@ void PasteBinDotCaProtocol::pasteFinished()
} else {
/// returns ""SUCCESS:[id]""
const QByteArray data = m_pasteReply->readAll();
const QString link = QString::fromLatin1(urlC) + QString::fromAscii(data).remove(QLatin1String("SUCCESS:"));
const QString link = QString::fromLatin1(urlC) + QString::fromLatin1(data).remove(QLatin1String("SUCCESS:"));
emit pasteDone(link);
}
m_pasteReply->deleteLater();
@@ -134,7 +134,7 @@ void PasteBinDotComProtocol::pasteFinished()
if (m_pasteReply->error()) {
qWarning("Pastebin.com protocol error: %s", qPrintable(m_pasteReply->errorString()));
} else {
emit pasteDone(QString::fromAscii(m_pasteReply->readAll()));
emit pasteDone(QString::fromLatin1(m_pasteReply->readAll()));
}
m_pasteReply->deleteLater();
@@ -171,7 +171,7 @@ void PasteBinDotComProtocol::fetchFinished()
qDebug() << "fetchFinished: error" << m_fetchId << content;
} else {
title = QString::fromLatin1("Pastebin.com: %1").arg(m_fetchId);
content = QString::fromAscii(m_fetchReply->readAll());
content = QString::fromLatin1(m_fetchReply->readAll());
// Cut out from '<pre>' formatting
const int preEnd = content.lastIndexOf(QLatin1String("</pre>"));
if (preEnd != -1)
@@ -574,7 +574,7 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
QString newDeclText = linkSelection.selectedText();
for (int i = 0; i < newDeclText.size(); ++i) {
if (newDeclText.at(i).toAscii() == 0)
if (newDeclText.at(i).toLatin1() == 0)
newDeclText[i] = QLatin1Char('\n');
}
newDeclText.append(QLatin1String("{}"));
+1 -1
View File
@@ -148,7 +148,7 @@ static inline const VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c)
{
return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
}
static inline bool messageBoxQuestion(const QString &title, const QString &question, QWidget *parent = 0)
+2 -2
View File
@@ -800,7 +800,7 @@ void CdbEngine::runEngine()
if (debug)
qDebug("runEngine");
foreach (const QString &breakEvent, m_options->breakEvents)
postCommand(QByteArray("sxe ") + breakEvent.toAscii(), 0);
postCommand(QByteArray("sxe ") + breakEvent.toLatin1(), 0);
// Break functions: each function must be fully qualified,
// else the debugger will slow down considerably.
foreach (const QString &breakFunctionS, m_options->breakFunctions) {
@@ -1260,7 +1260,7 @@ void CdbEngine::handleJumpToLineAddressResolution(const CdbBuiltinCommandPtr &cm
static inline bool isAsciiWord(const QString &s)
{
foreach (const QChar &c, s) {
if (!c.isLetterOrNumber() || c.toAscii() == 0)
if (!c.isLetterOrNumber() || c.toLatin1() == 0)
return false;
}
return true;
+1 -1
View File
@@ -556,7 +556,7 @@ bool parseCdbDisassemblerLine(const QString &line, DisassemblerLine *dLine, uint
dLine->address = addressS.toULongLong(&ok, 16);
if (!ok)
return false;
dLine->rawData = QByteArray::fromHex(line.mid(rawDataPos, rawDataEnd - rawDataPos).toAscii());
dLine->rawData = QByteArray::fromHex(line.mid(rawDataPos, rawDataEnd - rawDataPos).toLatin1());
dLine->data = line.right(line.size() - instructionPos).trimmed();
return true;
}
@@ -56,7 +56,7 @@ bool NameDemanglerPrivate::demangle(const QString &mangledName)
{
bool success;
try {
m_parseState.m_mangledName = mangledName.toAscii();
m_parseState.m_mangledName = mangledName.toLatin1();
m_parseState.m_pos = 0;
m_demangledName.clear();
@@ -943,7 +943,7 @@ QtMessageLogItem *QmlV8DebuggerClientPrivate::constructLogItemTree(
if (objectData.name.isEmpty())
text = objectData.value.toString();
else
text = QString(_("%1: %2")).arg(QString::fromAscii(objectData.name))
text = QString(_("%1: %2")).arg(QString::fromLatin1(objectData.name))
.arg(objectData.value.toString());
QtMessageLogItem *item = new QtMessageLogItem(parent,
@@ -91,10 +91,10 @@ IntegerValidator::IntegerValidator(QObject *parent) :
bool IntegerValidator::isCharAcceptable(const QChar &c, int base)
{
if (c.isLetter())
return base == 16 && c.toLower().toAscii() <= 'f';
return base == 16 && c.toLower().toLatin1() <= 'f';
if (!c.isDigit())
return false;
const int digit = c.toAscii() - '0';
const int digit = c.toLatin1() - '0';
if (base == 8 && digit > 7)
return false;
if (base == 2 && digit > 1)
+1 -1
View File
@@ -281,7 +281,7 @@ bool isKeyWord(const QString &exp)
{
// FIXME: incomplete
QTC_ASSERT(!exp.isEmpty(), return false);
switch (exp.at(0).toAscii()) {
switch (exp.at(0).toLatin1()) {
case 'a':
return exp == QLatin1String("auto");
case 'b':
+1 -1
View File
@@ -799,7 +799,7 @@ static Input parseVimKeyName(const QString &keyName)
static const QMap<QString, int> k = vimKeyNames();
QMap<QString, int>::ConstIterator it = k.constFind(key.toUpper());
if (it != k.end())
return Input(*it, mods, *it <= 0x7f ? QString(QChar::fromAscii(*it)) : QString(""));
return Input(*it, mods, *it <= 0x7f ? QString(QChar::fromLatin1(*it)) : QString(""));
}
return Input();
+1 -1
View File
@@ -538,7 +538,7 @@ bool DebianManager::setPackageManagerIcon(const Utils::FileName &debianDir, Core
QBuffer buffer(&iconAsBase64);
buffer.open(QIODevice::WriteOnly);
if (!pixmap.scaled(MaddeDevice::packageManagerIconSize(deviceType))
.save(&buffer, iconPath.toFileInfo().suffix().toAscii())) {
.save(&buffer, iconPath.toFileInfo().suffix().toLatin1())) {
if (error)
*error = tr("Could not export image file '%1'.").arg(iconPath.toUserOutput());
return false;
+2 -2
View File
@@ -96,7 +96,7 @@ bool MaemoGlobal::isValidMaemoQtVersion(const QString &qmakePath, Core::Id devic
return false;
madAdminProc.setReadChannel(QProcess::StandardOutput);
const QByteArray tgtName = targetName(qmakePath).toAscii();
const QByteArray tgtName = targetName(qmakePath).toLatin1();
while (madAdminProc.canReadLine()) {
const QByteArray &line = madAdminProc.readLine();
if (line.contains(tgtName)
@@ -141,7 +141,7 @@ QString MaemoGlobal::remoteSourceProfilesCommand()
QByteArray remoteCall(":");
foreach (const QByteArray &profile, profiles)
remoteCall += "; test -f " + profile + " && source " + profile;
return QString::fromAscii(remoteCall);
return QString::fromLatin1(remoteCall);
}
PortList MaemoGlobal::freePorts(const Kit *k)
@@ -188,7 +188,7 @@ void MaemoPackageCreationWidget::setPackageManagerIcon()
QString imageFilter = tr("Images") + QLatin1String("( ");
const QList<QByteArray> &imageTypes = QImageReader::supportedImageFormats();
foreach (const QByteArray &imageType, imageTypes)
imageFilter += "*." + QString::fromAscii(imageType) + QLatin1Char(' ');
imageFilter += "*." + QString::fromLatin1(imageType) + QLatin1Char(' ');
imageFilter += QLatin1Char(')');
const QSize iconSize = MaddeDevice::packageManagerIconSize(deviceType);
const QString iconFileName = QFileDialog::getOpenFileName(this,
+2 -2
View File
@@ -109,7 +109,7 @@ static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c)
{
return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
}
// Ensure adding "..." to relative paths which is p4's convention
@@ -624,7 +624,7 @@ void PerforcePlugin::startSubmitProject()
Utils::TempFileSaver saver;
saver.setAutoRemove(false);
saver.write(result.stdOut.toAscii());
saver.write(result.stdOut.toLatin1());
if (!saver.finalize()) {
VcsBase::VcsBaseOutputWindow::instance()->appendError(saver.errorString());
cleanCommitMessageFile();
+1 -1
View File
@@ -695,7 +695,7 @@ QList<Abi> Abi::abisOfBinary(const Utils::FileName &path)
quint64 fileNameOffset = 0;
if (fileName.startsWith(QLatin1String("#1/")))
fileNameOffset = fileName.mid(3).toInt();
const QString fileLength = QString::fromAscii(data.mid(48, 10));
const QString fileLength = QString::fromLatin1(data.mid(48, 10));
int toSkip = 60 + fileNameOffset;
offset += fileLength.toInt() + 60 /* header */;
@@ -237,7 +237,7 @@ void ItemLibraryWidget::setSearchFilter(const QString &searchFilter)
nameFilterList.append(QString("*%1*").arg(searchFilter));
} else {
foreach (const QByteArray &extension, QImageReader::supportedImageFormats()) {
nameFilterList.append(QString("*%1*.%2").arg(searchFilter, QString::fromAscii(extension)));
nameFilterList.append(QString("*%1*.%2").arg(searchFilter, QString::fromLatin1(extension)));
}
}
@@ -78,7 +78,7 @@ SubComponentManager::SubComponentManager(Model *model, QObject *parent)
void SubComponentManager::addImport(int pos, const Import &import)
{
if (debug)
qDebug() << Q_FUNC_INFO << pos << import.file().toAscii();
qDebug() << Q_FUNC_INFO << pos << import.file().toLatin1();
if (import.isFileImport()) {
QFileInfo dirInfo = QFileInfo(m_filePath.resolved(import.file()).toLocalFile());
@@ -48,7 +48,7 @@ QVariant read(const QString &typeStr, const QString &str, const MetaInfo &)
QVariant read(const QString &typeStr, const QString &str)
{
int type = QMetaType::type(typeStr.toAscii().constData());
int type = QMetaType::type(typeStr.toLatin1().constData());
if (type == 0) {
qWarning() << "Type " << typeStr
<< " is unknown to QMetaType system. Cannot create properly typed QVariant for value "
@@ -326,7 +326,7 @@ ImageFileFilterItem::ImageFileFilterItem(QObject *parent)
// supported image formats according to
QList<QByteArray> extensions = QImageReader::supportedImageFormats();
foreach (const QByteArray &extension, extensions) {
filter.append(QString("*.%1;").arg(QString::fromAscii(extension)));
filter.append(QString("*.%1;").arg(QString::fromLatin1(extension)));
}
setFilter(filter);
}
@@ -280,8 +280,8 @@ QByteArray AbstractMobileApp::generateProFile(QString *errorMessage) const
out << line << endl;
};
proFileContent.replace("../shared/" + DeploymentPriFileName.toAscii(),
DeploymentPriFileName.toAscii());
proFileContent.replace("../shared/" + DeploymentPriFileName.toLatin1(),
DeploymentPriFileName.toLatin1());
return proFileContent;
}
@@ -438,7 +438,7 @@ QByteArray AbstractMobileApp::generateFile(int fileType,
const QString versionLine =
comment + sep + FileChecksum + sep + checkSumString
+ sep + FileStubVersion + sep + versionString + QLatin1Char('\x0A');
return versionLine.toAscii() + data;
return versionLine.toLatin1() + data;
}
int AbstractMobileApp::makeStubVersion(int minor)
@@ -150,7 +150,7 @@ static inline bool generateFormClass(const GuiAppParameters &params,
}
}
if (headerContents.isEmpty() || sourceContents.isEmpty()) {
*errorMessage = QString::fromAscii("Failed to obtain Designer plugin code generation service.");
*errorMessage = QString::fromLatin1("Failed to obtain Designer plugin code generation service.");
return false;
}
@@ -154,7 +154,7 @@ public:
saver.setAutoRemove(false);
if (!saver.hasError())
saver.setResult(m_pixmap.save(
saver.file(), QFileInfo(m_iconPath).suffix().toAscii().constData()));
saver.file(), QFileInfo(m_iconPath).suffix().toLatin1().constData()));
if (!saver.finalize()) {
QMessageBox::critical(QApplication::activeWindow(),
tr("File Error"),
@@ -178,7 +178,7 @@ public:
Q_UNUSED(size)
QMutexLocker lock(&m_mutex);
QUrl url = QUrl::fromEncoded(id.toAscii());
QUrl url = QUrl::fromEncoded(id.toLatin1());
if (!m_fetcher.asynchronousFetchData(url))
return QImage();
@@ -250,19 +250,19 @@ bool TarPackageCreationStep::writeHeader(QFile &tarFile, const QFileInfo &fileIn
| (02 * fileInfo.permission(QFile::WriteOther))
| (01 * fileInfo.permission(QFile::ExeOther));
const QByteArray permissionString = QString("%1").arg(permissions,
sizeof header.fileMode - 1, 8, QLatin1Char('0')).toAscii();
sizeof header.fileMode - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.fileMode, permissionString.data(), permissionString.length());
const QByteArray uidString = QString("%1").arg(fileInfo.ownerId(),
sizeof header.uid - 1, 8, QLatin1Char('0')).toAscii();
sizeof header.uid - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.uid, uidString.data(), uidString.length());
const QByteArray gidString = QString("%1").arg(fileInfo.groupId(),
sizeof header.gid - 1, 8, QLatin1Char('0')).toAscii();
sizeof header.gid - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.gid, gidString.data(), gidString.length());
const QByteArray sizeString = QString("%1").arg(fileInfo.size(),
sizeof header.length - 1, 8, QLatin1Char('0')).toAscii();
sizeof header.length - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.length, sizeString.data(), sizeString.length());
const QByteArray mtimeString = QString("%1").arg(fileInfo.lastModified().toTime_t(),
sizeof header.mtime - 1, 8, QLatin1Char('0')).toAscii();
sizeof header.mtime - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.mtime, mtimeString.data(), mtimeString.length());
if (fileInfo.isDir())
header.typeflag = '5';
@@ -277,7 +277,7 @@ bool TarPackageCreationStep::writeHeader(QFile &tarFile, const QFileInfo &fileIn
for (size_t i = 0; i < sizeof header; ++i)
checksum += reinterpret_cast<char *>(&header)[i];
const QByteArray checksumString = QString("%1").arg(checksum,
sizeof header.chksum - 1, 8, QLatin1Char('0')).toAscii();
sizeof header.chksum - 1, 8, QLatin1Char('0')).toLatin1();
std::memcpy(&header.chksum, checksumString.data(), checksumString.length());
header.chksum[sizeof header.chksum-1] = 0;
if (!tarFile.write(reinterpret_cast<char *>(&header), sizeof header)) {
@@ -699,7 +699,7 @@ bool ResourceModel::iconFileExtension(const QString &path)
const QList<QByteArray> _ext_list = QImageReader::supportedImageFormats();
foreach (const QByteArray &ext, _ext_list) {
QString dotExt = QString(QLatin1Char('.'));
dotExt += QString::fromAscii(ext);
dotExt += QString::fromLatin1(ext);
ext_list.append(dotExt);
}
}
+1 -1
View File
@@ -144,7 +144,7 @@ static inline const VcsBase::VcsBaseEditorParameters *findType(int ie)
static inline QString debugCodec(const QTextCodec *c)
{
return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec");
return c ? QString::fromLatin1(c->name()) : QString::fromLatin1("Null codec");
}
// Parse "svn status" output for added/modified/deleted files
@@ -62,7 +62,7 @@ QString toolTipForFrame(const Frame &frame)
if (frame.instructionPointer())
lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol",
"Instruction pointer:"),
QString::fromAscii("0x%1").arg(frame.instructionPointer(), 0, 16));
QString::fromLatin1("0x%1").arg(frame.instructionPointer(), 0, 16));
if (!frame.object().isEmpty())
lines << qMakePair(QCoreApplication::translate("Valgrind::XmlProtocol", "Object:"), frame.object());