Bug 1463266 - fix some white-space issues in nsAddrDatabase.cpp. rs=white-space-only a=jorgk
authorJorg K <jorgk@jorgk.com>
Thu, 13 Sep 2018 00:56:11 +0200
changeset 32160 7ebd318d99dac3805458096431ef1f5bf8aa6633
parent 32159 cabd893ac8e91b3e64f3d0158ab6effa2e6f291c
child 32161 505528fac6296ffb436caf0b8c711df8d8c5f621
push id2313
push usermozilla@jorgk.com
push dateTue, 18 Sep 2018 20:58:26 +0000
treeherdercomm-beta@35cda8f6b181 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhite-space-only, jorgk
bugs1463266
Bug 1463266 - fix some white-space issues in nsAddrDatabase.cpp. rs=white-space-only a=jorgk [skip-blame]
mailnews/addrbook/src/nsAddrDatabase.cpp
--- a/mailnews/addrbook/src/nsAddrDatabase.cpp
+++ b/mailnews/addrbook/src/nsAddrDatabase.cpp
@@ -128,27 +128,27 @@ nsAddrDatabase::nsAddrDatabase()
       m_AddressCharSetColumnToken(0),
       m_LastRecordKey(0),
       m_dbDirectory(nullptr)
 {
 }
 
 nsAddrDatabase::~nsAddrDatabase()
 {
-    Close(false);    // better have already been closed.
-
-    // better not be any listeners, because we're going away.
-    NS_ASSERTION(m_ChangeListeners.Length() == 0, "shouldn't have any listeners");
-
-    RemoveFromCache(this);
-    // clean up after ourself!
-    if (m_mdbPabTable)
-      m_mdbPabTable->Release();
-    NS_IF_RELEASE(m_mdbStore);
-    NS_IF_RELEASE(m_mdbEnv);
+  Close(false);    // better have already been closed.
+
+  // better not be any listeners, because we're going away.
+  NS_ASSERTION(m_ChangeListeners.Length() == 0, "shouldn't have any listeners");
+
+  RemoveFromCache(this);
+  // clean up after ourself!
+  if (m_mdbPabTable)
+    m_mdbPabTable->Release();
+  NS_IF_RELEASE(m_mdbStore);
+  NS_IF_RELEASE(m_mdbEnv);
 }
 
 NS_IMPL_ISUPPORTS(nsAddrDatabase, nsIAddrDatabase, nsIAddrDBAnnouncer)
 
 NS_IMETHODIMP nsAddrDatabase::AddListener(nsIAddrDBListener *listener)
 {
   NS_ENSURE_ARG_POINTER(listener);
   return m_ChangeListeners.AppendElement(listener) ? NS_OK : NS_ERROR_FAILURE;
@@ -219,17 +219,17 @@ nsAddrDatabase::CleanupCache()
   if (m_dbCache)
   {
     for (int32_t i = m_dbCache->Length() - 1; i >= 0; --i)
     {
       nsAddrDatabase* pAddrDB = m_dbCache->ElementAt(i);
       if (pAddrDB)
         pAddrDB->ForceClosed();
     }
-    //        NS_ASSERTION(m_dbCache.Length() == 0, "some msg dbs left open");    // better not be any open db's.
+    // NS_ASSERTION(m_dbCache.Length() == 0, "some msg dbs left open");    // better not be any open db's.
     delete m_dbCache;
     m_dbCache = nullptr;
   }
 }
 
 //----------------------------------------------------------------------
 // FindInCache - this addrefs the db it finds.
 //----------------------------------------------------------------------
@@ -245,23 +245,23 @@ already_AddRefed<nsAddrDatabase> nsAddrD
       return pAddrDB.forget();
     }
   }
   return nullptr;
 }
 
 bool nsAddrDatabase::MatchDbName(nsIFile* dbName)    // returns true if they match
 {
-    bool dbMatches = false;
-
-    nsresult rv = m_dbName->Equals(dbName, &dbMatches);
-    if (NS_FAILED(rv))
-      return false;
-
-    return dbMatches;
+  bool dbMatches = false;
+
+  nsresult rv = m_dbName->Equals(dbName, &dbMatches);
+  if (NS_FAILED(rv))
+    return false;
+
+  return dbMatches;
 }
 
 //----------------------------------------------------------------------
 // RemoveFromCache
 //----------------------------------------------------------------------
 void nsAddrDatabase::RemoveFromCache(nsAddrDatabase* pAddrDB)
 {
   if (m_dbCache)
@@ -278,25 +278,25 @@ void nsAddrDatabase::GetMDBFactory(nsIMd
       rv = mdbFactoryService->GetMdbFactory(getter_AddRefs(mMdbFactory));
   }
   NS_IF_ADDREF(*aMdbFactory = mMdbFactory);
 }
 
 /* caller need to delete *aDbPath */
 NS_IMETHODIMP nsAddrDatabase::GetDbPath(nsIFile* *aDbPath)
 {
-    if (!aDbPath)
-        return NS_ERROR_NULL_POINTER;
-
-    return m_dbName->Clone(aDbPath);
+  if (!aDbPath)
+    return NS_ERROR_NULL_POINTER;
+
+  return m_dbName->Clone(aDbPath);
 }
 
 NS_IMETHODIMP nsAddrDatabase::SetDbPath(nsIFile* aDbPath)
 {
-    return aDbPath->Clone(getter_AddRefs(m_dbName));
+  return aDbPath->Clone(getter_AddRefs(m_dbName));
 }
 
 NS_IMETHODIMP nsAddrDatabase::Open
 (nsIFile *aMabFile, bool aCreate, bool upgrading /* unused */, nsIAddrDatabase** pAddrDB)
 {
   *pAddrDB = nullptr;
 
   RefPtr<nsAddrDatabase> pAddressBookDB = FindInCache(aMabFile);
@@ -574,40 +574,40 @@ NS_IMETHODIMP nsAddrDatabase::OpenMDB(ns
     }
     NS_IF_RELEASE(thumb);
   }
   return ret;
 }
 
 NS_IMETHODIMP nsAddrDatabase::CloseMDB(bool commit)
 {
-    if (commit)
-        Commit(nsAddrDBCommitType::kSessionCommit);
+  if (commit)
+    Commit(nsAddrDBCommitType::kSessionCommit);
 //???    RemoveFromCache(this);  // if we've closed it, better not leave it in the cache.
-    return NS_OK;
+  return NS_OK;
 }
 
 // force the database to close - this'll flush out anybody holding onto
 // a database without having a listener!
 // This is evil in the com world, but there are times we need to delete the file.
 NS_IMETHODIMP nsAddrDatabase::ForceClosed()
 {
-    nsresult    err = NS_OK;
-    nsCOMPtr<nsIAddrDatabase> aDb(do_QueryInterface(this, &err));
-
-    // make sure someone has a reference so object won't get deleted out from under us.
-    NS_ADDREF_THIS();
-    NotifyAnnouncerGoingAway();
-    // OK, remove from cache first and close the store.
-    RemoveFromCache(this);
-
-    err = CloseMDB(false);    // since we're about to delete it, no need to commit.
-    NS_IF_RELEASE(m_mdbStore);
-    NS_RELEASE_THIS();
-    return err;
+  nsresult err = NS_OK;
+  nsCOMPtr<nsIAddrDatabase> aDb(do_QueryInterface(this, &err));
+
+  // make sure someone has a reference so object won't get deleted out from under us.
+  NS_ADDREF_THIS();
+  NotifyAnnouncerGoingAway();
+  // OK, remove from cache first and close the store.
+  RemoveFromCache(this);
+
+  err = CloseMDB(false);    // since we're about to delete it, no need to commit.
+  NS_IF_RELEASE(m_mdbStore);
+  NS_RELEASE_THIS();
+  return err;
 }
 
 NS_IMETHODIMP nsAddrDatabase::Commit(uint32_t commitType)
 {
   nsresult err = NS_OK;
   nsIMdbThumb *commitThumb = nullptr;
 
   if (commitType == nsAddrDBCommitType::kLargeCommit ||
@@ -659,17 +659,17 @@ NS_IMETHODIMP nsAddrDatabase::Commit(uin
   // ### do something with error, but clear it now because mork errors out on commits.
   if (m_mdbEnv)
     m_mdbEnv->ClearErrors();
   return err;
 }
 
 NS_IMETHODIMP nsAddrDatabase::Close(bool forceCommit /* = TRUE */)
 {
-    return CloseMDB(forceCommit);
+  return CloseMDB(forceCommit);
 }
 
 // set up empty tablesetc.
 nsresult nsAddrDatabase::InitNewDB()
 {
   nsresult err = InitMDBInfo();
   if (NS_SUCCEEDED(err))
   {
@@ -683,17 +683,17 @@ nsresult nsAddrDatabase::InitNewDB()
 nsresult nsAddrDatabase::InitPabTable()
 {
   return m_mdbStore && m_mdbEnv ? m_mdbStore->NewTableWithOid(m_mdbEnv,
                                                   &gAddressBookTableOID,
                                                   m_PabTableKind,
                                                   false,
                                                   (const mdbOid*)nullptr,
                                                   &m_mdbPabTable)
-      : NS_ERROR_NULL_POINTER;
+                                : NS_ERROR_NULL_POINTER;
 }
 
 //save the last record number, store in m_DataRowScopeToken, row 1
 nsresult nsAddrDatabase::InitLastRecorKey()
 {
   if (!m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
@@ -725,32 +725,32 @@ nsresult nsAddrDatabase::GetDataRow(nsIM
   m_mdbStore->GetRow(m_mdbEnv, &dataRowOid, &pRow);
   *pDataRow = pRow;
 
   return pRow ? NS_OK : NS_ERROR_FAILURE;
 }
 
 nsresult nsAddrDatabase::GetLastRecordKey()
 {
-    if (!m_mdbPabTable)
-        return NS_ERROR_NULL_POINTER;
-
-    nsCOMPtr <nsIMdbRow> pDataRow;
-    nsresult err = GetDataRow(getter_AddRefs(pDataRow));
-
-    if (NS_SUCCEEDED(err) && pDataRow)
-    {
-        m_LastRecordKey = 0;
-        err = GetIntColumn(pDataRow, m_LastRecordKeyColumnToken, &m_LastRecordKey, 0);
-        if (NS_FAILED(err))
-            err = NS_ERROR_NOT_AVAILABLE;
-        return NS_OK;
-    }
-
-    return NS_ERROR_NOT_AVAILABLE;
+  if (!m_mdbPabTable)
+      return NS_ERROR_NULL_POINTER;
+
+  nsCOMPtr <nsIMdbRow> pDataRow;
+  nsresult err = GetDataRow(getter_AddRefs(pDataRow));
+
+  if (NS_SUCCEEDED(err) && pDataRow)
+  {
+    m_LastRecordKey = 0;
+    err = GetIntColumn(pDataRow, m_LastRecordKeyColumnToken, &m_LastRecordKey, 0);
+    if (NS_FAILED(err))
+      err = NS_ERROR_NOT_AVAILABLE;
+    return NS_OK;
+  }
+
+  return NS_ERROR_NOT_AVAILABLE;
 }
 
 nsresult nsAddrDatabase::UpdateLastRecordKey()
 {
   if (!m_mdbPabTable || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   nsCOMPtr <nsIMdbRow> pDataRow;
@@ -901,24 +901,24 @@ nsresult nsAddrDatabase::UpdateLowercase
 We store UTF8 strings in the database.  We need to convert the UTF8
 string into unicode string, then convert to lower case.  Before storing
 back into the database,  we need to convert the lowercase unicode string
 into UTF8 string.
 */
 nsresult nsAddrDatabase::ConvertAndAddLowercaseColumn
 (nsIMdbRow * row, mdb_token fromCol, mdb_token toCol)
 {
-    nsAutoString colString;
-
-    nsresult rv = GetStringColumn(row, fromCol, colString);
-    if (!colString.IsEmpty())
-    {
-        rv = AddLowercaseColumn(row, toCol, NS_ConvertUTF16toUTF8(colString).get());
-    }
-    return rv;
+  nsAutoString colString;
+
+  nsresult rv = GetStringColumn(row, fromCol, colString);
+  if (!colString.IsEmpty())
+  {
+    rv = AddLowercaseColumn(row, toCol, NS_ConvertUTF16toUTF8(colString).get());
+  }
+  return rv;
 }
 
 // Change the unicode string to lowercase, then convert to UTF8 string to store in db
 nsresult nsAddrDatabase::AddUnicodeToColumn(nsIMdbRow * row, mdb_token aColToken, mdb_token aLowerCaseColToken, const char16_t* aUnicodeStr)
 {
   nsresult rv = AddCharStringColumn(row, aColToken, NS_ConvertUTF16toUTF8(aUnicodeStr).get());
   NS_ENSURE_SUCCESS(rv,rv);
 
@@ -1311,111 +1311,111 @@ NS_IMETHODIMP nsAddrDatabase::AddListCar
 
   }
 
   return NS_OK;
 }
 
 nsresult nsAddrDatabase::AddListAttributeColumnsToRow(nsIAbDirectory *list, nsIMdbRow *listRow, nsIAbDirectory *aParent)
 {
-    nsresult    err = NS_OK;
-
-    if ((!list && !listRow) || !m_mdbEnv)
-        return NS_ERROR_NULL_POINTER;
-
-    mdbOid rowOid, tableOid;
-    m_mdbPabTable->GetOid(m_mdbEnv, &tableOid);
-    listRow->GetOid(m_mdbEnv, &rowOid);
-
-    nsCOMPtr<nsIAbMDBDirectory> dblist(do_QueryInterface(list,&err));
-    if (NS_SUCCEEDED(err))
-        dblist->SetDbRowID(rowOid.mOid_Id);
-
-    // add the row to the singleton table.
-    if (NS_SUCCEEDED(err) && listRow)
+  nsresult err = NS_OK;
+
+  if ((!list && !listRow) || !m_mdbEnv)
+    return NS_ERROR_NULL_POINTER;
+
+  mdbOid rowOid, tableOid;
+  m_mdbPabTable->GetOid(m_mdbEnv, &tableOid);
+  listRow->GetOid(m_mdbEnv, &rowOid);
+
+  nsCOMPtr<nsIAbMDBDirectory> dblist(do_QueryInterface(list,&err));
+  if (NS_SUCCEEDED(err))
+    dblist->SetDbRowID(rowOid.mOid_Id);
+
+  // add the row to the singleton table.
+  if (NS_SUCCEEDED(err) && listRow)
+  {
+    nsString unicodeStr;
+
+    list->GetDirName(unicodeStr);
+    if (!unicodeStr.IsEmpty())
+        AddUnicodeToColumn(listRow, m_ListNameColumnToken, m_LowerListNameColumnToken, unicodeStr.get());
+
+    list->GetListNickName(unicodeStr);
+    AddListNickName(listRow, NS_ConvertUTF16toUTF8(unicodeStr).get());
+
+    list->GetDescription(unicodeStr);
+    AddListDescription(listRow, NS_ConvertUTF16toUTF8(unicodeStr).get());
+
+    // XXX todo, this code has problems if you manually enter duplicate emails.
+    nsCOMPtr<nsIMutableArray> pAddressLists;
+    list->GetAddressLists(getter_AddRefs(pAddressLists));
+
+    uint32_t count;
+    pAddressLists->GetLength(&count);
+
+    nsAutoString email;
+    uint32_t i, total;
+    total = 0;
+    for (i = 0; i < count; i++)
     {
-        nsString unicodeStr;
-
-        list->GetDirName(unicodeStr);
-        if (!unicodeStr.IsEmpty())
-            AddUnicodeToColumn(listRow, m_ListNameColumnToken, m_LowerListNameColumnToken, unicodeStr.get());
-
-        list->GetListNickName(unicodeStr);
-        AddListNickName(listRow, NS_ConvertUTF16toUTF8(unicodeStr).get());
-
-        list->GetDescription(unicodeStr);
-        AddListDescription(listRow, NS_ConvertUTF16toUTF8(unicodeStr).get());
-
-        // XXX todo, this code has problems if you manually enter duplicate emails.
-        nsCOMPtr<nsIMutableArray> pAddressLists;
-        list->GetAddressLists(getter_AddRefs(pAddressLists));
-
-        uint32_t count;
-        pAddressLists->GetLength(&count);
-
-        nsAutoString email;
-        uint32_t i, total;
-        total = 0;
-        for (i = 0; i < count; i++)
-        {
-            nsCOMPtr<nsIAbCard> pCard(do_QueryElementAt(pAddressLists, i, &err));
-
-            if (NS_FAILED(err))
-                continue;
-
-            pCard->GetPrimaryEmail(email);
-            if (!email.IsEmpty())
-                total++;
-        }
-        SetListAddressTotal(listRow, total);
-
-        uint32_t pos;
-        for (i = 0; i < count; i++)
-        {
-            nsCOMPtr<nsIAbCard> pCard(do_QueryElementAt(pAddressLists, i, &err));
-
-            if (NS_FAILED(err))
-                continue;
-
-            bool listHasCard = false;
-            err = list->HasCard(pCard, &listHasCard);
-
-            // start from 1
-            pos = i + 1;
-            pCard->GetPrimaryEmail(email);
-            if (!email.IsEmpty())
-            {
-                nsCOMPtr<nsIAbCard> pNewCard;
-                err = AddListCardColumnsToRow(pCard, listRow, pos, getter_AddRefs(pNewCard), listHasCard, list, aParent);
-                if (pNewCard)
-                    pAddressLists->ReplaceElementAt(pNewCard, i);
-            }
-        }
+      nsCOMPtr<nsIAbCard> pCard(do_QueryElementAt(pAddressLists, i, &err));
+
+      if (NS_FAILED(err))
+        continue;
+
+      pCard->GetPrimaryEmail(email);
+      if (!email.IsEmpty())
+        total++;
     }
-    return NS_OK;
+    SetListAddressTotal(listRow, total);
+
+    uint32_t pos;
+    for (i = 0; i < count; i++)
+    {
+      nsCOMPtr<nsIAbCard> pCard(do_QueryElementAt(pAddressLists, i, &err));
+
+      if (NS_FAILED(err))
+        continue;
+
+      bool listHasCard = false;
+      err = list->HasCard(pCard, &listHasCard);
+
+      // start from 1
+      pos = i + 1;
+      pCard->GetPrimaryEmail(email);
+      if (!email.IsEmpty())
+      {
+        nsCOMPtr<nsIAbCard> pNewCard;
+        err = AddListCardColumnsToRow(pCard, listRow, pos, getter_AddRefs(pNewCard), listHasCard, list, aParent);
+        if (pNewCard)
+          pAddressLists->ReplaceElementAt(pNewCard, i);
+      }
+    }
+  }
+  return NS_OK;
 }
 
 uint32_t nsAddrDatabase::GetListAddressTotal(nsIMdbRow* listRow)
 {
-    uint32_t count = 0;
-    GetIntColumn(listRow, m_ListTotalColumnToken, &count, 0);
-    return count;
+  uint32_t count = 0;
+  GetIntColumn(listRow, m_ListTotalColumnToken, &count, 0);
+  return count;
 }
 
 NS_IMETHODIMP nsAddrDatabase::SetListAddressTotal(nsIMdbRow* aListRow, uint32_t aTotal)
 {
-    return AddIntColumn(aListRow, m_ListTotalColumnToken, aTotal);
+  return AddIntColumn(aListRow, m_ListTotalColumnToken, aTotal);
 }
 
 NS_IMETHODIMP nsAddrDatabase::FindRowByCard(nsIAbCard * aCard,nsIMdbRow **aRow)
 {
-    nsString primaryEmail;
-    aCard->GetPrimaryEmail(primaryEmail);
-    return GetRowForCharColumn(primaryEmail.get(), m_PriEmailColumnToken,
-                               true, true, aRow, nullptr);
+  nsString primaryEmail;
+  aCard->GetPrimaryEmail(primaryEmail);
+  return GetRowForCharColumn(primaryEmail.get(), m_PriEmailColumnToken,
+                             true, true, aRow, nullptr);
 }
 
 nsresult nsAddrDatabase::GetAddressRowByPos(nsIMdbRow* listRow, uint16_t pos, nsIMdbRow** cardRow)
 {
   if (!m_mdbStore || !listRow || !cardRow || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   mdb_token listAddressColumnToken;
@@ -1429,38 +1429,38 @@ nsresult nsAddrDatabase::GetAddressRowBy
   nsresult err = GetIntColumn(listRow, listAddressColumnToken, (uint32_t*)&rowID, 0);
   NS_ENSURE_SUCCESS(err, err);
 
   return GetCardRowByRowID(rowID, cardRow);
 }
 
 NS_IMETHODIMP nsAddrDatabase::CreateMailListAndAddToDB(nsIAbDirectory *aNewList, bool aNotify /* = FALSE */, nsIAbDirectory *aParent)
 {
-    if (!aNewList || !m_mdbPabTable || !m_mdbEnv)
-        return NS_ERROR_NULL_POINTER;
-
-    nsIMdbRow *listRow;
-    nsresult err = GetNewListRow(&listRow);
-
-    if (NS_SUCCEEDED(err) && listRow)
-    {
-        AddListAttributeColumnsToRow(aNewList, listRow, aParent);
-        AddRecordKeyColumnToRow(listRow);
-        nsresult merror = m_mdbPabTable->AddRow(m_mdbEnv, listRow);
-        NS_ENSURE_SUCCESS(merror, NS_ERROR_FAILURE);
-
-        nsCOMPtr<nsIAbCard> listCard;
-        CreateABListCard(listRow, getter_AddRefs(listCard));
-        NotifyCardEntryChange(AB_NotifyInserted, listCard, aParent);
-
-        NS_RELEASE(listRow);
-        return NS_OK;
-    }
-
-    return NS_ERROR_FAILURE;
+  if (!aNewList || !m_mdbPabTable || !m_mdbEnv)
+    return NS_ERROR_NULL_POINTER;
+
+  nsIMdbRow *listRow;
+  nsresult err = GetNewListRow(&listRow);
+
+  if (NS_SUCCEEDED(err) && listRow)
+  {
+    AddListAttributeColumnsToRow(aNewList, listRow, aParent);
+    AddRecordKeyColumnToRow(listRow);
+    nsresult merror = m_mdbPabTable->AddRow(m_mdbEnv, listRow);
+    NS_ENSURE_SUCCESS(merror, NS_ERROR_FAILURE);
+
+    nsCOMPtr<nsIAbCard> listCard;
+    CreateABListCard(listRow, getter_AddRefs(listCard));
+    NotifyCardEntryChange(AB_NotifyInserted, listCard, aParent);
+
+    NS_RELEASE(listRow);
+    return NS_OK;
+  }
+
+  return NS_ERROR_FAILURE;
 }
 
 void nsAddrDatabase::DeleteCardFromAllMailLists(mdb_id cardRowID)
 {
   if (!m_mdbEnv)
     return;
 
   nsCOMPtr <nsIMdbTableRowCursor> rowCursor;
@@ -1740,41 +1740,41 @@ NS_IMETHODIMP nsAddrDatabase::EditCard(n
   if (aNotify)
     NotifyCardEntryChange(AB_NotifyPropertyChanged, aCard, aParent);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAddrDatabase::ContainsCard(nsIAbCard *card, bool *hasCard)
 {
-    if (!card || !m_mdbPabTable || !m_mdbEnv)
-        return NS_ERROR_NULL_POINTER;
-
-    nsresult err = NS_OK;
-    mdb_bool hasOid;
-    mdbOid rowOid;
-    bool bIsMailList;
-
-    card->GetIsMailList(&bIsMailList);
-
-    if (bIsMailList)
-        rowOid.mOid_Scope = m_ListRowScopeToken;
-    else
-        rowOid.mOid_Scope = m_CardRowScopeToken;
-
-    err = card->GetPropertyAsUint32(kRowIDProperty, &rowOid.mOid_Id);
-    NS_ENSURE_SUCCESS(err, err);
-
-    err = m_mdbPabTable->HasOid(m_mdbEnv, &rowOid, &hasOid);
-    if (NS_SUCCEEDED(err))
-    {
-        *hasCard = hasOid;
-    }
-
-    return err;
+  if (!card || !m_mdbPabTable || !m_mdbEnv)
+      return NS_ERROR_NULL_POINTER;
+
+  nsresult err = NS_OK;
+  mdb_bool hasOid;
+  mdbOid rowOid;
+  bool bIsMailList;
+
+  card->GetIsMailList(&bIsMailList);
+
+  if (bIsMailList)
+    rowOid.mOid_Scope = m_ListRowScopeToken;
+  else
+    rowOid.mOid_Scope = m_CardRowScopeToken;
+
+  err = card->GetPropertyAsUint32(kRowIDProperty, &rowOid.mOid_Id);
+  NS_ENSURE_SUCCESS(err, err);
+
+  err = m_mdbPabTable->HasOid(m_mdbEnv, &rowOid, &hasOid);
+  if (NS_SUCCEEDED(err))
+  {
+    *hasCard = hasOid;
+  }
+
+  return err;
 }
 
 NS_IMETHODIMP nsAddrDatabase::DeleteMailList(nsIAbDirectory *aMailList,
                                              nsIAbDirectory *aParent)
 {
   if (!aMailList || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
@@ -1842,34 +1842,34 @@ NS_IMETHODIMP nsAddrDatabase::EditMailLi
   }
 
   NS_RELEASE(pListRow);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAddrDatabase::ContainsMailList(nsIAbDirectory *mailList, bool *hasList)
 {
-    if (!mailList || !m_mdbPabTable || !m_mdbEnv)
-        return NS_ERROR_NULL_POINTER;
-
-    nsresult err = NS_OK;
-    mdb_bool hasOid;
-    mdbOid rowOid;
-
-    rowOid.mOid_Scope = m_ListRowScopeToken;
-
-    nsCOMPtr<nsIAbMDBDirectory> dbmailList(do_QueryInterface(mailList,&err));
-    NS_ENSURE_SUCCESS(err, err);
-    dbmailList->GetDbRowID((uint32_t*)&rowOid.mOid_Id);
-
-    err = m_mdbPabTable->HasOid(m_mdbEnv, &rowOid, &hasOid);
-    if (NS_SUCCEEDED(err))
-        *hasList = hasOid;
-
-    return (NS_SUCCEEDED(err)) ? NS_OK : NS_ERROR_FAILURE;
+  if (!mailList || !m_mdbPabTable || !m_mdbEnv)
+    return NS_ERROR_NULL_POINTER;
+
+  nsresult err = NS_OK;
+  mdb_bool hasOid;
+  mdbOid rowOid;
+
+  rowOid.mOid_Scope = m_ListRowScopeToken;
+
+  nsCOMPtr<nsIAbMDBDirectory> dbmailList(do_QueryInterface(mailList,&err));
+  NS_ENSURE_SUCCESS(err, err);
+  dbmailList->GetDbRowID((uint32_t*)&rowOid.mOid_Id);
+
+  err = m_mdbPabTable->HasOid(m_mdbEnv, &rowOid, &hasOid);
+  if (NS_SUCCEEDED(err))
+    *hasList = hasOid;
+
+  return (NS_SUCCEEDED(err)) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsAddrDatabase::GetNewRow(nsIMdbRow * *newRow)
 {
   if (!m_mdbStore || !newRow || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   return m_mdbStore->NewRow(m_mdbEnv, m_CardRowScopeToken, newRow);
@@ -1934,39 +1934,39 @@ NS_IMETHODIMP nsAddrDatabase::AddLdifLis
     SetListAddressTotal(listRow, total);
   }
   return NS_OK;
 }
 
 
 void nsAddrDatabase::GetCharStringYarn(char* str, struct mdbYarn* strYarn)
 {
-    strYarn->mYarn_Grow = nullptr;
-    strYarn->mYarn_Buf = str;
-    strYarn->mYarn_Size = PL_strlen((const char *) strYarn->mYarn_Buf) + 1;
-    strYarn->mYarn_Fill = strYarn->mYarn_Size - 1;
-    strYarn->mYarn_Form = 0;
+  strYarn->mYarn_Grow = nullptr;
+  strYarn->mYarn_Buf = str;
+  strYarn->mYarn_Size = PL_strlen((const char *) strYarn->mYarn_Buf) + 1;
+  strYarn->mYarn_Fill = strYarn->mYarn_Size - 1;
+  strYarn->mYarn_Form = 0;
 }
 
 void nsAddrDatabase::GetStringYarn(const nsAString & aStr, struct mdbYarn* strYarn)
 {
-    strYarn->mYarn_Buf = ToNewUTF8String(aStr);
-    strYarn->mYarn_Size = PL_strlen((const char *) strYarn->mYarn_Buf) + 1;
-    strYarn->mYarn_Fill = strYarn->mYarn_Size - 1;
-    strYarn->mYarn_Form = 0;
+  strYarn->mYarn_Buf = ToNewUTF8String(aStr);
+  strYarn->mYarn_Size = PL_strlen((const char *) strYarn->mYarn_Buf) + 1;
+  strYarn->mYarn_Fill = strYarn->mYarn_Size - 1;
+  strYarn->mYarn_Form = 0;
 }
 
 void nsAddrDatabase::GetIntYarn(uint32_t nValue, struct mdbYarn* intYarn)
 {
-    intYarn->mYarn_Fill = intYarn->mYarn_Size;
-    intYarn->mYarn_Form = 0;
-    intYarn->mYarn_Grow = nullptr;
-
-    PR_snprintf((char*)intYarn->mYarn_Buf, intYarn->mYarn_Size, "%lx", nValue);
-    intYarn->mYarn_Fill = PL_strlen((const char *) intYarn->mYarn_Buf);
+  intYarn->mYarn_Fill = intYarn->mYarn_Size;
+  intYarn->mYarn_Form = 0;
+  intYarn->mYarn_Grow = nullptr;
+
+  PR_snprintf((char*)intYarn->mYarn_Buf, intYarn->mYarn_Size, "%lx", nValue);
+  intYarn->mYarn_Fill = PL_strlen((const char *) intYarn->mYarn_Buf);
 }
 
 nsresult nsAddrDatabase::AddCharStringColumn(nsIMdbRow* cardRow, mdb_column inColumn, const char* str)
 {
   if (!m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   struct mdbYarn yarn;
@@ -1991,48 +1991,48 @@ nsresult nsAddrDatabase::AddStringColumn
 }
 
 nsresult nsAddrDatabase::AddIntColumn(nsIMdbRow* cardRow, mdb_column inColumn, uint32_t nValue)
 {
   if (!m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   struct mdbYarn yarn;
-  char    yarnBuf[100];
+  char yarnBuf[100];
 
   yarn.mYarn_Buf = (void *) yarnBuf;
   yarn.mYarn_Size = sizeof(yarnBuf);
   GetIntYarn(nValue, &yarn);
   nsresult err = cardRow->AddColumn(m_mdbEnv, inColumn, &yarn);
 
   return (NS_SUCCEEDED(err)) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 nsresult nsAddrDatabase::AddBoolColumn(nsIMdbRow* cardRow, mdb_column inColumn, bool bValue)
 {
   if (!m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   struct mdbYarn yarn;
-  char    yarnBuf[100];
+  char yarnBuf[100];
 
   yarn.mYarn_Buf = (void *) yarnBuf;
   yarn.mYarn_Size = sizeof(yarnBuf);
 
   GetIntYarn(bValue ? 1 : 0, &yarn);
 
   nsresult err = cardRow->AddColumn(m_mdbEnv, inColumn, &yarn);
 
   return (NS_SUCCEEDED(err)) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 nsresult nsAddrDatabase::GetStringColumn(nsIMdbRow *cardRow, mdb_token outToken, nsString& str)
 {
-  nsresult    err = NS_ERROR_NULL_POINTER;
-  nsIMdbCell    *cardCell;
+  nsresult err = NS_ERROR_NULL_POINTER;
+  nsIMdbCell *cardCell;
 
   if (cardRow && m_mdbEnv)
   {
     err = cardRow->GetCell(m_mdbEnv, outToken, &cardCell);
     if (NS_SUCCEEDED(err) && cardCell)
     {
       struct mdbYarn yarn;
       cardCell->AliasYarn(m_mdbEnv, &yarn);
@@ -2046,68 +2046,68 @@ nsresult nsAddrDatabase::GetStringColumn
     else
       err = NS_ERROR_FAILURE;
   }
   return err;
 }
 
 void nsAddrDatabase::YarnToUInt32(struct mdbYarn *yarn, uint32_t *pResult)
 {
-    uint8_t numChars = std::min<mdb_fill>(8, yarn->mYarn_Fill);
-    *pResult = MsgUnhex((char *) yarn->mYarn_Buf, numChars);
+  uint8_t numChars = std::min<mdb_fill>(8, yarn->mYarn_Fill);
+  *pResult = MsgUnhex((char *) yarn->mYarn_Buf, numChars);
 }
 
 nsresult nsAddrDatabase::GetIntColumn
 (nsIMdbRow *cardRow, mdb_token outToken, uint32_t* pValue, uint32_t defaultValue)
 {
-    nsresult    err = NS_ERROR_NULL_POINTER;
-    nsIMdbCell    *cardCell;
-
-    if (pValue)
-        *pValue = defaultValue;
-    if (cardRow && m_mdbEnv)
+  nsresult    err = NS_ERROR_NULL_POINTER;
+  nsIMdbCell    *cardCell;
+
+  if (pValue)
+      *pValue = defaultValue;
+  if (cardRow && m_mdbEnv)
+  {
+    err = cardRow->GetCell(m_mdbEnv, outToken, &cardCell);
+    if (NS_SUCCEEDED(err) && cardCell)
     {
-        err = cardRow->GetCell(m_mdbEnv, outToken, &cardCell);
-        if (NS_SUCCEEDED(err) && cardCell)
-        {
-            struct mdbYarn yarn;
-            cardCell->AliasYarn(m_mdbEnv, &yarn);
-            YarnToUInt32(&yarn, pValue);
-            cardCell->Release();
-        }
-        else
-            err = NS_ERROR_FAILURE;
+      struct mdbYarn yarn;
+      cardCell->AliasYarn(m_mdbEnv, &yarn);
+      YarnToUInt32(&yarn, pValue);
+      cardCell->Release();
     }
-    return err;
+    else
+      err = NS_ERROR_FAILURE;
+  }
+  return err;
 }
 
 nsresult nsAddrDatabase::GetBoolColumn(nsIMdbRow *cardRow, mdb_token outToken, bool* pValue)
 {
   NS_ENSURE_ARG_POINTER(pValue);
 
-    nsresult    err = NS_ERROR_NULL_POINTER;
-    nsIMdbCell    *cardCell;
-    uint32_t nValue = 0;
-
-    if (cardRow && m_mdbEnv)
+  nsresult    err = NS_ERROR_NULL_POINTER;
+  nsIMdbCell    *cardCell;
+  uint32_t nValue = 0;
+
+  if (cardRow && m_mdbEnv)
+  {
+    err = cardRow->GetCell(m_mdbEnv, outToken, &cardCell);
+    if (NS_SUCCEEDED(err) && cardCell)
     {
-        err = cardRow->GetCell(m_mdbEnv, outToken, &cardCell);
-        if (NS_SUCCEEDED(err) && cardCell)
-        {
-            struct mdbYarn yarn;
-            cardCell->AliasYarn(m_mdbEnv, &yarn);
-            YarnToUInt32(&yarn, &nValue);
-            cardCell->Release();
-        }
-        else
-            err = NS_ERROR_FAILURE;
+      struct mdbYarn yarn;
+      cardCell->AliasYarn(m_mdbEnv, &yarn);
+      YarnToUInt32(&yarn, &nValue);
+      cardCell->Release();
     }
-
-    *pValue = nValue ? true : false;
-    return err;
+    else
+      err = NS_ERROR_FAILURE;
+  }
+
+  *pValue = nValue ? true : false;
+  return err;
 }
 
 /*  value is UTF8 string */
 NS_IMETHODIMP nsAddrDatabase::AddPrimaryEmail(nsIMdbRow *aRow, const char *aValue)
 {
   NS_ENSURE_ARG_POINTER(aValue);
 
   nsresult rv = AddCharStringColumn(aRow, m_PriEmailColumnToken, aValue);
@@ -2210,43 +2210,43 @@ NS_IMETHODIMP nsAddrDatabase::InitCardFr
   if (NS_SUCCEEDED(rv))
     newCard->SetPropertyAsUint32(kRecordKeyColumn, key);
 
   return NS_OK;
 }
 
 nsresult nsAddrDatabase::GetListCardFromDB(nsIAbCard *listCard, nsIMdbRow* listRow)
 {
-    nsresult    err = NS_OK;
-    if (!listCard || !listRow)
-        return NS_ERROR_NULL_POINTER;
-
-    nsAutoString tempString;
-
-    err = GetStringColumn(listRow, m_ListNameColumnToken, tempString);
-    if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
-    {
-        listCard->SetDisplayName(tempString);
-        listCard->SetLastName(tempString);
-    }
-    err = GetStringColumn(listRow, m_ListNickNameColumnToken, tempString);
-    if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
-    {
-        listCard->SetPropertyAsAString(kNicknameProperty, tempString);
-    }
-    err = GetStringColumn(listRow, m_ListDescriptionColumnToken, tempString);
-    if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
-    {
-        listCard->SetPropertyAsAString(kNotesProperty, tempString);
-    }
-    uint32_t key = 0;
-    err = GetIntColumn(listRow, m_RecordKeyColumnToken, &key, 0);
-    if (NS_SUCCEEDED(err))
-      listCard->SetPropertyAsUint32(kRecordKeyColumn, key);
-    return err;
+  nsresult    err = NS_OK;
+  if (!listCard || !listRow)
+      return NS_ERROR_NULL_POINTER;
+
+  nsAutoString tempString;
+
+  err = GetStringColumn(listRow, m_ListNameColumnToken, tempString);
+  if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
+  {
+    listCard->SetDisplayName(tempString);
+    listCard->SetLastName(tempString);
+  }
+  err = GetStringColumn(listRow, m_ListNickNameColumnToken, tempString);
+  if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
+  {
+    listCard->SetPropertyAsAString(kNicknameProperty, tempString);
+  }
+  err = GetStringColumn(listRow, m_ListDescriptionColumnToken, tempString);
+  if (NS_SUCCEEDED(err) && !tempString.IsEmpty())
+  {
+    listCard->SetPropertyAsAString(kNotesProperty, tempString);
+  }
+  uint32_t key = 0;
+  err = GetIntColumn(listRow, m_RecordKeyColumnToken, &key, 0);
+  if (NS_SUCCEEDED(err))
+    listCard->SetPropertyAsUint32(kRecordKeyColumn, key);
+  return err;
 }
 
 nsresult nsAddrDatabase::GetListFromDB(nsIAbDirectory *newList, nsIMdbRow* listRow)
 {
   nsresult    err = NS_OK;
   if (!newList || !listRow || !m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
@@ -2298,32 +2298,32 @@ nsresult nsAddrDatabase::GetListFromDB(n
     }
   }
 
   return err;
 }
 
 class nsAddrDBEnumerator : public nsSimpleEnumerator, public nsIAddrDBListener
 {
-public:
+  public:
     NS_DECL_ISUPPORTS_INHERITED
 
     const nsID& DefaultInterface() override
     {
       return NS_GET_IID(nsIAbCard);
     }
 
     // nsISimpleEnumerator methods:
     NS_DECL_NSISIMPLEENUMERATOR
     NS_DECL_NSIADDRDBLISTENER
 
     // nsAddrDBEnumerator methods:
     nsAddrDBEnumerator(nsAddrDatabase* aDb);
     void Clear();
-protected:
+  protected:
     ~nsAddrDBEnumerator() override;
     RefPtr<nsAddrDatabase> mDb;
     nsIMdbTable *mDbTable;
     nsCOMPtr<nsIMdbTableRowCursor> mRowCursor;
     nsCOMPtr<nsIMdbRow> mCurrentRow;
     mdb_pos mRowPos;
 };
 
@@ -2351,106 +2351,106 @@ void nsAddrDBEnumerator::Clear()
 }
 
 NS_IMPL_ISUPPORTS_INHERITED(nsAddrDBEnumerator, nsSimpleEnumerator, nsIAddrDBListener)
 
 NS_IMETHODIMP
 nsAddrDBEnumerator::HasMoreElements(bool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
-    *aResult = false;
-
-    if (!mDbTable || !mDb->GetEnv())
-    {
-        return NS_ERROR_NULL_POINTER;
-    }
-
-    nsCOMPtr<nsIMdbTableRowCursor> rowCursor;
-    mDbTable->GetTableRowCursor(mDb->GetEnv(), mRowPos,
-                                getter_AddRefs(rowCursor));
-    NS_ENSURE_TRUE(rowCursor, NS_ERROR_FAILURE);
-
-    mdbOid rowOid;
-    rowCursor->NextRowOid(mDb->GetEnv(), &rowOid, nullptr);
-    while (rowOid.mOid_Id != (mdb_id)-1)
+  *aResult = false;
+
+  if (!mDbTable || !mDb->GetEnv())
+  {
+      return NS_ERROR_NULL_POINTER;
+  }
+
+  nsCOMPtr<nsIMdbTableRowCursor> rowCursor;
+  mDbTable->GetTableRowCursor(mDb->GetEnv(), mRowPos,
+                              getter_AddRefs(rowCursor));
+  NS_ENSURE_TRUE(rowCursor, NS_ERROR_FAILURE);
+
+  mdbOid rowOid;
+  rowCursor->NextRowOid(mDb->GetEnv(), &rowOid, nullptr);
+  while (rowOid.mOid_Id != (mdb_id)-1)
+  {
+    if (mDb->IsListRowScopeToken(rowOid.mOid_Scope) ||
+        mDb->IsCardRowScopeToken(rowOid.mOid_Scope))
     {
-        if (mDb->IsListRowScopeToken(rowOid.mOid_Scope) ||
-            mDb->IsCardRowScopeToken(rowOid.mOid_Scope))
-        {
-            *aResult = true;
-
-            return NS_OK;
-        }
-
-        if (!mDb->IsDataRowScopeToken(rowOid.mOid_Scope))
-        {
-            return NS_ERROR_FAILURE;
-        }
-
-        rowCursor->NextRowOid(mDb->GetEnv(), &rowOid, nullptr);
+      *aResult = true;
+
+      return NS_OK;
     }
 
-    return NS_OK;
+    if (!mDb->IsDataRowScopeToken(rowOid.mOid_Scope))
+    {
+      return NS_ERROR_FAILURE;
+    }
+
+    rowCursor->NextRowOid(mDb->GetEnv(), &rowOid, nullptr);
+  }
+
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAddrDBEnumerator::GetNext(nsISupports **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
-    *aResult = nullptr;
-
-    if (!mDbTable || !mDb->GetEnv())
-    {
-        return NS_ERROR_NULL_POINTER;
-    }
-
-    if (!mRowCursor)
-    {
-         mDbTable->GetTableRowCursor(mDb->GetEnv(), -1,
-                                     getter_AddRefs(mRowCursor));
-         NS_ENSURE_TRUE(mRowCursor, NS_ERROR_FAILURE);
-    }
-
-    nsCOMPtr<nsIAbCard> resultCard;
-    mRowCursor->NextRow(mDb->GetEnv(), getter_AddRefs(mCurrentRow), &mRowPos);
-    while (mCurrentRow)
+  *aResult = nullptr;
+
+  if (!mDbTable || !mDb->GetEnv())
+  {
+      return NS_ERROR_NULL_POINTER;
+  }
+
+  if (!mRowCursor)
+  {
+       mDbTable->GetTableRowCursor(mDb->GetEnv(), -1,
+                                   getter_AddRefs(mRowCursor));
+       NS_ENSURE_TRUE(mRowCursor, NS_ERROR_FAILURE);
+  }
+
+  nsCOMPtr<nsIAbCard> resultCard;
+  mRowCursor->NextRow(mDb->GetEnv(), getter_AddRefs(mCurrentRow), &mRowPos);
+  while (mCurrentRow)
+  {
+    mdbOid rowOid;
+    if (NS_SUCCEEDED(mCurrentRow->GetOid(mDb->GetEnv(), &rowOid)))
     {
-        mdbOid rowOid;
-        if (NS_SUCCEEDED(mCurrentRow->GetOid(mDb->GetEnv(), &rowOid)))
-        {
-            nsresult rv;
-            if (mDb->IsListRowScopeToken(rowOid.mOid_Scope))
-            {
-                rv = mDb->CreateABListCard(mCurrentRow,
-                                           getter_AddRefs(resultCard));
-                NS_ENSURE_SUCCESS(rv, rv);
-            }
-            else if (mDb->IsCardRowScopeToken(rowOid.mOid_Scope))
-            {
-                rv = mDb->CreateABCard(mCurrentRow, 0,
-                                       getter_AddRefs(resultCard));
-                NS_ENSURE_SUCCESS(rv, rv);
-            }
-            else if (!mDb->IsDataRowScopeToken(rowOid.mOid_Scope))
-            {
-                return NS_ERROR_FAILURE;
-            }
-
-            if (resultCard)
-            {
-                return CallQueryInterface(resultCard, aResult);
-            }
-        }
-
-        mRowCursor->NextRow(mDb->GetEnv(), getter_AddRefs(mCurrentRow),
-                            &mRowPos);
+      nsresult rv;
+      if (mDb->IsListRowScopeToken(rowOid.mOid_Scope))
+      {
+        rv = mDb->CreateABListCard(mCurrentRow,
+                                   getter_AddRefs(resultCard));
+        NS_ENSURE_SUCCESS(rv, rv);
+      }
+      else if (mDb->IsCardRowScopeToken(rowOid.mOid_Scope))
+      {
+        rv = mDb->CreateABCard(mCurrentRow, 0,
+                               getter_AddRefs(resultCard));
+        NS_ENSURE_SUCCESS(rv, rv);
+      }
+      else if (!mDb->IsDataRowScopeToken(rowOid.mOid_Scope))
+      {
+        return NS_ERROR_FAILURE;
+      }
+
+      if (resultCard)
+      {
+        return CallQueryInterface(resultCard, aResult);
+      }
     }
 
-    return NS_ERROR_FAILURE;
+    mRowCursor->NextRow(mDb->GetEnv(), getter_AddRefs(mCurrentRow),
+                        &mRowPos);
+  }
+
+  return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsAddrDBEnumerator::OnCardAttribChange(uint32_t abCode)
 {
   return NS_OK;
 }
 
 /* void onCardEntryChange (in unsigned long aAbCode, in nsIAbCard aCard, in nsIAbDirectory aParent); */
@@ -2469,47 +2469,47 @@ NS_IMETHODIMP nsAddrDBEnumerator::OnList
 NS_IMETHODIMP nsAddrDBEnumerator::OnAnnouncerGoingAway()
 {
   Clear();
   return NS_OK;
 }
 
 class nsListAddressEnumerator final : public nsSimpleEnumerator
 {
-public:
+  public:
     const nsID& DefaultInterface() override
     {
       return NS_GET_IID(nsIAbCard);
     }
 
     // nsISimpleEnumerator methods:
     NS_DECL_NSISIMPLEENUMERATOR
 
     // nsListAddressEnumerator methods:
     nsListAddressEnumerator(nsAddrDatabase* aDb, mdb_id aRowID);
 
-protected:
+  protected:
     ~nsListAddressEnumerator() override = default;
     RefPtr<nsAddrDatabase> mDb;
     nsIMdbTable *mDbTable;
     nsCOMPtr<nsIMdbRow> mListRow;
     mdb_id mListRowID;
     uint32_t mAddressTotal;
     uint16_t mAddressPos;
 };
 
 nsListAddressEnumerator::nsListAddressEnumerator(nsAddrDatabase* aDb,
                                                  mdb_id aRowID)
     : mDb(aDb),
       mDbTable(aDb->GetPabTable()),
       mListRowID(aRowID),
       mAddressPos(0)
 {
-    mDb->GetListRowByRowID(mListRowID, getter_AddRefs(mListRow));
-    mAddressTotal = aDb->GetListAddressTotal(mListRow);
+  mDb->GetListRowByRowID(mListRowID, getter_AddRefs(mListRow));
+  mAddressTotal = aDb->GetListAddressTotal(mListRow);
 }
 
 NS_IMETHODIMP
 nsListAddressEnumerator::HasMoreElements(bool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
   *aResult = false;
@@ -2545,107 +2545,107 @@ nsListAddressEnumerator::HasMoreElements
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsListAddressEnumerator::GetNext(nsISupports **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
-    *aResult = nullptr;
-
-    if (!mDbTable || !mDb->GetEnv())
-    {
-        return NS_ERROR_NULL_POINTER;
-    }
-
-    if (++mAddressPos <= mAddressTotal)
-    {
-        nsCOMPtr<nsIMdbRow> currentRow;
-        nsresult rv = mDb->GetAddressRowByPos(mListRow, mAddressPos,
-                                              getter_AddRefs(currentRow));
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        nsCOMPtr<nsIAbCard> resultCard;
-        rv = mDb->CreateABCard(currentRow, mListRowID,
-                               getter_AddRefs(resultCard));
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        return CallQueryInterface(resultCard, aResult);
-    }
-
-    return NS_ERROR_FAILURE;
+  *aResult = nullptr;
+
+  if (!mDbTable || !mDb->GetEnv())
+  {
+      return NS_ERROR_NULL_POINTER;
+  }
+
+  if (++mAddressPos <= mAddressTotal)
+  {
+    nsCOMPtr<nsIMdbRow> currentRow;
+    nsresult rv = mDb->GetAddressRowByPos(mListRow, mAddressPos,
+                                          getter_AddRefs(currentRow));
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    nsCOMPtr<nsIAbCard> resultCard;
+    rv = mDb->CreateABCard(currentRow, mListRowID,
+                           getter_AddRefs(resultCard));
+    NS_ENSURE_SUCCESS(rv, rv);
+
+    return CallQueryInterface(resultCard, aResult);
+  }
+
+  return NS_ERROR_FAILURE;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP nsAddrDatabase::EnumerateCards(nsIAbDirectory *directory, nsISimpleEnumerator **result)
 {
-    NS_ADDREF(*result = new nsAddrDBEnumerator(this));
-    m_dbDirectory = do_GetWeakReference(directory);
-    return NS_OK;
+  NS_ADDREF(*result = new nsAddrDBEnumerator(this));
+  m_dbDirectory = do_GetWeakReference(directory);
+  return NS_OK;
 }
 
 NS_IMETHODIMP nsAddrDatabase::GetMailingListsFromDB(nsIAbDirectory *parentDir)
 {
-    nsCOMPtr<nsIAbDirectory>    resultList;
-    nsIMdbTableRowCursor*       rowCursor = nullptr;
-    nsCOMPtr<nsIMdbRow> currentRow;
-     mdb_pos                        rowPos;
-    bool                        done = false;
+  nsCOMPtr<nsIAbDirectory>    resultList;
+  nsIMdbTableRowCursor*       rowCursor = nullptr;
+  nsCOMPtr<nsIMdbRow> currentRow;
+  mdb_pos                     rowPos;
+  bool                        done = false;
 
   if (!m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   m_dbDirectory = do_GetWeakReference(parentDir);
 
-    nsIMdbTable*                dbTable = GetPabTable();
-
-    if (!dbTable)
-        return NS_ERROR_FAILURE;
-
-    dbTable->GetTableRowCursor(m_mdbEnv, -1, &rowCursor);
-    if (!rowCursor)
-        return NS_ERROR_FAILURE;
-
-    while (!done)
+  nsIMdbTable* dbTable = GetPabTable();
+
+  if (!dbTable)
+    return NS_ERROR_FAILURE;
+
+  dbTable->GetTableRowCursor(m_mdbEnv, -1, &rowCursor);
+  if (!rowCursor)
+    return NS_ERROR_FAILURE;
+
+  while (!done)
+  {
+    nsresult rv = rowCursor->NextRow(m_mdbEnv, getter_AddRefs(currentRow), &rowPos);
+    if (currentRow && NS_SUCCEEDED(rv))
     {
-                nsresult rv = rowCursor->NextRow(m_mdbEnv, getter_AddRefs(currentRow), &rowPos);
-        if (currentRow && NS_SUCCEEDED(rv))
-        {
-            mdbOid rowOid;
-
-            if (NS_SUCCEEDED(currentRow->GetOid(m_mdbEnv, &rowOid)))
-            {
-                if (IsListRowScopeToken(rowOid.mOid_Scope))
-                    rv = CreateABList(currentRow, getter_AddRefs(resultList));
-            }
-        }
-        else
-            done = true;
+      mdbOid rowOid;
+
+      if (NS_SUCCEEDED(currentRow->GetOid(m_mdbEnv, &rowOid)))
+      {
+        if (IsListRowScopeToken(rowOid.mOid_Scope))
+          rv = CreateABList(currentRow, getter_AddRefs(resultList));
+      }
     }
-        NS_IF_RELEASE(rowCursor);
-    return NS_OK;
+    else
+      done = true;
+  }
+  NS_IF_RELEASE(rowCursor);
+  return NS_OK;
 }
 
 NS_IMETHODIMP nsAddrDatabase::EnumerateListAddresses(nsIAbDirectory *directory, nsISimpleEnumerator **result)
 {
-    nsresult rv = NS_OK;
-    mdb_id rowID;
-
-    nsCOMPtr<nsIAbMDBDirectory> dbdirectory(do_QueryInterface(directory,&rv));
-
-    if(NS_SUCCEEDED(rv))
-    {
-      dbdirectory->GetDbRowID((uint32_t*)&rowID);
-
-      NS_ADDREF(*result = new nsListAddressEnumerator(this, rowID));
-      m_dbDirectory = do_GetWeakReference(directory);
-    }
-    return rv;
+  nsresult rv = NS_OK;
+  mdb_id rowID;
+
+  nsCOMPtr<nsIAbMDBDirectory> dbdirectory(do_QueryInterface(directory,&rv));
+
+  if(NS_SUCCEEDED(rv))
+  {
+    dbdirectory->GetDbRowID((uint32_t*)&rowID);
+
+    NS_ADDREF(*result = new nsListAddressEnumerator(this, rowID));
+    m_dbDirectory = do_GetWeakReference(directory);
+  }
+  return rv;
 }
 
 nsresult nsAddrDatabase::CreateCardFromDeletedCardsTable(nsIMdbRow* cardRow, mdb_id listRowID, nsIAbCard **result)
 {
   if (!cardRow || !m_mdbEnv || !result)
     return NS_ERROR_NULL_POINTER;
 
   nsresult rv = NS_OK;
@@ -2706,17 +2706,17 @@ nsresult nsAddrDatabase::CreateCard(nsIM
     personCard.forget(result);
   }
 
   return rv;
 }
 
 nsresult nsAddrDatabase::CreateABCard(nsIMdbRow* cardRow, mdb_id listRowID, nsIAbCard **result)
 {
-    return CreateCard(cardRow, listRowID, result);
+  return CreateCard(cardRow, listRowID, result);
 }
 
 /* create a card for mailing list in the address book */
 nsresult nsAddrDatabase::CreateABListCard(nsIMdbRow* listRow, nsIAbCard **result)
 {
   if (!listRow || !m_mdbEnv || !result)
     return NS_ERROR_NULL_POINTER;
 
@@ -2767,72 +2767,72 @@ nsresult nsAddrDatabase::CreateABListCar
     PR_smprintf_free(listURI);
 
   return rv;
 }
 
 /* create a sub directory for mailing list in the address book left pane */
 nsresult nsAddrDatabase::CreateABList(nsIMdbRow* listRow, nsIAbDirectory **result)
 {
-    nsresult rv = NS_OK;
-
-    if (!listRow || !m_mdbEnv || !result)
-        return NS_ERROR_NULL_POINTER;
-
-    mdbOid outOid;
-    mdb_id rowID = 0;
-
-    if (NS_SUCCEEDED(listRow->GetOid(m_mdbEnv, &outOid)))
-        rowID = outOid.mOid_Id;
-
-    char* listURI = nullptr;
-
-    nsAutoString fileName;
-    m_dbName->GetLeafName(fileName);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    listURI = PR_smprintf("%s%s/MailList%ld", kMDBDirectoryRoot, NS_ConvertUTF16toUTF8(fileName).get(), rowID);
-
-    nsCOMPtr<nsIAbDirectory> mailList;
-    nsCOMPtr<nsIAbMDBDirectory> dbm_dbDirectory(do_QueryReferent(m_dbDirectory,
-                                                                 &rv));
-    if (NS_SUCCEEDED(rv) && dbm_dbDirectory)
+  nsresult rv = NS_OK;
+
+  if (!listRow || !m_mdbEnv || !result)
+      return NS_ERROR_NULL_POINTER;
+
+  mdbOid outOid;
+  mdb_id rowID = 0;
+
+  if (NS_SUCCEEDED(listRow->GetOid(m_mdbEnv, &outOid)))
+    rowID = outOid.mOid_Id;
+
+  char* listURI = nullptr;
+
+  nsAutoString fileName;
+  m_dbName->GetLeafName(fileName);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  listURI = PR_smprintf("%s%s/MailList%ld", kMDBDirectoryRoot, NS_ConvertUTF16toUTF8(fileName).get(), rowID);
+
+  nsCOMPtr<nsIAbDirectory> mailList;
+  nsCOMPtr<nsIAbMDBDirectory> dbm_dbDirectory(do_QueryReferent(m_dbDirectory,
+                                                               &rv));
+  if (NS_SUCCEEDED(rv) && dbm_dbDirectory)
+  {
+    rv = dbm_dbDirectory->AddDirectory(listURI, getter_AddRefs(mailList));
+
+    nsCOMPtr<nsIAbMDBDirectory> dbmailList (do_QueryInterface(mailList, &rv));
+
+    if (mailList)
     {
-        rv = dbm_dbDirectory->AddDirectory(listURI, getter_AddRefs(mailList));
-
-        nsCOMPtr<nsIAbMDBDirectory> dbmailList (do_QueryInterface(mailList, &rv));
-
-        if (mailList)
-        {
-            // if we are using turbo, and we "exit" and restart with the same profile
-            // the current mailing list will still be in memory, so when we do
-            // GetResource() and QI, we'll get it again.
-            // in that scenario, the mailList that we pass in will already be
-            // be a mailing list, with a valid row and all the entries
-            // in that scenario, we can skip GetListFromDB(), which would have
-            // have added all the cards to the list again.
-            // see bug #134743
-            mdb_id existingID;
-            dbmailList->GetDbRowID(&existingID);
-            if (existingID != rowID) {
-              // Ensure IsMailList is set up first.
-              mailList->SetIsMailList(true);
-              GetListFromDB(mailList, listRow);
-              dbmailList->SetDbRowID(rowID);
-            }
-
-            dbm_dbDirectory->AddMailListToDirectory(mailList);
-            mailList.forget(result);
-        }
+      // if we are using turbo, and we "exit" and restart with the same profile
+      // the current mailing list will still be in memory, so when we do
+      // GetResource() and QI, we'll get it again.
+      // in that scenario, the mailList that we pass in will already be
+      // be a mailing list, with a valid row and all the entries
+      // in that scenario, we can skip GetListFromDB(), which would have
+      // have added all the cards to the list again.
+      // see bug #134743
+      mdb_id existingID;
+      dbmailList->GetDbRowID(&existingID);
+      if (existingID != rowID) {
+        // Ensure IsMailList is set up first.
+        mailList->SetIsMailList(true);
+        GetListFromDB(mailList, listRow);
+        dbmailList->SetDbRowID(rowID);
+      }
+
+      dbm_dbDirectory->AddMailListToDirectory(mailList);
+      mailList.forget(result);
     }
-
-    if (listURI)
-        PR_smprintf_free(listURI);
-
-    return rv;
+  }
+
+  if (listURI)
+    PR_smprintf_free(listURI);
+
+  return rv;
 }
 
 nsresult nsAddrDatabase::GetCardRowByRowID(mdb_id rowID, nsIMdbRow **dbRow)
 {
   if (!m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   mdbOid rowOid;