diff options
Diffstat (limited to 'src/tools/rcc/rcc.cpp')
-rw-r--r-- | src/tools/rcc/rcc.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 1f641dd7e1..3227c585b7 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -35,14 +35,6 @@ enum { CONSTANT_COMPRESSTHRESHOLD_DEFAULT = 70 }; -#if QT_CONFIG(zstd) && QT_VERSION >= QT_VERSION_CHECK(6,0,0) -# define CONSTANT_COMPRESSALGO_DEFAULT RCCResourceLibrary::CompressionAlgorithm::Zstd -#elif !defined(QT_NO_COMPRESS) -# define CONSTANT_COMPRESSALGO_DEFAULT RCCResourceLibrary::CompressionAlgorithm::Zlib -#else -# define CONSTANT_COMPRESSALGO_DEFAULT RCCResourceLibrary::CompressionAlgorithm::None -#endif - void RCCResourceLibrary::write(const char *str, int len) { int n = m_out.size(); @@ -87,7 +79,7 @@ public: QLocale::Language language = QLocale::C, QLocale::Territory territory = QLocale::AnyTerritory, uint flags = NoFlags, - RCCResourceLibrary::CompressionAlgorithm compressAlgo = CONSTANT_COMPRESSALGO_DEFAULT, + RCCResourceLibrary::CompressionAlgorithm compressAlgo = RCCResourceLibrary::CompressionAlgorithm::Best, int compressLevel = CONSTANT_COMPRESSLEVEL_DEFAULT, int compressThreshold = CONSTANT_COMPRESSTHRESHOLD_DEFAULT, bool noZstd = false); @@ -379,7 +371,7 @@ qint64 RCCFileInfo::writeDataName(RCCResourceLibrary &lib, qint64 offset) } // write the length - lib.writeNumber2(m_name.length()); + lib.writeNumber2(m_name.size()); if (text || pass1) lib.writeString("\n "); else if (python) @@ -396,14 +388,14 @@ qint64 RCCFileInfo::writeDataName(RCCResourceLibrary &lib, qint64 offset) // write the m_name const QChar *unicode = m_name.unicode(); - for (int i = 0; i < m_name.length(); ++i) { + for (int i = 0; i < m_name.size(); ++i) { lib.writeNumber2(unicode[i].unicode()); if ((text || pass1) && i % 16 == 0) lib.writeString("\n "); else if (python && i % 16 == 0) lib.writeString("\\\n"); } - offset += m_name.length()*2; + offset += m_name.size()*2; // done if (text || pass1) @@ -438,7 +430,7 @@ RCCResourceLibrary::RCCResourceLibrary(quint8 formatVersion) : m_root(nullptr), m_format(C_Code), m_verbose(false), - m_compressionAlgo(CONSTANT_COMPRESSALGO_DEFAULT), + m_compressionAlgo(CompressionAlgorithm::Best), m_compressLevel(CONSTANT_COMPRESSLEVEL_DEFAULT), m_compressThreshold(CONSTANT_COMPRESSTHRESHOLD_DEFAULT), m_treeOffset(0), @@ -514,7 +506,7 @@ bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice, QString attribute = attributes.value(m_strings.ATTRIBUTE_LANG).toString(); QLocale lang = QLocale(attribute); language = lang.language(); - if (2 == attribute.length()) { + if (2 == attribute.size()) { // Language only territory = QLocale::AnyTerritory; } else { @@ -733,7 +725,7 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file) for (auto it = cbegin; it != cend; ++it) { if (it.key() == filename && it.value()->m_language == s->m_language && it.value()->m_territory == s->m_territory) { - for (const QString &name : qAsConst(m_fileNames)) { + for (const QString &name : std::as_const(m_fileNames)) { qWarning("%s: Warning: potential duplicate alias detected: '%s'", qPrintable(name), qPrintable(filename)); } |