scc checking in from jst's account. bug #75220: sr=jst, rs=brendan. renaming |nsPromiseC?Concatenation| to |nsDependentC?Concatenation|; |nsPromiseC?Substring| to |nsDependentC?Substring|; |nsLiteralC?String| and |nsLocalC?String| to |nsDependentC?String|, as these new names better reflect clients obligations to instances.

This commit is contained in:
jst%netscape.com 2001-05-19 11:27:30 +00:00
Родитель 2bf024984c
Коммит f72e19a2c3
100 изменённых файлов: 443 добавлений и 460 удалений

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

@ -136,7 +136,7 @@ NS_IMETHODIMP nsRootAccessible::GetAccValue(PRUnichar * *aAccValue)
nsCOMPtr<nsIURI> pURI(mDocument->GetDocumentURL());
char *path;
pURI->GetSpec(&path);
*aAccValue = ToNewUnicode(nsLiteralCString(path));
*aAccValue = ToNewUnicode(nsDependentCString(path));
return NS_OK;
}

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

@ -136,7 +136,7 @@ NS_IMETHODIMP nsRootAccessible::GetAccValue(PRUnichar * *aAccValue)
nsCOMPtr<nsIURI> pURI(mDocument->GetDocumentURL());
char *path;
pURI->GetSpec(&path);
*aAccValue = ToNewUnicode(nsLiteralCString(path));
*aAccValue = ToNewUnicode(nsDependentCString(path));
return NS_OK;
}

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

@ -2806,7 +2806,7 @@ nsDocument::GetBaseURI(nsAWritableString &aURI)
nsXPIDLCString spec;
mDocumentBaseURL->GetSpec(getter_Copies(spec));
if (spec) {
CopyASCIItoUCS2(nsLiteralCString(spec), aURI);
CopyASCIItoUCS2(nsDependentCString(spec), aURI);
}
}
return NS_OK;

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

@ -415,7 +415,7 @@ nsNode3Tearoff::GetBaseURI(nsAWritableString& aURI)
uri->GetSpec(getter_Copies(spec));
CopyASCIItoUCS2(nsLiteralCString(spec), aURI);
CopyASCIItoUCS2(nsDependentCString(spec), aURI);
}
return NS_OK;

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

@ -89,7 +89,7 @@ nsXMLContentSerializer::AppendTextData(nsIDOMNode* aNode,
if (frag) {
PRInt32 length = ((aEndOffset == -1) ? frag->GetLength() : aEndOffset) - aStartOffset;
if (frag->Is2b()) {
AppendToString(nsLiteralString(frag->Get2b()+aStartOffset, length),
AppendToString(nsDependentString(frag->Get2b()+aStartOffset, length),
aStr,
aTranslateEntities,
aIncrColumn);

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

@ -1633,7 +1633,7 @@ nsHTMLDocument::GetBaseURI(nsAWritableString &aURI)
nsXPIDLCString spec;
uri->GetSpec(getter_Copies(spec));
if (spec) {
CopyASCIItoUCS2(nsLiteralCString(spec), aURI);
CopyASCIItoUCS2(nsDependentCString(spec), aURI);
}
}
return NS_OK;
@ -2384,7 +2384,7 @@ nsHTMLDocument::ScriptWriteCommon(PRBool aNewlineTerminate)
JSString *jsstr = JS_ValueToString(cx, argv[0]);
NS_ENSURE_TRUE(jsstr, NS_ERROR_OUT_OF_MEMORY);
nsLiteralString str(NS_REINTERPRET_CAST(const PRUnichar *,
nsDependentString str(NS_REINTERPRET_CAST(const PRUnichar *,
::JS_GetStringChars(jsstr)),
::JS_GetStringLength(jsstr));

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

@ -498,7 +498,7 @@ nsresult nsImageDocument::UpdateTitle( void )
rv = bundle->FormatStringFromName(key.GetUnicode(), formatStrings, 2, getter_Copies(valUni));
}
}
if (nsLiteralString(valUni).IsEmpty()) {
if (!valUni[0]) {
key.AssignWithConversion("ImageTitleWithoutDimensions");
rv = bundle->GetStringFromName(key.GetUnicode(), getter_Copies(valUni));
}

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

@ -912,7 +912,7 @@ CSSLoaderImpl::DidLoadStyle(nsIStreamLoader* aLoader,
nsXPIDLCString url;
aLoadData->mURL->GetSpec(getter_Copies(url));
nsCAutoString errorMessage(NS_LITERAL_CSTRING("CSSLoaderImpl::DidLoadStyle: Load of URL '") +
nsLiteralCString(url) +
nsDependentCString(url) +
NS_LITERAL_CSTRING("' failed. Error code: "));
errorMessage.AppendInt(NS_ERROR_GET_CODE(aStatus));
NS_WARNING(errorMessage.get());
@ -1194,7 +1194,7 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData)
nsXPIDLCString url;
aKey.mURL->GetSpec(getter_Copies(url));
nsCAutoString errorMessage(NS_LITERAL_CSTRING("CSSLoaderImpl::LoadSheet: Load of URL '") +
nsLiteralCString(url) +
nsDependentCString(url) +
NS_LITERAL_CSTRING("' failed. Error code: "));
errorMessage.AppendInt(NS_ERROR_GET_CODE(result));
NS_WARNING(errorMessage.get());
@ -1533,7 +1533,7 @@ CSSLoaderImpl::LoadAgentSheet(nsIURI* aURL,
nsXPIDLCString url;
aURL->GetSpec(getter_Copies(url));
nsCAutoString errorMessage(NS_LITERAL_CSTRING("CSSLoaderImpl::LoadAgentSheet: Load of URL '") +
nsLiteralCString(url) +
nsDependentCString(url) +
NS_LITERAL_CSTRING("' failed. Error code: "));
errorMessage.AppendInt(NS_ERROR_GET_CODE(result));
NS_WARNING(errorMessage.get());

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

@ -568,7 +568,7 @@ nsComputedDOMStyle::Item(PRUint32 aIndex, nsAWritableString& aReturn)
GetLength(&length);
aReturn.Truncate();
if (aIndex >= 0 && aIndex < length) {
CopyASCIItoUCS2(nsLiteralCString(nsCSSProps::GetStringValue(queryableProperties[aIndex])), aReturn);
CopyASCIItoUCS2(nsCSSProps::GetStringValue(queryableProperties[aIndex]), aReturn);
}
return NS_OK;
}
@ -805,7 +805,7 @@ static void ColorToHex(nscolor aColor, nsAWritableString& aHexString)
NS_GET_G(aColor),
NS_GET_B(aColor));
CopyASCIItoUCS2(nsLiteralCString(buf, len), aHexString);
CopyASCIItoUCS2(nsDependentCString(buf, len), aHexString);
}

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

@ -2047,7 +2047,7 @@ nsXULDocument::SetDefaultStylesheets(nsIURI* aUrl)
NS_IMETHODIMP
nsXULDocument::SetTitle(const PRUnichar *aTitle)
{
return SetTitle(nsLiteralString(aTitle));
return SetTitle(nsDependentString(aTitle));
}
//----------------------------------------------------------------------
@ -3656,7 +3656,7 @@ nsXULDocument::GetBaseURI(nsAWritableString &aURI)
nsXPIDLCString spec;
mDocumentBaseURL->GetSpec(getter_Copies(spec));
if (spec) {
CopyASCIItoUCS2(nsLiteralCString(spec), aURI);
CopyASCIItoUCS2(nsDependentCString(spec), aURI);
}
}
return NS_OK;

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

@ -899,7 +899,7 @@ nsresult nsDocShell::FindTarget(const PRUnichar *aWindowTarget,
rv = parentWindow->Open(NS_LITERAL_STRING(""), // URL to load
name, // Window name
nsLiteralString(nsnull), // Window features
nsDependentString(nsnull), // Window features
getter_AddRefs(newWindow));
if (NS_FAILED(rv)) return rv;

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

@ -472,14 +472,14 @@ nsWebShell::GetReferrer(nsIURI **aReferrer)
void
nsWebShell::SetReferrer(const PRUnichar* aReferrer)
{
NS_NewURI(getter_AddRefs(mReferrerURI), nsLiteralString(aReferrer), nsnull);
NS_NewURI(getter_AddRefs(mReferrerURI), nsDependentString(aReferrer), nsnull);
}
NS_IMETHODIMP
nsWebShell::SetURL(const PRUnichar* aURL)
{
nsCOMPtr<nsIURI> uri;
NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(uri), nsLiteralString(aURL),
NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(uri), nsDependentString(aURL),
nsnull),
NS_ERROR_FAILURE);
SetCurrentURI(uri);
@ -788,7 +788,7 @@ nsWebShell::HandleLinkClickEvent(nsIContent *aContent,
// and down in the load document code we'll detect this and
// set the correct uri loader command
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), nsLiteralString(aURLSpec), nsnull);
NS_NewURI(getter_AddRefs(uri), nsDependentString(aURLSpec), nsnull);
// No URI object? This may indicate the URLspec is for an
// unrecognized protocol. Embedders might still be interested

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

@ -1275,7 +1275,7 @@ nsWindowSH::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
nsresult rv = window->GetLocation(getter_AddRefs(location));
NS_ENSURE_SUCCESS(rv, rv);
nsLiteralString href(NS_REINTERPRET_CAST(PRUnichar *,
nsDependentString href(NS_REINTERPRET_CAST(PRUnichar *,
::JS_GetStringChars(val)),
::JS_GetStringLength(val));
@ -1414,7 +1414,7 @@ nsWindowSH::GlobalResolve(nsISupports *native, JSContext *cx, JSObject *obj,
NS_ENSURE_TRUE(gNameSpaceManager, NS_ERROR_NOT_INITIALIZED);
nsLiteralString name(NS_REINTERPRET_CAST(const PRUnichar*,
nsDependentString name(NS_REINTERPRET_CAST(const PRUnichar*,
::JS_GetStringChars(str)),
::JS_GetStringLength(str));
@ -2141,7 +2141,7 @@ nsNamedArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSString *str = JSVAL_TO_STRING(id);
nsLiteralString name(NS_REINTERPRET_CAST(const PRUnichar *,
nsDependentString name(NS_REINTERPRET_CAST(const PRUnichar *,
::JS_GetStringChars(str)),
::JS_GetStringLength(str));
@ -2311,7 +2311,7 @@ nsDocumentSH::SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSString *val = ::JS_ValueToString(cx, *vp);
NS_ENSURE_TRUE(val, NS_ERROR_UNEXPECTED);
nsLiteralString href(NS_REINTERPRET_CAST(const PRUnichar *,
nsDependentString href(NS_REINTERPRET_CAST(const PRUnichar *,
::JS_GetStringChars(val)),
::JS_GetStringLength(val));
@ -2345,7 +2345,7 @@ nsHTMLDocumentSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
JSString *str = JSVAL_TO_STRING(id);
nsLiteralString name(NS_REINTERPRET_CAST(const PRUnichar *,
nsDependentString name(NS_REINTERPRET_CAST(const PRUnichar *,
::JS_GetStringChars(str)),
::JS_GetStringLength(str));
@ -2372,7 +2372,7 @@ nsHTMLFormElementSH::FindNamedItem(nsIForm *aForm, JSString *str,
{
*aResult = nsnull;
nsLiteralString name(NS_REINTERPRET_CAST(const PRUnichar *,
nsDependentString name(NS_REINTERPRET_CAST(const PRUnichar *,
::JS_GetStringChars(str)),
::JS_GetStringLength(str));

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

@ -162,7 +162,7 @@ NS_IMETHODIMP
nsDOMException::GetMessage(nsAWritableString& aMessage)
{
if (mMessage) {
CopyASCIItoUCS2(nsLiteralCString(mMessage), aMessage);
CopyASCIItoUCS2(nsDependentCString(mMessage), aMessage);
}
else {
aMessage.Truncate();
@ -175,7 +175,7 @@ NS_IMETHODIMP
nsDOMException::GetName(nsAWritableString& aName)
{
if (mName) {
CopyASCIItoUCS2(nsLiteralCString(mName), aName);
CopyASCIItoUCS2(nsDependentCString(mName), aName);
}
else {
aName.Truncate();
@ -201,7 +201,7 @@ nsDOMException::ToString(nsAWritableString& aReturn)
GetCode(&code);
char* temp = PR_smprintf(format, msg, code, mResult, resultName, location);
if (temp) {
CopyASCIItoUCS2(nsLiteralCString(temp), aReturn);
CopyASCIItoUCS2(nsDependentCString(temp), aReturn);
PR_smprintf_free(temp);
}

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

@ -2424,7 +2424,7 @@ GlobalWindowImpl::Escape(const nsAReadableString& aStr,
// Escape the string
char *outBuf =
nsEscape(dest, nsEscapeMask(url_XAlphas | url_XPAlphas | url_Path));
CopyASCIItoUCS2(nsLiteralCString(outBuf), aReturn);
CopyASCIItoUCS2(nsDependentCString(outBuf), aReturn);
nsMemory::Free(outBuf);
nsMemory::Free(dest);

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

@ -321,7 +321,7 @@ HistoryImpl::Go()
JSString* jsstr = JS_ValueToString(cx, argv[0]);
return GoUri(nsLiteralString(NS_REINTERPRET_CAST(const PRUnichar *,
return GoUri(nsDependentString(NS_REINTERPRET_CAST(const PRUnichar *,
::JS_GetStringChars(jsstr)),
::JS_GetStringLength(jsstr)));
}

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

@ -231,7 +231,7 @@ LocationImpl::GetHost(nsAWritableString& aHost)
if (NS_SUCCEEDED(result)) {
PRInt32 port;
CopyASCIItoUCS2(nsLiteralCString(host), aHost);
CopyASCIItoUCS2(nsDependentCString(host), aHost);
uri->GetPort(&port);
@ -292,7 +292,7 @@ LocationImpl::GetHostname(nsAWritableString& aHostname)
result = uri->GetHost(getter_Copies(host));
if (NS_SUCCEEDED(result)) {
CopyASCIItoUCS2(nsLiteralCString(host), aHostname);
CopyASCIItoUCS2(nsDependentCString(host), aHostname);
}
}
}
@ -340,7 +340,7 @@ LocationImpl::GetHref(nsAWritableString& aHref)
result = uri->GetSpec(getter_Copies(uriString));
if (NS_SUCCEEDED(result))
CopyASCIItoUCS2(nsLiteralCString(uriString), aHref);
CopyASCIItoUCS2(nsDependentCString(uriString), aHref);
}
}
@ -480,7 +480,7 @@ LocationImpl::GetPathname(nsAWritableString& aPathname)
result = url->GetFilePath(getter_Copies(file));
if (NS_SUCCEEDED(result)) {
CopyASCIItoUCS2(nsLiteralCString(file), aPathname);
CopyASCIItoUCS2(nsDependentCString(file), aPathname);
}
}
}

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

@ -95,10 +95,9 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
continue;
}
nsAutoString name;
CopyASCIItoUCS2(nsLiteralCString(categoryEntry), name);
nsStringKey key(name);
const nsAString& temp = NS_ConvertASCIItoUCS2(categoryEntry);
// XXX Mac chokes _later_ if we put the |NS_Conv...| right in the |nsStringKey| ctor, so make a temp
nsStringKey key(temp);
if (!mGlobalNames.Get(&key)) {
nsGlobalNameStruct *s = new nsGlobalNameStruct;
@ -193,12 +192,7 @@ nsScriptNameSpaceManager::FillHashWithDOMInterfaces()
s->mType = nsGlobalNameStruct::eTypeInterface;
nsAutoString name;
CopyASCIItoUCS2(nsLiteralCString(if_name.get() +
strlen(NS_DOM_INTERFACE_PREFIX)),
name);
nsStringKey key(name);
nsStringKey key(NS_ConvertASCIItoUCS2(if_name.get() + strlen(NS_DOM_INTERFACE_PREFIX)));
mGlobalNames.Put(&key, s);
}

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

@ -95,10 +95,9 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
continue;
}
nsAutoString name;
CopyASCIItoUCS2(nsLiteralCString(categoryEntry), name);
nsStringKey key(name);
const nsAString& temp = NS_ConvertASCIItoUCS2(categoryEntry);
// XXX Mac chokes _later_ if we put the |NS_Conv...| right in the |nsStringKey| ctor, so make a temp
nsStringKey key(temp);
if (!mGlobalNames.Get(&key)) {
nsGlobalNameStruct *s = new nsGlobalNameStruct;
@ -193,12 +192,7 @@ nsScriptNameSpaceManager::FillHashWithDOMInterfaces()
s->mType = nsGlobalNameStruct::eTypeInterface;
nsAutoString name;
CopyASCIItoUCS2(nsLiteralCString(if_name.get() +
strlen(NS_DOM_INTERFACE_PREFIX)),
name);
nsStringKey key(name);
nsStringKey key(NS_ConvertASCIItoUCS2(if_name.get() + strlen(NS_DOM_INTERFACE_PREFIX)));
mGlobalNames.Put(&key, s);
}

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

@ -451,7 +451,7 @@ nsListItemCommand::ToggleState(nsIEditorShell *aEditorShell, const char* aTagNam
{
if (!bMixed)
{
rv = htmlEditor->RemoveList(nsLiteralString(tagStr));
rv = htmlEditor->RemoveList(nsDependentString(tagStr));
}
nsCRT::free(tagStr);
}

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

@ -1119,7 +1119,7 @@ nsEditorShell::SetAttribute(nsIDOMElement *element, const PRUnichar *attr, const
nsresult result = NS_NOINTERFACE;
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
if (editor) {
result = editor->SetAttribute(element, nsLiteralString(attr), nsLiteralString(value));
result = editor->SetAttribute(element, nsDependentString(attr), nsDependentString(value));
}
return result;
@ -1134,7 +1134,7 @@ nsEditorShell::RemoveAttribute(nsIDOMElement *element, const PRUnichar *attr)
nsresult result = NS_NOINTERFACE;
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
if (editor) {
result = editor->RemoveAttribute(element, nsLiteralString(attr));
result = editor->RemoveAttribute(element, nsDependentString(attr));
}
return result;
@ -1155,7 +1155,7 @@ nsEditorShell::SetTextProperty(const PRUnichar *prop, const PRUnichar *attr, con
case ePlainTextEditorType:
// should we allow this?
case eHTMLTextEditorType:
err = mEditor->SetInlineProperty(styleAtom, nsLiteralString(attr), nsLiteralString(value));
err = mEditor->SetInlineProperty(styleAtom, nsDependentString(attr), nsDependentString(value));
break;
default:
err = NS_ERROR_NOT_IMPLEMENTED;
@ -1229,7 +1229,7 @@ nsEditorShell::GetTextProperty(const PRUnichar *prop, const PRUnichar *attr, con
case ePlainTextEditorType:
// should we allow this?
case eHTMLTextEditorType:
err = mEditor->GetInlineProperty(styleAtom, nsLiteralString(attr), nsLiteralString(value), firstHas, anyHas, allHas);
err = mEditor->GetInlineProperty(styleAtom, nsDependentString(attr), nsDependentString(value), firstHas, anyHas, allHas);
break;
default:
err = NS_ERROR_NOT_IMPLEMENTED;
@ -1831,7 +1831,7 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
PRUnichar *titleUnicode = ToNewUnicode(nsLiteralString(title.get()));
PRUnichar *titleUnicode = ToNewUnicode(title);
nsAutoString captionStr, msgStr1, msgStr2;
GetBundleString(NS_LITERAL_STRING("DocumentTitle"), captionStr);
@ -1856,8 +1856,11 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a
return NS_OK;
}
// This sets title in HTML node
mEditor->SetDocumentTitle(nsLiteralString(titleUnicode));
title = titleUnicode;
{
nsDependentString temp(titleUnicode);
mEditor->SetDocumentTitle(temp);
title = temp;
}
nsCRT::free(titleUnicode);
titleChanged = PR_TRUE;
}
@ -2323,7 +2326,7 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
if (mEditorType != eHTMLTextEditorType)
return NS_ERROR_NOT_IMPLEMENTED;
res = mEditor->SetDocumentTitle(nsLiteralString(title));
res = mEditor->SetDocumentTitle(nsDependentString(title));
if (NS_FAILED(res)) return res;
// PR_FALSE means don't save menu to prefs
@ -2693,7 +2696,7 @@ nsEditorShell::InsertText(const PRUnichar *textToInsert)
{
nsCOMPtr<nsIPlaintextEditor> textEditor (do_QueryInterface(mEditor));
if (textEditor)
err = textEditor->InsertText(nsLiteralString(textToInsert));
err = textEditor->InsertText(nsDependentString(textToInsert));
}
break;

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

@ -215,7 +215,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
while (posInString < length)
{
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(tString, posInString, length-posInString));
nsAutoString debug (Substring(tString, posInString, length-posInString));
printf("Outer loop: '%s'\n", debug.ToNewCString());
#endif
@ -294,11 +294,11 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
if (citeLevel == 0)
{
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(tString, posInString,
nsAutoString debug (Substring(tString, posInString,
nextNewline-posInString));
printf("Unquoted: appending '%s'\n", debug.ToNewCString());
#endif
aOutString.Append(nsPromiseSubstring(tString, posInString,
aOutString.Append(Substring(tString, posInString,
nextNewline-posInString));
outStringCol += nextNewline - posInString;
if (nextNewline != (PRInt32)length)
@ -318,7 +318,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
while ((PRInt32)posInString < nextNewline)
{
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(tString, posInString, nextNewline-posInString));
nsAutoString debug (Substring(tString, posInString, nextNewline-posInString));
printf("Inner loop: '%s'\n", debug.ToNewCString());
#endif
@ -330,10 +330,10 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
if (nextNewline+1 == (PRInt32)length && tString[nextNewline-1] == nl)
++nextNewline;
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(tString, posInString, nextNewline - posInString));
nsAutoString debug (Substring(tString, posInString, nextNewline - posInString));
printf("Short line: '%s'\n", debug.ToNewCString());
#endif
aOutString += nsPromiseSubstring(tString,
aOutString += Substring(tString,
posInString, nextNewline - posInString);
outStringCol += nextNewline - posInString;
posInString = nextNewline + 1;
@ -374,7 +374,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
printf("breakPt = %d\n", breakPt);
#endif
aOutString += nsPromiseSubstring(tString, posInString, breakPt);
aOutString += Substring(tString, posInString, breakPt);
posInString += breakPt;
outStringCol += breakPt;

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

@ -451,7 +451,7 @@ nsListItemCommand::ToggleState(nsIEditorShell *aEditorShell, const char* aTagNam
{
if (!bMixed)
{
rv = htmlEditor->RemoveList(nsLiteralString(tagStr));
rv = htmlEditor->RemoveList(nsDependentString(tagStr));
}
nsCRT::free(tagStr);
}

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

@ -1119,7 +1119,7 @@ nsEditorShell::SetAttribute(nsIDOMElement *element, const PRUnichar *attr, const
nsresult result = NS_NOINTERFACE;
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
if (editor) {
result = editor->SetAttribute(element, nsLiteralString(attr), nsLiteralString(value));
result = editor->SetAttribute(element, nsDependentString(attr), nsDependentString(value));
}
return result;
@ -1134,7 +1134,7 @@ nsEditorShell::RemoveAttribute(nsIDOMElement *element, const PRUnichar *attr)
nsresult result = NS_NOINTERFACE;
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
if (editor) {
result = editor->RemoveAttribute(element, nsLiteralString(attr));
result = editor->RemoveAttribute(element, nsDependentString(attr));
}
return result;
@ -1155,7 +1155,7 @@ nsEditorShell::SetTextProperty(const PRUnichar *prop, const PRUnichar *attr, con
case ePlainTextEditorType:
// should we allow this?
case eHTMLTextEditorType:
err = mEditor->SetInlineProperty(styleAtom, nsLiteralString(attr), nsLiteralString(value));
err = mEditor->SetInlineProperty(styleAtom, nsDependentString(attr), nsDependentString(value));
break;
default:
err = NS_ERROR_NOT_IMPLEMENTED;
@ -1229,7 +1229,7 @@ nsEditorShell::GetTextProperty(const PRUnichar *prop, const PRUnichar *attr, con
case ePlainTextEditorType:
// should we allow this?
case eHTMLTextEditorType:
err = mEditor->GetInlineProperty(styleAtom, nsLiteralString(attr), nsLiteralString(value), firstHas, anyHas, allHas);
err = mEditor->GetInlineProperty(styleAtom, nsDependentString(attr), nsDependentString(value), firstHas, anyHas, allHas);
break;
default:
err = NS_ERROR_NOT_IMPLEMENTED;
@ -1831,7 +1831,7 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
if (dialog)
{
PRUnichar *titleUnicode = ToNewUnicode(nsLiteralString(title.get()));
PRUnichar *titleUnicode = ToNewUnicode(title);
nsAutoString captionStr, msgStr1, msgStr2;
GetBundleString(NS_LITERAL_STRING("DocumentTitle"), captionStr);
@ -1856,8 +1856,11 @@ nsEditorShell::SaveDocument(PRBool aSaveAs, PRBool aSaveCopy, const PRUnichar* a
return NS_OK;
}
// This sets title in HTML node
mEditor->SetDocumentTitle(nsLiteralString(titleUnicode));
title = titleUnicode;
{
nsDependentString temp(titleUnicode);
mEditor->SetDocumentTitle(temp);
title = temp;
}
nsCRT::free(titleUnicode);
titleChanged = PR_TRUE;
}
@ -2323,7 +2326,7 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
if (mEditorType != eHTMLTextEditorType)
return NS_ERROR_NOT_IMPLEMENTED;
res = mEditor->SetDocumentTitle(nsLiteralString(title));
res = mEditor->SetDocumentTitle(nsDependentString(title));
if (NS_FAILED(res)) return res;
// PR_FALSE means don't save menu to prefs
@ -2693,7 +2696,7 @@ nsEditorShell::InsertText(const PRUnichar *textToInsert)
{
nsCOMPtr<nsIPlaintextEditor> textEditor (do_QueryInterface(mEditor));
if (textEditor)
err = textEditor->InsertText(nsLiteralString(textToInsert));
err = textEditor->InsertText(nsDependentString(textToInsert));
}
break;

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

@ -215,7 +215,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
while (posInString < length)
{
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(tString, posInString, length-posInString));
nsAutoString debug (Substring(tString, posInString, length-posInString));
printf("Outer loop: '%s'\n", debug.ToNewCString());
#endif
@ -294,11 +294,11 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
if (citeLevel == 0)
{
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(tString, posInString,
nsAutoString debug (Substring(tString, posInString,
nextNewline-posInString));
printf("Unquoted: appending '%s'\n", debug.ToNewCString());
#endif
aOutString.Append(nsPromiseSubstring(tString, posInString,
aOutString.Append(Substring(tString, posInString,
nextNewline-posInString));
outStringCol += nextNewline - posInString;
if (nextNewline != (PRInt32)length)
@ -318,7 +318,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
while ((PRInt32)posInString < nextNewline)
{
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(tString, posInString, nextNewline-posInString));
nsAutoString debug (Substring(tString, posInString, nextNewline-posInString));
printf("Inner loop: '%s'\n", debug.ToNewCString());
#endif
@ -330,10 +330,10 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
if (nextNewline+1 == (PRInt32)length && tString[nextNewline-1] == nl)
++nextNewline;
#ifdef DEBUG_wrapping
nsAutoString debug (nsPromiseSubstring<PRUnichar>(tString, posInString, nextNewline - posInString));
nsAutoString debug (Substring(tString, posInString, nextNewline - posInString));
printf("Short line: '%s'\n", debug.ToNewCString());
#endif
aOutString += nsPromiseSubstring(tString,
aOutString += Substring(tString,
posInString, nextNewline - posInString);
outStringCol += nextNewline - posInString;
posInString = nextNewline + 1;
@ -374,7 +374,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
printf("breakPt = %d\n", breakPt);
#endif
aOutString += nsPromiseSubstring(tString, posInString, breakPt);
aOutString += Substring(tString, posInString, breakPt);
posInString += breakPt;
outStringCol += breakPt;

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

@ -572,7 +572,7 @@ NS_METHOD CBrowserWindow::SetStatus(const PRUnichar* aStatus)
{
nsCAutoString cStr;
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(aStatus), cStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(aStatus), cStr);
mStatusBar->SetText(const_cast<char *>(cStr.get()), cStr.Length());
}
return NS_OK;

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

@ -196,7 +196,7 @@ void CProfileManager::DoManageProfilesDialog()
for (PRUint32 index = 0; index < listLen; index++)
{
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(profileList[index]), cStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(profileList[index]), cStr);
table->InsertRows(1, LONG_MAX, cStr.get(), cStr.Length(), true);
if (nsCRT::strcmp(profileList[index], currProfileName.get()) == 0)
@ -237,7 +237,7 @@ void CProfileManager::DoManageProfilesDialog()
dataSize = sizeof(dataBuf) - 1;
table->GetCellData(selectedCell, dataBuf, dataSize);
dataBuf[dataSize] = '\0';
CPlatformUCSConversion::GetInstance()->PlatformToUCS(nsLiteralCString(dataBuf), unicodeStr);
CPlatformUCSConversion::GetInstance()->PlatformToUCS(nsDependentCString(dataBuf), unicodeStr);
rv = profileService->SetCurrentProfile(unicodeStr.GetUnicode());
}
break;
@ -250,7 +250,7 @@ void CProfileManager::DoManageProfilesDialog()
{
if (DoNewProfileDialog(dataBuf, sizeof(dataBuf)))
{
CPlatformUCSConversion::GetInstance()->PlatformToUCS(nsLiteralCString(dataBuf), unicodeStr);
CPlatformUCSConversion::GetInstance()->PlatformToUCS(nsDependentCString(dataBuf), unicodeStr);
rv = profileService->CreateNewProfile(unicodeStr.GetUnicode(), nsnull, nsnull, PR_FALSE);
if (NS_FAILED(rv))
break;
@ -271,7 +271,7 @@ void CProfileManager::DoManageProfilesDialog()
dataSize = sizeof(dataBuf) - 1;
table->GetCellData(selectedCell, dataBuf, dataSize);
dataBuf[dataSize] = '\0';
CPlatformUCSConversion::GetInstance()->PlatformToUCS(nsLiteralCString(dataBuf), unicodeStr);
CPlatformUCSConversion::GetInstance()->PlatformToUCS(nsDependentCString(dataBuf), unicodeStr);
rv = profileService->DeleteProfile(unicodeStr.GetUnicode(), PR_TRUE);
if (NS_FAILED(rv))
@ -295,11 +295,11 @@ void CProfileManager::DoManageProfilesDialog()
dataSize = sizeof(dataBuf) - 1;
table->GetCellData(selectedCell, dataBuf, dataSize);
dataBuf[dataSize] = '\0';
CPlatformUCSConversion::GetInstance()->PlatformToUCS(nsLiteralCString(dataBuf), oldName);
CPlatformUCSConversion::GetInstance()->PlatformToUCS(nsDependentCString(dataBuf), oldName);
if (DoNewProfileDialog(dataBuf, sizeof(dataBuf)))
{
CPlatformUCSConversion::GetInstance()->PlatformToUCS(nsLiteralCString(dataBuf), unicodeStr);
CPlatformUCSConversion::GetInstance()->PlatformToUCS(nsDependentCString(dataBuf), unicodeStr);
profileService->RenameProfile(oldName.GetUnicode(), unicodeStr.GetUnicode());
table->SetCellData(selectedCell, dataBuf, strlen(dataBuf));
}
@ -319,7 +319,7 @@ void CProfileManager::DoLogout()
nsXPIDLString currentProfile;
Str255 pStr;
profileService->GetCurrentProfile(getter_Copies(currentProfile));
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(currentProfile.get()), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(currentProfile.get()), pStr);
::ParamText(pStr, "\p", "\p", "\p");
DialogItemIndex item = UModalAlerts::StopAlert(alrt_ConfirmLogout);

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

@ -460,7 +460,7 @@ NS_IMETHODIMP CWebBrowserChrome::SetTitle(const PRUnichar * aTitle)
Str255 pStr;
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(aTitle), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(aTitle), pStr);
mBrowserWindow->SetDescriptor(pStr);
return NS_OK;
}
@ -518,7 +518,7 @@ NS_IMETHODIMP
CWebBrowserChrome::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords, const PRUnichar *aTipText)
{
nsCAutoString printable;
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(aTipText), printable);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(aTipText), printable);
#ifdef DEBUG
printf("--------- SHOW TOOLTIP AT %ld %ld, |%s|\n", aXCoords, aYCoords, (const char *)printable );

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

@ -103,11 +103,11 @@ NS_IMETHODIMP CPromptService::Alert(nsIDOMWindow *parent, const PRUnichar *dialo
nsCAutoString cStr;
Str255 pStr;
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(dialogTitle), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(dialogTitle), pStr);
theDialog->SetDescriptor(pStr);
LStaticText *msgText = dynamic_cast<LStaticText*>(theDialog->FindPaneByID('Msg '));
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(text), cStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(text), cStr);
cStr.ReplaceChar('\n', '\r');
msgText->SetText(const_cast<char *>(cStr.get()), cStr.Length());
@ -136,16 +136,16 @@ NS_IMETHODIMP CPromptService::AlertCheck(nsIDOMWindow *parent, const PRUnichar *
nsCAutoString cStr;
Str255 pStr;
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(dialogTitle), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(dialogTitle), pStr);
theDialog->SetDescriptor(pStr);
LStaticText *msgText = dynamic_cast<LStaticText*>(theDialog->FindPaneByID('Msg '));
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(text), cStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(text), cStr);
cStr.ReplaceChar('\n', '\r');
msgText->SetText(const_cast<char *>(cStr.get()), cStr.Length());
LCheckBox *checkBox = dynamic_cast<LCheckBox*>(theDialog->FindPaneByID('Chck'));
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(checkMsg), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(checkMsg), pStr);
checkBox->SetDescriptor(pStr);
checkBox->SetValue(*checkValue ? 1 : 0);
@ -177,11 +177,11 @@ NS_IMETHODIMP CPromptService::Confirm(nsIDOMWindow *parent, const PRUnichar *dia
nsCAutoString cStr;
Str255 pStr;
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(dialogTitle), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(dialogTitle), pStr);
theDialog->SetDescriptor(pStr);
LStaticText *msgText = dynamic_cast<LStaticText*>(theDialog->FindPaneByID('Msg '));
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(text), cStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(text), cStr);
cStr.ReplaceChar('\n', '\r');
msgText->SetText(const_cast<char *>(cStr.get()), cStr.Length());
@ -220,16 +220,16 @@ NS_IMETHODIMP CPromptService::ConfirmCheck(nsIDOMWindow *parent, const PRUnichar
nsCAutoString cStr;
Str255 pStr;
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(dialogTitle), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(dialogTitle), pStr);
theDialog->SetDescriptor(pStr);
LStaticText *msgText = dynamic_cast<LStaticText*>(theDialog->FindPaneByID('Msg '));
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(text), cStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(text), cStr);
cStr.ReplaceChar('\n', '\r');
msgText->SetText(const_cast<char *>(cStr.get()), cStr.Length());
LCheckBox *checkBox = dynamic_cast<LCheckBox*>(theDialog->FindPaneByID('Chck'));
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(checkMsg), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(checkMsg), pStr);
checkBox->SetDescriptor(pStr);
checkBox->SetValue(*checkValue ? 1 : 0);
@ -284,25 +284,25 @@ NS_IMETHODIMP CPromptService::Prompt(nsIDOMWindow *parent, const PRUnichar *dial
Str255 pStr;
if (dialogTitle) {
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(dialogTitle), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(dialogTitle), pStr);
theDialog->SetDescriptor(pStr);
}
LStaticText *msgText = dynamic_cast<LStaticText*>(theDialog->FindPaneByID('Msg '));
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(text), cStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(text), cStr);
cStr.ReplaceChar('\n', '\r');
msgText->SetText(const_cast<char *>(cStr.get()), cStr.Length());
LEditText *responseText = dynamic_cast<LEditText*>(theDialog->FindPaneByID('Rslt'));
if (value && *value) {
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(*value), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(*value), pStr);
responseText->SetDescriptor(pStr);
}
if (checkValue) {
checkbox->SetValue(*checkValue);
if (checkMsg) {
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(checkMsg), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(checkMsg), pStr);
checkbox->SetDescriptor(pStr);
}
}
@ -364,30 +364,30 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent, co
Str255 pStr;
if (dialogTitle) {
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(dialogTitle), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(dialogTitle), pStr);
theDialog->SetDescriptor(pStr);
}
LStaticText *msgText = dynamic_cast<LStaticText*>(theDialog->FindPaneByID('Msg '));
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(text), cStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(text), cStr);
cStr.ReplaceChar('\n', '\r');
msgText->SetText(const_cast<char *>(cStr.get()), cStr.Length());
LEditText *userText = dynamic_cast<LEditText*>(theDialog->FindPaneByID('Name'));
if (username && *username) {
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(*username), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(*username), pStr);
userText->SetDescriptor(pStr);
}
LEditText *pwdText = dynamic_cast<LEditText*>(theDialog->FindPaneByID('Pass'));
if (password && *password) {
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(*password), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(*password), pStr);
pwdText->SetDescriptor(pStr);
}
if (checkValue) {
checkbox->SetValue(*checkValue);
if (checkMsg) {
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(checkMsg), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(checkMsg), pStr);
checkbox->SetDescriptor(pStr);
}
}
@ -459,25 +459,25 @@ NS_IMETHODIMP CPromptService::PromptPassword(nsIDOMWindow *parent, const PRUnich
Str255 pStr;
if (dialogTitle) {
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(dialogTitle), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(dialogTitle), pStr);
theDialog->SetDescriptor(pStr);
}
LStaticText *msgText = dynamic_cast<LStaticText*>(theDialog->FindPaneByID('Msg '));
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(text), cStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(text), cStr);
cStr.ReplaceChar('\n', '\r');
msgText->SetText(const_cast<char *>(cStr.get()), cStr.Length());
LEditText *pwdText = dynamic_cast<LEditText*>(theDialog->FindPaneByID('Pass'));
if (password && *password) {
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(*password), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(*password), pStr);
pwdText->SetDescriptor(pStr);
}
if (checkValue) {
checkbox->SetValue(*checkValue);
if (checkMsg) {
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsLiteralString(checkMsg), pStr);
CPlatformUCSConversion::GetInstance()->UCSToPlatform(nsDependentString(checkMsg), pStr);
checkbox->SetDescriptor(pStr);
}
}

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

@ -232,5 +232,5 @@ CPlatformUCSConversion::PlatformToUCS(const Str255& aIn, nsAWritableString& aOut
memcpy(charBuf, &aIn[1], aIn[0]);
charBuf[aIn[0]] = '\0';
return PlatformToUCS(nsLiteralCString(charBuf), aOut);
return PlatformToUCS(nsDependentCString(charBuf, aIn[0]), aOut);
}

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

@ -65,7 +65,7 @@ NS_IMETHODIMP nsNonPersistAuthPrompt::Prompt(const PRUnichar *dialogTitle,
NS_ENSURE_TRUE(mPromptDialogs, NS_ERROR_NOT_INITIALIZED);
NS_ENSURE_ARG_POINTER(result);
*result = ToNewUnicode(nsLiteralString(defaultText));
*result = ToNewUnicode(nsDependentString(defaultText));
if (*result == nsnull) return NS_ERROR_OUT_OF_MEMORY;
return mPromptDialogs->Prompt(dialogTitle, text, result, nsnull, nsnull, _retval);
}

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

@ -216,7 +216,7 @@ nsPrompt::Prompt(const PRUnichar* dialogTitle,
{
// Ignore passwordRealm and savePassword
if (defaultText)
*result = ToNewUnicode(nsLiteralString(defaultText));
*result = ToNewUnicode(nsDependentString(defaultText));
return mPromptService->Prompt(mParent, dialogTitle, text,
result, nsnull, nsnull, _retval);
}

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

@ -2279,10 +2279,8 @@ si_DoDialogIfPrefIsOff(
DialogType dlg) {
nsresult res;
nsAutoString realm;
CopyASCIItoUCS2(nsLiteralCString(passwordRealm), realm);
const PRUnichar * prompt_string = dialogTitle;
if (dialogTitle == nsnull || nsCRT::strlen(dialogTitle) == 0) {
if (dialogTitle == nsnull || !dialogTitle[0]) {
prompt_string = Wallet_Localize("PromptForData");
}

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

@ -524,7 +524,9 @@ void nsExpatTokenizer::FrontloadMisplacedContent(nsDeque& aDeque){
void Tokenizer_HandleStartElement(void *userData, const XML_Char *name, const XML_Char **atts) {
XMLParserState* state = (XMLParserState*) userData;
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_unknown, nsLiteralString((PRUnichar*)name));
typedef const PRUnichar* const_PRUnichar_ptr;
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_unknown, nsDependentString(const_PRUnichar_ptr(name)));
if(theToken) {
// If an ID attribute exists for this element, set it on the start token
PRInt32 index = XML_GetIdAttributeIndex(state->parser);
@ -541,7 +543,7 @@ void Tokenizer_HandleStartElement(void *userData, const XML_Char *name, const XM
while(*atts){
theAttrCount++;
CAttributeToken* theAttrToken = (CAttributeToken*)
state->tokenAllocator->CreateTokenOfType(eToken_attribute, eHTMLTag_unknown, nsLiteralString((PRUnichar*)atts[1]));
state->tokenAllocator->CreateTokenOfType(eToken_attribute, eHTMLTag_unknown, nsDependentString(const_PRUnichar_ptr(atts[1])));
if(theAttrToken){
PRUnichar* ptr = (PRUnichar*)atts[0];
if ((ptr >= state->bufferStart) && (ptr < state->bufferEnd)) {
@ -554,7 +556,7 @@ void Tokenizer_HandleStartElement(void *userData, const XML_Char *name, const XM
theAttrToken->BindKey(state->scanner, start, end);
}
else {
theAttrToken->SetKey(nsLiteralString(ptr));
theAttrToken->SetKey(nsDependentString(ptr));
}
}
CToken* theTok=(CToken*)theAttrToken;
@ -570,7 +572,8 @@ void Tokenizer_HandleStartElement(void *userData, const XML_Char *name, const XM
void Tokenizer_HandleEndElement(void *userData, const XML_Char *name) {
XMLParserState* state = (XMLParserState*) userData;
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_end,eHTMLTag_unknown, nsLiteralString((PRUnichar *) name));
typedef const PRUnichar* const_PRUnichar_ptr;
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_end,eHTMLTag_unknown, nsDependentString(const_PRUnichar_ptr(name)));
if(theToken) {
nsExpatTokenizer::AddToken(theToken, NS_OK, state->tokenDeque, state->tokenAllocator);
}
@ -596,7 +599,7 @@ void Tokenizer_HandleCharacterData(void *userData, const XML_Char *s, int len) {
break;
case kSpace:
case kTab:
newToken = state->tokenAllocator->CreateTokenOfType(eToken_whitespace,eHTMLTag_unknown, nsLocalString((PRUnichar*)s, len));
newToken = state->tokenAllocator->CreateTokenOfType(eToken_whitespace,eHTMLTag_unknown, nsDependentString((PRUnichar*)s, len));
break;
default:
{
@ -611,7 +614,7 @@ void Tokenizer_HandleCharacterData(void *userData, const XML_Char *s, int len) {
textToken->Bind(state->scanner, start, end);
}
else {
textToken->Bind(nsLocalString(ptr, len));
textToken->Bind(nsDependentString(ptr, len));
}
newToken = textToken;
}
@ -634,7 +637,8 @@ void Tokenizer_HandleComment(void *userData, const XML_Char *name) {
state->doctypeText.Append((PRUnichar*)name);
state->doctypeText.Append(NS_LITERAL_STRING("-->"));
} else {
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_comment, eHTMLTag_unknown, nsLiteralString((PRUnichar*)name));
typedef const PRUnichar* const_PRUnichar_ptr;
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_comment, eHTMLTag_unknown, nsDependentString(const_PRUnichar_ptr(name)));
if(theToken) {
nsExpatTokenizer::AddToken(theToken, NS_OK, state->tokenDeque, state->tokenAllocator);
}

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

@ -536,7 +536,7 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag)
static const PRUnichar theTerminalsChars[] =
{ PRUnichar('\n'), PRUnichar('\r'), PRUnichar('&'), PRUnichar('<'),
PRUnichar(0) };
const nsLocalString theTerminals(theTerminalsChars,
const nsDependentString theTerminals(theTerminalsChars,
sizeof(theTerminalsChars)/sizeof(theTerminalsChars[0]) - 1);
nsresult result=NS_OK;
PRBool done=PR_FALSE;
@ -912,7 +912,7 @@ nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32
{ PRUnichar('\n'), PRUnichar('\r'), PRUnichar('\''), PRUnichar('"'),
PRUnichar('>'),
PRUnichar(0) };
const nsLocalString theTerminals(theTerminalsChars,
const nsDependentString theTerminals(theTerminalsChars,
sizeof(theTerminalsChars)/sizeof(theTerminalsChars[0]) - 1);
nsresult result=NS_OK;
PRBool done=PR_FALSE;
@ -1551,7 +1551,7 @@ nsresult ConsumeAttributeValueText(nsString& aString,
const PRUnichar *aTerminalChars,
PRInt32 aFlag)
{
const nsLocalString theTerminals(aTerminalChars,
const nsDependentString theTerminals(aTerminalChars,
sizeof(aTerminalChars)/sizeof(aTerminalChars[0]) - 1);
nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE);
@ -1653,7 +1653,7 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 a
{ PRUnichar('\b'), PRUnichar('\t'), PRUnichar('\n'), PRUnichar('\r'),
PRUnichar(' '), PRUnichar('"'), PRUnichar('='), PRUnichar('>'),
PRUnichar(0) };
const nsLocalString theTerminals(theTerminalsChars,
const nsDependentString theTerminals(theTerminalsChars,
sizeof(theTerminalsChars)/sizeof(theTerminalsChars[0]) - 1);
result=aScanner.ReadUntil(start,end,theTerminals,PR_FALSE);
}

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

@ -330,7 +330,7 @@ nsresult nsScanner::Append(const char* aBuffer, PRUint32 aLen){
} while (NS_FAILED(res) && (aLen > 0));
}
else {
nsLiteralCString str(aBuffer, aLen);
nsDependentCString str(aBuffer, aLen);
unichars = ToNewUnicode(str);
AppendToBuffer(unichars, unichars+aLen, unichars+aLen);
mTotalRead+=aLen;
@ -378,7 +378,7 @@ nsresult nsScanner::FillBuffer(void) {
}
if((0<numread) && (0==result)) {
nsLiteralCString str(buf, numread);
nsDependentCString str(buf, numread);
PRUnichar* unichars = ToNewUnicode(str);
AppendToBuffer(unichars, unichars+numread, unichars+kBufsize+1);
}

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

@ -227,7 +227,7 @@ class nsScanner {
PRBool addTerminal)
{
return ReadUntil(aString,
nsLocalCString(aTerminalSet),
nsDependentCString(aTerminalSet),
addTerminal);
}

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

@ -320,7 +320,13 @@ NS_IMETHODIMP nsMetaCharsetObserver::Observe(nsISupports *aSubject,
const PRUnichar *aData)
{
nsresult rv = NS_OK;
nsLiteralString aTopicString(aTopic);
nsDependentString aTopicString(aTopic);
/*
Warning! |NS_LITERAL_STRING(APPSTARTUP_CATEGORY)| relies on the order of
evaluation of the two |#defines|. This is known _not_ to work on platforms
that support wide characters directly. Better to define |APPSTARTUP_CATEGORY|
in terms of |NS_LITERAL_STRING| directly.
*/
if (aTopicString.Equals(NS_LITERAL_STRING(APPSTARTUP_CATEGORY))) //"app_startup"
rv = Start();
return rv;

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

@ -112,7 +112,7 @@ nsresult nsFontPackageHandler::CreateURLString(const char *aPackID, char **aURL)
return NS_ERROR_OUT_OF_MEMORY;
}
*aURL = ToNewUTF8String(nsLocalString(urlString));
*aURL = ToNewUTF8String(nsDependentString(urlString));
nsTextFormatter::smprintf_free(urlString);
return NS_OK;

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

@ -499,9 +499,7 @@ nsLocaleService::GetLocaleFromAcceptLanguage(const char *acceptLanguage, nsILoca
//
result = NS_ERROR_FAILURE;
if (countLang>0) {
PRUnichar* localeName = ToNewUnicode(nsLiteralCString(acceptLanguageList[0]));
result = NewLocale(localeName,_retval);
delete localeName;
result = NewLocale(NS_ConvertASCIItoUCS2(acceptLanguageList[0]).get(),_retval);
}
//

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

@ -334,7 +334,7 @@ nsStringBundle::FormatStringFromName(const PRUnichar *aName,
if (NS_FAILED(rv)) return rv;
nsAutoString formatStr;
rv = GetStringFromName(nsLiteralString(aName), formatStr);
rv = GetStringFromName(nsDependentString(aName), formatStr);
if (NS_FAILED(rv)) return rv;
return FormatString(formatStr.GetUnicode(), aParams, aLength, aResult);

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

@ -326,9 +326,9 @@ NS_IMETHODIMP nsCharsetMenuObserver::Observe(nsISupports *aSubject, const PRUnic
{
nsresult rv;
nsLiteralString aTopicString(aTopic);
nsDependentString aTopicString(aTopic);
if (aTopicString.Equals(NS_LITERAL_STRING("nsPref:changed"))) {
nsLiteralString prefName(someData);
nsDependentString prefName(someData);
if (prefName.Equals(NS_LITERAL_STRING(kBrowserStaticPrefKey))) {
// refresh menus which share this pref

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

@ -1769,7 +1769,7 @@ nsXPCComponents::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName
static const NS_NAMED_LITERAL_STRING(s_interfaces, "interfaces");
static const NS_NAMED_LITERAL_STRING(s_results, "results");
const nsLiteralString name(propertyName);
const nsDependentString name(propertyName);
if(name.Equals(s_interfaces) || name.Equals(s_results))
*_retval = CloneAllAccess();

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

@ -517,7 +517,7 @@ nsXPCException::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, ch
{
static const NS_NAMED_LITERAL_STRING(s_toString, "toString");
const nsLiteralString name(methodName);
const nsDependentString name(methodName);
if(name.Equals(s_toString))
*_retval = CloneAllAccess();
@ -535,7 +535,7 @@ nsXPCException::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName,
static const NS_NAMED_LITERAL_STRING(s_code , "code");
static const NS_NAMED_LITERAL_STRING(s_name , "name");
const nsLiteralString name(propertyName);
const nsDependentString name(propertyName);
if(name.Equals(s_message) ||
name.Equals(s_result) ||

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

@ -2112,11 +2112,11 @@ private:
/***************************************************************************/
// class to export a JSString as an nsAReadableString, including refcounting
class XPCReadableJSStringWrapper : public nsLocalString
class XPCReadableJSStringWrapper : public nsDependentString
{
public:
XPCReadableJSStringWrapper(JSString *str) :
nsLocalString(NS_REINTERPRET_CAST(PRUnichar *,
nsDependentString(NS_REINTERPRET_CAST(PRUnichar *,
JS_GetStringChars(str)),
JS_GetStringLength(str)),
mStr(str), mBufferHandle(0), mHandleIsShared(JS_FALSE)

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

@ -912,7 +912,7 @@ CSSLoaderImpl::DidLoadStyle(nsIStreamLoader* aLoader,
nsXPIDLCString url;
aLoadData->mURL->GetSpec(getter_Copies(url));
nsCAutoString errorMessage(NS_LITERAL_CSTRING("CSSLoaderImpl::DidLoadStyle: Load of URL '") +
nsLiteralCString(url) +
nsDependentCString(url) +
NS_LITERAL_CSTRING("' failed. Error code: "));
errorMessage.AppendInt(NS_ERROR_GET_CODE(aStatus));
NS_WARNING(errorMessage.get());
@ -1194,7 +1194,7 @@ CSSLoaderImpl::LoadSheet(URLKey& aKey, SheetLoadData* aData)
nsXPIDLCString url;
aKey.mURL->GetSpec(getter_Copies(url));
nsCAutoString errorMessage(NS_LITERAL_CSTRING("CSSLoaderImpl::LoadSheet: Load of URL '") +
nsLiteralCString(url) +
nsDependentCString(url) +
NS_LITERAL_CSTRING("' failed. Error code: "));
errorMessage.AppendInt(NS_ERROR_GET_CODE(result));
NS_WARNING(errorMessage.get());
@ -1533,7 +1533,7 @@ CSSLoaderImpl::LoadAgentSheet(nsIURI* aURL,
nsXPIDLCString url;
aURL->GetSpec(getter_Copies(url));
nsCAutoString errorMessage(NS_LITERAL_CSTRING("CSSLoaderImpl::LoadAgentSheet: Load of URL '") +
nsLiteralCString(url) +
nsDependentCString(url) +
NS_LITERAL_CSTRING("' failed. Error code: "));
errorMessage.AppendInt(NS_ERROR_GET_CODE(result));
NS_WARNING(errorMessage.get());

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

@ -568,7 +568,7 @@ nsComputedDOMStyle::Item(PRUint32 aIndex, nsAWritableString& aReturn)
GetLength(&length);
aReturn.Truncate();
if (aIndex >= 0 && aIndex < length) {
CopyASCIItoUCS2(nsLiteralCString(nsCSSProps::GetStringValue(queryableProperties[aIndex])), aReturn);
CopyASCIItoUCS2(nsCSSProps::GetStringValue(queryableProperties[aIndex]), aReturn);
}
return NS_OK;
}
@ -805,7 +805,7 @@ static void ColorToHex(nscolor aColor, nsAWritableString& aHexString)
NS_GET_G(aColor),
NS_GET_B(aColor));
CopyASCIItoUCS2(nsLiteralCString(buf, len), aHexString);
CopyASCIItoUCS2(nsDependentCString(buf, len), aHexString);
}

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

@ -148,7 +148,7 @@ nsTextBoxFrame::Init(nsIPresContext* aPresContext,
nsXPIDLString prefValue;
nsresult res = prefs->GetLocalizedUnicharPref("intl.menuitems.alwaysappendacceskeys", getter_Copies(prefValue));
if (NS_SUCCEEDED(res)) {
gAlwaysAppendAccessKey = nsLocalString(prefValue).Equals(NS_LITERAL_STRING("true"));
gAlwaysAppendAccessKey = nsDependentString(prefValue).Equals(NS_LITERAL_STRING("true"));
}
}
}

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

@ -232,7 +232,7 @@ nsMsgPrintEngine::SetWindow(nsIDOMWindowInternal *aWin)
NS_IMETHODIMP
nsMsgPrintEngine::AddPrintURI(const PRUnichar *aMsgURI)
{
mURIArray.AppendString(nsLiteralString(aMsgURI));
mURIArray.AppendString(nsDependentString(aMsgURI));
return NS_OK;
}

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

@ -85,10 +85,10 @@ NS_IMETHODIMP nsFolderCharsetObserver::Observe(nsISupports *aSubject, const PRUn
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsLiteralString aTopicString(aTopic);
nsDependentString aTopicString(aTopic);
if (aTopicString.Equals(NS_LITERAL_STRING("nsPref:changed")))
{
nsLiteralString prefName(someData);
nsDependentString prefName(someData);
if (prefName.Equals(NS_LITERAL_STRING(kMAILNEWS_VIEW_DEFAULT_CHARSET)))
{

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

@ -1392,9 +1392,7 @@ nsMsgNewsFolder::GetGroupPasswordWithUI(const PRUnichar * aPromptMessage, const
rv = CreateNewsgroupPasswordUrlForSignon(mURI, getter_Copies(signonURL));
if (NS_FAILED(rv)) return rv;
nsAutoString realm;
CopyASCIItoUCS2(nsLiteralCString(NS_STATIC_CAST(const char*, signonURL)), realm);
rv = dialog->PromptPassword(aPromptTitle, aPromptMessage, realm.GetUnicode(), nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY,
rv = dialog->PromptPassword(aPromptTitle, aPromptMessage, NS_ConvertASCIItoUCS2(NS_STATIC_CAST(const char*, signonURL)).get(), nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY,
getter_Copies(uniGroupPassword), &okayValue);
if (NS_FAILED(rv)) return rv;
@ -1461,9 +1459,7 @@ nsMsgNewsFolder::GetGroupUsernameWithUI(const PRUnichar * aPromptMessage, const
rv = CreateNewsgroupUsernameUrlForSignon(mURI, getter_Copies(signonURL));
if (NS_FAILED(rv)) return rv;
nsAutoString realm;
CopyASCIItoUCS2(nsLiteralCString(NS_STATIC_CAST(const char*, signonURL)), realm);
rv = dialog->Prompt(aPromptTitle, aPromptMessage, realm.GetUnicode(),
rv = dialog->Prompt(aPromptTitle, aPromptMessage, NS_ConvertASCIItoUCS2(NS_STATIC_CAST(const char*, signonURL)).get(),
nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY, nsnull,
getter_Copies(uniGroupUsername), &okayValue);
if (NS_FAILED(rv)) return rv;

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

@ -43,7 +43,7 @@ public:
/* const char * constructor */
LogScope(PRLogModuleInfo *aLog, void *from, const nsAReadableCString &fn,
const nsLiteralCString &paramName, const char *paramValue) :
const nsDependentCString &paramName, const char *paramValue) :
mLog(aLog), mFrom(from), mFunc(fn)
{
PR_LOG(mLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%s\") {ENTER}\n",
@ -55,7 +55,7 @@ public:
/* void ptr constructor */
LogScope(PRLogModuleInfo *aLog, void *from, const nsAReadableCString &fn,
const nsLiteralCString &paramName, const void *paramValue) :
const nsDependentCString &paramName, const void *paramValue) :
mLog(aLog), mFrom(from), mFunc(fn)
{
PR_LOG(mLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=%p) {ENTER}\n",
@ -67,7 +67,7 @@ public:
/* PRInt32 constructor */
LogScope(PRLogModuleInfo *aLog, void *from, const nsAReadableCString &fn,
const nsLiteralCString &paramName, PRInt32 paramValue) :
const nsDependentCString &paramName, PRInt32 paramValue) :
mLog(aLog), mFrom(from), mFunc(fn)
{
PR_LOG(mLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%d\") {ENTER}\n",
@ -79,7 +79,7 @@ public:
/* PRUint32 constructor */
LogScope(PRLogModuleInfo *aLog, void *from, const nsAReadableCString &fn,
const nsLiteralCString &paramName, PRUint32 paramValue) :
const nsDependentCString &paramName, PRUint32 paramValue) :
mLog(aLog), mFrom(from), mFunc(fn)
{
PR_LOG(mLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%d\") {ENTER}\n",
@ -105,15 +105,15 @@ private:
class LogFunc {
public:
LogFunc(PRLogModuleInfo *aLog, void *from, const nsLiteralCString &fn)
LogFunc(PRLogModuleInfo *aLog, void *from, const nsDependentCString &fn)
{
PR_LOG(aLog, PR_LOG_DEBUG, ("%d [this=%p] %s\n",
GIVE_ME_MS_NOW(), from,
fn.get()));
}
LogFunc(PRLogModuleInfo *aLog, void *from, const nsLiteralCString &fn,
const nsLiteralCString &paramName, const char *paramValue)
LogFunc(PRLogModuleInfo *aLog, void *from, const nsDependentCString &fn,
const nsDependentCString &paramName, const char *paramValue)
{
PR_LOG(aLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%s\")\n",
GIVE_ME_MS_NOW(), from,
@ -121,8 +121,8 @@ public:
paramName.get(), paramValue));
}
LogFunc(PRLogModuleInfo *aLog, void *from, const nsLiteralCString &fn,
const nsLiteralCString &paramName, const void *paramValue)
LogFunc(PRLogModuleInfo *aLog, void *from, const nsDependentCString &fn,
const nsDependentCString &paramName, const void *paramValue)
{
PR_LOG(aLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%p\")\n",
GIVE_ME_MS_NOW(), from,
@ -131,8 +131,8 @@ public:
}
LogFunc(PRLogModuleInfo *aLog, void *from, const nsLiteralCString &fn,
const nsLiteralCString &paramName, PRUint32 paramValue)
LogFunc(PRLogModuleInfo *aLog, void *from, const nsDependentCString &fn,
const nsDependentCString &paramName, PRUint32 paramValue)
{
PR_LOG(aLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%d\")\n",
GIVE_ME_MS_NOW(), from,
@ -145,8 +145,8 @@ public:
class LogMessage {
public:
LogMessage(PRLogModuleInfo *aLog, void *from, const nsLiteralCString &fn,
const nsLiteralCString &msg)
LogMessage(PRLogModuleInfo *aLog, void *from, const nsDependentCString &fn,
const nsDependentCString &msg)
{
PR_LOG(aLog, PR_LOG_DEBUG, ("%d [this=%p] %s -- %s\n",
GIVE_ME_MS_NOW(), from,

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

@ -462,18 +462,21 @@ nsresult nsAutoConfig::getEmailAddr(nsAWritableCString & emailAddr)
getter_Copies(prefValue));
// Checking prefValue and its length. Since by default the preference
// is set to nothing
if (NS_SUCCEEDED(rv) && nsCRT::strlen(prefValue) > 0) {
PRUint32 len;
if (NS_SUCCEEDED(rv) && (len = nsCRT::strlen(prefValue)) > 0) {
emailAddr = NS_LITERAL_CSTRING("mail.account.") +
nsLocalCString(prefValue) + NS_LITERAL_CSTRING(".identities");
nsDependentCString(prefValue, len) + NS_LITERAL_CSTRING(".identities");
rv = mPrefBranch->GetCharPref(PromiseFlatCString(emailAddr).get(),
getter_Copies(prefValue));
if (NS_FAILED(rv) || nsCRT::strlen(prefValue) < 0) return rv;
// should the following |strlen|s ask |== 0|? |PRUint32| can't be |<0|
if (NS_FAILED(rv) || (len = nsCRT::strlen(prefValue)) < 0) return rv;
emailAddr = NS_LITERAL_CSTRING("mail.identity.") +
nsLocalCString(prefValue) + NS_LITERAL_CSTRING(".useremail");
nsDependentCString(prefValue, len) + NS_LITERAL_CSTRING(".useremail");
rv = mPrefBranch->GetCharPref(PromiseFlatCString(emailAddr).get(),
getter_Copies(prefValue));
if (NS_FAILED(rv) || nsCRT::strlen(prefValue) < 0) return rv;
emailAddr = nsLocalCString(prefValue);
if (NS_FAILED(rv) || (len = nsCRT::strlen(prefValue)) < 0) return rv;
emailAddr = nsDependentCString(prefValue, len);
}
else {
if (mCurrProfile) {

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

@ -354,7 +354,7 @@ nsCacheEntryDescriptor::GetMetaDataElement(const char *key, char ** result)
*result = nsnull;
// XXX not thread safe
nsresult rv = mCacheEntry->GetMetaDataElement(nsLiteralCString(key), &value);
nsresult rv = mCacheEntry->GetMetaDataElement(nsDependentCString(key), &value);
if (NS_FAILED(rv)) return rv;
if (!value) return NS_ERROR_NOT_AVAILABLE;
@ -374,8 +374,8 @@ nsCacheEntryDescriptor::SetMetaDataElement(const char *key, const char *value)
if (!key) return NS_ERROR_NULL_POINTER;
// XXX not thread safe
// XXX allow null value, for clearing key?
nsresult rv = mCacheEntry->SetMetaDataElement(nsLiteralCString(key),
nsLiteralCString(value));
nsresult rv = mCacheEntry->SetMetaDataElement(nsDependentCString(key),
nsDependentCString(value));
if (NS_SUCCEEDED(rv))
mCacheEntry->TouchMetaData();
return rv;

4
netwerk/cache/src/nsCacheMetaData.cpp поставляемый
Просмотреть файл

@ -187,8 +187,8 @@ nsCacheMetaData::UnflattenMetaData(char * data, PRUint32 size)
const char* value = data;
PRUint32 valueSize = nsCRT::strlen(value);
data += 1 + valueSize;
rv = SetElement(nsLocalCString(name, nameSize),
nsLocalCString(value, valueSize));
rv = SetElement(nsDependentCString(name, nameSize),
nsDependentCString(value, valueSize));
if (NS_FAILED(rv)) break;
}
}

4
netwerk/cache/src/nsDiskCacheDevice.cpp поставляемый
Просмотреть файл

@ -94,7 +94,7 @@ NS_IMETHODIMP nsDiskCacheObserver::Observe(nsISupports *aSubject, const PRUnicha
}
// which preference changed?
nsLiteralString prefName(someData);
nsDependentString prefName(someData);
if (prefName.Equals(NS_LITERAL_STRING(CACHE_DIR_PREF))) {
nsCOMPtr<nsILocalFile> cacheDirectory;
rv = prefs->GetFileXPref(CACHE_DIR_PREF, getter_AddRefs(cacheDirectory));
@ -314,7 +314,7 @@ nsDiskCacheEvictor::VisitRecord(nsDiskCacheRecord * mapRecord)
// XXX FIXME compare clientID's without malloc
// get client ID from key
rv = ClientIDFromCacheKey(nsLiteralCString(diskEntry->mKeyStart), &clientID);
rv = ClientIDFromCacheKey(nsDependentCString(diskEntry->mKeyStart), &clientID);
if (NS_FAILED(rv)) goto exit;
if (nsCRT::strcmp(mClientID, clientID) != 0) goto exit;

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

@ -640,29 +640,34 @@ static nsresult convertUTF8ToUnicode(const char *utf8String, PRUnichar ** aResul
static nsresult AddAttribute( nsIMIMEInfo* inElement, nsCString& inAttribute, nsCString& inValue )
{
/*
Note: maybe the constants |kMIMEType|, |kDescription|, |kExtensions|, etc., would be
better defined using |NS_LITERAL_CSTRING| to avoid the complicated constructions
below, and constant re-calculation of length.
*/
nsresult rv = NS_OK;
if ( inAttribute == nsLiteralCString(kMIMEType) )
if ( inAttribute == nsDependentCString(kMIMEType) )
{
rv = inElement->SetMIMEType( inValue );
}
else if ( inAttribute == nsLiteralCString(kDescription) )
else if ( inAttribute == nsDependentCString(kDescription) )
{
PRUnichar* unicode;
convertUTF8ToUnicode( inValue, &unicode );
rv =inElement->SetDescription( unicode );
nsTextFormatter::smprintf_free(unicode);
}
else if ( inAttribute == nsLiteralCString(kExtensions) )
else if ( inAttribute == nsDependentCString(kExtensions) )
{
rv = inElement->SetFileExtensions( inValue );
}
else if ( inAttribute == nsLiteralCString(kMacType) )
else if ( inAttribute == nsDependentCString(kMacType) )
{
PRUint32 value;
sscanf ( inValue, "%x", &value);
rv = inElement->SetMacType( value );
}
else if ( inAttribute == nsLiteralCString(kMacCreator) )
else if ( inAttribute == nsDependentCString(kMacCreator) )
{
PRUint32 value;
sscanf ( inValue, "%x", &value);

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

@ -846,12 +846,9 @@ nsFtpState::S_user() {
formatStrings, 1,
getter_Copies(formatedString));
nsAutoString realm; // XXX i18n
CopyASCIItoUCS2(nsLiteralCString(NS_STATIC_CAST(const char*, host)), realm);
rv = mAuthPrompter->PromptUsernameAndPassword(nsnull,
formatedString,
realm.GetUnicode(),
NS_ConvertASCIItoUCS2(host).GetUnicode(), // XXX i18n
nsIAuthPrompt::SAVE_PASSWORD_PERMANENTLY,
&user,
&passwd,

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

@ -524,7 +524,9 @@ void nsExpatTokenizer::FrontloadMisplacedContent(nsDeque& aDeque){
void Tokenizer_HandleStartElement(void *userData, const XML_Char *name, const XML_Char **atts) {
XMLParserState* state = (XMLParserState*) userData;
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_unknown, nsLiteralString((PRUnichar*)name));
typedef const PRUnichar* const_PRUnichar_ptr;
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_unknown, nsDependentString(const_PRUnichar_ptr(name)));
if(theToken) {
// If an ID attribute exists for this element, set it on the start token
PRInt32 index = XML_GetIdAttributeIndex(state->parser);
@ -541,7 +543,7 @@ void Tokenizer_HandleStartElement(void *userData, const XML_Char *name, const XM
while(*atts){
theAttrCount++;
CAttributeToken* theAttrToken = (CAttributeToken*)
state->tokenAllocator->CreateTokenOfType(eToken_attribute, eHTMLTag_unknown, nsLiteralString((PRUnichar*)atts[1]));
state->tokenAllocator->CreateTokenOfType(eToken_attribute, eHTMLTag_unknown, nsDependentString(const_PRUnichar_ptr(atts[1])));
if(theAttrToken){
PRUnichar* ptr = (PRUnichar*)atts[0];
if ((ptr >= state->bufferStart) && (ptr < state->bufferEnd)) {
@ -554,7 +556,7 @@ void Tokenizer_HandleStartElement(void *userData, const XML_Char *name, const XM
theAttrToken->BindKey(state->scanner, start, end);
}
else {
theAttrToken->SetKey(nsLiteralString(ptr));
theAttrToken->SetKey(nsDependentString(ptr));
}
}
CToken* theTok=(CToken*)theAttrToken;
@ -570,7 +572,8 @@ void Tokenizer_HandleStartElement(void *userData, const XML_Char *name, const XM
void Tokenizer_HandleEndElement(void *userData, const XML_Char *name) {
XMLParserState* state = (XMLParserState*) userData;
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_end,eHTMLTag_unknown, nsLiteralString((PRUnichar *) name));
typedef const PRUnichar* const_PRUnichar_ptr;
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_end,eHTMLTag_unknown, nsDependentString(const_PRUnichar_ptr(name)));
if(theToken) {
nsExpatTokenizer::AddToken(theToken, NS_OK, state->tokenDeque, state->tokenAllocator);
}
@ -596,7 +599,7 @@ void Tokenizer_HandleCharacterData(void *userData, const XML_Char *s, int len) {
break;
case kSpace:
case kTab:
newToken = state->tokenAllocator->CreateTokenOfType(eToken_whitespace,eHTMLTag_unknown, nsLocalString((PRUnichar*)s, len));
newToken = state->tokenAllocator->CreateTokenOfType(eToken_whitespace,eHTMLTag_unknown, nsDependentString((PRUnichar*)s, len));
break;
default:
{
@ -611,7 +614,7 @@ void Tokenizer_HandleCharacterData(void *userData, const XML_Char *s, int len) {
textToken->Bind(state->scanner, start, end);
}
else {
textToken->Bind(nsLocalString(ptr, len));
textToken->Bind(nsDependentString(ptr, len));
}
newToken = textToken;
}
@ -634,7 +637,8 @@ void Tokenizer_HandleComment(void *userData, const XML_Char *name) {
state->doctypeText.Append((PRUnichar*)name);
state->doctypeText.Append(NS_LITERAL_STRING("-->"));
} else {
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_comment, eHTMLTag_unknown, nsLiteralString((PRUnichar*)name));
typedef const PRUnichar* const_PRUnichar_ptr;
CToken* theToken = state->tokenAllocator->CreateTokenOfType(eToken_comment, eHTMLTag_unknown, nsDependentString(const_PRUnichar_ptr(name)));
if(theToken) {
nsExpatTokenizer::AddToken(theToken, NS_OK, state->tokenDeque, state->tokenAllocator);
}

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

@ -536,7 +536,7 @@ nsresult CTextToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag)
static const PRUnichar theTerminalsChars[] =
{ PRUnichar('\n'), PRUnichar('\r'), PRUnichar('&'), PRUnichar('<'),
PRUnichar(0) };
const nsLocalString theTerminals(theTerminalsChars,
const nsDependentString theTerminals(theTerminalsChars,
sizeof(theTerminalsChars)/sizeof(theTerminalsChars[0]) - 1);
nsresult result=NS_OK;
PRBool done=PR_FALSE;
@ -912,7 +912,7 @@ nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32
{ PRUnichar('\n'), PRUnichar('\r'), PRUnichar('\''), PRUnichar('"'),
PRUnichar('>'),
PRUnichar(0) };
const nsLocalString theTerminals(theTerminalsChars,
const nsDependentString theTerminals(theTerminalsChars,
sizeof(theTerminalsChars)/sizeof(theTerminalsChars[0]) - 1);
nsresult result=NS_OK;
PRBool done=PR_FALSE;
@ -1551,7 +1551,7 @@ nsresult ConsumeAttributeValueText(nsString& aString,
const PRUnichar *aTerminalChars,
PRInt32 aFlag)
{
const nsLocalString theTerminals(aTerminalChars,
const nsDependentString theTerminals(aTerminalChars,
sizeof(aTerminalChars)/sizeof(aTerminalChars[0]) - 1);
nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE);
@ -1653,7 +1653,7 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 a
{ PRUnichar('\b'), PRUnichar('\t'), PRUnichar('\n'), PRUnichar('\r'),
PRUnichar(' '), PRUnichar('"'), PRUnichar('='), PRUnichar('>'),
PRUnichar(0) };
const nsLocalString theTerminals(theTerminalsChars,
const nsDependentString theTerminals(theTerminalsChars,
sizeof(theTerminalsChars)/sizeof(theTerminalsChars[0]) - 1);
result=aScanner.ReadUntil(start,end,theTerminals,PR_FALSE);
}

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

@ -330,7 +330,7 @@ nsresult nsScanner::Append(const char* aBuffer, PRUint32 aLen){
} while (NS_FAILED(res) && (aLen > 0));
}
else {
nsLiteralCString str(aBuffer, aLen);
nsDependentCString str(aBuffer, aLen);
unichars = ToNewUnicode(str);
AppendToBuffer(unichars, unichars+aLen, unichars+aLen);
mTotalRead+=aLen;
@ -378,7 +378,7 @@ nsresult nsScanner::FillBuffer(void) {
}
if((0<numread) && (0==result)) {
nsLiteralCString str(buf, numread);
nsDependentCString str(buf, numread);
PRUnichar* unichars = ToNewUnicode(str);
AppendToBuffer(unichars, unichars+numread, unichars+kBufsize+1);
}

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

@ -227,7 +227,7 @@ class nsScanner {
PRBool addTerminal)
{
return ReadUntil(aString,
nsLocalCString(aTerminalSet),
nsDependentCString(aTerminalSet),
addTerminal);
}

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

@ -973,8 +973,8 @@ nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile)
NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE);
nsISupports *subject = (nsISupports *)((nsIProfile *)this);
nsLiteralString context(isSwitch ? (NS_LITERAL_STRING("switch")).get() : NS_LITERAL_STRING("startup").get());
const nsAFlatString& context = isSwitch ? NS_LITERAL_STRING("switch") : NS_LITERAL_STRING("startup");
if (isSwitch)
{
// Phase 1: See if anybody objects to the profile being changed.
@ -1050,7 +1050,7 @@ NS_IMETHODIMP nsProfile::ShutDownCurrentProfile(PRUint32 shutDownType)
NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE);
nsISupports *subject = (nsISupports *)((nsIProfile *)this);
nsLiteralString context(shutDownType == SHUTDOWN_CLEANSE ? NS_LITERAL_STRING("shutdown-cleanse").get() : NS_LITERAL_STRING("shutdown-persist").get());
const nsAFlatString& context = (shutDownType == SHUTDOWN_CLEANSE) ? NS_LITERAL_STRING("shutdown-cleanse") : NS_LITERAL_STRING("shutdown-persist");
// Phase 1: See if anybody objects to the profile being changed.
mProfileChangeVetoed = PR_FALSE;

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

@ -408,7 +408,7 @@ nsProfileAccess::FillProfileInfo(nsIFile* regName)
kRegistryMigratedString.get(),
getter_Copies(isMigrated));
if (NS_FAILED(rv)) return rv;
nsLiteralString isMigratedString(isMigrated);
nsDependentString isMigratedString(isMigrated);
// Not checking the return values of these variables as they
// are for activation, they are optional and their values

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

@ -591,9 +591,9 @@ class NS_COM NS_ConvertASCIItoUCS2
explicit NS_ConvertASCIItoUCS2( char );
#if 0
operator const nsLocalString() const
operator const nsDependentString() const
{
return nsLocalString(mUStr, mLength);
return nsDependentString(mUStr, mLength);
}
#endif

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

@ -35,12 +35,9 @@ nsDependentString.h
nsDependentSubstring.h
nsFragmentedString.h
nsLiteralString.h
nsLocalString.h
nsPrintfCString.h
nsPrivateSharableString.h
nsPromiseConcatenation.h
nsPromiseFlatString.h
nsPromiseSubstring.h
nsReadableUtils.h
nsSharableString.h
nsSharedBufferList.h

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

@ -45,12 +45,9 @@ EXPORTS = \
nsDependentSubstring.h \
nsFragmentedString.h \
nsLiteralString.h \
nsLocalString.h \
nsPrintfCString.h \
nsPrivateSharableString.h \
nsPromiseConcatenation.h \
nsPromiseFlatString.h \
nsPromiseSubstring.h \
nsReadableUtils.h \
nsSharableString.h \
nsSharedBufferList.h \

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

@ -39,12 +39,9 @@ EXPORTS = \
nsDependentSubstring.h \
nsFragmentedString.h \
nsLiteralString.h \
nsLocalString.h \
nsPrintfCString.h \
nsPrivateSharableString.h \
nsPromiseConcatenation.h \
nsPromiseFlatString.h \
nsPromiseSubstring.h \
nsReadableUtils.h \
nsSharableString.h \
nsSharedBufferList.h \

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

@ -37,8 +37,8 @@ typedef const nsACString nsAReadableCString;
#include "nsLiteralString.h"
#endif
#ifndef nsPromiseSubstring_h___
#include "nsPromiseSubstring.h"
#ifndef nDependentSubstring_h___
#include "nsDependentSubstring.h"
#endif
#ifndef nsPromiseFlatString_h___

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

@ -806,8 +806,8 @@ nsACString::Left( nsACString& aResult, size_type aLengthToCopy ) const
}
// Once you've got strings, you shouldn't need to do anything else to have concatenation
#ifndef nsPromiseConcatenation_h___
#include "nsPromiseConcatenation.h"
#ifndef nsDependentConcatenation_h___
#include "nsDependentConcatenation.h"
#endif
#endif // !defined(nsAString_h___)

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

@ -235,9 +235,6 @@ operator+( const nsDependentCConcatenation& lhs, const nsACString& rhs )
return nsDependentCConcatenation(lhs, rhs, lhs.GetFragmentIdentifierMask()<<1);
}
#if 0
// temporarily comment these two global operators out, until |nsPromiseConcatenation| is removed
inline
const nsDependentConcatenation
operator+( const nsAString& lhs, const nsAString& rhs )
@ -251,7 +248,6 @@ operator+( const nsACString& lhs, const nsACString& rhs )
{
return nsDependentCConcatenation(lhs, rhs);
}
#endif
#if 0
inline

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

@ -29,18 +29,17 @@
#endif
/*
...this class wraps a constant literal string and lets it act like an |nsAReadable...|.
...this class wraps a constant literal string and lets it act like an |const nsAString|.
Use it like this:
SomeFunctionTakingACString( nsLiteralCString("Hello, World!") );
With some tweaking, I think I can make this work as well...
SomeStringFunc( nsLiteralString( L"Hello, World!" ) );
SomeFunctionTakingACString( nsLiteralCString(myCharPtr) );
This class just holds a pointer. If you don't supply the length, it must calculate it.
No copying or allocations are performed.
See also |NS_LITERAL_STRING| and |NS_LITERAL_CSTRING| when you have a quoted string you want to
use as a |const nsAString|.
*/
class NS_COM nsDependentString
@ -49,26 +48,26 @@ class NS_COM nsDependentString
public:
explicit
nsDependentString( const PRUnichar* aLiteral )
: mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits<PRUnichar>::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral))
nsDependentString( const PRUnichar* aPtr )
: mHandle(NS_CONST_CAST(PRUnichar*, aPtr), aPtr ? (NS_CONST_CAST(PRUnichar*, aPtr)+nsCharTraits<PRUnichar>::length(aPtr)) : 0)
{
// nothing else to do here
}
nsDependentString( const PRUnichar* aLiteral, PRUint32 aLength )
: mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), NS_CONST_CAST(PRUnichar*, aLiteral)+aLength)
nsDependentString( const PRUnichar* aPtr, PRUint32 aLength )
: mHandle(NS_CONST_CAST(PRUnichar*, aPtr), NS_CONST_CAST(PRUnichar*, aPtr)+aLength)
{
// This is an annoying hack. Callers should be fixed to use the other
// constructor if they don't really know the length.
if ( aLength == PRUint32(-1) )
{
// NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor.");
mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits<PRUnichar>::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral));
mHandle.DataEnd(aPtr ? (NS_CONST_CAST(PRUnichar*, aPtr)+nsCharTraits<PRUnichar>::length(aPtr)) : 0);
}
}
// nsDependentString( const nsDependentString& ); // auto-generated copy-constructor OK
// ~nsDependentString(); // auto-generated destructor OK
// nsDependentString( const nsDependentString& ); // auto-generated copy-constructor OK
// ~nsDependentString(); // auto-generated destructor OK
virtual const nsBufferHandle<PRUnichar>* GetFlatBufferHandle() const { return &mHandle; }
virtual const nsBufferHandle<PRUnichar>* GetBufferHandle() const { return &mHandle; }
@ -89,26 +88,26 @@ class NS_COM nsDependentCString
public:
explicit
nsDependentCString( const char* aLiteral )
: mHandle(NS_CONST_CAST(char*, aLiteral), aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits<char>::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral))
nsDependentCString( const char* aPtr )
: mHandle(NS_CONST_CAST(char*, aPtr), aPtr ? (NS_CONST_CAST(char*, aPtr)+nsCharTraits<char>::length(aPtr)) : 0)
{
// nothing else to do here
}
nsDependentCString( const char* aLiteral, PRUint32 aLength )
: mHandle(NS_CONST_CAST(char*, aLiteral), NS_CONST_CAST(char*, aLiteral)+aLength)
nsDependentCString( const char* aPtr, PRUint32 aLength )
: mHandle(NS_CONST_CAST(char*, aPtr), NS_CONST_CAST(char*, aPtr)+aLength)
{
// This is an annoying hack. Callers should be fixed to use the other
// constructor if they don't really know the length.
if ( aLength == PRUint32(-1) )
{
// NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor.");
mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits<char>::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral));
mHandle.DataEnd(aPtr ? (NS_CONST_CAST(char*, aPtr)+nsCharTraits<char>::length(aPtr)) : 0);
}
}
// nsDependentCString( const nsDependentCString& ); // auto-generated copy-constructor OK
// ~nsDependentCString(); // auto-generated destructor OK
// nsDependentCString( const nsDependentCString& ); // auto-generated copy-constructor OK
// ~nsDependentCString(); // auto-generated destructor OK
virtual const nsBufferHandle<char>* GetFlatBufferHandle() const { return &mHandle; }
virtual const nsBufferHandle<char>* GetBufferHandle() const { return &mHandle; }
@ -121,4 +120,10 @@ class NS_COM nsDependentCString
void operator=( const nsDependentCString& ); // we're immutable
};
// temporary |typedef|s till we fix commercial and soap
// see http://bugzilla.mozilla.org/show_bug.cgi?id=75220
typedef nsDependentString nsLocalString;
typedef nsDependentCString nsLocalCString;
#endif /* !defined(nsDependentString_h___) */

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

@ -28,47 +28,50 @@
#include "nscore.h"
#endif
#ifndef nsLocalString_h___
#include "nsLocalString.h"
#ifndef nsDependentString_h___
#include "nsDependentString.h"
#endif
typedef nsLocalString nsLiteralString;
typedef nsLocalCString nsLiteralCString;
// temporary |typedef|s till we fix commercial and soap
// see http://bugzilla.mozilla.org/show_bug.cgi?id=75220
typedef nsDependentString nsLiteralString;
typedef nsDependentCString nsLiteralCString;
#if 0
inline
const nsLocalString
const nsDependentString
literal_string( const PRUnichar* aPtr )
{
return nsLocalString(aPtr);
return nsDependentString(aPtr);
}
inline
const nsLocalString
const nsDependentString
literal_string( const PRUnichar* aPtr, PRUint32 aLength )
{
return nsLocalString(aPtr, aLength);
return nsDependentString(aPtr, aLength);
}
inline
const nsLocalCString
const nsDependentCString
literal_string( const char* aPtr )
{
return nsLocalCString(aPtr);
return nsDependentCString(aPtr);
}
inline
const nsLocalCString
const nsDependentCString
literal_string( const char* aPtr, PRUint32 aLength )
{
return nsLocalCString(aPtr, aLength);
return nsDependentCString(aPtr, aLength);
}
#endif
#ifdef HAVE_CPP_2BYTE_WCHAR_T
#define NS_L(s) L##s
#define NS_MULTILINE_LITERAL_STRING(s) nsLocalString(NS_REINTERPRET_CAST(const PRUnichar*, s), (sizeof(s)/sizeof(wchar_t))-1)
#define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) nsLocalString n(NS_REINTERPRET_CAST(const PRUnichar*, s), (sizeof(s)/sizeof(wchar_t))-1)
#define NS_MULTILINE_LITERAL_STRING(s) nsDependentString(NS_REINTERPRET_CAST(const PRUnichar*, s), (sizeof(s)/sizeof(wchar_t))-1)
#define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) nsDependentString n(NS_REINTERPRET_CAST(const PRUnichar*, s), (sizeof(s)/sizeof(wchar_t))-1)
#else
#define NS_L(s) s
#define NS_MULTILINE_LITERAL_STRING(s) NS_ConvertASCIItoUCS2(s, sizeof(s)-1)
@ -78,7 +81,7 @@ literal_string( const char* aPtr, PRUint32 aLength )
#define NS_LITERAL_STRING(s) NS_MULTILINE_LITERAL_STRING(NS_L(s))
#define NS_NAMED_LITERAL_STRING(n,s) NS_NAMED_MULTILINE_LITERAL_STRING(n,NS_L(s))
#define NS_LITERAL_CSTRING(s) nsLocalCString(s, sizeof(s)-1)
#define NS_NAMED_LITERAL_CSTRING(n,s) nsLocalCString n(s, sizeof(s)-1)
#define NS_LITERAL_CSTRING(s) nsDependentCString(s, sizeof(s)-1)
#define NS_NAMED_LITERAL_CSTRING(n,s) nsDependentCString n(s, sizeof(s)-1)
#endif /* !defined(nsLiteralString_h___) */

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

@ -39,8 +39,8 @@
#include "nsAString.h"
#endif
#ifndef nsLocalString_h___
#include "nsLocalString.h"
#ifndef nsDependentString_h___
#include "nsDependentString.h"
#endif
#ifndef nsBufferHandleUtils_h___
@ -183,7 +183,7 @@ class NS_COM nsSharedBufferList
NewSingleAllocationBuffer( const PRUnichar* aData, PRUint32 aDataLength, PRUint32 aAdditionalCapacity = 1 )
{
typedef Buffer* Buffer_ptr;
return NS_AllocateContiguousHandleWithData(Buffer_ptr(0), nsLocalString(aData, aDataLength), aAdditionalCapacity);
return NS_AllocateContiguousHandleWithData(Buffer_ptr(0), nsDependentString(aData, aDataLength), aAdditionalCapacity);
}
static

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

@ -52,10 +52,10 @@ class nsAFlatCString;
/**
* @see nsLocalString.h
* @see nsDependentString.h
*/
class nsLocalString;
class nsLocalCString;
class nsDependentString;
class nsDependentCString;
#endif /* !defined(nsStringFwd_h___) */

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

@ -44,10 +44,10 @@
template <class CharT>
struct nsStringTraits
{
typedef nsAString abstract_string_type;
typedef nsAPromiseString abstract_promise_type;
typedef nsAFlatString abstract_flat_type;
typedef const nsLocalString literal_string_type;
typedef nsAString abstract_string_type;
typedef nsAPromiseString abstract_promise_type;
typedef nsAFlatString abstract_flat_type;
typedef const nsDependentString literal_string_type;
};
#if 0
@ -56,20 +56,20 @@ struct nsStringTraits
NS_SPECIALIZE_TEMPLATE
struct nsStringTraits<PRUnichar>
{
typedef nsAString abstract_string_type;
typedef nsAPromiseString abstract_promise_type;
typedef nsAFlatString abstract_flat_type;
typedef const nsLocalString literal_string_type;
typedef nsAString abstract_string_type;
typedef nsAPromiseString abstract_promise_type;
typedef nsAFlatString abstract_flat_type;
typedef const nsDependentString literal_string_type;
};
#endif
NS_SPECIALIZE_TEMPLATE
struct nsStringTraits<char>
{
typedef nsACString abstract_string_type;
typedef nsAPromiseCString abstract_promise_type;
typedef nsAFlatCString abstract_flat_type;
typedef const nsLocalCString literal_string_type;
typedef nsACString abstract_string_type;
typedef nsAPromiseCString abstract_promise_type;
typedef nsAFlatCString abstract_flat_type;
typedef const nsDependentCString literal_string_type;
};

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

@ -40,12 +40,9 @@ CPPSRCS = \
nsDependentString.cpp \
nsDependentSubstring.cpp \
nsFragmentedString.cpp \
nsLocalString.cpp \
nsPrintfCString.cpp \
nsPrivateSharableString.cpp \
nsPromiseConcatenation.cpp \
nsPromiseFlatString.cpp \
nsPromiseSubstring.cpp \
nsReadableUtils.cpp \
nsSharableString.cpp \
nsSharedBufferList.cpp \

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

@ -35,12 +35,9 @@ CPP_OBJS = \
.\$(OBJDIR)\nsDependentString.obj \
.\$(OBJDIR)\nsDependentSubstring.obj \
.\$(OBJDIR)\nsFragmentedString.obj \
.\$(OBJDIR)\nsLocalString.obj \
.\$(OBJDIR)\nsPrintfCString.obj \
.\$(OBJDIR)\nsPrivateSharableString.obj \
.\$(OBJDIR)\nsPromiseConcatenation.obj \
.\$(OBJDIR)\nsPromiseFlatString.obj \
.\$(OBJDIR)\nsPromiseSubstring.obj \
.\$(OBJDIR)\nsReadableUtils.obj \
.\$(OBJDIR)\nsSharableString.obj \
.\$(OBJDIR)\nsSharedBufferList.obj \

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

@ -22,8 +22,8 @@
*/
#include "nsAString.h"
#include "nsPromiseSubstring.h"
#include "nsLocalString.h"
#include "nsDependentSubstring.h"
#include "nsDependentString.h"
#include "nsCRT.h"
@ -88,7 +88,7 @@ Compare( const nsAString& lhs, const nsAString& rhs, const nsStringComparator& a
PRBool
nsAString::Equals( const char_type* rhs ) const
{
return Equals(nsLocalString(rhs));
return Equals(nsDependentString(rhs));
}
@ -256,19 +256,19 @@ nsAString::do_AssignFromReadable( const self_type& aReadable )
void
nsAString::do_AssignFromElementPtr( const char_type* aPtr )
{
do_AssignFromReadable(nsLocalString(aPtr));
do_AssignFromReadable(nsDependentString(aPtr));
}
void
nsAString::do_AssignFromElementPtrLength( const char_type* aPtr, size_type aLength )
{
do_AssignFromReadable(nsLocalString(aPtr, aLength));
do_AssignFromReadable(nsDependentString(aPtr, aLength));
}
void
nsAString::do_AssignFromElement( char_type aChar )
{
do_AssignFromReadable(nsLocalString(&aChar, 1));
do_AssignFromReadable(nsDependentString(&aChar, 1));
}
@ -319,21 +319,21 @@ nsAString::do_AppendFromReadable( const self_type& aReadable )
}
void
nsAString::do_AppendFromElementPtr( const char_type* aChar )
nsAString::do_AppendFromElementPtr( const char_type* aPtr )
{
do_AppendFromReadable(nsLocalString(aChar));
do_AppendFromReadable(nsDependentString(aPtr));
}
void
nsAString::do_AppendFromElementPtrLength( const char_type* aChar, size_type aLength )
nsAString::do_AppendFromElementPtrLength( const char_type* aPtr, size_type aLength )
{
do_AppendFromReadable(nsLocalString(aChar, aLength));
do_AppendFromReadable(nsDependentString(aPtr, aLength));
}
void
nsAString::do_AppendFromElement( char_type aChar )
{
do_AppendFromReadable(nsLocalString(&aChar, 1));
do_AppendFromReadable(nsDependentString(&aChar, 1));
}
@ -390,19 +390,19 @@ nsAString::do_InsertFromReadable( const self_type& aReadable, index_type atPosit
void
nsAString::do_InsertFromElementPtr( const char_type* aPtr, index_type atPosition )
{
do_InsertFromReadable(nsLocalString(aPtr), atPosition);
do_InsertFromReadable(nsDependentString(aPtr), atPosition);
}
void
nsAString::do_InsertFromElementPtrLength( const char_type* aPtr, index_type atPosition, size_type aLength )
{
do_InsertFromReadable(nsLocalString(aPtr, aLength), atPosition);
do_InsertFromReadable(nsDependentString(aPtr, aLength), atPosition);
}
void
nsAString::do_InsertFromElement( char_type aChar, index_type atPosition )
{
do_InsertFromReadable(nsLocalString(&aChar, 1), atPosition);
do_InsertFromReadable(nsDependentString(&aChar, 1), atPosition);
}
@ -454,7 +454,7 @@ nsAString::ReplaceFromPromise( index_type cutStart, size_type cutLength, const s
const_iterator fromBegin, fromEnd;
char_type* toBegin = buffer;
copy_string(aReadable.BeginReading(fromBegin), aReadable.EndReading(fromEnd), toBegin);
do_ReplaceFromReadable(cutStart, cutLength, nsLocalString(buffer, length));
do_ReplaceFromReadable(cutStart, cutLength, nsDependentString(buffer, length));
delete buffer;
}
// else assert?
@ -550,7 +550,7 @@ Compare( const nsACString& lhs, const nsACString& rhs, const nsCStringComparator
PRBool
nsACString::Equals( const char_type* rhs ) const
{
return Equals(nsLocalCString(rhs));
return Equals(nsDependentCString(rhs));
}
nsACString::char_type
@ -716,19 +716,19 @@ nsACString::do_AssignFromReadable( const self_type& aReadable )
void
nsACString::do_AssignFromElementPtr( const char_type* aPtr )
{
do_AssignFromReadable(nsLocalCString(aPtr));
do_AssignFromReadable(nsDependentCString(aPtr));
}
void
nsACString::do_AssignFromElementPtrLength( const char_type* aPtr, size_type aLength )
{
do_AssignFromReadable(nsLocalCString(aPtr, aLength));
do_AssignFromReadable(nsDependentCString(aPtr, aLength));
}
void
nsACString::do_AssignFromElement( char_type aChar )
{
do_AssignFromReadable(nsLocalCString(&aChar, 1));
do_AssignFromReadable(nsDependentCString(&aChar, 1));
}
@ -779,21 +779,21 @@ nsACString::do_AppendFromReadable( const self_type& aReadable )
}
void
nsACString::do_AppendFromElementPtr( const char_type* aChar )
nsACString::do_AppendFromElementPtr( const char_type* aPtr )
{
do_AppendFromReadable(nsLocalCString(aChar));
do_AppendFromReadable(nsDependentCString(aPtr));
}
void
nsACString::do_AppendFromElementPtrLength( const char_type* aChar, size_type aLength )
nsACString::do_AppendFromElementPtrLength( const char_type* aPtr, size_type aLength )
{
do_AppendFromReadable(nsLocalCString(aChar, aLength));
do_AppendFromReadable(nsDependentCString(aPtr, aLength));
}
void
nsACString::do_AppendFromElement( char_type aChar )
{
do_AppendFromReadable(nsLocalCString(&aChar, 1));
do_AppendFromReadable(nsDependentCString(&aChar, 1));
}
@ -850,19 +850,19 @@ nsACString::do_InsertFromReadable( const self_type& aReadable, index_type atPosi
void
nsACString::do_InsertFromElementPtr( const char_type* aPtr, index_type atPosition )
{
do_InsertFromReadable(nsLocalCString(aPtr), atPosition);
do_InsertFromReadable(nsDependentCString(aPtr), atPosition);
}
void
nsACString::do_InsertFromElementPtrLength( const char_type* aPtr, index_type atPosition, size_type aLength )
{
do_InsertFromReadable(nsLocalCString(aPtr, aLength), atPosition);
do_InsertFromReadable(nsDependentCString(aPtr, aLength), atPosition);
}
void
nsACString::do_InsertFromElement( char_type aChar, index_type atPosition )
{
do_InsertFromReadable(nsLocalCString(&aChar, 1), atPosition);
do_InsertFromReadable(nsDependentCString(&aChar, 1), atPosition);
}
@ -914,7 +914,7 @@ nsACString::ReplaceFromPromise( index_type cutStart, size_type cutLength, const
const_iterator fromBegin, fromEnd;
char_type* toBegin = buffer;
copy_string(aReadable.BeginReading(fromBegin), aReadable.EndReading(fromEnd), toBegin);
do_ReplaceFromReadable(cutStart, cutLength, nsLocalCString(buffer, length));
do_ReplaceFromReadable(cutStart, cutLength, nsDependentCString(buffer, length));
delete buffer;
}
// else assert?

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

@ -74,7 +74,7 @@ void GetURIStringFromRequest(nsIRequest* request, nsXPIDLCString &aStr)
request->GetName(getter_Copies(name));
if (name)
*getter_Copies(aStr) = ToNewUTF8String(nsLocalString(name));
*getter_Copies(aStr) = ToNewUTF8String(nsDependentString(name));
}
}
#endif /* DEBUG */

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

@ -675,8 +675,8 @@ NS_IMETHODIMP nsFilePicker::GetDisplayDirectory(nsILocalFile **aDirectory)
NS_IMETHODIMP
nsFilePicker::AppendFilter(const PRUnichar *aTitle, const PRUnichar *aFilter)
{
mFilters.AppendString(nsLiteralString(aFilter));
mTitles.AppendString(nsLiteralString(aTitle));
mFilters.AppendString(nsDependentString(aFilter));
mTitles.AppendString(nsDependentString(aTitle));
return NS_OK;
}

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

@ -197,7 +197,7 @@ NS_COM nsIAtom* NS_NewAtom( const nsAReadableString& aString )
NS_COM nsIAtom* NS_NewAtom( const PRUnichar* str )
{
return NS_NewAtom(nsLiteralString(str));
return NS_NewAtom(nsDependentString(str));
}
NS_COM nsrefcnt NS_GetNumberOfAtoms(void)

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

@ -591,9 +591,9 @@ class NS_COM NS_ConvertASCIItoUCS2
explicit NS_ConvertASCIItoUCS2( char );
#if 0
operator const nsLocalString() const
operator const nsDependentString() const
{
return nsLocalString(mUStr, mLength);
return nsDependentString(mUStr, mLength);
}
#endif

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

@ -35,12 +35,9 @@ nsDependentString.h
nsDependentSubstring.h
nsFragmentedString.h
nsLiteralString.h
nsLocalString.h
nsPrintfCString.h
nsPrivateSharableString.h
nsPromiseConcatenation.h
nsPromiseFlatString.h
nsPromiseSubstring.h
nsReadableUtils.h
nsSharableString.h
nsSharedBufferList.h

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

@ -45,12 +45,9 @@ EXPORTS = \
nsDependentSubstring.h \
nsFragmentedString.h \
nsLiteralString.h \
nsLocalString.h \
nsPrintfCString.h \
nsPrivateSharableString.h \
nsPromiseConcatenation.h \
nsPromiseFlatString.h \
nsPromiseSubstring.h \
nsReadableUtils.h \
nsSharableString.h \
nsSharedBufferList.h \

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

@ -39,12 +39,9 @@ EXPORTS = \
nsDependentSubstring.h \
nsFragmentedString.h \
nsLiteralString.h \
nsLocalString.h \
nsPrintfCString.h \
nsPrivateSharableString.h \
nsPromiseConcatenation.h \
nsPromiseFlatString.h \
nsPromiseSubstring.h \
nsReadableUtils.h \
nsSharableString.h \
nsSharedBufferList.h \

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

@ -37,8 +37,8 @@ typedef const nsACString nsAReadableCString;
#include "nsLiteralString.h"
#endif
#ifndef nsPromiseSubstring_h___
#include "nsPromiseSubstring.h"
#ifndef nDependentSubstring_h___
#include "nsDependentSubstring.h"
#endif
#ifndef nsPromiseFlatString_h___

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

@ -806,8 +806,8 @@ nsACString::Left( nsACString& aResult, size_type aLengthToCopy ) const
}
// Once you've got strings, you shouldn't need to do anything else to have concatenation
#ifndef nsPromiseConcatenation_h___
#include "nsPromiseConcatenation.h"
#ifndef nsDependentConcatenation_h___
#include "nsDependentConcatenation.h"
#endif
#endif // !defined(nsAString_h___)

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

@ -235,9 +235,6 @@ operator+( const nsDependentCConcatenation& lhs, const nsACString& rhs )
return nsDependentCConcatenation(lhs, rhs, lhs.GetFragmentIdentifierMask()<<1);
}
#if 0
// temporarily comment these two global operators out, until |nsPromiseConcatenation| is removed
inline
const nsDependentConcatenation
operator+( const nsAString& lhs, const nsAString& rhs )
@ -251,7 +248,6 @@ operator+( const nsACString& lhs, const nsACString& rhs )
{
return nsDependentCConcatenation(lhs, rhs);
}
#endif
#if 0
inline

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

@ -29,18 +29,17 @@
#endif
/*
...this class wraps a constant literal string and lets it act like an |nsAReadable...|.
...this class wraps a constant literal string and lets it act like an |const nsAString|.
Use it like this:
SomeFunctionTakingACString( nsLiteralCString("Hello, World!") );
With some tweaking, I think I can make this work as well...
SomeStringFunc( nsLiteralString( L"Hello, World!" ) );
SomeFunctionTakingACString( nsLiteralCString(myCharPtr) );
This class just holds a pointer. If you don't supply the length, it must calculate it.
No copying or allocations are performed.
See also |NS_LITERAL_STRING| and |NS_LITERAL_CSTRING| when you have a quoted string you want to
use as a |const nsAString|.
*/
class NS_COM nsDependentString
@ -49,26 +48,26 @@ class NS_COM nsDependentString
public:
explicit
nsDependentString( const PRUnichar* aLiteral )
: mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits<PRUnichar>::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral))
nsDependentString( const PRUnichar* aPtr )
: mHandle(NS_CONST_CAST(PRUnichar*, aPtr), aPtr ? (NS_CONST_CAST(PRUnichar*, aPtr)+nsCharTraits<PRUnichar>::length(aPtr)) : 0)
{
// nothing else to do here
}
nsDependentString( const PRUnichar* aLiteral, PRUint32 aLength )
: mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), NS_CONST_CAST(PRUnichar*, aLiteral)+aLength)
nsDependentString( const PRUnichar* aPtr, PRUint32 aLength )
: mHandle(NS_CONST_CAST(PRUnichar*, aPtr), NS_CONST_CAST(PRUnichar*, aPtr)+aLength)
{
// This is an annoying hack. Callers should be fixed to use the other
// constructor if they don't really know the length.
if ( aLength == PRUint32(-1) )
{
// NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor.");
mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits<PRUnichar>::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral));
mHandle.DataEnd(aPtr ? (NS_CONST_CAST(PRUnichar*, aPtr)+nsCharTraits<PRUnichar>::length(aPtr)) : 0);
}
}
// nsDependentString( const nsDependentString& ); // auto-generated copy-constructor OK
// ~nsDependentString(); // auto-generated destructor OK
// nsDependentString( const nsDependentString& ); // auto-generated copy-constructor OK
// ~nsDependentString(); // auto-generated destructor OK
virtual const nsBufferHandle<PRUnichar>* GetFlatBufferHandle() const { return &mHandle; }
virtual const nsBufferHandle<PRUnichar>* GetBufferHandle() const { return &mHandle; }
@ -89,26 +88,26 @@ class NS_COM nsDependentCString
public:
explicit
nsDependentCString( const char* aLiteral )
: mHandle(NS_CONST_CAST(char*, aLiteral), aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits<char>::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral))
nsDependentCString( const char* aPtr )
: mHandle(NS_CONST_CAST(char*, aPtr), aPtr ? (NS_CONST_CAST(char*, aPtr)+nsCharTraits<char>::length(aPtr)) : 0)
{
// nothing else to do here
}
nsDependentCString( const char* aLiteral, PRUint32 aLength )
: mHandle(NS_CONST_CAST(char*, aLiteral), NS_CONST_CAST(char*, aLiteral)+aLength)
nsDependentCString( const char* aPtr, PRUint32 aLength )
: mHandle(NS_CONST_CAST(char*, aPtr), NS_CONST_CAST(char*, aPtr)+aLength)
{
// This is an annoying hack. Callers should be fixed to use the other
// constructor if they don't really know the length.
if ( aLength == PRUint32(-1) )
{
// NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor.");
mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits<char>::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral));
mHandle.DataEnd(aPtr ? (NS_CONST_CAST(char*, aPtr)+nsCharTraits<char>::length(aPtr)) : 0);
}
}
// nsDependentCString( const nsDependentCString& ); // auto-generated copy-constructor OK
// ~nsDependentCString(); // auto-generated destructor OK
// nsDependentCString( const nsDependentCString& ); // auto-generated copy-constructor OK
// ~nsDependentCString(); // auto-generated destructor OK
virtual const nsBufferHandle<char>* GetFlatBufferHandle() const { return &mHandle; }
virtual const nsBufferHandle<char>* GetBufferHandle() const { return &mHandle; }
@ -121,4 +120,10 @@ class NS_COM nsDependentCString
void operator=( const nsDependentCString& ); // we're immutable
};
// temporary |typedef|s till we fix commercial and soap
// see http://bugzilla.mozilla.org/show_bug.cgi?id=75220
typedef nsDependentString nsLocalString;
typedef nsDependentCString nsLocalCString;
#endif /* !defined(nsDependentString_h___) */

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

@ -28,47 +28,50 @@
#include "nscore.h"
#endif
#ifndef nsLocalString_h___
#include "nsLocalString.h"
#ifndef nsDependentString_h___
#include "nsDependentString.h"
#endif
typedef nsLocalString nsLiteralString;
typedef nsLocalCString nsLiteralCString;
// temporary |typedef|s till we fix commercial and soap
// see http://bugzilla.mozilla.org/show_bug.cgi?id=75220
typedef nsDependentString nsLiteralString;
typedef nsDependentCString nsLiteralCString;
#if 0
inline
const nsLocalString
const nsDependentString
literal_string( const PRUnichar* aPtr )
{
return nsLocalString(aPtr);
return nsDependentString(aPtr);
}
inline
const nsLocalString
const nsDependentString
literal_string( const PRUnichar* aPtr, PRUint32 aLength )
{
return nsLocalString(aPtr, aLength);
return nsDependentString(aPtr, aLength);
}
inline
const nsLocalCString
const nsDependentCString
literal_string( const char* aPtr )
{
return nsLocalCString(aPtr);
return nsDependentCString(aPtr);
}
inline
const nsLocalCString
const nsDependentCString
literal_string( const char* aPtr, PRUint32 aLength )
{
return nsLocalCString(aPtr, aLength);
return nsDependentCString(aPtr, aLength);
}
#endif
#ifdef HAVE_CPP_2BYTE_WCHAR_T
#define NS_L(s) L##s
#define NS_MULTILINE_LITERAL_STRING(s) nsLocalString(NS_REINTERPRET_CAST(const PRUnichar*, s), (sizeof(s)/sizeof(wchar_t))-1)
#define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) nsLocalString n(NS_REINTERPRET_CAST(const PRUnichar*, s), (sizeof(s)/sizeof(wchar_t))-1)
#define NS_MULTILINE_LITERAL_STRING(s) nsDependentString(NS_REINTERPRET_CAST(const PRUnichar*, s), (sizeof(s)/sizeof(wchar_t))-1)
#define NS_NAMED_MULTILINE_LITERAL_STRING(n,s) nsDependentString n(NS_REINTERPRET_CAST(const PRUnichar*, s), (sizeof(s)/sizeof(wchar_t))-1)
#else
#define NS_L(s) s
#define NS_MULTILINE_LITERAL_STRING(s) NS_ConvertASCIItoUCS2(s, sizeof(s)-1)
@ -78,7 +81,7 @@ literal_string( const char* aPtr, PRUint32 aLength )
#define NS_LITERAL_STRING(s) NS_MULTILINE_LITERAL_STRING(NS_L(s))
#define NS_NAMED_LITERAL_STRING(n,s) NS_NAMED_MULTILINE_LITERAL_STRING(n,NS_L(s))
#define NS_LITERAL_CSTRING(s) nsLocalCString(s, sizeof(s)-1)
#define NS_NAMED_LITERAL_CSTRING(n,s) nsLocalCString n(s, sizeof(s)-1)
#define NS_LITERAL_CSTRING(s) nsDependentCString(s, sizeof(s)-1)
#define NS_NAMED_LITERAL_CSTRING(n,s) nsDependentCString n(s, sizeof(s)-1)
#endif /* !defined(nsLiteralString_h___) */

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

@ -39,8 +39,8 @@
#include "nsAString.h"
#endif
#ifndef nsLocalString_h___
#include "nsLocalString.h"
#ifndef nsDependentString_h___
#include "nsDependentString.h"
#endif
#ifndef nsBufferHandleUtils_h___
@ -183,7 +183,7 @@ class NS_COM nsSharedBufferList
NewSingleAllocationBuffer( const PRUnichar* aData, PRUint32 aDataLength, PRUint32 aAdditionalCapacity = 1 )
{
typedef Buffer* Buffer_ptr;
return NS_AllocateContiguousHandleWithData(Buffer_ptr(0), nsLocalString(aData, aDataLength), aAdditionalCapacity);
return NS_AllocateContiguousHandleWithData(Buffer_ptr(0), nsDependentString(aData, aDataLength), aAdditionalCapacity);
}
static

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

@ -52,10 +52,10 @@ class nsAFlatCString;
/**
* @see nsLocalString.h
* @see nsDependentString.h
*/
class nsLocalString;
class nsLocalCString;
class nsDependentString;
class nsDependentCString;
#endif /* !defined(nsStringFwd_h___) */

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

@ -44,10 +44,10 @@
template <class CharT>
struct nsStringTraits
{
typedef nsAString abstract_string_type;
typedef nsAPromiseString abstract_promise_type;
typedef nsAFlatString abstract_flat_type;
typedef const nsLocalString literal_string_type;
typedef nsAString abstract_string_type;
typedef nsAPromiseString abstract_promise_type;
typedef nsAFlatString abstract_flat_type;
typedef const nsDependentString literal_string_type;
};
#if 0
@ -56,20 +56,20 @@ struct nsStringTraits
NS_SPECIALIZE_TEMPLATE
struct nsStringTraits<PRUnichar>
{
typedef nsAString abstract_string_type;
typedef nsAPromiseString abstract_promise_type;
typedef nsAFlatString abstract_flat_type;
typedef const nsLocalString literal_string_type;
typedef nsAString abstract_string_type;
typedef nsAPromiseString abstract_promise_type;
typedef nsAFlatString abstract_flat_type;
typedef const nsDependentString literal_string_type;
};
#endif
NS_SPECIALIZE_TEMPLATE
struct nsStringTraits<char>
{
typedef nsACString abstract_string_type;
typedef nsAPromiseCString abstract_promise_type;
typedef nsAFlatCString abstract_flat_type;
typedef const nsLocalCString literal_string_type;
typedef nsACString abstract_string_type;
typedef nsAPromiseCString abstract_promise_type;
typedef nsAFlatCString abstract_flat_type;
typedef const nsDependentCString literal_string_type;
};

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

@ -40,12 +40,9 @@ CPPSRCS = \
nsDependentString.cpp \
nsDependentSubstring.cpp \
nsFragmentedString.cpp \
nsLocalString.cpp \
nsPrintfCString.cpp \
nsPrivateSharableString.cpp \
nsPromiseConcatenation.cpp \
nsPromiseFlatString.cpp \
nsPromiseSubstring.cpp \
nsReadableUtils.cpp \
nsSharableString.cpp \
nsSharedBufferList.cpp \

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

@ -35,12 +35,9 @@ CPP_OBJS = \
.\$(OBJDIR)\nsDependentString.obj \
.\$(OBJDIR)\nsDependentSubstring.obj \
.\$(OBJDIR)\nsFragmentedString.obj \
.\$(OBJDIR)\nsLocalString.obj \
.\$(OBJDIR)\nsPrintfCString.obj \
.\$(OBJDIR)\nsPrivateSharableString.obj \
.\$(OBJDIR)\nsPromiseConcatenation.obj \
.\$(OBJDIR)\nsPromiseFlatString.obj \
.\$(OBJDIR)\nsPromiseSubstring.obj \
.\$(OBJDIR)\nsReadableUtils.obj \
.\$(OBJDIR)\nsSharableString.obj \
.\$(OBJDIR)\nsSharedBufferList.obj \

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

@ -22,8 +22,8 @@
*/
#include "nsAString.h"
#include "nsPromiseSubstring.h"
#include "nsLocalString.h"
#include "nsDependentSubstring.h"
#include "nsDependentString.h"
#include "nsCRT.h"
@ -88,7 +88,7 @@ Compare( const nsAString& lhs, const nsAString& rhs, const nsStringComparator& a
PRBool
nsAString::Equals( const char_type* rhs ) const
{
return Equals(nsLocalString(rhs));
return Equals(nsDependentString(rhs));
}
@ -256,19 +256,19 @@ nsAString::do_AssignFromReadable( const self_type& aReadable )
void
nsAString::do_AssignFromElementPtr( const char_type* aPtr )
{
do_AssignFromReadable(nsLocalString(aPtr));
do_AssignFromReadable(nsDependentString(aPtr));
}
void
nsAString::do_AssignFromElementPtrLength( const char_type* aPtr, size_type aLength )
{
do_AssignFromReadable(nsLocalString(aPtr, aLength));
do_AssignFromReadable(nsDependentString(aPtr, aLength));
}
void
nsAString::do_AssignFromElement( char_type aChar )
{
do_AssignFromReadable(nsLocalString(&aChar, 1));
do_AssignFromReadable(nsDependentString(&aChar, 1));
}
@ -319,21 +319,21 @@ nsAString::do_AppendFromReadable( const self_type& aReadable )
}
void
nsAString::do_AppendFromElementPtr( const char_type* aChar )
nsAString::do_AppendFromElementPtr( const char_type* aPtr )
{
do_AppendFromReadable(nsLocalString(aChar));
do_AppendFromReadable(nsDependentString(aPtr));
}
void
nsAString::do_AppendFromElementPtrLength( const char_type* aChar, size_type aLength )
nsAString::do_AppendFromElementPtrLength( const char_type* aPtr, size_type aLength )
{
do_AppendFromReadable(nsLocalString(aChar, aLength));
do_AppendFromReadable(nsDependentString(aPtr, aLength));
}
void
nsAString::do_AppendFromElement( char_type aChar )
{
do_AppendFromReadable(nsLocalString(&aChar, 1));
do_AppendFromReadable(nsDependentString(&aChar, 1));
}
@ -390,19 +390,19 @@ nsAString::do_InsertFromReadable( const self_type& aReadable, index_type atPosit
void
nsAString::do_InsertFromElementPtr( const char_type* aPtr, index_type atPosition )
{
do_InsertFromReadable(nsLocalString(aPtr), atPosition);
do_InsertFromReadable(nsDependentString(aPtr), atPosition);
}
void
nsAString::do_InsertFromElementPtrLength( const char_type* aPtr, index_type atPosition, size_type aLength )
{
do_InsertFromReadable(nsLocalString(aPtr, aLength), atPosition);
do_InsertFromReadable(nsDependentString(aPtr, aLength), atPosition);
}
void
nsAString::do_InsertFromElement( char_type aChar, index_type atPosition )
{
do_InsertFromReadable(nsLocalString(&aChar, 1), atPosition);
do_InsertFromReadable(nsDependentString(&aChar, 1), atPosition);
}
@ -454,7 +454,7 @@ nsAString::ReplaceFromPromise( index_type cutStart, size_type cutLength, const s
const_iterator fromBegin, fromEnd;
char_type* toBegin = buffer;
copy_string(aReadable.BeginReading(fromBegin), aReadable.EndReading(fromEnd), toBegin);
do_ReplaceFromReadable(cutStart, cutLength, nsLocalString(buffer, length));
do_ReplaceFromReadable(cutStart, cutLength, nsDependentString(buffer, length));
delete buffer;
}
// else assert?
@ -550,7 +550,7 @@ Compare( const nsACString& lhs, const nsACString& rhs, const nsCStringComparator
PRBool
nsACString::Equals( const char_type* rhs ) const
{
return Equals(nsLocalCString(rhs));
return Equals(nsDependentCString(rhs));
}
nsACString::char_type
@ -716,19 +716,19 @@ nsACString::do_AssignFromReadable( const self_type& aReadable )
void
nsACString::do_AssignFromElementPtr( const char_type* aPtr )
{
do_AssignFromReadable(nsLocalCString(aPtr));
do_AssignFromReadable(nsDependentCString(aPtr));
}
void
nsACString::do_AssignFromElementPtrLength( const char_type* aPtr, size_type aLength )
{
do_AssignFromReadable(nsLocalCString(aPtr, aLength));
do_AssignFromReadable(nsDependentCString(aPtr, aLength));
}
void
nsACString::do_AssignFromElement( char_type aChar )
{
do_AssignFromReadable(nsLocalCString(&aChar, 1));
do_AssignFromReadable(nsDependentCString(&aChar, 1));
}
@ -779,21 +779,21 @@ nsACString::do_AppendFromReadable( const self_type& aReadable )
}
void
nsACString::do_AppendFromElementPtr( const char_type* aChar )
nsACString::do_AppendFromElementPtr( const char_type* aPtr )
{
do_AppendFromReadable(nsLocalCString(aChar));
do_AppendFromReadable(nsDependentCString(aPtr));
}
void
nsACString::do_AppendFromElementPtrLength( const char_type* aChar, size_type aLength )
nsACString::do_AppendFromElementPtrLength( const char_type* aPtr, size_type aLength )
{
do_AppendFromReadable(nsLocalCString(aChar, aLength));
do_AppendFromReadable(nsDependentCString(aPtr, aLength));
}
void
nsACString::do_AppendFromElement( char_type aChar )
{
do_AppendFromReadable(nsLocalCString(&aChar, 1));
do_AppendFromReadable(nsDependentCString(&aChar, 1));
}
@ -850,19 +850,19 @@ nsACString::do_InsertFromReadable( const self_type& aReadable, index_type atPosi
void
nsACString::do_InsertFromElementPtr( const char_type* aPtr, index_type atPosition )
{
do_InsertFromReadable(nsLocalCString(aPtr), atPosition);
do_InsertFromReadable(nsDependentCString(aPtr), atPosition);
}
void
nsACString::do_InsertFromElementPtrLength( const char_type* aPtr, index_type atPosition, size_type aLength )
{
do_InsertFromReadable(nsLocalCString(aPtr, aLength), atPosition);
do_InsertFromReadable(nsDependentCString(aPtr, aLength), atPosition);
}
void
nsACString::do_InsertFromElement( char_type aChar, index_type atPosition )
{
do_InsertFromReadable(nsLocalCString(&aChar, 1), atPosition);
do_InsertFromReadable(nsDependentCString(&aChar, 1), atPosition);
}
@ -914,7 +914,7 @@ nsACString::ReplaceFromPromise( index_type cutStart, size_type cutLength, const
const_iterator fromBegin, fromEnd;
char_type* toBegin = buffer;
copy_string(aReadable.BeginReading(fromBegin), aReadable.EndReading(fromEnd), toBegin);
do_ReplaceFromReadable(cutStart, cutLength, nsLocalCString(buffer, length));
do_ReplaceFromReadable(cutStart, cutLength, nsDependentCString(buffer, length));
delete buffer;
}
// else assert?

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

@ -93,7 +93,7 @@ nsLDAPAutoCompleteSession::OnStartLookup(const PRUnichar *searchString,
// that are too short
//
if (searchString[0] == 0 ||
nsLiteralString(searchString).FindChar(PRUnichar('@'), 0) !=
nsDependentString(searchString).FindChar(PRUnichar('@'), 0) !=
kNotFound ||
mMinStringLength && nsCRT::strlen(searchString) < mMinStringLength) {

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

@ -1297,7 +1297,7 @@ void nsHTTPIndex::GetDestination(nsIRDFResource* r, nsXPIDLCString& dest) {
} else {
const PRUnichar* uri;
url->GetValueConst(&uri);
*getter_Copies(dest) = ToNewUTF8String(nsLocalString(uri));
*getter_Copies(dest) = ToNewUTF8String(nsDependentString(uri));
}
}

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

@ -134,8 +134,8 @@ public:
const char *aValue, PRUint32 aValueLen) :
tokenName(aName, aNameLen),
tokenValue(aValue, aValueLen) {}
nsLiteralCString tokenName;
nsLiteralCString tokenValue;
nsDependentCString tokenName;
nsDependentCString tokenValue;
};
// individual search term, pulled from token/value structs
@ -154,9 +154,9 @@ public:
text.AssignWithConversion(aText, textLen);
}
nsLiteralCString datasource; // should always be "history" ?
nsLiteralCString property; // AgeInDays, Hostname, etc
nsLiteralCString method; // is, isgreater, isless
nsDependentCString datasource; // should always be "history" ?
nsDependentCString property; // AgeInDays, Hostname, etc
nsDependentCString method; // is, isgreater, isless
nsAutoString text; // text to match
rowMatchCallback match; // matching callback if needed
};
@ -505,7 +505,7 @@ nsGlobalHistory::~nsGlobalHistory()
mExpireNowTimer->Cancel();
for(PRInt32 i = 0; i < mIgnorePrefixes->Count(); ++i) {
nsLocalString* entry = (nsLocalString*) mIgnorePrefixes->ElementAt(i);
nsDependentString* entry = NS_STATIC_CAST(nsDependentString*, mIgnorePrefixes->ElementAt(i));
delete entry;
}
}
@ -830,7 +830,7 @@ nsGlobalHistory::GetRowValue(nsIMdbRow *aRow, mdb_column aCol,
err = aRow->AliasCellYarn(mEnv, aCol, &yarn);
if (err != 0) return NS_ERROR_FAILURE;
nsLiteralCString url((const char *)yarn.mYarn_Buf, yarn.mYarn_Fill);
nsDependentCString url((const char *)yarn.mYarn_Buf, yarn.mYarn_Fill);
aResult.Assign(url);
return NS_OK;
@ -954,7 +954,7 @@ nsGlobalHistory::MatchHost(nsIMdbRow *aRow,
if (err != 0) return PR_FALSE;
// do smart zero-termination
nsLiteralCString url((const char *)yarn.mYarn_Buf, yarn.mYarn_Fill);
nsDependentCString url((const char *)yarn.mYarn_Buf, yarn.mYarn_Fill);
rv = hostInfo->cachedUrl->SetSpec(nsCAutoString(url).get());
if (NS_FAILED(rv)) return PR_FALSE;
@ -1036,7 +1036,7 @@ nsGlobalHistory::RemoveMatchingRows(rowMatchCallback aMatchFunc,
if (err != 0)
continue;
nsLiteralCString uri((const char*) yarn.mYarn_Buf, yarn.mYarn_Fill);
nsDependentCString uri((const char*) yarn.mYarn_Buf, yarn.mYarn_Fill);
rv = gRDFService->GetResource(nsCAutoString(uri).get(), getter_AddRefs(resource));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource");
@ -2666,7 +2666,7 @@ nsGlobalHistory::GetRootDayQueries(nsISimpleEnumerator **aResult)
PRInt32 i;
nsCOMPtr<nsIRDFResource> finduri;
nsLiteralCString
nsDependentCString
prefix(FIND_BY_AGEINDAYS_PREFIX "is" "&text=");
nsCAutoString uri;
for (i=0; i<7; i++) {
@ -3060,7 +3060,7 @@ nsGlobalHistory::Observe(nsISupports *aSubject, const PRUnichar *aTopic,
{
nsresult rv;
nsLiteralString aTopicString(aTopic);
nsDependentString aTopicString(aTopic);
// pref changing - update member vars
if (aTopicString.Equals(NS_LITERAL_STRING("nsPref:changed"))) {
@ -3139,7 +3139,7 @@ nsGlobalHistory::URLEnumerator::ConvertToISupports(nsIMdbRow* aRow, nsISupports*
// Since the URLEnumerator always returns the value of the URL
// column, we create an RDF resource.
nsLiteralCString uri((const char*) yarn.mYarn_Buf, yarn.mYarn_Fill);
nsDependentCString uri((const char*) yarn.mYarn_Buf, yarn.mYarn_Fill);
nsresult rv;
nsCOMPtr<nsIRDFResource> resource;
@ -3330,7 +3330,7 @@ nsGlobalHistory::RowMatches(nsIMdbRow *aRow,
if (term->method.Equals("is")) {
// is the cell in unicode or not? Hmm...let's assume so?
nsLiteralCString rowVal((const char *)yarn.mYarn_Buf, yarn.mYarn_Fill);
nsDependentCString rowVal((const char *)yarn.mYarn_Buf, yarn.mYarn_Fill);
if (NS_ConvertUCS2toUTF8(term->text) != rowVal)
return PR_FALSE;
@ -3371,7 +3371,7 @@ nsGlobalHistory::SearchEnumerator::ConvertToISupports(nsIMdbRow* aRow,
if (err != 0) return NS_ERROR_FAILURE;
nsLiteralCString uri((const char*)yarn.mYarn_Buf, yarn.mYarn_Fill);
nsDependentCString uri((const char*)yarn.mYarn_Buf, yarn.mYarn_Fill);
rv = gRDFService->GetResource(nsCAutoString(uri).get(),
getter_AddRefs(resource));
@ -3393,7 +3393,7 @@ nsGlobalHistory::SearchEnumerator::ConvertToISupports(nsIMdbRow* aRow,
nsCAutoString findUri(mFindUriPrefix);
nsLiteralCString rowValue((const char *)groupByValue.mYarn_Buf,
nsDependentCString rowValue((const char *)groupByValue.mYarn_Buf,
groupByValue.mYarn_Fill);
findUri.Append(rowValue);
@ -3489,7 +3489,7 @@ nsGlobalHistory::OnStartLookup(const PRUnichar *searchString,
AutoCompleteStatus status = nsIAutoCompleteStatus::failed;
// pass user input through filter before search
nsSharableString filtered = AutoCompletePrefilter(nsLocalString (searchString));
nsSharableString filtered = AutoCompletePrefilter(nsDependentString (searchString));
if (filtered.Length() == 0) {
listener->OnAutoComplete(results, status);
return NS_OK;
@ -3558,7 +3558,7 @@ nsGlobalHistory::AutoCompleteSearch(const nsAReadableString& aSearchString,
if (aPrevResults) {
nsXPIDLString prevURL;
aPrevResults->GetSearchString(getter_Copies(prevURL));
nsLocalString prevURLStr(prevURL);
nsDependentString prevURLStr(prevURL);
// if search string begins with the previous search string, it's a go
searchPrevious = Substring(aSearchString, 0, prevURLStr.Length()).Equals(prevURLStr);
}
@ -3581,7 +3581,7 @@ nsGlobalHistory::AutoCompleteSearch(const nsAReadableString& aSearchString,
nsXPIDLString url;
item->GetValue(getter_Copies(url));
nsLocalString urlstr(url);
nsDependentString urlstr(url);
if (AutoCompleteCompare(urlstr, aSearchString))
resultItems->AppendElement(item);
}