Bug 690761 - Switch nsIAbManager::convertQueryStringToExpression aQueryString parameter to nsAUTF8String. r=Standard8, sr=bienvenu.
authorMike Conley <mconley@mozilla.com>
Mon, 07 Nov 2011 11:11:02 -0500
changeset 8797 d4943eb34ac0
parent 8796 7e11d75ffd08
child 8798 7acf46d99cea
push id6755
push usermconley@mozilla.com
push date2011-11-07 16:24 +0000
treeherdercomm-central@4aedb030685a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8, bienvenu
bugs690761
Bug 690761 - Switch nsIAbManager::convertQueryStringToExpression aQueryString parameter to nsAUTF8String. r=Standard8, sr=bienvenu.
mailnews/addrbook/public/nsIAbManager.idl
mailnews/addrbook/src/nsAbLDAPDirectory.cpp
mailnews/addrbook/src/nsAbMDBDirectory.cpp
mailnews/addrbook/src/nsAbManager.cpp
mailnews/addrbook/src/nsAbOSXDirectory.mm
mailnews/addrbook/src/nsAbOutlookDirectory.cpp
mailnews/addrbook/src/nsAbQueryStringToExpression.cpp
mailnews/addrbook/src/nsAbQueryStringToExpression.h
--- a/mailnews/addrbook/public/nsIAbManager.idl
+++ b/mailnews/addrbook/public/nsIAbManager.idl
@@ -48,17 +48,17 @@ interface nsIAbBooleanExpression;
 
 /**
  * nsIAbManager is an interface to the main address book mananger
  * via the contract id "@mozilla.org/abmanager;1"
  *
  * It contains the main functions to create and delete address books as well
  * as some helper functions.
  */
-[scriptable, uuid(479919a2-c5f9-4d84-af87-f99c4ecb7f5e)]
+[scriptable, uuid(c3b33078-0b9c-4b56-83ed-3c5e84de82c8)]
 interface nsIAbManager : nsISupports 
 {
   /**
    * Returns an enumerator containing all the top-level directories
    * (non-recursive)
    */
   readonly attribute nsISimpleEnumerator directories;
 
@@ -205,10 +205,10 @@ interface nsIAbManager : nsISupports
 
   /**
    * A utility function that converts an nsIAbDirectory query string to an
    * nsIAbBooleanExpression.
    *
    * @param aQueryString The nsIAbDirectory query string
    * @return an nsIAbBooleanExpression for the query string
    */
-  nsIAbBooleanExpression convertQueryStringToExpression(in string aQueryString);
+  nsIAbBooleanExpression convertQueryStringToExpression(in AUTF8String aQueryString);
 };
--- a/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
@@ -315,17 +315,17 @@ NS_IMETHODIMP nsAbLDAPDirectory::StartSe
 
     rv = StopSearch();
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIAbDirectoryQueryArguments> arguments = do_CreateInstance(NS_ABDIRECTORYQUERYARGUMENTS_CONTRACTID,&rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIAbBooleanExpression> expression;
-    rv = nsAbQueryStringToExpression::Convert(mQueryString.get(),
+    rv = nsAbQueryStringToExpression::Convert(mQueryString,
                                               getter_AddRefs(expression));
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = arguments->SetExpression(expression);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = arguments->SetQuerySubDirectories(PR_TRUE);
     NS_ENSURE_SUCCESS(rv, rv);
--- a/mailnews/addrbook/src/nsAbMDBDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbMDBDirectory.cpp
@@ -918,17 +918,17 @@ NS_IMETHODIMP nsAbMDBDirectory::StartSea
 
   mPerformingQuery = PR_TRUE;
   mSearchCache.Clear();
 
   nsCOMPtr<nsIAbDirectoryQueryArguments> arguments = do_CreateInstance(NS_ABDIRECTORYQUERYARGUMENTS_CONTRACTID,&rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIAbBooleanExpression> expression;
-  rv = nsAbQueryStringToExpression::Convert(mQueryString.get(),
+  rv = nsAbQueryStringToExpression::Convert(mQueryString,
     getter_AddRefs(expression));
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = arguments->SetExpression(expression);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // don't search the subdirectories 
   // if the current directory is a mailing list, it won't have any subdirectories
--- a/mailnews/addrbook/src/nsAbManager.cpp
+++ b/mailnews/addrbook/src/nsAbManager.cpp
@@ -1299,14 +1299,15 @@ nsAbManager::GenerateUUID(const nsACStri
 {
   uuid.Assign(aDirectoryId);
   uuid.Append('#');
   uuid.Append(aLocalId);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsAbManager::ConvertQueryStringToExpression(const char *aQueryString,
+nsAbManager::ConvertQueryStringToExpression(const nsACString &aQueryString,
                                             nsIAbBooleanExpression **_retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
-  return nsAbQueryStringToExpression::Convert(aQueryString, _retval);
+  return nsAbQueryStringToExpression::Convert(aQueryString,
+                                              _retval);
 }
--- a/mailnews/addrbook/src/nsAbOSXDirectory.mm
+++ b/mailnews/addrbook/src/nsAbOSXDirectory.mm
@@ -937,17 +937,17 @@ nsAbOSXDirectory::GetChildCards(nsISimpl
 {
   NS_ENSURE_ARG_POINTER(aCards);
   
   nsresult rv;
   NSArray *cards;
   if (mIsQueryURI)
   {
     nsCOMPtr<nsIAbBooleanExpression> expression;
-    rv = nsAbQueryStringToExpression::Convert(mQueryString.get(),
+    rv = nsAbQueryStringToExpression::Convert(mQueryString,
                                               getter_AddRefs(expression));
     NS_ENSURE_SUCCESS(rv, rv);
     
     bool canHandle = !m_IsMailList && Search(expression, &cards);
     if (!canHandle)
       return FallbackSearch(expression, aCards);
 
     if (!mCardList)
--- a/mailnews/addrbook/src/nsAbOutlookDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbOutlookDirectory.cpp
@@ -958,17 +958,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::Star
     NS_ENSURE_SUCCESS(retCode, retCode) ;
     mCardList.Clear();
 
     nsCOMPtr<nsIAbBooleanExpression> expression ;
 
     nsCOMPtr<nsIAbDirectoryQueryArguments> arguments = do_CreateInstance(NS_ABDIRECTORYQUERYARGUMENTS_CONTRACTID,&retCode);
     NS_ENSURE_SUCCESS(retCode, retCode);
 
-    retCode = nsAbQueryStringToExpression::Convert(mQueryString.get (), getter_AddRefs(expression)) ;
+    retCode = nsAbQueryStringToExpression::Convert(mQueryString, getter_AddRefs(expression)) ;
     NS_ENSURE_SUCCESS(retCode, retCode) ;
     retCode = arguments->SetExpression(expression) ;
     NS_ENSURE_SUCCESS(retCode, retCode) ;
 
     retCode = arguments->SetQuerySubDirectories(PR_TRUE) ;
     NS_ENSURE_SUCCESS(retCode, retCode) ;
 
     return DoQuery(this, arguments, this, -1, 0, &mSearchContext);
--- a/mailnews/addrbook/src/nsAbQueryStringToExpression.cpp
+++ b/mailnews/addrbook/src/nsAbQueryStringToExpression.cpp
@@ -44,31 +44,31 @@
 #include "nsStringGlue.h"
 #include "nsITextToSubURI.h"
 #include "nsAbBooleanExpression.h"
 #include "nsAbBaseCID.h"
 #include "plstr.h"
 #include "nsIMutableArray.h"
 
 nsresult nsAbQueryStringToExpression::Convert (
-    const char* queryString,
+    const nsACString &aQueryString,
     nsIAbBooleanExpression** expression)
 {
     nsresult rv;
 
-    nsCAutoString q(queryString);
-    q.StripWhitespace ();
-    queryString = q.get ();
+    nsCAutoString q(aQueryString);
+    q.StripWhitespace();
+    const char *queryChars = q.get();
 
     nsCOMPtr<nsISupports> s;
-    rv = ParseExpression (&queryString, getter_AddRefs(s));
+    rv = ParseExpression(&queryChars, getter_AddRefs(s));
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Case: Not end of string
-    if (*queryString != 0)
+    if (*queryChars != 0)
         return NS_ERROR_FAILURE;
 
     nsCOMPtr<nsIAbBooleanExpression> e(do_QueryInterface(s, &rv));
     NS_ENSURE_SUCCESS(rv, rv);
 
     NS_IF_ADDREF(*expression = e);
     return rv;
 }
@@ -151,17 +151,17 @@ nsresult nsAbQueryStringToExpression::Pa
     if (NS_FAILED(rv))
         return NS_ERROR_OUT_OF_MEMORY;
 
     // Case: ")(*)(*)....(*))"
     // printf ("Case: )(*)(*)....(*)): %s\n", *index);
     while (**index == '(')
     {
         nsCOMPtr<nsISupports> childExpression;
-        rv = ParseExpression (index, getter_AddRefs (childExpression));
+        rv = ParseExpression(index, getter_AddRefs (childExpression));
         NS_ENSURE_SUCCESS(rv, rv);
 
         expressions->AppendElement(childExpression, PR_FALSE);
     }
 
     if (**index == 0)
         return NS_ERROR_FAILURE;
 
--- a/mailnews/addrbook/src/nsAbQueryStringToExpression.h
+++ b/mailnews/addrbook/src/nsAbQueryStringToExpression.h
@@ -40,17 +40,17 @@
 #define nsAbQueryStringToExpression_h__
 
 #include "nsIAbBooleanExpression.h"
 
 class nsAbQueryStringToExpression
 {
 public:
     static nsresult Convert (
-        const char* queryString,
+        const nsACString &aQueryString,
         nsIAbBooleanExpression** expression);
 
 protected:
     static nsresult ParseExpression (
         const char** index,
         nsISupports** expression);
     static nsresult ParseExpressions (
         const char** index,