Bug 258642 Unused functions [PRUni]charPtrArrayTo[C]StringArray & [C]StringArrayTo[PRUni]charPtrArray

patch by mikael@parknert.se r=neil sr=bienvenu
This commit is contained in:
timeless%mozdev.org 2004-11-05 15:13:32 +00:00
Родитель 93c8848740
Коммит 7aa9391f40
12 изменённых файлов: 25 добавлений и 96 удалений

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

@ -92,7 +92,6 @@ CPPSRCS = \
nsAddbookUrl.cpp \
nsAbDirFactoryService.cpp \
nsAbMDBDirFactory.cpp \
nsAbUtils.cpp \
nsAbDirectoryQuery.cpp \
nsAbDirectoryQueryProxy.cpp \
nsAbDirSearchListener.cpp \

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

@ -40,7 +40,6 @@
#include "nsIPrefService.h"
#include "nsAbBSDirectory.h"
#include "nsAbUtils.h"
#include "nsRDFCID.h"
#include "nsIRDFService.h"

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

@ -176,12 +176,14 @@ NS_IMETHODIMP nsAbDirectoryQueryArguments::SetQuerySubDirectories(PRBool aQueryS
NS_IMETHODIMP nsAbDirectoryQueryArguments::SetReturnProperties(PRUint32 returnPropertiesSize,
const char** returnPropertiesArray)
{
nsresult rv;
rv = CharPtrArrayToCStringArray::Convert(mReturnProperties,
returnPropertiesSize,
returnPropertiesArray);
NS_ENSURE_ARG_POINTER(returnPropertiesArray);
return rv;
mReturnProperties.Clear();
for (PRUint32 i = 0; i < returnPropertiesSize; i++)
mReturnProperties.AppendCString(nsDependentCString(returnPropertiesArray[i]));
return NS_OK;
}
/* void getReturnProperties (out unsigned long returnPropertiesSize,
@ -189,11 +191,19 @@ NS_IMETHODIMP nsAbDirectoryQueryArguments::SetReturnProperties(PRUint32 returnPr
NS_IMETHODIMP nsAbDirectoryQueryArguments::GetReturnProperties(PRUint32* returnPropertiesSize,
char*** returnPropertiesArray)
{
nsresult rv;
rv = CStringArrayToCharPtrArray::Convert (mReturnProperties,
returnPropertiesSize, returnPropertiesArray);
NS_ENSURE_ARG_POINTER(returnPropertiesSize);
NS_ENSURE_ARG_POINTER(returnPropertiesArray);
return rv;
PRUint32 size = mReturnProperties.Count();
*returnPropertiesSize = size;
*returnPropertiesArray = NS_STATIC_CAST(char**, nsMemory::Alloc (sizeof (char* ) * size));
if (!(*returnPropertiesArray))
return NS_ERROR_OUT_OF_MEMORY;
for (PRUint32 i = 0; i < size; i++)
(*returnPropertiesArray)[i] = ToNewCString(*mReturnProperties[i]);
return NS_OK;
}
NS_IMPL_THREADSAFE_ISUPPORTS1(nsAbDirectoryQueryPropertyValue, nsIAbDirectoryQueryPropertyValue)

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

@ -40,7 +40,6 @@
#include "nsAbLDAPDirectory.h"
#include "nsAbLDAPProperties.h"
#include "nsAbUtils.h"
#include "nsAbQueryStringToExpression.h"
@ -362,13 +361,8 @@ NS_IMETHODIMP nsAbLDAPDirectory::StartSearch ()
// Set the return properties to
// return nsIAbCard interfaces
nsCStringArray properties;
properties.AppendCString (nsCAutoString ("card:nsIAbCard"));
CharPtrArrayGuard returnProperties (PR_FALSE);
rv = CStringArrayToCharPtrArray::Convert (properties,returnProperties.GetSizeAddr(),
returnProperties.GetArrayAddr(), PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
rv = arguments->SetReturnProperties (returnProperties.GetSize(), returnProperties.GetArray());
const char *arr = "card:nsIAbCard";
rv = arguments->SetReturnProperties (1, &arr);
NS_ENSURE_SUCCESS(rv, rv);
rv = arguments->SetQuerySubDirectories (PR_TRUE);

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

@ -54,7 +54,6 @@
#include "nsAbDirectoryQuery.h"
#include "nsIAbDirectoryQueryProxy.h"
#include "nsAbQueryStringToExpression.h"
#include "nsAbUtils.h"
#include "nsArrayEnumerator.h"
#include "nsAbMDBCardProperty.h"
@ -909,13 +908,8 @@ NS_IMETHODIMP nsAbMDBDirectory::StartSearch()
// Set the return properties to
// return nsIAbCard interfaces
nsCStringArray properties;
properties.AppendCString(nsCAutoString("card:nsIAbCard"));
CharPtrArrayGuard returnProperties(PR_FALSE);
rv = CStringArrayToCharPtrArray::Convert(properties,returnProperties.GetSizeAddr(),
returnProperties.GetArrayAddr(), PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
rv = arguments->SetReturnProperties(returnProperties.GetSize(), returnProperties.GetArray());
const char *arr = "card:nsIAbCard";
rv = arguments->SetReturnProperties(1, &arr);
NS_ENSURE_SUCCESS(rv, rv);
// don't search the subdirectories

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

@ -995,14 +995,9 @@ NS_IMETHODIMP nsAbOutlookDirectory::StartSearch(void)
NS_ENSURE_SUCCESS(retCode, retCode) ;
retCode = arguments->SetExpression(expression) ;
NS_ENSURE_SUCCESS(retCode, retCode) ;
nsCStringArray properties ;
CharPtrArrayGuard returnProperties(PR_FALSE) ;
properties.AppendCString(nsCAutoString("card:nsIAbCard")) ;
retCode = CStringArrayToCharPtrArray::Convert(properties, returnProperties.GetSizeAddr(),
returnProperties.GetArrayAddr(), PR_FALSE) ;
NS_ENSURE_SUCCESS(retCode, retCode) ;
retCode = arguments->SetReturnProperties(returnProperties.GetSize(), returnProperties.GetArray()) ;
const char *arr = "card:nsIAbCard";
retCode = arguments->SetReturnProperties(1, &arr);
NS_ENSURE_SUCCESS(retCode, retCode) ;
retCode = arguments->SetQuerySubDirectories(PR_TRUE) ;
NS_ENSURE_SUCCESS(retCode, retCode) ;

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

@ -41,7 +41,6 @@
#include "nsIAbDirectory.h"
#include "nsIAddrBookSession.h"
#include "nsIAbCard.h"
#include "nsAbUtils.h"
#include "rdf.h"
#include "nsIRDFService.h"

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

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

@ -105,40 +105,10 @@ private:
else
{
nsMemory::Free(mArray);
mArray=nsnull;
}
}
};
/*
* Helper class to convert an nsCStringArray
* to an array of char*
* By default strings will be copied, unless
* the copyElements parameter is set to PR_FALSE.
*/
class CStringArrayToCharPtrArray
{
public:
static nsresult Convert (nsCStringArray& array,
PRUint32* returnPropertiesSize,
char*** returnPropertiesArray,
PRBool copyElements = PR_TRUE);
};
/*
* Helper class to convert an array of char*
* to an nsCStringArray
*/
class CharPtrArrayToCStringArray
{
public:
static nsresult Convert (nsCStringArray& array,
PRUint32 returnPropertiesSize,
const char** returnPropertiesArray);
};
/*
* Wrapper class to automatically free an array of
* PRUnichar* when class goes out of scope
@ -199,36 +169,8 @@ private:
else
{
nsMemory::Free(mArray);
mArray=nsnull;
}
}
};
/*
* Helper class to convert an nsStringArray
* to an array of PRUnichar*
* By default strings will be copied, unless
* the copyElements parameter is set to PR_FALSE.
*/
class StringArrayToPRUnicharPtrArray
{
public:
static nsresult Convert (nsStringArray& array,
PRUint32* returnPropertiesSize,
PRUnichar*** returnPropertiesArray,
PRBool copyElements = PR_TRUE);
};
/*
* Helper class to convert an array of PRUnichar*
* to an nsStringArray
*/
class PRUnicharPtrArrayToStringArray
{
public:
static nsresult Convert (nsStringArray& returnPropertiesArray,
PRUint32 returnPropertiesSize,
const PRUnichar** array);
};
#endif /* nsAbUtils_h__ */

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

@ -44,7 +44,6 @@
#define USES_IID_IDistList
#include "nsAbWinHelper.h"
#include "nsAbUtils.h"
#include "nsMapiAddressBook.h"
#include "nsWabAddressBook.h"
#include "nsCRT.h"

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

@ -36,7 +36,6 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMapiAddressBook.h"
#include "nsAbUtils.h"
#include "nsAutoLock.h"
#include "prlog.h"

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

@ -36,7 +36,6 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsWabAddressBook.h"
#include "nsAbUtils.h"
#include "nsAutoLock.h"
#include "prlog.h"