Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2014-08-06 18:45:25 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:24:07 +0300
commit341a8f73cb7c55b4689071350e9bc54b60403d12 (patch)
tree6b7aeadc4f0e9a560bb908ba3821b21a3c0d3d14 /coding/file_container.cpp
parent107bf6c28e648e3477e4290e342cf53ba08ee2a5 (diff)
Removed dummy assert in compare functor.
Diffstat (limited to 'coding/file_container.cpp')
-rw-r--r--coding/file_container.cpp31
1 files changed, 22 insertions, 9 deletions
diff --git a/coding/file_container.cpp b/coding/file_container.cpp
index 6af4112311..28716334e1 100644
--- a/coding/file_container.cpp
+++ b/coding/file_container.cpp
@@ -22,6 +22,13 @@ template <class TSink> void Write(TSink & sink, FilesContainerBase::Info const &
WriteVarUint(sink, i.m_size);
}
+string DebugPrint(FilesContainerBase::Info const & info)
+{
+ ostringstream ss;
+ ss << "{ " << info.m_tag << ", " << info.m_offset << ", " << info.m_size << " }";
+ return ss.str();
+}
+
/////////////////////////////////////////////////////////////////////////////
// FilesContainerBase
/////////////////////////////////////////////////////////////////////////////
@@ -95,17 +102,23 @@ void FilesContainerW::Open(FileWriter::Op op)
case FileWriter::OP_WRITE_EXISTING:
{
- {
- // read an existing service info
- FileReader reader(m_name);
- ReadInfo(reader);
- }
-
- // Important: in append mode we should sort info-vector by offsets
- sort(m_info.begin(), m_info.end(), LessOffset());
- break;
+ // read an existing service info
+ FileReader reader(m_name);
+ ReadInfo(reader);
}
+ // Important: in append mode we should sort info-vector by offsets
+ sort(m_info.begin(), m_info.end(), LessOffset());
+
+ // Check that all offsets are unique
+#ifdef DEBUG
+ for (size_t i = 1; i < m_info.size(); ++i)
+ ASSERT(m_info[i-1].m_offset < m_info[i].m_offset ||
+ m_info[i-1].m_size == 0 ||
+ m_info[i].m_size == 0, ());
+#endif
+ break;
+
default:
ASSERT ( false, ("Unsupported options") );
break;