Bug 379070 --> Make address book nsCRT free. p=Prasad Sunkari,r=me,sr=mscott

This commit is contained in:
bugzilla%standard8.demon.co.uk 2007-06-07 18:15:50 +00:00
Родитель e597d63249
Коммит c6df9690a0
13 изменённых файлов: 99 добавлений и 97 удалений

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

@ -172,7 +172,7 @@ nsAbAutoCompleteSession::AddToResult(const PRUnichar* pNickNameStr,
if (!fullAddress.IsEmpty())
{
/* We need to convert back the result from UTF-8 to Unicode */
fullAddrStr = nsCRT::strdup(NS_ConvertUTF8toUTF16(fullAddress.get()).get());
fullAddrStr = ToNewUnicode(NS_ConvertUTF8toUTF16(fullAddress));
}
}
@ -274,7 +274,7 @@ nsAbAutoCompleteSession::AddToResult(const PRUnichar* pNickNameStr,
static PRBool CommonPrefix(const PRUnichar *aString, const PRUnichar *aSubstr, PRInt32 aSubstrLen)
{
if (!aSubstrLen || (nsCRT::strlen(aString) < NS_STATIC_CAST(PRUint32, aSubstrLen)))
if (!aSubstrLen || (NS_strlen(aString) < NS_STATIC_CAST(PRUint32, aSubstrLen)))
return PR_FALSE;
return (Substring(aString,
@ -674,7 +674,7 @@ NS_IMETHODIMP nsAbAutoCompleteSession::OnStartLookup(const PRUnichar *uSearchStr
// strings with commas (commas denote multiple names) should be ignored for
// autocomplete purposes
PRInt32 i;
for (i = nsCRT::strlen(uSearchString) - 1; i >= 0; i --)
for (i = NS_strlen(uSearchString) - 1; i >= 0; i --)
if (uSearchString[i] == ',')
{
listener->OnAutoComplete(nsnull, nsIAutoCompleteStatus::ignored);
@ -787,8 +787,8 @@ NS_IMPL_ISUPPORTS1(nsAbAutoCompleteParam, nsISupports)
nsAbAutoCompleteSearchString::nsAbAutoCompleteSearchString(const PRUnichar *uSearchString)
{
mFullString = nsCRT::strdup(uSearchString);
mFullStringLen = nsCRT::strlen(mFullString);
mFullString = NS_strdup(uSearchString);
mFullStringLen = NS_strlen(mFullString);
PRUint32 i;
PRUnichar * aPtr;
@ -796,9 +796,9 @@ nsAbAutoCompleteSearchString::nsAbAutoCompleteSearchString(const PRUnichar *uSea
{
if (*aPtr == ' ')
{
mFirstPart = nsCRT::strndup(mFullString, i);
mFirstPart = NS_strndup(mFullString, i);
mFirstPartLen = i;
mSecondPart = nsCRT::strdup(++aPtr);
mSecondPart = NS_strdup(++aPtr);
mSecondPartLen = mFullStringLen - i - 1;
return;
}
@ -814,9 +814,9 @@ nsAbAutoCompleteSearchString::nsAbAutoCompleteSearchString(const PRUnichar *uSea
nsAbAutoCompleteSearchString::~nsAbAutoCompleteSearchString()
{
if (mFullString)
nsCRT::free((PRUnichar*)mFullString);
NS_Free((PRUnichar*)mFullString);
if (mFirstPart)
nsCRT::free((PRUnichar*)mFirstPart);
NS_Free((PRUnichar*)mFirstPart);
if (mSecondPart)
nsCRT::free((PRUnichar*)mSecondPart);
NS_Free((PRUnichar*)mSecondPart);
}

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

@ -143,13 +143,13 @@ public:
{
const PRUnichar *empty = EmptyString().get();
mNickName = nsCRT::strdup(nickName ? nickName : empty);
mDisplayName = nsCRT::strdup(displayName ? displayName : empty);
mFirstName = nsCRT::strdup(firstName ? firstName : empty);
mLastName = nsCRT::strdup(lastName ? lastName : empty);
mEmailAddress = nsCRT::strdup(emailAddress ? emailAddress : empty);
mNotes = nsCRT::strdup(notes ? notes : empty);
mDirName = nsCRT::strdup(dirName ? dirName : empty);
mNickName = NS_strdup(nickName ? nickName : empty);
mDisplayName = NS_strdup(displayName ? displayName : empty);
mFirstName = NS_strdup(firstName ? firstName : empty);
mLastName = NS_strdup(lastName ? lastName : empty);
mEmailAddress = NS_strdup(emailAddress ? emailAddress : empty);
mNotes = NS_strdup(notes ? notes : empty);
mDirName = NS_strdup(dirName ? dirName : empty);
mIsMailList = isMailList;
mPopularityIndex = aPopularityIndex;
}

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

@ -56,7 +56,8 @@
#include "nsAbDirFactoryService.h"
#include "nsAbMDBDirFactory.h"
#include "nsArrayEnumerator.h"
#include "nsCRT.h"
#include "nsCRTGlue.h"
nsAbBSDirectory::nsAbBSDirectory()
: nsRDFResource(),
@ -434,13 +435,13 @@ NS_IMETHODIMP nsAbBSDirectory::ModifyDirectory(nsIAbDirectory *directory, nsIAbD
NS_ENSURE_SUCCESS(rv, rv);
NS_ConvertUTF8toUTF16 oldValue(server->description);
nsCRT::free(server->description);
NS_Free(server->description);
NS_ConvertUTF16toUTF8 utf8str(description.get());
server->description = ToNewCString(utf8str);
rv = aProperties->GetURI(getter_Copies(uri));
NS_ENSURE_SUCCESS(rv, rv);
nsCRT::free(server->uri);
NS_Free(server->uri);
server->uri = ToNewCString(uri);
DIR_SavePrefsForOneServer(server);

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

@ -47,7 +47,7 @@
#include "plstr.h"
#include "prmem.h"
#include "prprf.h"
#include "nsCRT.h"
#include "nsCRTGlue.h"
NS_IMPL_ISUPPORTS1(nsAbLDIFService, nsIAbLDIFService)
@ -204,7 +204,7 @@ nsresult nsAbLDIFService::str_parse_line(char *line, char **type, char **value,
int i, b64;
/* skip any leading space */
while ( NS_IS_SPACE( *line ) ) {
while ( isspace( *line ) ) {
line++;
}
*type = line;
@ -216,7 +216,7 @@ nsresult nsAbLDIFService::str_parse_line(char *line, char **type, char **value,
}
/* trim any space between type and : */
for ( p = s - 1; p > line && nsCRT::IsAsciiSpace( *p ); p-- ) {
for ( p = s - 1; p > line && isspace( *p ); p-- ) {
*p = '\0';
}
*s++ = '\0';
@ -231,7 +231,7 @@ nsresult nsAbLDIFService::str_parse_line(char *line, char **type, char **value,
}
/* skip space between : and value */
while ( NS_IS_SPACE( *s ) ) {
while ( isspace( *s ) ) {
s++;
}
@ -317,7 +317,7 @@ char* nsAbLDIFService::str_getline(char **next) const
lineStr = *next;
while ( (*next = PL_strchr( *next, '\n' )) != NULL ) {
c = *(*next + 1);
if ( NS_IS_SPACE ( c ) && c != '\n' ) {
if ( isspace( c ) && c != '\n' ) {
**next = CONTINUED_LINE_MARKER;
*(*next+1) = CONTINUED_LINE_MARKER;
} else {
@ -836,7 +836,7 @@ NS_IMETHODIMP nsAbLDIFService::IsLDIFFile(nsIFile *pSrc, PRBool *_retval)
i = 0;
while (sLDIFFields[i])
{
if (!nsCRT::strcasecmp( sLDIFFields[i], field))
if (!PL_strcasecmp( sLDIFFields[i], field))
{
ldifFields++;
gotLDIF = PR_TRUE;

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

@ -55,11 +55,11 @@
#include "nsIProxyObjectManager.h"
#include "nsEnumeratorUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsCRT.h"
#include "prlog.h"
#include "prthread.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsCRTGlue.h"
#ifdef PR_LOGGING
static PRLogModuleInfo* gAbOutlookDirectoryLog
@ -644,7 +644,7 @@ static ULONG findPropertyTag(const char *aName) {
PRUint32 i = 0 ;
for (i = 0 ; i < OutlookTableNbProps ; ++ i) {
if (nsCRT::strcmp(aName, OutlookTableStringToProp [i].mOuterName) == 0) {
if (strcmp(aName, OutlookTableStringToProp [i].mOuterName) == 0) {
return OutlookTableStringToProp [i].mMapiProp ;
}
}
@ -693,7 +693,7 @@ static nsresult BuildRestriction(nsIAbBooleanConditionString *aCondition,
aRestriction.res.resContent.ulPropTag = propertyTag ;
aRestriction.res.resContent.lpProp = new SPropValue ;
aRestriction.res.resContent.lpProp->ulPropTag = propertyTag ;
aRestriction.res.resContent.lpProp->Value.lpszA = nsCRT::strdup(valueAscii.get()) ;
aRestriction.res.resContent.lpProp->Value.lpszA = strdup(valueAscii.get()) ;
break ;
case nsIAbBooleanConditionTypes::DoesNotContain :
aRestriction.rt = RES_NOT ;
@ -703,7 +703,7 @@ static nsresult BuildRestriction(nsIAbBooleanConditionString *aCondition,
aRestriction.res.resNot.lpRes->res.resContent.ulPropTag = propertyTag ;
aRestriction.res.resNot.lpRes->res.resContent.lpProp = new SPropValue ;
aRestriction.res.resNot.lpRes->res.resContent.lpProp->ulPropTag = propertyTag ;
aRestriction.res.resNot.lpRes->res.resContent.lpProp->Value.lpszA = nsCRT::strdup(valueAscii.get()) ;
aRestriction.res.resNot.lpRes->res.resContent.lpProp->Value.lpszA = strdup(valueAscii.get()) ;
break ;
case nsIAbBooleanConditionTypes::Is :
aRestriction.rt = RES_CONTENT ;
@ -711,7 +711,7 @@ static nsresult BuildRestriction(nsIAbBooleanConditionString *aCondition,
aRestriction.res.resContent.ulPropTag = propertyTag ;
aRestriction.res.resContent.lpProp = new SPropValue ;
aRestriction.res.resContent.lpProp->ulPropTag = propertyTag ;
aRestriction.res.resContent.lpProp->Value.lpszA = nsCRT::strdup(valueAscii.get()) ;
aRestriction.res.resContent.lpProp->Value.lpszA = strdup(valueAscii.get()) ;
break ;
case nsIAbBooleanConditionTypes::IsNot :
aRestriction.rt = RES_NOT ;
@ -721,7 +721,7 @@ static nsresult BuildRestriction(nsIAbBooleanConditionString *aCondition,
aRestriction.res.resNot.lpRes->res.resContent.ulPropTag = propertyTag ;
aRestriction.res.resNot.lpRes->res.resContent.lpProp = new SPropValue ;
aRestriction.res.resNot.lpRes->res.resContent.lpProp->ulPropTag = propertyTag ;
aRestriction.res.resNot.lpRes->res.resContent.lpProp->Value.lpszA = nsCRT::strdup(valueAscii.get()) ;
aRestriction.res.resNot.lpRes->res.resContent.lpProp->Value.lpszA = strdup(valueAscii.get()) ;
break ;
case nsIAbBooleanConditionTypes::BeginsWith :
aRestriction.rt = RES_CONTENT ;
@ -729,7 +729,7 @@ static nsresult BuildRestriction(nsIAbBooleanConditionString *aCondition,
aRestriction.res.resContent.ulPropTag = propertyTag ;
aRestriction.res.resContent.lpProp = new SPropValue ;
aRestriction.res.resContent.lpProp->ulPropTag = propertyTag ;
aRestriction.res.resContent.lpProp->Value.lpszA = nsCRT::strdup(valueAscii.get()) ;
aRestriction.res.resContent.lpProp->Value.lpszA = strdup(valueAscii.get()) ;
break ;
case nsIAbBooleanConditionTypes::EndsWith :
// This condition should be implemented through regular expressions,
@ -740,7 +740,7 @@ static nsresult BuildRestriction(nsIAbBooleanConditionString *aCondition,
aRestriction.res.resProperty.ulPropTag = propertyTag ;
aRestriction.res.resProperty.lpProp = new SPropValue ;
aRestriction.res.resProperty.lpProp->ulPropTag = propertyTag ;
aRestriction.res.resProperty.lpProp->Value.lpszA = nsCRT::strdup(valueAscii.get()) ;
aRestriction.res.resProperty.lpProp->Value.lpszA = strdup(valueAscii.get()) ;
#else
aSkipItem = PR_TRUE ;
#endif // 0
@ -758,7 +758,7 @@ static nsresult BuildRestriction(nsIAbBooleanConditionString *aCondition,
aRestriction.res.resProperty.ulPropTag = propertyTag ;
aRestriction.res.resProperty.lpProp = new SPropValue ;
aRestriction.res.resProperty.lpProp->ulPropTag = propertyTag ;
aRestriction.res.resProperty.lpProp->Value.lpszA = nsCRT::strdup(valueAscii.get()) ;
aRestriction.res.resProperty.lpProp->Value.lpszA = strdup(valueAscii.get()) ;
#else
aSkipItem = PR_TRUE ;
#endif // 0
@ -769,7 +769,7 @@ static nsresult BuildRestriction(nsIAbBooleanConditionString *aCondition,
aRestriction.res.resProperty.ulPropTag = propertyTag ;
aRestriction.res.resProperty.lpProp = new SPropValue ;
aRestriction.res.resProperty.lpProp->ulPropTag = propertyTag ;
aRestriction.res.resProperty.lpProp->Value.lpszA = nsCRT::strdup(valueAscii.get()) ;
aRestriction.res.resProperty.lpProp->Value.lpszA = strdup(valueAscii.get()) ;
break ;
case nsIAbBooleanConditionTypes::GreaterThan :
aRestriction.rt = RES_PROPERTY ;
@ -777,7 +777,7 @@ static nsresult BuildRestriction(nsIAbBooleanConditionString *aCondition,
aRestriction.res.resProperty.ulPropTag = propertyTag ;
aRestriction.res.resProperty.lpProp = new SPropValue ;
aRestriction.res.resProperty.lpProp->ulPropTag = propertyTag ;
aRestriction.res.resProperty.lpProp->Value.lpszA = nsCRT::strdup(valueAscii.get()) ;
aRestriction.res.resProperty.lpProp->Value.lpszA = strdup(valueAscii.get()) ;
break ;
default :
aSkipItem = PR_TRUE ;
@ -911,10 +911,10 @@ static void DestroyRestriction(SRestriction& aRestriction)
break ;
case RES_CONTENT :
if (PROP_TYPE(aRestriction.res.resContent.ulPropTag) == PT_UNICODE) {
nsCRT::free(aRestriction.res.resContent.lpProp->Value.lpszW) ;
NS_Free(aRestriction.res.resContent.lpProp->Value.lpszW) ;
}
else if (PROP_TYPE(aRestriction.res.resContent.ulPropTag) == PT_STRING8) {
nsCRT::free(aRestriction.res.resContent.lpProp->Value.lpszA) ;
NS_Free(aRestriction.res.resContent.lpProp->Value.lpszA) ;
}
delete aRestriction.res.resContent.lpProp ;
break ;
@ -929,10 +929,10 @@ static void DestroyRestriction(SRestriction& aRestriction)
break ;
case RES_PROPERTY :
if (PROP_TYPE(aRestriction.res.resProperty.ulPropTag) == PT_UNICODE) {
nsCRT::free(aRestriction.res.resProperty.lpProp->Value.lpszW) ;
NS_Free(aRestriction.res.resProperty.lpProp->Value.lpszW) ;
}
else if (PROP_TYPE(aRestriction.res.resProperty.ulPropTag) == PT_STRING8) {
nsCRT::free(aRestriction.res.resProperty.lpProp->Value.lpszA) ;
NS_Free(aRestriction.res.resProperty.lpProp->Value.lpszA) ;
}
delete aRestriction.res.resProperty.lpProp ;
case RES_SIZE :
@ -962,7 +962,7 @@ nsresult FillPropertyValues(nsIAbCard *aCard, nsIAbDirectoryQueryArguments *aArg
const char* cPropName = properties[i] ;
newValue = nsnull ;
if (!nsCRT::strcmp(cPropName, "card:nsIAbCard")) {
if (!strcmp(cPropName, "card:nsIAbCard")) {
nsCOMPtr<nsISupports> bogusInterface (do_QueryInterface(aCard, &retCode)) ;
NS_ENSURE_SUCCESS(retCode, retCode) ;
@ -1511,7 +1511,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::ModifyCard(nsIAbCard *aModifiedCard)
utility.Assign(unichar.get());
if (!utility.IsEmpty())
utility.AppendWithConversion(CRLF);
utility.AppendLiteral("\r\n");
utility.Append(unichar2.get());
if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, utility.get())) {
@ -1523,7 +1523,7 @@ NS_IMETHODIMP nsAbOutlookDirectory::ModifyCard(nsIAbCard *aModifiedCard)
utility.Assign(unichar.get());
if (!utility.IsEmpty())
utility.AppendWithConversion(CRLF);
utility.AppendLiteral("\r\n");
utility.Append(unichar2.get());
if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, utility.get())) {

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

@ -46,7 +46,7 @@
#include "nsITextToSubURI.h"
#include "nsAbBooleanExpression.h"
#include "nsAbBaseCID.h"
#include "nsCRT.h"
#include "plstr.h"
nsresult nsAbQueryStringToExpression::Convert (
const char* queryString,
@ -222,7 +222,7 @@ nsresult nsAbQueryStringToExpression::ParseConditionEntry (
int entryLength = indexDeliminator - *index;
if (entryLength)
*entry = nsCRT::strndup (*index, entryLength);
*entry = PL_strndup (*index, entryLength);
else
*entry = 0;
@ -241,7 +241,7 @@ nsresult nsAbQueryStringToExpression::ParseOperationEntry (
{
int operationLength = indexBracketOpen2 - indexBracketOpen1 - 1;
if (operationLength)
*operation = nsCRT::strndup (indexBracketOpen1 + 1,
*operation = PL_strndup (indexBracketOpen1 + 1,
operationLength);
else
*operation = 0;
@ -254,11 +254,11 @@ nsresult nsAbQueryStringToExpression::CreateBooleanExpression(
nsIAbBooleanExpression** expression)
{
nsAbBooleanOperationType op;
if (nsCRT::strcasecmp (operation, "and") == 0)
if (PL_strcasecmp (operation, "and") == 0)
op = nsIAbBooleanOperationTypes::AND;
else if (nsCRT::strcasecmp (operation, "or") == 0)
else if (PL_strcasecmp (operation, "or") == 0)
op = nsIAbBooleanOperationTypes::OR;
else if (nsCRT::strcasecmp (operation, "not") == 0)
else if (PL_strcasecmp (operation, "not") == 0)
op = nsIAbBooleanOperationTypes::NOT;
else
return NS_ERROR_FAILURE;
@ -285,25 +285,25 @@ nsresult nsAbQueryStringToExpression::CreateBooleanConditionString (
nsAbBooleanConditionType c;
if (nsCRT::strcasecmp (condition, "=") == 0)
if (PL_strcasecmp (condition, "=") == 0)
c = nsIAbBooleanConditionTypes::Is;
else if (nsCRT::strcasecmp (condition, "!=") == 0)
else if (PL_strcasecmp (condition, "!=") == 0)
c = nsIAbBooleanConditionTypes::IsNot;
else if (nsCRT::strcasecmp (condition, "lt") == 0)
else if (PL_strcasecmp (condition, "lt") == 0)
c = nsIAbBooleanConditionTypes::LessThan;
else if (nsCRT::strcasecmp (condition, "gt") == 0)
else if (PL_strcasecmp (condition, "gt") == 0)
c = nsIAbBooleanConditionTypes::GreaterThan;
else if (nsCRT::strcasecmp (condition, "bw") == 0)
else if (PL_strcasecmp (condition, "bw") == 0)
c = nsIAbBooleanConditionTypes::BeginsWith;
else if (nsCRT::strcasecmp (condition, "ew") == 0)
else if (PL_strcasecmp (condition, "ew") == 0)
c = nsIAbBooleanConditionTypes::EndsWith;
else if (nsCRT::strcasecmp (condition, "c")== 0)
else if (PL_strcasecmp (condition, "c")== 0)
c = nsIAbBooleanConditionTypes::Contains;
else if (nsCRT::strcasecmp (condition, "!c") == 0)
else if (PL_strcasecmp (condition, "!c") == 0)
c = nsIAbBooleanConditionTypes::DoesNotContain;
else if (nsCRT::strcasecmp (condition, "~=") == 0)
else if (PL_strcasecmp (condition, "~=") == 0)
c = nsIAbBooleanConditionTypes::SoundsLike;
else if (nsCRT::strcasecmp (condition, "regex") == 0)
else if (PL_strcasecmp (condition, "regex") == 0)
c = nsIAbBooleanConditionTypes::RegExp;
else
return NS_ERROR_FAILURE;

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

@ -52,7 +52,7 @@
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsITreeColumns.h"
#include "nsCRT.h"
#include "nsCRTGlue.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
@ -668,7 +668,7 @@ static void SetSortClosure(const PRUnichar *sortColumn, const PRUnichar *sortDir
{
closure->colID = sortColumn;
if (sortDirection && !nsCRT::strcmp(sortDirection, NS_LITERAL_STRING("descending").get()))
if (sortDirection && !NS_strcmp(sortDirection, NS_LITERAL_STRING("descending").get()))
closure->factor = DESCENDING_SORT_FACTOR;
else
closure->factor = ASCENDING_SORT_FACTOR;
@ -700,7 +700,7 @@ NS_IMETHODIMP nsAbView::SortBy(const PRUnichar *colID, const PRUnichar *sortDir)
// note, we'll call SortBy() with the existing sort column and the
// existing sort direction, and that needs to do a complete resort.
// for example, we do that when the PREF_MAIL_ADDR_BOOK_LASTNAMEFIRST changes
if (!nsCRT::strcmp(mSortColumn.get(),sortColumn.get()) && nsCRT::strcmp(mSortDirection.get(), sortDir)) {
if (!NS_strcmp(mSortColumn.get(),sortColumn.get()) && NS_strcmp(mSortDirection.get(), sortDir)) {
PRInt32 halfPoint = count / 2;
for (i=0; i < halfPoint; i++) {
// swap the elements.
@ -852,7 +852,7 @@ NS_IMETHODIMP nsAbView::Observe(nsISupports *aSubject, const char *aTopic, const
{
nsresult rv;
if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
nsDependentString prefName(someData);
if (prefName.EqualsLiteral(PREF_MAIL_ADDR_BOOK_LASTNAMEFIRST)) {

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

@ -46,7 +46,6 @@
#include "nsAbWinHelper.h"
#include "nsMapiAddressBook.h"
#include "nsWabAddressBook.h"
#include "nsCRT.h"
#include <mapiguid.h>
@ -590,7 +589,7 @@ BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG
}
else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
alternativeValue.AssignWithConversion(aValues [i].get()) ;
char *av = nsCRT::strdup(alternativeValue.get()) ;
char *av = strdup(alternativeValue.get()) ;
if (!av) {
retCode = FALSE ;
break ;
@ -602,7 +601,7 @@ BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG
retCode = SetMAPIProperties(aObject, currentValue, values) ;
for (i = 0 ; i < currentValue ; ++ i) {
if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
nsCRT::free(values [i].Value.lpszA) ;
NS_Free(values [i].Value.lpszA) ;
}
}
delete [] values ;
@ -1009,13 +1008,13 @@ nsAbWinType getAbWinType(const char *aScheme, const char *aUri, nsCString& aStub
aEntry.Truncate() ;
PRUint32 schemeLength = strlen(aScheme) ;
if (nsCRT::strncmp(aUri, aScheme, schemeLength) == 0) {
if (nsCRT::strncmp(aUri + schemeLength, kOutlookStub, kOutlookStubLength) == 0) {
if (strncmp(aUri, aScheme, schemeLength) == 0) {
if (strncmp(aUri + schemeLength, kOutlookStub, kOutlookStubLength) == 0) {
aEntry = aUri + schemeLength + kOutlookStubLength ;
aStub = kOutlookStub ;
return nsAbWinType_Outlook ;
}
if (nsCRT::strncmp(aUri + schemeLength, kOutlookExpStub, kOutlookExpStubLength) == 0) {
if (strncmp(aUri + schemeLength, kOutlookExpStub, kOutlookExpStubLength) == 0) {
aEntry = aUri + schemeLength + kOutlookExpStubLength ;
aStub = kOutlookExpStub ;
return nsAbWinType_OutlookExp ;

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

@ -2057,7 +2057,7 @@ NS_IMETHODIMP nsAddrDatabase::GetCardValue(nsIAbCard *card, const char *name, PR
return NS_OK;
}
*value = nsCRT::strdup(tempString.get());
*value = NS_strdup(tempString.get());
if (!*value)
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;

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

@ -87,7 +87,7 @@
#include "nsIDocShell.h"
#include "nsAutoPtr.h"
#include "nsIMsgVCardService.h"
#include "nsCRT.h"
#include "nsCRTGlue.h"
#include "nsIAbLDAPAttributeMap.h"
#ifdef MOZ_XUL_APP
@ -957,13 +957,13 @@ PRBool nsAddressBook::IsSafeLDIFString(const PRUnichar *aStr)
return PR_FALSE;
PRUint32 i;
PRUint32 len = nsCRT::strlen(aStr);
PRUint32 len = NS_strlen(aStr);
for (i=0; i<len; i++) {
// If string contains CR or LF, it is not safe for LDIF
// and MUST be base64 encoded
if ((aStr[i] == PRUnichar('\n')) ||
(aStr[i] == PRUnichar('\r')) ||
(!nsCRT::IsAscii(aStr[i])))
(!NS_IsAscii(aStr[i])))
return PR_FALSE;
}
return PR_TRUE;
@ -1095,7 +1095,7 @@ NS_IMETHODIMP nsAddressBook::HandleContent(const char * aContentType,
nsresult rv = NS_OK;
// First of all, get the content type and make sure it is a content type we know how to handle!
if (nsCRT::strcasecmp(aContentType, "application/x-addvcard") == 0) {
if (PL_strcasecmp(aContentType, "application/x-addvcard") == 0) {
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIChannel> aChannel = do_QueryInterface(request);
if (!aChannel) return NS_ERROR_FAILURE;
@ -1147,7 +1147,7 @@ NS_IMETHODIMP nsAddressBook::HandleContent(const char * aContentType,
rv = NS_OK;
}
}
else if (nsCRT::strcasecmp(aContentType, "text/x-vcard") == 0) {
else if (PL_strcasecmp(aContentType, "text/x-vcard") == 0) {
// create a vcard stream listener that can parse the data stream
// and bring up the appropriate UI

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

@ -50,7 +50,7 @@
#include "nsIAddrDatabase.h"
#include "nsAbBaseCID.h"
#include "nsIAddrBookSession.h"
#include "nsCRT.h"
#include "nsCRTGlue.h"
#include "nsILocalFile.h"
#include "nsWeakReference.h"
#include "nsIAbMDBDirectory.h"
@ -58,9 +58,11 @@
#include "nsIAbLDAPDirectory.h"
#endif
#include "ctype.h"
#include "prlog.h"
#include "prmem.h"
#include "prprf.h"
#include "plstr.h"
#include "nsQuickSort.h"
/*****************************************************************************
@ -300,12 +302,12 @@ nsresult DIR_AddNewAddressBook(const PRUnichar *dirName, const char *fileName,
server->position = kDefaultPosition; // don't set position so alphabetic sort will happen.
if (fileName)
server->fileName = nsCRT::strdup(fileName);
server->fileName = strdup(fileName);
else
DIR_SetFileName(&server->fileName, kPersonalAddressbook);
if (dirType == LDAPDirectory) {
if (uri)
server->uri = nsCRT::strdup(uri);
server->uri = strdup(uri);
}
dir_ServerList->AppendElement(server);
@ -318,9 +320,9 @@ nsresult DIR_AddNewAddressBook(const PRUnichar *dirName, const char *fileName,
// right directory properties. For migration, pref names were already
// created so no need to get unique ones via dir_CreateServerPrefName().
if (!strcmp(server->fileName, kPersonalAddressbook))
server->prefName = nsCRT::strdup("ldap_2.servers.pab");
server->prefName = strdup("ldap_2.servers.pab");
else if (!strcmp(server->fileName, kCollectedAddressbook))
server->prefName = nsCRT::strdup("ldap_2.servers.history");
server->prefName = strdup("ldap_2.servers.history");
else
{
char * leafName = dir_ConvertDescriptionToPrefName (server);
@ -850,7 +852,7 @@ static char *DIR_GetStringPref(const char *prefRoot, const char *prefLeaf, const
}
else
{
value = defaultValue ? nsCRT::strdup(defaultValue) : nsnull;
value = defaultValue ? strdup(defaultValue) : nsnull;
}
return ToNewCString(value);
@ -891,7 +893,7 @@ static char *DIR_GetLocalizedStringPref
value = ToNewCString(utf8str);
}
else
value = defaultValue ? nsCRT::strdup(defaultValue) : nsnull;
value = defaultValue ? strdup(defaultValue) : nsnull;
return value;
}
@ -933,7 +935,7 @@ static void DIR_ConvertServerFileName(DIR_Server* pServer)
#else
newLeafName = strrchr(leafName, '/');
#endif
pServer->fileName = newLeafName ? nsCRT::strdup(newLeafName + 1) : nsCRT::strdup(leafName);
pServer->fileName = newLeafName ? strdup(newLeafName + 1) : strdup(leafName);
if (leafName) PR_Free(leafName);
}
@ -993,7 +995,7 @@ static char * dir_ConvertDescriptionToPrefName(DIR_Server * server)
numSrcBytes = PL_strlen(descr);
while (srcIndex < numSrcBytes && destIndex < MAX_PREF_NAME_SIZE-1)
{
if (nsCRT::IsAsciiDigit(descr[srcIndex]) || nsCRT::IsAsciiAlpha(descr[srcIndex]) )
if (isdigit(descr[srcIndex]) || isalpha(descr[srcIndex]) )
{
fileNameBuf[destIndex] = descr[srcIndex];
destIndex++;
@ -1006,7 +1008,7 @@ static char * dir_ConvertDescriptionToPrefName(DIR_Server * server)
}
if (destIndex) /* have at least one character in the file name? */
fileName = nsCRT::strdup(fileNameBuf);
fileName = strdup(fileNameBuf);
return fileName;
}
@ -1027,7 +1029,7 @@ void DIR_SetServerFileName(DIR_Server *server)
/* set default personal address book file name*/
if ((server->position == 1) && (server->dirType == PABDirectory))
server->fileName = nsCRT::strdup(kPersonalAddressbook);
server->fileName = strdup(kPersonalAddressbook);
else
{
/* now use the pref name as the file name since we know the pref name
@ -1038,7 +1040,7 @@ void DIR_SetServerFileName(DIR_Server *server)
/* extract just the pref name part and not the ldap tree name portion from the string */
numHeaderBytes = PL_strlen(PREF_LDAP_SERVER_TREE_NAME) + 1; /* + 1 for the '.' b4 the name */
if (PL_strlen(prefName) > numHeaderBytes)
tempName = nsCRT::strdup(prefName + numHeaderBytes);
tempName = strdup(prefName + numHeaderBytes);
if (tempName)
{
@ -1071,7 +1073,7 @@ static char *dir_CreateServerPrefName (DIR_Server *server)
{
// we need to handle this in case the description has no alphanumeric chars
// it's very common for cjk users
leafName = nsCRT::strdup("_nonascii");
leafName = strdup("_nonascii");
}
if (leafName)
@ -1091,7 +1093,7 @@ static char *dir_CreateServerPrefName (DIR_Server *server)
isUnique = PR_TRUE; /* now flip the logic and assume we are unique until we find a match */
for (PRUint32 i = 0; i < prefCount && isUnique; ++i)
{
if (!nsCRT::strcasecmp(children[i], prefName)) /* are they the same branch? */
if (!PL_strcasecmp(children[i], prefName)) /* are they the same branch? */
isUnique = PR_FALSE;
}
if (!isUnique) /* then try generating a new pref name and try again */
@ -1197,7 +1199,7 @@ static nsresult dir_GetPrefs(nsVoidArray **list)
if (server)
{
DIR_InitServer(server);
server->prefName = nsCRT::strdup(children[i]);
server->prefName = strdup(children[i]);
DIR_GetPrefsForOneServer(server);
if (server->description && server->description[0] &&
((server->dirType == PABDirectory ||
@ -1305,14 +1307,14 @@ static void DIR_SetStringPref(const char *prefRoot, const char *prefLeaf, const
nsCString userPref;
if (NS_SUCCEEDED(pPref->GetCharPref (prefLocation.get(), getter_Copies(userPref))))
{
if (value && (defaultValue ? nsCRT::strcasecmp(value, defaultValue) : value != defaultValue))
if (value && (defaultValue ? PL_strcasecmp(value, defaultValue) : value != defaultValue))
rv = pPref->SetCharPref (prefLocation.get(), value);
else
rv = pPref->ClearUserPref(prefLocation.get());
}
else
{
if (value && (defaultValue ? nsCRT::strcasecmp(value, defaultValue) : value != defaultValue))
if (value && (defaultValue ? PL_strcasecmp(value, defaultValue) : value != defaultValue))
rv = pPref->SetCharPref (prefLocation.get(), value);
}
}

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

@ -197,7 +197,7 @@ NS_IMPL_ISUPPORTS_INHERITED3(nsAbDirectoryDataSource, nsAbRDFDataSource, nsIAbLi
// nsIRDFDataSource methods
NS_IMETHODIMP nsAbDirectoryDataSource::GetURI(char* *uri)
{
if ((*uri = nsCRT::strdup("rdf:addressdirectory")) == nsnull)
if ((*uri = strdup("rdf:addressdirectory")) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
else
return NS_OK;

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

@ -48,7 +48,7 @@
#include "nsReadableUtils.h"
#include "nspr.h"
#include "nsIStringBundle.h"
#include "nsCRT.h"
#include "nsCRTGlue.h"
#include "nsIObserverService.h"
#include "nsNetUtil.h"
#include "nsICategoryManager.h"
@ -126,8 +126,8 @@ nsLDAPAutoCompleteSession::OnStartLookup(const PRUnichar *searchString,
nsDependentString(searchString).FindChar(PRUnichar(','), 0) !=
kNotFound ||
( !IS_CJK_CHAR_FOR_LDAP(searchString[0]) ?
mMinStringLength && nsCRT::strlen(searchString) < mMinStringLength :
mCjkMinStringLength && nsCRT::strlen(searchString) <
mMinStringLength && NS_strlen(searchString) < mMinStringLength :
mCjkMinStringLength && NS_strlen(searchString) <
mCjkMinStringLength ) ) {
FinishAutoCompleteLookup(nsIAutoCompleteStatus::ignored, 0, mState);