fix cores in catdb logic.

This commit is contained in:
mwells 2013-10-03 22:34:49 -06:00
parent 9e1fee2cb9
commit 0176f8d6a7
2 changed files with 11 additions and 4 deletions

View File

@ -308,7 +308,9 @@ bool CatRec::set ( Url *site ,
// add the ids
m_catids = (long*)p;
memcpy(p, catids, 4*m_numCatids);
p += 4*m_numCatids;
// skip over "numCatids" NOT m_numCatids which is TRUNCATED
// to MAX_CATIDS
p += 4*numCatids;
//}
// point to the filenum so we can mod it!
//m_filenumPtr = p;

View File

@ -509,8 +509,12 @@ void Categories::printPathFromIndex ( SafeBuf *sb ,
if (catIndex < 1) return;
// get the parent
parentId = m_cats[catIndex].m_parentid;
// print the parent(s) first
if (parentId > 1) {
long catid = m_cats[catIndex].m_catid;
// . print the parent(s) first
// . the new dmoz data dumps signify a parentless topic by
// havings its parentid equal its catid, so avoid infinite
// loops by checking for that here now. mdw oct 2013.
if (parentId > 1 && parentId != catid ) {
bool isParentRTL = isIdRTLStart(parentId);
// print spacing here if RTL
//if (isRTL && !raw)
@ -569,8 +573,9 @@ void Categories::printPathCrumbFromIndex ( SafeBuf *sb,
if (catIndex < 1) return;
// get the parent
parentId = m_cats[catIndex].m_parentid;
long catid = m_cats[catIndex].m_catid;
// print the parent(s) first
if (parentId > 1) {
if (parentId > 1 && parentId != catid ) {
bool isParentRTL = isIdRTLStart(parentId);
printPathCrumbFromId(sb, parentId, isRTL);
// print a spacing