fix header row copy to use mork, force invalid dbs to close

This commit is contained in:
bienvenu%netscape.com 1999-04-27 22:58:18 +00:00
Родитель a37df20ee6
Коммит dc1006fcee
4 изменённых файлов: 34 добавлений и 22 удалений

Просмотреть файл

@ -647,7 +647,8 @@ orkinRow::AddRow( // add all cells in another row to this one
if ( ev )
{
morkRow* source = 0;
if ( this->CanUseRow(mev, morkBool_kFalse, &outErr, &source) )
orkinRow* unsafeSource = (orkinRow*) ioSourceRow; // unsafe cast
if ( unsafeSource->CanUseRow(mev, morkBool_kFalse, &outErr, &source) )
{
row->AddRow(ev, source);
}
@ -668,7 +669,8 @@ orkinRow::SetRow( // make exact duplicate of another row
if ( ev )
{
morkRow* source = 0;
if ( this->CanUseRow(mev, morkBool_kFalse, &outErr, &source) )
orkinRow* unsafeSource = (orkinRow*) ioSourceRow; // unsafe cast
if ( unsafeSource->CanUseRow(mev, morkBool_kFalse, &outErr, &source) )
{
row->SetRow(ev, source);
}
@ -676,6 +678,7 @@ orkinRow::SetRow( // make exact duplicate of another row
}
return outErr;
}
// } ----- end row methods -----
// } ===== end nsIMdbRow methods =====

Просмотреть файл

@ -647,7 +647,8 @@ orkinRow::AddRow( // add all cells in another row to this one
if ( ev )
{
morkRow* source = 0;
if ( this->CanUseRow(mev, morkBool_kFalse, &outErr, &source) )
orkinRow* unsafeSource = (orkinRow*) ioSourceRow; // unsafe cast
if ( unsafeSource->CanUseRow(mev, morkBool_kFalse, &outErr, &source) )
{
row->AddRow(ev, source);
}
@ -668,7 +669,8 @@ orkinRow::SetRow( // make exact duplicate of another row
if ( ev )
{
morkRow* source = 0;
if ( this->CanUseRow(mev, morkBool_kFalse, &outErr, &source) )
orkinRow* unsafeSource = (orkinRow*) ioSourceRow; // unsafe cast
if ( unsafeSource->CanUseRow(mev, morkBool_kFalse, &outErr, &source) )
{
row->SetRow(ev, source);
}
@ -676,6 +678,7 @@ orkinRow::SetRow( // make exact duplicate of another row
}
return outErr;
}
// } ----- end row methods -----
// } ===== end nsIMdbRow methods =====

Просмотреть файл

@ -123,7 +123,7 @@ NS_IMETHODIMP nsMailDatabase::Open(nsFileSpec &folderName, PRBool create, nsIMsg
{
// this will make the db folder info release its ref to the mail db...
NS_IF_RELEASE(mailDB->m_dbFolderInfo);
mailDB->Close(PR_TRUE);
mailDB->ForceClosed();
if (err == NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE)
summarySpec.Delete(PR_FALSE);

Просмотреть файл

@ -1968,28 +1968,34 @@ NS_IMETHODIMP nsMsgDatabase::CopyHdrFromExistingHdr(nsMsgKey key, nsIMsgDBHdr *e
if (existingHdr)
{
#define MDB_DOES_CELL_CURSORS_OR_COPY_ROW
#ifdef MDB_DOES_CELL_CURSORS_OR_COPY_ROW
nsMsgHdr* sourceMsgHdr = NS_STATIC_CAST(nsMsgHdr*, existingHdr); // closed system, cast ok
nsMsgHdr *destMsgHdr = nsnull;
CreateNewHdr(key, &destMsgHdr);
nsIMdbRow sourceRow = sourceMsgHdr->GetMDBRow() ;
{
nsIMdbRowCellCursor* cellCursor = nsnull;
mdb_err res = sourceRow->GetRowCellCursor(GetEnv(), -1, &cellCursor) ; // acquire new cursor instance
if (res == 0 && cellCursor)
{
do
{
nsIMdbCell ioCell;
mdb_column outColumn;
mdb_pos outPos;
CreateNewHdr(key, (nsIMsgDBHdr **) &destMsgHdr);
nsIMdbRow *sourceRow = sourceMsgHdr->GetMDBRow() ;
nsIMdbRow *destRow = destMsgHdr->GetMDBRow();
err = destRow->SetRow(GetEnv(), sourceRow);
if (NS_SUCCEEDED(err))
err = AddNewHdrToDB(destMsgHdr, PR_TRUE);
res = cellCursor->NextCell(GetEnv(), &ioCell, &outColumn, &outPos);
// {
// nsIMdbRowCellCursor* cellCursor = nsnull;
// mdb_err res = sourceRow->GetRowCellCursor(GetEnv(), -1, &cellCursor) ; // acquire new cursor instance
// if (res == 0 && cellCursor)
// {
// do
// {
// nsIMdbCell ioCell;
// mdb_column outColumn;
// mdb_pos outPos;
// res = cellCursor->NextCell(GetEnv(), &ioCell, &outColumn, &outPos);
}
while (outPos >= 0 && res == 0);
}
}
// }
// while (outPos >= 0 && res == 0);
// }
// }
#else
nsMsgHdrStruct hdrStruct;
err = GetMsgHdrStructFromnsMsgHdr(existingHdr, &hdrStruct);