Skip to content

Commit 5911a98

Browse files
committed
Get rid of the m_newNamespaceScheme boolean.
Comparing the minorVersion "all the time" is enough.
1 parent 26f6469 commit 5911a98

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/fileheader.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ namespace zim
107107
bool hasChecksum() const { return getMimeListPos() >= 80; }
108108
offset_type getChecksumPos() const { return hasChecksum() ? checksumPos : 0; }
109109
void setChecksumPos(offset_type p) { checksumPos = p; }
110+
111+
bool useNewNamespaceScheme() const { return minorVersion >= 1; }
112+
110113
};
111114

112115
}

src/fileimpl.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ class Grouping
186186
zimReader(makeFileReader(zimFile)),
187187
direntReader(new DirentReader(zimReader)),
188188
clusterCache(envValue("ZIM_CLUSTERCACHE", CLUSTER_CACHE_SIZE)),
189-
m_newNamespaceScheme(false),
190189
m_hasFrontArticlesIndex(true),
191190
m_startUserEntry(0),
192191
m_endUserEntry(0)
@@ -366,8 +365,7 @@ class Grouping
366365
p = zp+1;
367366
}
368367

369-
const_cast<bool&>(m_newNamespaceScheme) = header.getMinorVersion() >= 1;
370-
if (m_newNamespaceScheme) {
368+
if (header.useNewNamespaceScheme()) {
371369
const_cast<entry_index_t&>(m_startUserEntry) = getNamespaceBeginOffset('C');
372370
const_cast<entry_index_t&>(m_endUserEntry) = getNamespaceEndOffset('C');
373371
} else {

src/fileimpl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ namespace zim
5656
typedef std::shared_ptr<const Cluster> ClusterHandle;
5757
ConcurrentCache<cluster_index_type, ClusterHandle> clusterCache;
5858

59-
const bool m_newNamespaceScheme;
6059
const bool m_hasFrontArticlesIndex;
6160
const entry_index_t m_startUserEntry;
6261
const entry_index_t m_endUserEntry;
@@ -109,7 +108,7 @@ namespace zim
109108
const std::string& getFilename() const { return zimFile->filename(); }
110109
const Fileheader& getFileheader() const { return header; }
111110
zsize_t getFilesize() const;
112-
bool hasNewNamespaceScheme() const { return m_newNamespaceScheme; }
111+
bool hasNewNamespaceScheme() const { return header.useNewNamespaceScheme(); }
113112
bool hasFrontArticlesIndex() const { return m_hasFrontArticlesIndex; }
114113

115114
FileCompound::PartRange getFileParts(offset_t offset, zsize_t size);

0 commit comments

Comments
 (0)