search/index: fixed a number of bad conversions to properly deal with text documents bigger than 2GB

This commit is contained in:
"Jean-Francois Dockes ext:(%22)
2011-07-12 08:28:09 -07:00
parent 5e59354535
commit 88685d2e64
11 changed files with 42 additions and 23 deletions
+2 -2
View File
@@ -108,8 +108,8 @@ public:
return -1;
}
if (fseeko(fp, cacheoffset(msgnum), SEEK_SET) != 0) {
LOGDEB0(("MboxCache::get_offsets: seek %ld errno %d\n",
(long)cacheoffset(msgnum), errno));
LOGDEB0(("MboxCache::get_offsets: seek %lld errno %d\n",
cacheoffset(msgnum), errno));
return -1;
}
mbhoff_type offset = -1;
+2
View File
@@ -69,11 +69,13 @@ bool MimeHandlerText::set_document_file(const string &fn)
}
m_pagesz = size_t(ps);
string reason;
LOGDEB(("calling file_to_string\n"));
// file_to_string() takes pagesz == size_t(-1) to mean read all.
if (!file_to_string(fn, m_text, 0, m_pagesz, &reason)) {
LOGERR(("MimeHandlerText: can't read file: %s\n", reason.c_str()));
return false;
}
LOGDEB(("file_to_string OK\n"));
m_offs = m_text.length();
}