if (mLine.Length() > 0) AddLdifRowToDatabase();
nsresult AddressBookParser::ParseLdifFile(PRFileDesc* file){    if (! file)        return NS_ERROR_NULL_POINTER;    char buf[1024];	PRInt32 startPos = 0;    PRInt32 len = 0;	nsIMdbRow* newRow = nsnull;	if (mDatabase)	{		mDatabase->GetNewRow(&newRow); 		if (!newRow)			return NS_ERROR_FAILURE;	}	else		return NS_ERROR_FAILURE;    while ((len = PR_Read(file, buf, sizeof(buf))) > 0)	{		startPos = 0;		while (NS_SUCCEEDED(GetLdifStringRecord(buf, len, &startPos)))		{			if (mDatabase)			{				mDatabase->GetNewRow(&newRow); 				if (!newRow)					return NS_ERROR_FAILURE;			}			else				return NS_ERROR_FAILURE;			char* cursor = (char*)mLine.ToNewCString(); 			char* saveCursor = cursor;  /* keep for deleting */ 			char* line = 0; 			char* typeSlot = 0; 			char* valueSlot = 0; 			int length = 0;  // the length  of an ldif attribute			while ( (line = str_getline(&cursor)) != NULL)			{				if ( str_parse_line(line, &typeSlot, &valueSlot, &length) == 0 )				{					AddLdifColToDatabase(newRow, typeSlot, valueSlot);				}				else					continue; // parse error: continue with next loop iteration			}			delete [] saveCursor;			mDatabase->AddCardRowToDB(newRow);			}	}	return NS_OK;}