зеркало из https://github.com/mozilla/gecko-dev.git
bug 245673 named literal strings should be const
r+sr=darin
This commit is contained in:
Родитель
52ead053dd
Коммит
a4396ff7b4
|
@ -1454,7 +1454,7 @@ nsXMLContentSink::PushNameSpacesFrom(const PRUnichar** aAtts)
|
|||
|
||||
NS_ENSURE_TRUE(nameSpace, NS_ERROR_UNEXPECTED);
|
||||
|
||||
static const NS_NAMED_LITERAL_STRING(kNameSpaceDef, "xmlns");
|
||||
static NS_NAMED_LITERAL_STRING(kNameSpaceDef, "xmlns");
|
||||
static const PRUint32 xmlns_len = kNameSpaceDef.Length();
|
||||
|
||||
|
||||
|
|
|
@ -1145,7 +1145,7 @@ XULContentSinkImpl::PushNameSpacesFrom(const PRUnichar** aAttributes)
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
static const NS_NAMED_LITERAL_STRING(kNameSpaceDef, "xmlns");
|
||||
static NS_NAMED_LITERAL_STRING(kNameSpaceDef, "xmlns");
|
||||
static const PRUint32 xmlns_len = kNameSpaceDef.Length();
|
||||
|
||||
for (; *aAttributes; aAttributes += 2) {
|
||||
|
|
|
@ -271,9 +271,9 @@ NS_IMETHODIMP
|
|||
PRUint32 aParameterCount,
|
||||
nsISOAPParameter ** aParameters)
|
||||
{
|
||||
static const NS_NAMED_LITERAL_STRING(realEmptySOAPDocStr1,
|
||||
static NS_NAMED_LITERAL_STRING(realEmptySOAPDocStr1,
|
||||
"<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"><env:Header/><env:Body/></env:Envelope>");
|
||||
static const NS_NAMED_LITERAL_STRING(realEmptySOAPDocStr2,
|
||||
static NS_NAMED_LITERAL_STRING(realEmptySOAPDocStr2,
|
||||
"<env:Envelope xmlns:env=\"http://www.w3.org/2001/09/soap-envelope\" xmlns:enc=\"http://www.w3.org/2001/09/soap-encoding\"><env:Header/><env:Body/></env:Envelope>");
|
||||
static const nsAString *kEmptySOAPDocStr[] = {
|
||||
&realEmptySOAPDocStr1, &realEmptySOAPDocStr2
|
||||
|
|
|
@ -661,8 +661,8 @@ XPCConvert::JSData2Native(XPCCallContext& ccx, void* d, jsval s,
|
|||
}
|
||||
case nsXPTType::T_DOMSTRING:
|
||||
{
|
||||
static const NS_NAMED_LITERAL_STRING(sEmptyString, "");
|
||||
static const NS_NAMED_LITERAL_STRING(sVoidString, "undefined");
|
||||
static NS_NAMED_LITERAL_STRING(sEmptyString, "");
|
||||
static NS_NAMED_LITERAL_STRING(sVoidString, "undefined");
|
||||
|
||||
const PRUnichar* chars;
|
||||
JSString* str = nsnull;
|
||||
|
|
|
@ -439,7 +439,7 @@ TestArgFormatter(JSContext* jscontext, JSObject* glob, nsIXPConnect* xpc)
|
|||
const char* a_in = "some string";
|
||||
nsCOMPtr<nsITestXPCFoo> b_in = new nsTestXPCFoo();
|
||||
nsCOMPtr<nsIWritableVariant> c_in = do_CreateInstance("@mozilla.org/variant;1");
|
||||
static const NS_NAMED_LITERAL_STRING(d_in, "foo bar");
|
||||
static NS_NAMED_LITERAL_STRING(d_in, "foo bar");
|
||||
const char* e_in = "another meaningless chunck of text";
|
||||
|
||||
|
||||
|
|
|
@ -524,7 +524,7 @@ nsresult CTextToken::ConsumeUntil(PRUnichar aChar,PRBool aIgnoreComments,nsScann
|
|||
// assume that the prematured terminal string is the actual terminal string and goto step 1. This
|
||||
// will be our last iteration.
|
||||
|
||||
const NS_NAMED_LITERAL_STRING(ltslash, "</");
|
||||
NS_NAMED_LITERAL_STRING(ltslash, "</");
|
||||
const nsString theTerminalString = ltslash + aEndTagName;
|
||||
|
||||
PRUint32 termStrLen=theTerminalString.Length();
|
||||
|
|
|
@ -82,13 +82,13 @@ literal_string( const nsACString::char_type* aPtr, PRUint32 aLength )
|
|||
#define NS_LL(s) L##s
|
||||
#define NS_MULTILINE_LITERAL_STRING(s) nsDependentString(NS_REINTERPRET_CAST(const nsAString::char_type*, s), PRUint32((sizeof(s)/sizeof(wchar_t))-1))
|
||||
#define NS_MULTILINE_LITERAL_STRING_INIT(n,s) n(NS_REINTERPRET_CAST(const nsAString::char_type*, s), PRUint32((sizeof(s)/sizeof(wchar_t))-1))
|
||||
#define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) nsDependentString n(NS_REINTERPRET_CAST(const nsAString::char_type*, s), PRUint32((sizeof(s)/sizeof(wchar_t))-1))
|
||||
#define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) const nsDependentString n(NS_REINTERPRET_CAST(const nsAString::char_type*, s), PRUint32((sizeof(s)/sizeof(wchar_t))-1))
|
||||
typedef nsDependentString nsLiteralString;
|
||||
#else
|
||||
#define NS_LL(s) s
|
||||
#define NS_MULTILINE_LITERAL_STRING(s) NS_ConvertASCIItoUTF16(s, PRUint32(sizeof(s)-1))
|
||||
#define NS_MULTILINE_LITERAL_STRING_INIT(n,s) n(s, PRUint32(sizeof(s)-1))
|
||||
#define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) NS_ConvertASCIItoUTF16 n(s, PRUint32(sizeof(s)-1))
|
||||
#define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) const NS_ConvertASCIItoUTF16 n(s, PRUint32(sizeof(s)-1))
|
||||
typedef NS_ConvertASCIItoUTF16 nsLiteralString;
|
||||
#endif
|
||||
|
||||
|
@ -107,9 +107,9 @@ literal_string( const nsACString::char_type* aPtr, PRUint32 aLength )
|
|||
#define NS_LITERAL_STRING_INIT(n,s) NS_MULTILINE_LITERAL_STRING_INIT(n, NS_LL(s))
|
||||
#define NS_NAMED_LITERAL_STRING(n,s) NS_NAMED_MULTILINE_LITERAL_STRING(n, NS_LL(s))
|
||||
|
||||
#define NS_LITERAL_CSTRING(s) nsDependentCString(s, PRUint32(sizeof(s)-1))
|
||||
#define NS_LITERAL_CSTRING(s) NS_STATIC_CAST(const nsAFlatCString&, nsDependentCString(s, PRUint32(sizeof(s)-1)))
|
||||
#define NS_LITERAL_CSTRING_INIT(n,s) n(s, PRUint32(sizeof(s)-1))
|
||||
#define NS_NAMED_LITERAL_CSTRING(n,s) nsDependentCString n(s, PRUint32(sizeof(s)-1))
|
||||
#define NS_NAMED_LITERAL_CSTRING(n,s) const nsDependentCString n(s, PRUint32(sizeof(s)-1))
|
||||
|
||||
typedef nsDependentCString nsLiteralCString;
|
||||
|
||||
|
|
|
@ -4264,12 +4264,12 @@ nsGlobalHistory::AutoCompleteSearch(const nsAString& aSearchString,
|
|||
AutoCompleteSortClosure closure;
|
||||
closure.history = this;
|
||||
closure.prefixCount = AUTOCOMPLETE_PREFIX_LIST_COUNT;
|
||||
closure.prefixes[0] = NS_STATIC_CAST(nsAFlatString*, &prefixHWStr);
|
||||
closure.prefixes[1] = NS_STATIC_CAST(nsAFlatString*, &prefixHStr);
|
||||
closure.prefixes[2] = NS_STATIC_CAST(nsAFlatString*, &prefixHSWStr);
|
||||
closure.prefixes[3] = NS_STATIC_CAST(nsAFlatString*, &prefixHSStr);
|
||||
closure.prefixes[4] = NS_STATIC_CAST(nsAFlatString*, &prefixFFStr);
|
||||
closure.prefixes[5] = NS_STATIC_CAST(nsAFlatString*, &prefixFStr);
|
||||
closure.prefixes[0] = &prefixHWStr;
|
||||
closure.prefixes[1] = &prefixHStr;
|
||||
closure.prefixes[2] = &prefixHSWStr;
|
||||
closure.prefixes[3] = &prefixHSStr;
|
||||
closure.prefixes[4] = &prefixFFStr;
|
||||
closure.prefixes[5] = &prefixFStr;
|
||||
|
||||
// sort it
|
||||
NS_QuickSort(items, count, sizeof(nsIAutoCompleteItem*),
|
||||
|
|
|
@ -232,7 +232,7 @@ protected:
|
|||
{
|
||||
nsGlobalHistory* history;
|
||||
size_t prefixCount;
|
||||
nsAFlatString* prefixes[AUTOCOMPLETE_PREFIX_LIST_COUNT];
|
||||
const nsAFlatString* prefixes[AUTOCOMPLETE_PREFIX_LIST_COUNT];
|
||||
};
|
||||
|
||||
// caching of PR_Now() so we don't call it every time we do
|
||||
|
|
Загрузка…
Ссылка в новой задаче