Bug in cbh codec resulting in missing dates
Chess Database Application
Status: Pre-Alpha
Brought to you by:
gcramer
When converting cbh databases to si4 or sci format the dates of the games are often missing, which is a quite serious piece of information. Looking at the cbh codec I found that the three bytes for the source are read only conditionally from the stream (lines 2305-2306 in cbh_codec.cpp):
if (!m_sourceMap2.empty())
m_sourceMap.push_back(getSource(strm.uint24()));
In case those bytes are not read, the date (and subsequent data) will be read from the wrong place.
I suggest to fix this by reading the source bytes unconditionally:
Source* source = getSource(strm.uint24());
if (!m_sourceMap2.empty())
m_sourceMap.push_back(source);
Using this fix I converted the 2026 Megabase (and others) with correct dates.
I'm including a patch file.