Permalink
Browse files

Backed out changeset 66a7359f9be2 (bug 791546) because it broke the b…

…uild
  • Loading branch information...
1 parent 69ca1f7 commit 448602e3480a593585b3a2f30929b39a13c0168c @ehsan ehsan committed Jan 3, 2013
View
4 docshell/base/nsDocShell.cpp
@@ -11549,8 +11549,8 @@ nsDocShell::Observe(nsISupports *aSubject, const char *aTopic,
{
nsresult rv = NS_OK;
if (mObserveErrorPages &&
- !nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) && aData &&
- !NS_strcmp(aData,
+ !nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) &&
+ !nsCRT::strcmp(aData,
NS_LITERAL_STRING("browser.xul.error_pages.enabled").get())) {
bool tmpbool;
View
4 dom/src/storage/nsDOMStorage.cpp
@@ -218,8 +218,8 @@ nsDOMStorageManager::Observe(nsISupports *aSubject,
const PRUnichar *aData)
{
if (!strcmp(aTopic, "profile-after-change")) {
- } else if (!strcmp(aTopic, "cookie-changed") && aData &&
- !NS_strcmp(aData, NS_LITERAL_STRING("cleared").get())) {
+ } else if (!strcmp(aTopic, "cookie-changed") &&
+ !nsCRT::strcmp(aData, NS_LITERAL_STRING("cleared").get())) {
mStorages.EnumerateEntries(ClearStorage, nullptr);
nsresult rv = DOMStorageImpl::InitDB();
View
2 editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp
@@ -67,7 +67,7 @@ ChangeCSSInlineStyleTxn::ValueIncludes(const nsAString &aValueList, const nsAStr
if (start < end) {
if (aCaseSensitive) {
- if (value && !NS_strcmp(value, start)) {
+ if (!nsCRT::strcmp(value, start)) {
result = true;
break;
}
View
2 extensions/cookie/nsPermissionManager.cpp
@@ -1106,7 +1106,7 @@ NS_IMETHODIMP nsPermissionManager::Observe(nsISupports *aSubject, const char *aT
// The profile is about to change,
// or is going away because the application is shutting down.
mIsShuttingDown = true;
- if (someData && !NS_strcmp(someData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
+ if (!nsCRT::strcmp(someData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
// Clear the permissions file and close the db asynchronously
RemoveAllInternal(false);
} else {
View
11 intl/locale/src/nsLocale.cpp
@@ -98,16 +98,7 @@ nsLocale::Hash_HashFunction(const void* key)
int
nsLocale::Hash_CompareNSString(const void* s1, const void* s2)
{
- if (s1 && s2) {
- return !NS_strcmp((const PRUnichar *) s1, (const PRUnichar *) s2);
- }
- if (s1) { //s2 must have been null
- return -1;
- }
- if (s2) { //s1 must have been null
- return 1;
- }
- return 0;
+ return !nsCRT::strcmp((const PRUnichar *) s1, (const PRUnichar *) s2);
}
View
2 modules/libpref/src/Preferences.cpp
@@ -392,7 +392,7 @@ Preferences::Observe(nsISupports *aSubject, const char *aTopic,
nsresult rv = NS_OK;
if (!nsCRT::strcmp(aTopic, "profile-before-change")) {
- if (someData && !NS_strcmp(someData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
+ if (!nsCRT::strcmp(someData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
if (mCurrentFile) {
mCurrentFile->Remove(false);
mCurrentFile = nullptr;
View
4 netwerk/cookie/nsCookieService.cpp
@@ -1442,8 +1442,8 @@ nsCookieService::Observe(nsISupports *aSubject,
if (!strcmp(aTopic, "profile-before-change")) {
// The profile is about to change,
// or is going away because the application is shutting down.
- if (mDBState && mDBState->dbConn && aData &&
- !NS_strcmp(aData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
+ if (mDBState && mDBState->dbConn &&
+ !nsCRT::strcmp(aData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
// Clear the cookie db if we're in the default DBState.
RemoveAll();
}
View
2 netwerk/protocol/http/nsHttpAuthCache.cpp
@@ -41,7 +41,7 @@ StrEquivalent(const PRUnichar *a, const PRUnichar *b)
if (!b)
b = emptyStr;
- return NS_strcmp(a, b) == 0;
+ return nsCRT::strcmp(a, b) == 0;
}
//-----------------------------------------------------------------------------
View
4 netwerk/protocol/http/nsHttpChannelAuthProvider.cpp
@@ -768,7 +768,7 @@ nsHttpChannelAuthProvider::GetCredentialsForChallenge(const char *challenge,
}
}
else if (!identFromURI ||
- (NS_strcmp(ident->User(),
+ (nsCRT::strcmp(ident->User(),
entry->Identity().User()) == 0 &&
!(loadFlags &
(nsIChannel::LOAD_ANONYMOUS |
@@ -1350,7 +1350,7 @@ nsHttpChannelAuthProvider::SetAuthorizationHeader(nsHttpAuthCache *authCache,
// up the one from the auth cache instead.
// when this is undesired, specify LOAD_EXPLICIT_CREDENTIALS load
// flag.
- if (NS_strcmp(ident.User(), entry->User()) == 0) {
+ if (nsCRT::strcmp(ident.User(), entry->User()) == 0) {
uint32_t loadFlags;
if (NS_SUCCEEDED(mAuthChannel->GetLoadFlags(&loadFlags)) &&
!(loadFlags && nsIChannel::LOAD_EXPLICIT_CREDENTIALS)) {
View
4 parser/htmlparser/src/nsHTMLTags.cpp
@@ -305,7 +305,7 @@ HTMLTagsKeyCompareUCPtr(const void *key1, const void *key2)
const PRUnichar *str1 = (const PRUnichar *)key1;
const PRUnichar *str2 = (const PRUnichar *)key2;
- return str1 && str2 && NS_strcmp(str1, str2) == 0;
+ return nsCRT::strcmp(str1, str2) == 0;
}
// nsIAtom* -> id hash
@@ -476,7 +476,7 @@ nsHTMLTags::TestTagTable()
id = LookupTag(nsDependentString(tag));
NS_ASSERTION(id != eHTMLTag_userdefined, "can't find tag id");
const PRUnichar* check = GetStringValue(id);
- NS_ASSERTION(0 == NS_strcmp(check, tag), "can't map id back to tag");
+ NS_ASSERTION(0 == nsCRT::strcmp(check, tag), "can't map id back to tag");
nsAutoString uname(tag);
ToUpperCase(uname);
View
3 rdf/base/src/nsRDFService.cpp
@@ -173,7 +173,8 @@ struct LiteralHashEntry : public PLDHashEntryHdr {
const LiteralHashEntry *entry =
static_cast<const LiteralHashEntry *>(hdr);
- return 0 == NS_strcmp(static_cast<const PRUnichar *>(key), entry->mKey);
+ return 0 == nsCRT::strcmp(static_cast<const PRUnichar *>(key),
+ entry->mKey);
}
};
View
2 security/manager/ssl/src/nsCertOverrideService.cpp
@@ -146,7 +146,7 @@ nsCertOverrideService::Observe(nsISupports *,
ReentrantMonitorAutoEnter lock(monitor);
- if (aData && !NS_strcmp(aData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
+ if (!nsCRT::strcmp(aData, NS_LITERAL_STRING("shutdown-cleanse").get())) {
RemoveAllFromMemory();
// delete the storage file
if (mSettingsFile) {
View
2 toolkit/components/filepicker/nsFileView.cpp
@@ -856,7 +856,7 @@ nsFileView::FilterFiles()
if (!isHidden) {
for (uint32_t j = 0; j < filterCount; ++j) {
bool matched = false;
- if (!NS_strcmp(mCurrentFilters.ElementAt(j),
+ if (!nsCRT::strcmp(mCurrentFilters.ElementAt(j),
NS_LITERAL_STRING("..apps").get()))
{
file->IsExecutable(&matched);
View
30 xpcom/ds/nsCRT.cpp
@@ -73,6 +73,36 @@ char* nsCRT::strtok(char* string, const char* delims, char* *newStr)
////////////////////////////////////////////////////////////////////////////////
/**
+ * Compare unichar string ptrs, stopping at the 1st null
+ * NOTE: If both are null, we return 0.
+ * NOTE: We terminate the search upon encountering a NULL
+ *
+ * @update gess 11/10/99
+ * @param s1 and s2 both point to unichar strings
+ * @return 0 if they match, -1 if s1<s2; 1 if s1>s2
+ */
+int32_t nsCRT::strcmp(const PRUnichar* s1, const PRUnichar* s2) {
+ if(s1 && s2) {
+ for (;;) {
+ PRUnichar c1 = *s1++;
+ PRUnichar c2 = *s2++;
+ if (c1 != c2) {
+ if (c1 < c2) return -1;
+ return 1;
+ }
+ if ((0==c1) || (0==c2)) break;
+ }
+ }
+ else {
+ if (s1) // s2 must have been null
+ return -1;
+ if (s2) // s1 must have been null
+ return 1;
+ }
+ return 0;
+}
+
+/**
* Compare unichar string ptrs, stopping at the 1st null or nth char.
* NOTE: If either is null, we return 0.
* NOTE: We DO NOT terminate the search upon encountering NULL's before N
View
2 xpcom/ds/nsCRT.h
@@ -136,6 +136,8 @@ class nsCRT {
static char* strtok(char* str, const char* delims, char* *newStr);
/// Like strcmp except for ucs2 strings
+ static int32_t strcmp(const PRUnichar* s1, const PRUnichar* s2);
+ /// Like strcmp except for ucs2 strings
static int32_t strncmp(const PRUnichar* s1, const PRUnichar* s2,
uint32_t aMaxLen);
View
2 xpcom/io/nsLocalFileCommon.cpp
@@ -224,7 +224,7 @@ nsLocalFile::GetRelativeDescriptor(nsIFile *fromFile, nsACString& _retval)
if (_wcsicmp(thisNodes[nodeIndex], fromNodes[nodeIndex]))
break;
#else
- if (NS_strcmp(thisNodes[nodeIndex], fromNodes[nodeIndex]))
+ if (nsCRT::strcmp(thisNodes[nodeIndex], fromNodes[nodeIndex]))
break;
#endif
}
View
4 xpcom/tests/TestCRT.cpp
@@ -46,9 +46,9 @@ static void Check(const char* s1, const char* s2, int n)
const PRUnichar* us2 = t2.get();
#ifdef DEBUG
- int u2 = us1 && us2 &&
+ int u2 =
#endif
- NS_strcmp(us1, us2);
+ nsCRT::strcmp(us1, us2);
#ifdef DEBUG
int u2_n =

0 comments on commit 448602e

Please sign in to comment.