From c2608138378474c220a8ac8771d49def0df1d7fe Mon Sep 17 00:00:00 2001 From: "mozilla.mano@sent.com" Date: Mon, 19 Nov 2007 19:28:27 -0800 Subject: [PATCH] Backing out bug 404370, which caused sortFolderByName to fail (in test_placesTxn). --- .../components/places/src/nsNavBookmarks.cpp | 38 ++++++------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/toolkit/components/places/src/nsNavBookmarks.cpp b/toolkit/components/places/src/nsNavBookmarks.cpp index f790cbf6864..6865a5af203 100644 --- a/toolkit/components/places/src/nsNavBookmarks.cpp +++ b/toolkit/components/places/src/nsNavBookmarks.cpp @@ -932,14 +932,10 @@ nsNavBookmarks::InsertBookmark(PRInt64 aFolder, nsIURI *aItem, PRInt32 aIndex, nsresult rv = History()->GetUrlIdFor(aItem, &childID, PR_TRUE); NS_ENSURE_SUCCESS(rv, rv); - PRInt32 index; - if (aIndex == nsINavBookmarksService::DEFAULT_INDEX) { - index = FolderCount(aFolder); - } else { - index = aIndex; - rv = AdjustIndices(aFolder, index, PR_INT32_MAX, 1); - NS_ENSURE_SUCCESS(rv, rv); - } + PRInt32 index = (aIndex == -1) ? FolderCount(aFolder) : aIndex; + + rv = AdjustIndices(aFolder, index, PR_INT32_MAX, 1); + NS_ENSURE_SUCCESS(rv, rv); mozStorageStatementScoper scope(mDBInsertBookmark); rv = mDBInsertBookmark->BindInt64Parameter(0, childID); @@ -1110,15 +1106,10 @@ nsNavBookmarks::CreateContainerWithID(PRInt64 aItemId, PRInt64 aParent, mozIStorageConnection *dbConn = DBConn(); mozStorageTransaction transaction(dbConn, PR_FALSE); - PRInt32 index; - nsresult rv; - if (*aIndex == nsINavBookmarksService::DEFAULT_INDEX) { - index = FolderCount(aParent); - } else { - index = *aIndex; - rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1); - NS_ENSURE_SUCCESS(rv, rv); - } + PRInt32 index = (*aIndex == -1) ? FolderCount(aParent) : *aIndex; + + nsresult rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1); + NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr statement; if (aItemId == -1) { @@ -1185,15 +1176,10 @@ nsNavBookmarks::InsertSeparator(PRInt64 aParent, PRInt32 aIndex, mozIStorageConnection *dbConn = DBConn(); mozStorageTransaction transaction(dbConn, PR_FALSE); - PRInt32 index; - nsresult rv; - if (aIndex == nsINavBookmarksService::DEFAULT_INDEX) { - index = FolderCount(aParent); - } else { - index = aIndex; - rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1); - NS_ENSURE_SUCCESS(rv, rv); - } + PRInt32 index = (aIndex == -1) ? FolderCount(aParent) : aIndex; + + nsresult rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1); + NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr statement; rv = dbConn->CreateStatement(NS_LITERAL_CSTRING("INSERT INTO moz_bookmarks "