return NS_ERROR_FAILURE;
if (NS_FAILED(rv)) { mDone = PR_TRUE; return rv; }  mdbOid outOid; nsMsgKey key=0; if (hdrRow->GetOid(mDB->GetEnv(), &outOid) == NS_OK) key = outOid.mOid_Id;  rv = mDB->GetHdrFromUseCache(key, &mResultHdr); if (NS_SUCCEEDED(rv) && mResultHdr) hdrRow->Release(); else rv = mDB->CreateMsgHdr(hdrRow, key, &mResultHdr); if (NS_FAILED(rv)) return rv;  if (mResultHdr) mResultHdr->GetFlags(&flags); else flags = 0; } while (mFilter && mFilter(mResultHdr, mClosure) != NS_OK && !(flags & MSG_FLAG_EXPUNGED));  if (mResultHdr) { mNextPrefetched = PR_TRUE; return NS_OK; } return NS_ERROR_FAILURE;
nsresult nsMsgDBEnumerator::PrefetchNext(){	nsresult rv = NS_OK;	nsIMdbRow* hdrRow;	mdb_pos rowPos;	PRUint32 flags;	if (!mRowCursor)	{		rv = GetRowCursor();		if (NS_FAILED(rv))			return rv;	}    do {        NS_IF_RELEASE(mResultHdr);        mResultHdr = nsnull;        rv = mRowCursor->NextRow(mDB->GetEnv(), &hdrRow, &rowPos);		if (!hdrRow) {            mDone = PR_TRUE;			return NS_ERROR_FAILURE;        }        if (NS_FAILED(rv)) {            mDone = PR_TRUE;            return rv;        }		//Get key from row		mdbOid outOid;		nsMsgKey key=0;		if (hdrRow->GetOid(mDB->GetEnv(), &outOid) == NS_OK)            key = outOid.mOid_Id;		rv = mDB->GetHdrFromUseCache(key, &mResultHdr);		if (NS_SUCCEEDED(rv) && mResultHdr)			hdrRow->Release();		else			rv = mDB->CreateMsgHdr(hdrRow, key, &mResultHdr);        if (NS_FAILED(rv))			return rv;		if (mResultHdr)			mResultHdr->GetFlags(&flags);		else			flags = 0;    } 	while (mFilter && mFilter(mResultHdr, mClosure) != NS_OK && !(flags & MSG_FLAG_EXPUNGED));    if (mResultHdr) 	{		mNextPrefetched = PR_TRUE;        return NS_OK;    }    return NS_ERROR_FAILURE;}