diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2016-12-15 14:05:07 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2016-12-16 10:16:40 +0000 |
commit | 7ebdd6ef8002e949469ed4dad4be8414dd0b2aab (patch) | |
tree | 4811ecfdafe0627bd6b7318fe43910ab409b46b6 /src/lib/corelib/language/filetags.cpp | |
parent | f0b106759521ad64772b89047981b99c53926bd7 (diff) |
PersistentPool: Prevent access to raw data stream
Instead, we employ our now-generic load/store interface for all
serialization operations. The advantages are two-fold:
1) It can no longer happen that carelessly written store()
functions mistakenly dump unshared strings into the build graph,
as it has happened several times in the past.
2) We get rid of enormous amounts of custom code dealing with
container (de)serialization. All of this is now done centrally by a
handful of templates in PersistentPool.
Change-Id: Ib1262da50989edda9726abd7d5a8ffdceaa0ec76
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/language/filetags.cpp')
-rw-r--r-- | src/lib/corelib/language/filetags.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/corelib/language/filetags.cpp b/src/lib/corelib/language/filetags.cpp index f086de102..792b5aebb 100644 --- a/src/lib/corelib/language/filetags.cpp +++ b/src/lib/corelib/language/filetags.cpp @@ -50,6 +50,16 @@ void FileTag::clear() Id::operator=(Id()); } +void FileTag::store(PersistentPool &pool) const +{ + pool.store(toString()); +} + +void FileTag::load(PersistentPool &pool) +{ + *this = FileTag(pool.load<QString>().toUtf8()); +} + QStringList FileTags::toStringList() const { QStringList strlst; @@ -62,7 +72,7 @@ FileTags FileTags::fromStringList(const QStringList &strings) { FileTags result; foreach (const QString &str, strings) - result += FileTag(str.toLocal8Bit()); + result += FileTag(str.toUtf8()); return result; } @@ -77,16 +87,6 @@ bool FileTags::matches(const FileTags &other) const return false; } -void FileTags::store(PersistentPool &pool) const -{ - pool.store(toStringList()); -} - -void FileTags::load(PersistentPool &pool) -{ - *this = fromStringList(pool.load<QStringList>()); -} - LogWriter operator <<(LogWriter w, const FileTags &tags) { bool firstLoop = true; |