corelib: settings - make qsettings.cpp unity buildable

Both qsettings.cpp and qjsonparser.cpp defined Space in the
global namespace. Hiding it in one of them in an implementation
namespace resolves the name clash.

Pick-to: 6.6 6.5
Change-Id: I8dd1244f80d87f3908597ed82c8e41b49b7b916c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4ff65f0e5615b1132ec13c6eeba3647162d8dd0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tim Blechmann 2024-02-06 13:40:25 +08:00 committed by Qt Cherry-pick Bot
parent e31fef039d
commit a4c158effe
2 changed files with 7 additions and 1 deletions

View File

@ -327,7 +327,6 @@ qt_internal_add_module(Core
text/qstringconverter.cpp # enum Data text/qstringconverter.cpp # enum Data
tools/qcryptographichash.cpp # KeccakNISTInterface/Final tools/qcryptographichash.cpp # KeccakNISTInterface/Final
io/qdebug.cpp # undef qDebug io/qdebug.cpp # undef qDebug
io/qsettings.cpp # Space (also in qjsonparser.cpp)
NO_PCH_SOURCES NO_PCH_SOURCES
compat/removed_api.cpp compat/removed_api.cpp
global/qsimd.cpp global/qsimd.cpp

View File

@ -1518,6 +1518,8 @@ void QConfFileSettingsPrivate::syncConfFile(QConfFile *confFile)
} }
} }
namespace SettingsImpl {
enum { Space = 0x1, Special = 0x2 }; enum { Space = 0x1, Special = 0x2 };
static const char charTraits[256] = static const char charTraits[256] =
@ -1544,10 +1546,15 @@ static const char charTraits[256] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}; };
} // namespace SettingsImpl
using SettingsImpl::charTraits;
bool QConfFileSettingsPrivate::readIniLine(QByteArrayView data, qsizetype &dataPos, bool QConfFileSettingsPrivate::readIniLine(QByteArrayView data, qsizetype &dataPos,
qsizetype &lineStart, qsizetype &lineLen, qsizetype &lineStart, qsizetype &lineLen,
qsizetype &equalsPos) qsizetype &equalsPos)
{ {
using namespace SettingsImpl;
qsizetype dataLen = data.size(); qsizetype dataLen = data.size();
bool inQuotes = false; bool inQuotes = false;