The lucky thing is:
size_t fileIdx = (fileIndex<0) ? newToken->m_FileIdx : (size_t)fileIndex;
Here, fileIndex is always < 0 (Unless we construct the Token tree from the cache)
So, the later code always works OK, because fileIdx is always newToken->m_FileIdx.
m_FilesMap[fileIdx].insert(newItem);