Bug 100476: Convert uses of member functions ToNewUnicode, ToNewCString and ToNewUTF8String to their global versions and remove support from nsCString and nsString. r=dbaron, rs=scc

This commit is contained in:
jaggernaut%netscape.com 2001-09-29 08:28:41 +00:00
Родитель aa12a9c2e9
Коммит ca6197295f
487 изменённых файлов: 2001 добавлений и 1912 удалений

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

@ -24,6 +24,7 @@
#include "nsBasePrincipal.h"
#include "nsScriptSecurityManager.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "plstr.h"
#include "nsIPref.h"
@ -307,13 +308,13 @@ nsBasePrincipal::GetPreferences(char** aPrefName, char** aID,
if (grantedListStr.Length() > 0)
{
grantedListStr.Truncate(grantedListStr.Length()-1);
*aGrantedList = grantedListStr.ToNewCString();
*aGrantedList = ToNewCString(grantedListStr);
if (!*aGrantedList) return NS_ERROR_OUT_OF_MEMORY;
}
if (deniedListStr.Length() > 0)
{
deniedListStr.Truncate(deniedListStr.Length()-1);
*aDeniedList = deniedListStr.ToNewCString();
*aDeniedList = ToNewCString(deniedListStr);
if (!*aDeniedList) return NS_ERROR_OUT_OF_MEMORY;
}
}

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

@ -41,6 +41,7 @@
#include "nsCertificatePrincipal.h"
#include "prmem.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
static NS_DEFINE_IID(kICertificatePrincipalIID, NS_ICERTIFICATEPRINCIPAL_IID);
@ -116,7 +117,7 @@ nsCertificatePrincipal::GetPreferences(char** aPrefName, char** aID,
s.Assign("capability.principal.certificate.p");
s.AppendInt(mCapabilitiesOrdinal++);
s.Append(".id");
mPrefName = s.ToNewCString();
mPrefName = ToNewCString(s);
}
return nsBasePrincipal::GetPreferences(aPrefName, aID,
aGrantedList, aDeniedList);

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

@ -46,6 +46,7 @@
#include "nsCOMPtr.h"
#include "nsIPref.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
NS_IMPL_QUERY_INTERFACE3_CI(nsCodebasePrincipal,
nsICodebasePrincipal,
@ -84,7 +85,7 @@ nsCodebasePrincipal::GetPreferences(char** aPrefName, char** aID,
s.Assign("capability.principal.codebase.p");
s.AppendInt(mCapabilitiesOrdinal++);
s.Append(".id");
mPrefName = s.ToNewCString();
mPrefName = ToNewCString(s);
}
return nsBasePrincipal::GetPreferences(aPrefName, aID,
aGrantedList, aDeniedList);

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

@ -50,6 +50,7 @@
#include "nsAggregatePrincipal.h"
#include "nsCRT.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIJSContextStack.h"
#include "nsDOMError.h"
#include "nsDOMCID.h"
@ -218,7 +219,7 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(PRUint32 aAction,
propertyStr.AppendWithConversion((PRUnichar*)JSValIDToString(aJSContext, aName));
char* property;
property = propertyStr.ToNewCString();
property = ToNewCString(propertyStr);
printf("### CanAccess(%s, %i) ", property, aAction);
PR_FREEIF(property);
}
@ -939,14 +940,14 @@ nsScriptSecurityManager::ReportErrorToConsole(nsIURI* aTarget)
nsCOMPtr<nsIConsoleService> console(do_GetService("@mozilla.org/consoleservice;1"));
if (console)
{
PRUnichar* messageUni = msg.ToNewUnicode();
PRUnichar* messageUni = ToNewUnicode(msg);
if (!messageUni)
return NS_ERROR_FAILURE;
console->LogStringMessage(messageUni);
nsMemory::Free(messageUni);
}
#ifdef DEBUG
char* messageCstr = msg.ToNewCString();
char* messageCstr = ToNewCString(msg);
if (!messageCstr)
return NS_ERROR_FAILURE;
fprintf(stderr, "%s\n", messageCstr);
@ -2007,7 +2008,7 @@ nsScriptSecurityManager::Observe(nsISupports* aObject, const PRUnichar* aAction,
nsresult rv = NS_OK;
nsCAutoString prefNameStr;
prefNameStr.AssignWithConversion(aPrefName);
char* prefName = prefNameStr.ToNewCString();
char* prefName = ToNewCString(prefNameStr);
if (!prefName)
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsISecurityPref> securityPref(do_QueryReferent(mPrefBranchWeakRef));

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

@ -45,6 +45,7 @@
#include "nsIURL.h"
#include "nsCOMPtr.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
NS_IMPL_QUERY_INTERFACE2_CI(nsSystemPrincipal, nsIPrincipal, nsISerializable)
@ -64,7 +65,7 @@ nsSystemPrincipal::ToString(char **result)
nsAutoString buf;
buf.AssignWithConversion("[System]");
*result = buf.ToNewCString();
*result = ToNewCString(buf);
return *result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}

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

@ -64,6 +64,7 @@
#include "nsIRDFContainerUtils.h"
#include "nsHashtable.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsXPIDLString.h"
#include "nsIStringBundle.h"
#include "nsISimpleEnumerator.h"
@ -2751,7 +2752,7 @@ nsChromeRegistry::GetBackstopSheets(nsIDocShell* aDocShell, nsISupportsArray **a
if (!sheets.IsEmpty()) {
// Construct the URIs and try to load each sheet.
nsCAutoString sheetsStr; sheetsStr.AssignWithConversion(sheets);
char* str = sheets.ToNewCString();
char* str = ToNewCString(sheets);
char* newStr;
char* token = nsCRT::strtok( str, ", ", &newStr );
while (token) {

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

@ -43,6 +43,7 @@
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsISupports.h"
#include "nsIContent.h"
#include "nsIContentViewerContainer.h"
@ -2110,23 +2111,17 @@ DocumentViewerImpl::GetWebShellTitleAndURL(nsIWebShell * aWebShell,
presShell->GetDocument(getter_AddRefs(doc));
if (doc) {
const nsString* docTitle = doc->GetDocumentTitle();
if (docTitle != nsnull) {
nsAutoString title(docTitle->get());
if (title.Length() > 0) {
*aTitle = title.ToNewUnicode();
}
if (docTitle && !docTitle->IsEmpty()) {
*aTitle = ToNewUnicode(*docTitle);
}
nsCOMPtr<nsIURI> url;
doc->GetDocumentURL(getter_AddRefs(url));
if (url) {
char * urlCStr;
url->GetSpec(&urlCStr);
if (urlCStr) {
nsAutoString urlStr;
urlStr.AssignWithConversion(urlCStr);
*aURLStr = urlStr.ToNewUnicode();
nsMemory::Free(urlCStr);
nsXPIDLCString urlCStr;
url->GetSpec(getter_Copies(urlCStr));
if (urlCStr.get()) {
*aURLStr = ToNewUnicode(urlCStr);
}
}
@ -3297,8 +3292,7 @@ DocumentViewerImpl::SetupToPrintContent(nsIWebShell* aParent,
docTitleStr = docURLStr;
docURLStr = nsnull;
} else {
nsAutoString docStr(NS_LITERAL_STRING("Document"));
docTitleStr = docStr.ToNewUnicode();
docTitleStr = ToNewUnicode(NS_LITERAL_STRING("Document"));
}
}
// BeginDocument may pass back a FAILURE code
@ -3483,8 +3477,7 @@ DocumentViewerImpl::DoPrint(PrintObject * aPO, PRBool aDoSyncPrinting, PRBool& a
GetWebShellTitleAndURL(webShell, &docTitleStr, &docURLStr);
if (!docTitleStr) {
nsAutoString emptyTitle(NS_LITERAL_STRING(""));
docTitleStr = emptyTitle.ToNewUnicode();
docTitleStr = ToNewUnicode(NS_LITERAL_STRING(""));
}
if (docTitleStr) {
@ -4823,7 +4816,7 @@ NS_IMETHODIMP DocumentViewerImpl::GetDefaultCharacterSet(PRUnichar** aDefaultCha
else
mDefaultCharacterSet.Assign(gDefCharset);
}
*aDefaultCharacterSet = mDefaultCharacterSet.ToNewUnicode();
*aDefaultCharacterSet = ToNewUnicode(mDefaultCharacterSet);
return NS_OK;
}
@ -4853,7 +4846,7 @@ NS_IMETHODIMP DocumentViewerImpl::GetForceCharacterSet(PRUnichar** aForceCharact
*aForceCharacterSet = nsnull;
}
else {
*aForceCharacterSet = mForceCharacterSet.ToNewUnicode();
*aForceCharacterSet = ToNewUnicode(mForceCharacterSet);
}
return NS_OK;
}
@ -4881,7 +4874,7 @@ NS_IMETHODIMP DocumentViewerImpl::GetHintCharacterSet(PRUnichar * *aHintCharacte
if(kCharsetUninitialized == mHintCharsetSource) {
*aHintCharacterSet = nsnull;
} else {
*aHintCharacterSet = mHintCharset.ToNewUnicode();
*aHintCharacterSet = ToNewUnicode(mHintCharset);
// this can't possibly be right. we can't set a value just because somebody got a related value!
//mHintCharsetSource = kCharsetUninitialized;
}

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

@ -52,6 +52,7 @@
#include "nsTextFragment.h"
#include "nsParserCIID.h"
#include "nsContentUtils.h"
#include "nsReadableUtils.h"
static NS_DEFINE_CID(kLWBrkCID, NS_LWBRK_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
@ -1499,7 +1500,7 @@ nsPlainTextSerializer::Write(const nsAReadableString& aString)
#ifdef DEBUG_wrapping
nsAutoString remaining;
str.Right(remaining, totLen - bol);
foo = remaining.ToNewCString();
foo = ToNewCString(remaining);
// printf("Next line: bol = %d, newlinepos = %d, totLen = %d, string = '%s'\n",
// bol, nextpos, totLen, foo);
nsMemory::Free(foo);

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

@ -43,6 +43,8 @@
#include "nscore.h"
#include "nsRange.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIDOMNode.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNSDocument.h"
@ -2299,7 +2301,7 @@ nsRange::CreateContextualFragment(const nsAReadableString& aFragment,
if (nsIDOMNode::ELEMENT_NODE == nodeType) {
parent->GetNodeName(tagName);
// XXX Wish we didn't have to allocate here
name = tagName.ToNewUnicode();
name = ToNewUnicode(tagName);
if (name) {
tagStack->Push(name);
temp = parent;

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

@ -44,6 +44,8 @@
#include "nsWeakReference.h"
#include "nsIFactory.h"
#include "nsIEnumerator.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIDOMRange.h"
#include "nsIFrameSelection.h"
#include "nsISelection.h"
@ -1762,7 +1764,7 @@ nsTypedSelection::ToStringWithFormat(const char * aFormatType, PRUint32 aFlags,
nsAutoString tmp;
rv = encoder->EncodeToString(tmp);
*aReturn = tmp.ToNewUnicode();//get the unicode pointer from it. this is temporary
*aReturn = ToNewUnicode(tmp);//get the unicode pointer from it. this is temporary
return rv;
}
@ -5814,7 +5816,7 @@ nsTypedSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset)
{
nsAutoString tagString;
tag->ToString(tagString);
char * tagCString = tagString.ToNewCString();
char * tagCString = ToNewCString(tagString);
printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset);
delete [] tagCString;
}
@ -6638,7 +6640,7 @@ nsTypedSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset)
{
nsAutoString tagString;
tag->ToString(tagString);
char * tagCString = tagString.ToNewCString();
char * tagCString = ToNewCString(tagString);
printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset);
delete [] tagCString;
}
@ -6736,7 +6738,8 @@ nsTypedSelection::ContainsNode(nsIDOMNode* aNode, PRBool aRecursive, PRBool* aYe
nsAutoString name, value;
aNode->GetNodeName(name);
aNode->GetNodeValue(value);
printf("%s [%s]: %d, %d\n", name.ToNewCString(), value.ToNewCString(),
printf("%s [%s]: %d, %d\n", NS_LossyConvertUCS2toASCII(name).get(),
NS_LossyConvertUCS2toASCII(value).get(),
nodeStartsBeforeRange, nodeEndsAfterRange);
#endif
PRUint16 nodeType;

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

@ -386,9 +386,7 @@ nsAttributeContent::ValidateTextFragment()
nsAutoString result;
mContent->GetAttr(mNameSpaceID, mAttrName, result);
PRUnichar * text = result.ToNewUnicode();
mText.SetTo(text, result.Length());
nsCRT::free(text);
mText.SetTo(result.get(), result.Length());
}
else {
mText.SetTo("", 0);

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

@ -37,6 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsHTMLUtils.h"
#include "nsReadableUtils.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMNSHTMLAnchorElement.h"
#include "nsIDOMEventReceiver.h"
@ -773,7 +774,7 @@ nsHTMLAnchorElement::GetHrefCString(char* &aBuf)
}
else {
// Absolute URL is same as relative URL.
aBuf = relURLSpec.ToNewUTF8String();
aBuf = ToNewUTF8String(relURLSpec);
}
}
else {

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

@ -50,6 +50,7 @@
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsHTMLUtils.h"
#include "nsReadableUtils.h"
class nsHTMLAreaElement : public nsGenericHTMLLeafElement,
@ -512,7 +513,7 @@ nsHTMLAreaElement::GetHrefCString(char* &aBuf)
}
else {
// Absolute URL is same as relative URL.
aBuf = relURLSpec.ToNewUTF8String();
aBuf = ToNewUTF8String(relURLSpec);
}
}
else {

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

@ -50,6 +50,7 @@
#include "nsIStyleSheet.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsStyleLinkElement.h"
#include "nsReadableUtils.h"
#include "nsHTMLUtils.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
@ -355,7 +356,7 @@ nsHTMLLinkElement::GetHrefCString(char* &aBuf)
}
else {
// Absolute URL is same as relative URL.
aBuf = relURLSpec.ToNewUTF8String();
aBuf = ToNewUTF8String(relURLSpec);
}
}
else {

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

@ -52,6 +52,7 @@
#include "nsNetUtil.h"
#include "nsIDocument.h"
#include "nsHTMLUtils.h"
#include "nsReadableUtils.h"
// XXX no SRC attribute
@ -285,7 +286,7 @@ nsHTMLStyleElement::GetHrefCString(char* &aBuf)
}
else {
// Absolute URL is same as relative URL.
aBuf = relURLSpec.ToNewUTF8String();
aBuf = ToNewUTF8String(relURLSpec);
}
}
else {

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

@ -842,7 +842,7 @@ GetOptionText(const nsIParserNode& aNode, nsString& aText)
break;
}
nsAutoString x;
char* y = aText.ToNewCString();
char* y = ToNewCString(aText);
printf("foo");
}
#endif
@ -4002,7 +4002,7 @@ HTMLContentSink::ScrollToRef()
// XXX Duplicate code in nsXMLContentSink.
// XXX Be sure to change both places if you make changes here.
if (!mRef.IsEmpty()) {
char* tmpstr = mRef.ToNewCString();
char* tmpstr = ToNewCString(mRef);
if(! tmpstr)
return;
nsUnescape(tmpstr);

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

@ -43,6 +43,7 @@
#include "nsCOMPtr.h"
#include "nsIFileChannel.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsHTMLDocument.h"
#include "nsIParser.h"
#include "nsIParserFilter.h"
@ -500,7 +501,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
if (NS_SUCCEEDED(rv)) {
#ifdef DEBUG_charset
char* cCharset = charset.ToNewCString();
char* cCharset = ToNewCString(charset);
printf("From HTTP Header, charset = %s\n", cCharset);
Recycle(cCharset);
#endif
@ -649,7 +650,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
{
#ifdef DEBUG_charset
nsAutoString d(requestCharset);
char* cCharset = d.ToNewCString();
char* cCharset = ToNewCString(d);
printf("From request charset, charset = %s req=%d->%d\n",
cCharset, charsetSource, requestCharsetSource);
Recycle(cCharset);
@ -668,7 +669,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
{
#ifdef DEBUG_charset
nsAutoString d(forceCharsetFromWebShell);
char* cCharset = d.ToNewCString();
char* cCharset = ToNewCString(d);
printf("From force, charset = %s \n", cCharset);
Recycle(cCharset);
#endif
@ -766,7 +767,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
csAtom->ToString(charset);
charsetSource = kCharsetFromParentFrame;
// printf("### 0 >>> Having parent CS = %s\n", charset.ToNewCString());
// printf("### 0 >>> Having parent CS = %s\n", NS_LossyConvertUCS2toASCII(charset).get());
}
}
}
@ -848,7 +849,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
nsCOMPtr<nsIParserFilter> oldFilter = getter_AddRefs(mParser->SetParserFilter(cdetflt));
#ifdef DEBUG_charset
char* cCharset = charset.ToNewCString();
char* cCharset = ToNewCString(charset);
printf("set to parser charset = %s source %d\n",
cCharset, charsetSource);
Recycle(cCharset);

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

@ -62,6 +62,7 @@
#include "nsLayoutAtoms.h"
#include "nsIFrame.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsVoidArray.h"
#include "nsIUnicharInputStream.h"
#include "nsHTMLIIDs.h"
@ -2284,7 +2285,7 @@ CSSStyleSheetImpl::CheckRuleForAttributes(nsICSSRule *aRule)
#ifdef DEBUG_shaver_off
nsAutoString str;
sel->mAttr->ToString(str);
char * chars = str.ToNewCString();
char * chars = ToNewCString(str);
fprintf(stderr, "[%s@%p]", chars, this);
nsMemory::Free(chars);
#endif

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

@ -55,6 +55,7 @@
#include "nsIServiceManager.h"
#include "nsIPref.h"
#include "nsReadableUtils.h"
// XXX This is here because nsCachedStyleData is accessed outside of
// the content module; e.g., by nsCSSFrameConstructor.
@ -717,7 +718,7 @@ PRBool nsStyleUtil::IsSimpleXlink(nsIContent *aContent, nsIPresContext *aPresCon
// convert here, rather than twice in NS_MakeAbsoluteURI and
// back again
char * href = val.ToNewCString();
char * href = ToNewCString(val);
char * absHREF = nsnull;
(void) NS_MakeAbsoluteURI(&absHREF, href, baseURI);
nsCRT::free(href);

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

@ -55,6 +55,7 @@
#include "nsIServiceManager.h"
#include "nsIPref.h"
#include "nsReadableUtils.h"
// XXX This is here because nsCachedStyleData is accessed outside of
// the content module; e.g., by nsCSSFrameConstructor.
@ -717,7 +718,7 @@ PRBool nsStyleUtil::IsSimpleXlink(nsIContent *aContent, nsIPresContext *aPresCon
// convert here, rather than twice in NS_MakeAbsoluteURI and
// back again
char * href = val.ToNewCString();
char * href = ToNewCString(val);
char * absHREF = nsnull;
(void) NS_MakeAbsoluteURI(&absHREF, href, baseURI);
nsCRT::free(href);

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

@ -50,6 +50,7 @@
#include "nsIDOMEventReceiver.h"
#include "nsIChannel.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsNetUtil.h"

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

@ -48,6 +48,7 @@
#include "nsIDOMEventReceiver.h"
#include "nsIChannel.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsNetUtil.h"
@ -1045,7 +1046,7 @@ nsXBLPrototypeBinding::InitClass(const nsCString& aClassName, nsIScriptContext *
// Change the class name and we're done.
nsMemory::Free((void*) c->name);
c->name = aClassName.ToNewCString();
c->name = ToNewCString(aClassName);
}
// Add c to our table.
@ -1336,7 +1337,7 @@ nsXBLPrototypeBinding::ConstructAttributeTable(nsIContent* aElement)
}
// The user specified at least one attribute.
char* str = inherits.ToNewCString();
char* str = ToNewCString(inherits);
char* newStr;
// XXX We should use a strtok function that tokenizes PRUnichars
// so that we don't have to convert from Unicode to ASCII and then back
@ -1442,7 +1443,7 @@ nsXBLPrototypeBinding::ConstructInsertionTable(nsIContent* aContent)
}
else {
// The user specified at least one attribute.
char* str = includes.ToNewCString();
char* str = ToNewCString(includes);
char* newStr;
// XXX We should use a strtok function that tokenizes PRUnichar's
// so that we don't have to convert from Unicode to ASCII and then back
@ -1514,7 +1515,7 @@ nsXBLPrototypeBinding::ConstructInterfaceTable(nsIContent* aElement)
mInterfaceTable = new nsSupportsHashtable(4);
// The user specified at least one attribute.
char* str = impls.ToNewCString();
char* str = ToNewCString(impls);
char* newStr;
// XXX We should use a strtok function that tokenizes PRUnichars
// so that we don't have to convert from Unicode to ASCII and then back

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

@ -68,6 +68,7 @@
#include "nsIPref.h"
#include "nsIServiceManager.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsXULAtoms.h"
#include "nsGUIEvent.h"
#include "nsIXPConnect.h"
@ -980,7 +981,7 @@ nsXBLPrototypeHandler::ConstructMask()
nsAutoString modifiers;
mHandlerElement->GetAttr(kNameSpaceID_None, kModifiersAtom, modifiers);
if (!modifiers.IsEmpty()) {
char* str = modifiers.ToNewCString();
char* str = ToNewCString(modifiers);
char* newStr;
char* token = nsCRT::strtok( str, ", ", &newStr );
while( token != NULL ) {

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

@ -49,6 +49,7 @@
#include "nsIPref.h"
#include "nsIServiceManager.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsXULAtoms.h"
#include "nsIXPConnect.h"
#include "nsIDOMScriptObjectFactory.h"
@ -575,7 +576,7 @@ nsresult nsXBLPrototypeProperty::ParseMethod(nsIScriptContext * aContext)
// Get the argname and add it to the array.
nsAutoString argName;
arg->GetAttr(kNameSpaceID_None, kNameAtom, argName);
char* argStr = argName.ToNewCString();
char* argStr = ToNewCString(argName);
args[argCount] = argStr;
argCount++;
}

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

@ -37,6 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsXMLContentSink.h"
#include "nsIElementFactory.h"
#include "nsIParser.h"
@ -276,7 +277,7 @@ nsXMLContentSink::ScrollToRef()
// XXX Duplicate code in nsHTMLContentSink.
// XXX Be sure to change both places if you make changes here.
if (!mRef.IsEmpty()) {
char* tmpstr = mRef.ToNewCString();
char* tmpstr = ToNewCString(mRef);
if(! tmpstr)
return;
nsUnescape(tmpstr);

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

@ -39,8 +39,7 @@
#include "nsTransformMediator.h"
#include "nsIComponentManager.h"
#include "nsString.h"
const char* kTransformerContractIDPrefix = "@mozilla.org/document-transformer;1?type=";
#include "nsReadableUtils.h"
nsresult
NS_NewTransformMediator(nsITransformMediator** aResult,
@ -74,10 +73,10 @@ nsTransformMediator::~nsTransformMediator()
}
static
nsresult ConstructContractID(nsString& aContractID, const nsString& aMimeType)
nsresult ConstructContractID(nsCString& aContractID, const nsString& aMimeType)
{
aContractID.AssignWithConversion(kTransformerContractIDPrefix);
aContractID.Append(aMimeType);
aContractID.Assign(NS_LITERAL_CSTRING("@mozilla.org/document-transformer;1?type="));
aContractID.AppendWithConversion(aMimeType);
return NS_OK;
}
@ -85,20 +84,14 @@ nsresult ConstructContractID(nsString& aContractID, const nsString& aMimeType)
nsresult
nsTransformMediator::Init(const nsString& aMimeType)
{
nsString contractID;
nsCString contractID;
nsresult rv = NS_OK;
// Construct prog ID for the document tranformer component
rv = ConstructContractID(contractID, aMimeType);
if (NS_SUCCEEDED(rv)) {
nsCID cid;
char* contractIDStr = (char*)contractID.ToNewCString();
rv = nsComponentManager::ContractIDToClassID((const char*)contractIDStr, &cid);
if (NS_SUCCEEDED(rv)) {
// Try to find a component that implements the nsIDocumentTransformer interface
mTransformer = do_CreateInstance(cid, &rv);
}
delete [] contractIDStr;
// Try to find a component that implements the nsIDocumentTransformer interface
mTransformer = do_CreateInstance(contractID.get(), &rv);
}
return rv;

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

@ -66,6 +66,7 @@
#include "nsIDOMEventTarget.h"
#include "nsGUIEvent.h"
#include "nsContentUtils.h"
#include "nsReadableUtils.h"
#ifdef PR_LOGGING
static PRLogModuleInfo* gLog;
@ -321,7 +322,7 @@ nsXULCommandDispatcher::UpdateCommands(const nsAReadableString& aEventName)
#if 0
{
char* actionString = aEventName.ToNewCString();
char* actionString = ToNewCString(aEventName);
printf("Doing UpdateCommands(\"%s\")\n", actionString);
free(actionString);
}

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

@ -95,6 +95,7 @@
#include "nsVoidArray.h"
#include "nsWeakPtr.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsXULElement.h"
#include "prlog.h"
#include "prmem.h"
@ -425,8 +426,8 @@ XULContentSinkImpl::~XULContentSinkImpl()
prefix.AssignWithConversion("<default>");
}
char* prefixStr = prefix.ToNewCString();
char* uriStr = uri.ToNewCString();
char* prefixStr = ToNewCString(prefix);
char* uriStr = ToNewCString(uri);
PR_LOG(gLog, PR_LOG_ALWAYS,
("xul: warning: unclosed namespace '%s' (%s)",

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

@ -6592,7 +6592,7 @@ nsXULDocument::InsertElement(nsIContent* aParent, nsIContent* aChild)
nsCOMPtr<nsIDOMXULDocument> xulDocument(do_QueryInterface(document));
nsCOMPtr<nsIDOMElement> domElement;
char* str = posStr.ToNewCString();
char* str = ToNewCString(posStr);
char* rest;
char* token = nsCRT::strtok(str, ", ", &rest);

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

@ -37,6 +37,7 @@
#include "nsLDAPConnection.h"
#include "nsLDAPChannel.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsMimeTypes.h"
#include "nsIPipe.h"
#include "nsXPIDLString.h"
@ -926,7 +927,7 @@ nsLDAPChannel::OnLDAPSearchEntry(nsILDAPMessage *aMessage)
// print all values of this attribute
//
for ( PRUint32 j=0 ; j < valueCount; j++ ) {
entry.Append(NS_ConvertASCIItoUCS2(attrs[i]).ToNewUnicode());
entry.Append(NS_ConvertASCIItoUCS2(attrs[i]));
entry.Append(NS_LITERAL_STRING(": "));
entry.Append(vals[j]);
entry.Append(NS_LITERAL_STRING("\n"));

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

@ -40,6 +40,7 @@
#include "nsLDAPInternal.h"
#include "nsIServiceManager.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIComponentManager.h"
#include "nsLDAPConnection.h"
#include "nsLDAPMessage.h"
@ -307,7 +308,7 @@ nsLDAPConnection::GetBindName(PRUnichar **_retval)
// otherwise, hand out a copy of the bind name
//
*_retval = mBindName->ToNewUnicode();
*_retval = ToNewUnicode(*mBindName);
if (!(*_retval)) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -328,8 +329,8 @@ nsLDAPConnection::GetLdErrno(PRUnichar **matched, PRUnichar **errString,
NS_ENSURE_ARG_POINTER(_retval);
*_retval = ldap_get_lderrno(mConnectionHandle, &match, &err);
*matched = NS_ConvertUTF8toUCS2(match).ToNewUnicode();
*errString = NS_ConvertUTF8toUCS2(err).ToNewUnicode();
*matched = ToNewUnicode(NS_ConvertUTF8toUCS2(match));
*errString = ToNewUnicode(NS_ConvertUTF8toUCS2(err));
return NS_OK;
}
@ -353,7 +354,7 @@ nsLDAPConnection::GetErrorString(PRUnichar **_retval)
// make a copy using the XPCOM shared allocator
//
*_retval = NS_ConvertUTF8toUCS2(rv).ToNewUnicode();
*_retval = ToNewUnicode(NS_ConvertUTF8toUCS2(rv));
if (!*_retval) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -38,6 +38,7 @@
#include "nsDebug.h"
#include "nsCRT.h"
#include "nsLDAPConnection.h"
#include "nsReadableUtils.h"
NS_IMPL_THREADSAFE_ISUPPORTS1(nsLDAPMessage, nsILDAPMessage);
@ -457,7 +458,7 @@ NS_IMETHODIMP nsLDAPMessage::GetDn(PRUnichar **aDn)
// get a copy made with the shared allocator, and dispose of the original
//
*aDn = NS_ConvertUTF8toUCS2(rawDn).ToNewUnicode();
*aDn = ToNewUnicode(NS_ConvertUTF8toUCS2(rawDn));
ldap_memfree(rawDn);
if (!*aDn) {
@ -521,7 +522,7 @@ nsLDAPMessage::GetValues(const char *aAttr, PRUint32 *aCount,
//
PRUint32 i;
for ( i = 0 ; i < numVals ; i++ ) {
(*aValues)[i] = NS_ConvertUTF8toUCS2(values[i]).ToNewUnicode();
(*aValues)[i] = ToNewUnicode(NS_ConvertUTF8toUCS2(values[i]));
if ( ! (*aValues)[i] ) {
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(i, aValues);
return NS_ERROR_OUT_OF_MEMORY;

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

@ -33,6 +33,7 @@
*/
#include "nsLDAPServer.h"
#include "nsReadableUtils.h"
NS_IMPL_THREADSAFE_ISUPPORTS1(nsLDAPServer, nsILDAPServer)
@ -55,7 +56,7 @@ NS_IMETHODIMP nsLDAPServer::GetKey(PRUnichar **_retval)
return NS_ERROR_NULL_POINTER;
}
*_retval = mKey.ToNewUnicode();
*_retval = ToNewUnicode(mKey);
if (!*_retval) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -76,7 +77,7 @@ NS_IMETHODIMP nsLDAPServer::GetUsername(PRUnichar **_retval)
return NS_ERROR_NULL_POINTER;
}
*_retval = mUsername.ToNewUnicode();
*_retval = ToNewUnicode(mUsername);
if (!*_retval) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -97,7 +98,7 @@ NS_IMETHODIMP nsLDAPServer::GetPassword(PRUnichar **_retval)
return NS_ERROR_NULL_POINTER;
}
*_retval = mPassword.ToNewUnicode();
*_retval = ToNewUnicode(mPassword);
if (!*_retval) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -118,7 +119,7 @@ NS_IMETHODIMP nsLDAPServer::GetBinddn(PRUnichar **_retval)
return NS_ERROR_NULL_POINTER;
}
*_retval = mBindDN.ToNewUnicode();
*_retval = ToNewUnicode(mBindDN);
if (!*_retval) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -37,6 +37,7 @@
#include "nsLDAPConnection.h"
#include "nsLDAPOperation.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIServiceManager.h"
#include "nsIConsoleService.h"
#include "nsILDAPURL.h"
@ -1006,22 +1007,21 @@ char *
nsLDAPService::NextToken(nsReadingIterator<PRUnichar> & aIter,
nsReadingIterator<PRUnichar> & aIterEnd)
{
nsAutoString token;
// move past any leading whitespace
//
while ( aIter != aIterEnd && nsCRT::IsAsciiSpace(*aIter) ) {
++aIter;
}
nsAString::const_iterator start(aIter);
// copy the token into our local variable
//
while ( aIter != aIterEnd && !nsCRT::IsAsciiSpace(*aIter) ) {
token.Append(*aIter);
++aIter;
}
return NS_ConvertUCS2toUTF8(token).ToNewCString();
return ToNewUTF8String(Substring(start, aIter));
}
// Note that these 2 functions might go away in the future, see bug 84186.
@ -1038,7 +1038,7 @@ nsLDAPService::UCS2toUTF8(const nsAReadableString &aString,
return NS_ERROR_NULL_POINTER;
}
str = NS_ConvertUCS2toUTF8(aString).ToNewCString();
str = ToNewUTF8String(aString);
if (!str) {
NS_ERROR("nsLDAPService::UCS2toUTF8: out of memory ");
return NS_ERROR_OUT_OF_MEMORY;
@ -1053,14 +1053,6 @@ NS_IMETHODIMP
nsLDAPService::UTF8toUCS2(const char *aString,
nsAWritableString &_retval)
{
PRUnichar *str;
str = NS_ConvertUTF8toUCS2(aString).ToNewUnicode();
if (!str) {
NS_ERROR("nsLDAPService::UTF8toUCS2: out of memory ");
return NS_ERROR_OUT_OF_MEMORY;
}
_retval = str;
_retval = NS_ConvertUTF8toUCS2(aString);
return NS_OK;
}

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

@ -34,6 +34,7 @@
*/
#include "nsLDAPURL.h"
#include "nsReadableUtils.h"
// The two schemes we support, LDAP and LDAPS
//
@ -109,7 +110,7 @@ nsLDAPURL::GetSpec(char **_retval)
spec.Append('?');
while (index < count) {
spec.Append((mAttributes->CStringAt(index++))->ToNewCString());
spec.Append(*(mAttributes->CStringAt(index++)));
if (index < count) {
spec.Append(',');
}
@ -131,7 +132,7 @@ nsLDAPURL::GetSpec(char **_retval)
}
}
*_retval = spec.ToNewCString();
*_retval = ToNewCString(spec);
if (!*_retval) {
NS_ERROR("nsLDAPURL::GetSpec: out of memory ");
return NS_ERROR_OUT_OF_MEMORY;
@ -291,7 +292,7 @@ nsLDAPURL::GetHost(char **_retval)
return NS_ERROR_NULL_POINTER;
}
*_retval = mHost.ToNewCString();
*_retval = ToNewCString(mHost);
if (!*_retval) {
NS_ERROR("nsLDAPURL::GetHost: out of memory ");
return NS_ERROR_OUT_OF_MEMORY;
@ -350,7 +351,7 @@ NS_IMETHODIMP nsLDAPURL::GetPath(char **_retval)
return NS_ERROR_NULL_POINTER;
}
*_retval = mDN.ToNewCString();
*_retval = ToNewCString(mDN);
if (!*_retval) {
NS_ERROR("nsLDAPURL::GetPath: out of memory ");
return NS_ERROR_OUT_OF_MEMORY;
@ -411,7 +412,7 @@ NS_IMETHODIMP nsLDAPURL::GetDn(char **_retval)
return NS_ERROR_NULL_POINTER;
}
*_retval = mDN.ToNewCString();
*_retval = ToNewCString(mDN);
if (!*_retval) {
NS_ERROR("nsLDAPURL::GetDN: out of memory ");
return NS_ERROR_OUT_OF_MEMORY;
@ -449,7 +450,7 @@ NS_IMETHODIMP nsLDAPURL::GetAttributes(PRUint32 *aCount, char ***_retval)
// Loop through the string array, and build up the C-array.
//
while (index < count) {
if (!(cArray[index] = (mAttributes->CStringAt(index))->ToNewCString())) {
if (!(cArray[index] = ToNewCString(*(mAttributes->CStringAt(index))))) {
NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(index, cArray);
NS_ERROR("nsLDAPURL::GetAttributes: out of memory ");
return NS_ERROR_OUT_OF_MEMORY;
@ -567,7 +568,7 @@ NS_IMETHODIMP nsLDAPURL::GetFilter(char **_retval)
return NS_ERROR_NULL_POINTER;
}
*_retval = mFilter.ToNewCString();
*_retval = ToNewCString(mFilter);
if (!*_retval) {
NS_ERROR("nsLDAPURL::GetFilter: out of memory ");
return NS_ERROR_OUT_OF_MEMORY;

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

@ -21,6 +21,7 @@
*/
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsNetUtil.h"
#include "nsEscape.h"
@ -304,7 +305,7 @@ nsresult nsDefaultURIFixup::KeywordURIFixup(const PRUnichar* aStringURI,
if(keyword)
{
nsCAutoString keywordSpec("keyword:");
char *utf8Spec = uriString.ToNewUTF8String();
char *utf8Spec = ToNewUTF8String(uriString);
if(utf8Spec)
{
char* escapedUTF8Spec = nsEscape(utf8Spec, url_Path);

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

@ -40,6 +40,7 @@
#include "prprf.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIChromeEventHandler.h"
#include "nsIDOMWindowInternal.h"
#include "nsIWebBrowserChrome.h"
@ -1126,7 +1127,7 @@ nsDocShell::GetCharset(PRUnichar** aCharset)
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
nsAutoString charset;
NS_ENSURE_SUCCESS(doc->GetDocumentCharacterSet(charset), NS_ERROR_FAILURE);
*aCharset = charset.ToNewUnicode();
*aCharset = ToNewUnicode(charset);
return NS_OK;
}
@ -1416,7 +1417,7 @@ NS_IMETHODIMP
nsDocShell::GetName(PRUnichar ** aName)
{
NS_ENSURE_ARG_POINTER(aName);
*aName = mName.ToNewUnicode();
*aName = ToNewUnicode(mName);
return NS_OK;
}
@ -1864,7 +1865,7 @@ nsDocShell::AddChild(nsIDocShellTreeItem * aChild)
if (NS_FAILED(res))
return NS_OK;
// printf("### 1 >>> Adding child. Parent CS = %s. ItemType = %d.\n", parentCS.ToNewCString(), mItemType);
// printf("### 1 >>> Adding child. Parent CS = %s. ItemType = %d.\n", NS_LossyConvertUCS2toASCII(parentCS).get(), mItemType);
return NS_OK;
}
@ -3083,7 +3084,7 @@ nsDocShell::GetTitle(PRUnichar ** aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);
*aTitle = mTitle.ToNewUnicode();
*aTitle = ToNewUnicode(mTitle);
return NS_OK;
}
@ -4936,7 +4937,7 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor)
if (NS_SUCCEEDED(rv) && shell) {
*aWasAnchor = PR_TRUE;
char *str = sNewRef.ToNewCString();
char *str = ToNewCString(sNewRef);
// nsUnescape modifies the string that is passed into it.
nsUnescape(str);
@ -4965,11 +4966,11 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor)
nsAutoString aCharset;
rv = doc->GetDocumentCharacterSet(aCharset);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
char *charsetStr = aCharset.ToNewCString();
char *charsetStr = ToNewCString(aCharset);
NS_ENSURE_TRUE(charsetStr, NS_ERROR_OUT_OF_MEMORY);
// Use the saved string
char *uriStr = savedNewRef.ToNewCString();
char *uriStr = ToNewCString(savedNewRef);
if (!uriStr) {
nsMemory::Free(charsetStr);
return NS_ERROR_OUT_OF_MEMORY;

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

@ -23,6 +23,7 @@
// Local Includes
#include "nsDocShellLoadInfo.h"
#include "nsReadableUtils.h"
//*****************************************************************************
//*** nsDocShellLoadInfo: Object Management
@ -133,7 +134,7 @@ NS_IMETHODIMP nsDocShellLoadInfo::GetTarget(char** aTarget)
{
NS_ENSURE_ARG_POINTER(aTarget);
*aTarget = mTarget.ToNewCString();
*aTarget = ToNewCString(mTarget);
return NS_OK;
}

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

@ -74,6 +74,7 @@ typedef unsigned long HMTX;
#include "nsCRT.h"
#include "nsVoidArray.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsWidgetsCID.h"
#include "nsGfxCIID.h"
#include "plevent.h"
@ -524,7 +525,7 @@ nsWebShell::GetURL(PRInt32 aIndex, const PRUnichar** aURLResult)
nsXPIDLCString spec;
uri->GetSpec(getter_Copies(spec));
*aURLResult = NS_ConvertASCIItoUCS2(spec).ToNewUnicode();
*aURLResult = ToNewUnicode(NS_ConvertASCIItoUCS2(spec));
return NS_OK;
}

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

@ -60,6 +60,7 @@
#include "nsIJSRuntimeService.h"
#include "nsIPref.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsJSUtils.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
@ -216,7 +217,7 @@ NS_ScriptErrorReporter(JSContext *cx,
error.AppendWithConversion("Error was suppressed by event handler\n");
#ifdef DEBUG
char *errorStr = error.ToNewCString();
char *errorStr = ToNewCString(error);
if (errorStr) {
fprintf(stderr, "%s\n", errorStr);
fflush(stderr);

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

@ -41,6 +41,7 @@
#include "nsCRT.h"
#include "nsDOMError.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsJSProtocolHandler.h"
#include "nsNetUtil.h"
@ -267,7 +268,7 @@ nsresult nsJSThunk::EvaluateScript()
}
else {
// XXXbe this should not decimate! pass back UCS-2 to necko
mResult = result.ToNewCString();
mResult = ToNewCString(result);
mLength = result.Length();
}
return rv;

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

@ -43,6 +43,7 @@
#include "nsISelection.h"
#include "nsIDOMText.h"
#include "nsIDOMElement.h"
#include "nsReadableUtils.h"
//included for new nsEditor::CreateContent()
#include "nsIContent.h"
@ -90,7 +91,7 @@ NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
{
if (gNoisy)
{
char* nodename = mTag.ToNewCString();
char* nodename = ToNewCString(mTag);
printf("Do Create Element parent = %p <%s>, offset = %d\n",
mParent.get(), nodename, mOffsetInParent);
nsMemory::Free(nodename);

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

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsReadableUtils.h"
#include "DeleteElementTxn.h"
#ifdef NS_DEBUG
#include "nsIDOMElement.h"
@ -90,8 +92,8 @@ NS_IMETHODIMP DeleteElementTxn::DoTransaction(void)
if (parentElement)
parentElement->GetTagName(parentElementTag);
char *c, *p;
c = elementTag.ToNewCString();
p = parentElementTag.ToNewCString();
c = ToNewCString(elementTag);
p = ToNewCString(parentElementTag);
if (c&&p)
{
if (gNoisy)
@ -129,8 +131,8 @@ NS_IMETHODIMP DeleteElementTxn::UndoTransaction(void)
if (parentElement)
parentElement->GetTagName(parentElementTag);
char *c, *p;
c = elementTag.ToNewCString();
p = parentElementTag.ToNewCString();
c = ToNewCString(elementTag);
p = ToNewCString(parentElementTag);
if (c&&p)
{
if (gNoisy)

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

@ -40,6 +40,7 @@
#include "nsISelection.h"
#include "nsIContent.h"
#include "nsIDOMNodeList.h"
#include "nsReadableUtils.h"
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
@ -84,7 +85,7 @@ NS_IMETHODIMP InsertElementTxn::DoTransaction(void)
nsCOMPtr<nsIContent>parentAsContent = do_QueryInterface(mParent);
nsString namestr;
mNode->GetNodeName(namestr);
char* nodename = namestr.ToNewCString();
char* nodename = ToNewCString(namestr);
printf("%p Do Insert Element of %p <%s> into parent %p at offset %d\n",
this, nodeAsContent.get(), nodename,
parentAsContent.get(), mOffset);

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

@ -38,6 +38,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsEditorService.h"
#include "nsReadableUtils.h"
nsEditorService::nsEditorService()
{

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

@ -82,6 +82,7 @@
#include "nsIWindowMediator.h"
#include "plevent.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIAppShell.h"
#include "nsIAppShellService.h"
@ -887,7 +888,7 @@ nsEditorShell::SetWebShellWindow(nsIDOMWindowInternal* aWin)
docShellAsItem->GetName(getter_Copies(name));
nsAutoString str(name);
char* cstr = str.ToNewCString();
char* cstr = ToNewCString(str);
printf("Attaching to WebShellWindow[%s]\n", cstr);
nsCRT::free(cstr);
#endif
@ -941,7 +942,7 @@ nsEditorShell::GetEditorType(PRUnichar **_retval)
if (!_retval)
return NS_ERROR_NULL_POINTER;
*_retval = mEditorTypeString.ToNewUnicode();
*_retval = ToNewUnicode(mEditorTypeString);
return NS_OK;
}
@ -951,7 +952,7 @@ NS_IMETHODIMP
nsEditorShell::GetContentsMIMEType(char * *aContentsMIMEType)
{
NS_ENSURE_ARG_POINTER(aContentsMIMEType);
*aContentsMIMEType = mContentMIMEType.ToNewCString();
*aContentsMIMEType = ToNewCString(mContentMIMEType);
return NS_OK;
}
@ -1014,7 +1015,7 @@ nsEditorShell::InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell)
nsAutoString errorMsg; errorMsg.AssignWithConversion("Failed to init editor. Unknown editor type \"");
errorMsg += mEditorTypeString;
errorMsg.AppendWithConversion("\"\n");
char *errorMsgCString = errorMsg.ToNewCString();
char *errorMsgCString = ToNewCString(errorMsg);
NS_WARNING(errorMsgCString);
nsCRT::free(errorMsgCString);
#endif
@ -1324,7 +1325,7 @@ nsEditorShell::GetParagraphState(PRBool *aMixed, PRUnichar **_retval)
nsAutoString state;
err = htmlEditor->GetParagraphState(&bMixed, state);
if (!bMixed)
*_retval = state.ToNewUnicode();
*_retval = ToNewUnicode(state);
}
return err;
}
@ -1350,7 +1351,7 @@ nsEditorShell::GetListState(PRBool *aMixed, PRUnichar **_retval)
if (bOL) tagStr.AssignWithConversion("ol");
else if (bUL) tagStr.AssignWithConversion("ul");
else if (bDL) tagStr.AssignWithConversion("dl");
*_retval = tagStr.ToNewUnicode();
*_retval = ToNewUnicode(tagStr);
}
}
}
@ -1378,7 +1379,7 @@ nsEditorShell::GetListItemState(PRBool *aMixed, PRUnichar **_retval)
if (bLI) tagStr.AssignWithConversion("li");
else if (bDT) tagStr.AssignWithConversion("dt");
else if (bDD) tagStr.AssignWithConversion("dd");
*_retval = tagStr.ToNewUnicode();
*_retval = ToNewUnicode(tagStr);
}
}
}
@ -1409,7 +1410,7 @@ nsEditorShell::GetAlignment(PRBool *aMixed, PRUnichar **_retval)
tagStr.AssignWithConversion("right");
else if (firstAlign == nsIHTMLEditor::eJustify)
tagStr.AssignWithConversion("justify");
*_retval = tagStr.ToNewUnicode();
*_retval = ToNewUnicode(tagStr);
}
}
return err;
@ -2220,7 +2221,7 @@ nsEditorShell::GetLocalFileURL(nsIDOMWindowInternal *parent, const PRUnichar *fi
nsAutoString returnVal;
returnVal.AssignWithConversion((const char*) url);
*_retval = returnVal.ToNewUnicode();
*_retval = ToNewUnicode(returnVal);
if (!*_retval)
res = NS_ERROR_OUT_OF_MEMORY;
@ -2337,11 +2338,11 @@ nsEditorShell::GetDocumentTitle(PRUnichar **title)
nsresult res = GetDocumentTitleString(titleStr);
if (NS_SUCCEEDED(res))
{
*title = titleStr.ToNewUnicode();
*title = ToNewUnicode(titleStr);
} else {
// Don't fail, just return an empty string
nsAutoString empty;
*title = empty.ToNewUnicode();
*title = ToNewUnicode(empty);
res = NS_OK;
}
return res;
@ -3004,7 +3005,7 @@ nsEditorShell::GetContentsAs(const PRUnichar *format, PRUint32 flags,
if (editor)
err = editor->OutputToString(contentsAs, aFormat, flags);
*aContentsAs = contentsAs.ToNewUnicode();
*aContentsAs = ToNewUnicode(contentsAs);
return err;
}
@ -3020,7 +3021,7 @@ nsEditorShell::GetHeadContentsAsHTML(PRUnichar **aHeadContents)
if (editor)
err = editor->GetHeadContentsAsHTML(headContents);
*aHeadContents = headContents.ToNewUnicode();
*aHeadContents = ToNewUnicode(headContents);
return err;
}
@ -4291,7 +4292,7 @@ nsEditorShell::GetSelectedOrParentTableElement(PRUnichar **aTagName, PRInt32 *aS
nsAutoString TagName(*aTagName);
if (tableEditor)
result = tableEditor->GetSelectedOrParentTableElement(*_retval, TagName, *aSelectedCount);
*aTagName = TagName.ToNewUnicode();
*aTagName = ToNewUnicode(TagName);
}
break;
default:
@ -4457,7 +4458,7 @@ nsEditorShell::GetNextMisspelledWord(PRUnichar **aNextMisspelledWord)
DeleteSuggestedWordList();
result = mSpellChecker->NextMisspelledWord(&nextMisspelledWord, &mSuggestedWordList);
}
*aNextMisspelledWord = nextMisspelledWord.ToNewUnicode();
*aNextMisspelledWord = ToNewUnicode(nextMisspelledWord);
return result;
}
@ -4479,7 +4480,7 @@ nsEditorShell::GetSuggestedWord(PRUnichar **aSuggestedWord)
}
result = NS_OK;
}
*aSuggestedWord = word.ToNewUnicode();
*aSuggestedWord = ToNewUnicode(word);
return result;
}
@ -4553,7 +4554,7 @@ nsEditorShell::GetPersonalDictionaryWord(PRUnichar **aDictionaryWord)
}
result = NS_OK;
}
*aDictionaryWord = word.ToNewUnicode();
*aDictionaryWord = ToNewUnicode(word);
return result;
}
@ -4635,7 +4636,7 @@ nsEditorShell::GetDictionaryList(PRUnichar ***aDictionaryList, PRUint32 *aCount)
for (i = 0; i < *aCount; i++)
{
dictList.StringAt(i, dictStr);
tmpPtr[i] = dictStr.ToNewUnicode();
tmpPtr[i] = ToNewUnicode(dictStr);
}
}
@ -4660,7 +4661,7 @@ nsEditorShell::GetCurrentDictionary(PRUnichar **aDictionary)
if (NS_FAILED(result))
return result;
*aDictionary = dictStr.ToNewUnicode();
*aDictionary = ToNewUnicode(dictStr);
}
return result;

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

@ -38,6 +38,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsICaret.h"
#include "nsReadableUtils.h"
#include "nsHTMLEditor.h"
#include "nsHTMLEditRules.h"
@ -545,7 +546,7 @@ nsHTMLEditor::NodeIsBlockStatic(nsIDOMNode *aNode, PRBool *aIsBlock)
{
nsAutoString assertmsg (NS_LITERAL_STRING("Parser and editor disagree on blockness: "));
assertmsg.Append(tagName);
char* assertstr = assertmsg.ToNewCString();
char* assertstr = ToNewCString(assertmsg);
NS_ASSERTION(*aIsBlock, assertstr);
Recycle(assertstr);
}

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

@ -37,6 +37,8 @@
* ***** END LICENSE BLOCK ***** */
#include "nsICaret.h"
#include "nsReadableUtils.h"
#include "nsHTMLEditor.h"
#include "nsHTMLEditRules.h"
#include "nsTextEditUtils.h"
@ -827,7 +829,7 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
{
nsAutoString propString;
aProperty->ToString(propString);
char *propCString = propString.ToNewCString();
char *propCString = ToNewCString(propString);
if (gNoisy) { printf("nsTextEditor::GetTextProperty %s\n", propCString); }
nsCRT::free(propCString);
}

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

@ -39,6 +39,7 @@
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsInternetCiter.h"
#include "nsCOMPtr.h"
@ -229,7 +230,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
{
#ifdef DEBUG_wrapping
nsAutoString debug (Substring(tString, posInString, length-posInString));
printf("Outer loop: '%s'\n", debug.ToNewCString());
printf("Outer loop: '%s'\n", NS_LossyConvertUCS2toASCII(debug).get());
#endif
// Get the new cite level here since we're at the beginning of a line
@ -309,7 +310,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
#ifdef DEBUG_wrapping
nsAutoString debug (Substring(tString, posInString,
nextNewline-posInString));
printf("Unquoted: appending '%s'\n", debug.ToNewCString());
printf("Unquoted: appending '%s'\n", NS_LossyConvertUCS2toASCII(debug).get());
#endif
aOutString.Append(Substring(tString, posInString,
nextNewline-posInString));
@ -332,7 +333,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
{
#ifdef DEBUG_wrapping
nsAutoString debug (Substring(tString, posInString, nextNewline-posInString));
printf("Inner loop: '%s'\n", debug.ToNewCString());
printf("Inner loop: '%s'\n", NS_LossyConvertUCS2toASCII(debug).get());
#endif
// If this is a short line, just append it and continue:
@ -344,7 +345,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
++nextNewline;
#ifdef DEBUG_wrapping
nsAutoString debug (Substring(tString, posInString, nextNewline - posInString));
printf("Short line: '%s'\n", debug.ToNewCString());
printf("Short line: '%s'\n", NS_LossyConvertUCS2toASCII(debug).get());
#endif
aOutString += Substring(tString,
posInString, nextNewline - posInString);
@ -401,7 +402,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
} // end inner loop within one line of aInString
#ifdef DEBUG_wrapping
printf("---------\nEnd inner loop: out string is now '%s'\n-----------\n",
aOutString.ToNewCString());
NS_LossyConvertUCS2toASCII(aOutString).get());
#endif
} // end outer loop over lines of aInString

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

@ -82,6 +82,7 @@
#include "nsIWindowMediator.h"
#include "plevent.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIAppShell.h"
#include "nsIAppShellService.h"
@ -887,7 +888,7 @@ nsEditorShell::SetWebShellWindow(nsIDOMWindowInternal* aWin)
docShellAsItem->GetName(getter_Copies(name));
nsAutoString str(name);
char* cstr = str.ToNewCString();
char* cstr = ToNewCString(str);
printf("Attaching to WebShellWindow[%s]\n", cstr);
nsCRT::free(cstr);
#endif
@ -941,7 +942,7 @@ nsEditorShell::GetEditorType(PRUnichar **_retval)
if (!_retval)
return NS_ERROR_NULL_POINTER;
*_retval = mEditorTypeString.ToNewUnicode();
*_retval = ToNewUnicode(mEditorTypeString);
return NS_OK;
}
@ -951,7 +952,7 @@ NS_IMETHODIMP
nsEditorShell::GetContentsMIMEType(char * *aContentsMIMEType)
{
NS_ENSURE_ARG_POINTER(aContentsMIMEType);
*aContentsMIMEType = mContentMIMEType.ToNewCString();
*aContentsMIMEType = ToNewCString(mContentMIMEType);
return NS_OK;
}
@ -1014,7 +1015,7 @@ nsEditorShell::InstantiateEditor(nsIDOMDocument *aDoc, nsIPresShell *aPresShell)
nsAutoString errorMsg; errorMsg.AssignWithConversion("Failed to init editor. Unknown editor type \"");
errorMsg += mEditorTypeString;
errorMsg.AppendWithConversion("\"\n");
char *errorMsgCString = errorMsg.ToNewCString();
char *errorMsgCString = ToNewCString(errorMsg);
NS_WARNING(errorMsgCString);
nsCRT::free(errorMsgCString);
#endif
@ -1324,7 +1325,7 @@ nsEditorShell::GetParagraphState(PRBool *aMixed, PRUnichar **_retval)
nsAutoString state;
err = htmlEditor->GetParagraphState(&bMixed, state);
if (!bMixed)
*_retval = state.ToNewUnicode();
*_retval = ToNewUnicode(state);
}
return err;
}
@ -1350,7 +1351,7 @@ nsEditorShell::GetListState(PRBool *aMixed, PRUnichar **_retval)
if (bOL) tagStr.AssignWithConversion("ol");
else if (bUL) tagStr.AssignWithConversion("ul");
else if (bDL) tagStr.AssignWithConversion("dl");
*_retval = tagStr.ToNewUnicode();
*_retval = ToNewUnicode(tagStr);
}
}
}
@ -1378,7 +1379,7 @@ nsEditorShell::GetListItemState(PRBool *aMixed, PRUnichar **_retval)
if (bLI) tagStr.AssignWithConversion("li");
else if (bDT) tagStr.AssignWithConversion("dt");
else if (bDD) tagStr.AssignWithConversion("dd");
*_retval = tagStr.ToNewUnicode();
*_retval = ToNewUnicode(tagStr);
}
}
}
@ -1409,7 +1410,7 @@ nsEditorShell::GetAlignment(PRBool *aMixed, PRUnichar **_retval)
tagStr.AssignWithConversion("right");
else if (firstAlign == nsIHTMLEditor::eJustify)
tagStr.AssignWithConversion("justify");
*_retval = tagStr.ToNewUnicode();
*_retval = ToNewUnicode(tagStr);
}
}
return err;
@ -2220,7 +2221,7 @@ nsEditorShell::GetLocalFileURL(nsIDOMWindowInternal *parent, const PRUnichar *fi
nsAutoString returnVal;
returnVal.AssignWithConversion((const char*) url);
*_retval = returnVal.ToNewUnicode();
*_retval = ToNewUnicode(returnVal);
if (!*_retval)
res = NS_ERROR_OUT_OF_MEMORY;
@ -2337,11 +2338,11 @@ nsEditorShell::GetDocumentTitle(PRUnichar **title)
nsresult res = GetDocumentTitleString(titleStr);
if (NS_SUCCEEDED(res))
{
*title = titleStr.ToNewUnicode();
*title = ToNewUnicode(titleStr);
} else {
// Don't fail, just return an empty string
nsAutoString empty;
*title = empty.ToNewUnicode();
*title = ToNewUnicode(empty);
res = NS_OK;
}
return res;
@ -3004,7 +3005,7 @@ nsEditorShell::GetContentsAs(const PRUnichar *format, PRUint32 flags,
if (editor)
err = editor->OutputToString(contentsAs, aFormat, flags);
*aContentsAs = contentsAs.ToNewUnicode();
*aContentsAs = ToNewUnicode(contentsAs);
return err;
}
@ -3020,7 +3021,7 @@ nsEditorShell::GetHeadContentsAsHTML(PRUnichar **aHeadContents)
if (editor)
err = editor->GetHeadContentsAsHTML(headContents);
*aHeadContents = headContents.ToNewUnicode();
*aHeadContents = ToNewUnicode(headContents);
return err;
}
@ -4291,7 +4292,7 @@ nsEditorShell::GetSelectedOrParentTableElement(PRUnichar **aTagName, PRInt32 *aS
nsAutoString TagName(*aTagName);
if (tableEditor)
result = tableEditor->GetSelectedOrParentTableElement(*_retval, TagName, *aSelectedCount);
*aTagName = TagName.ToNewUnicode();
*aTagName = ToNewUnicode(TagName);
}
break;
default:
@ -4457,7 +4458,7 @@ nsEditorShell::GetNextMisspelledWord(PRUnichar **aNextMisspelledWord)
DeleteSuggestedWordList();
result = mSpellChecker->NextMisspelledWord(&nextMisspelledWord, &mSuggestedWordList);
}
*aNextMisspelledWord = nextMisspelledWord.ToNewUnicode();
*aNextMisspelledWord = ToNewUnicode(nextMisspelledWord);
return result;
}
@ -4479,7 +4480,7 @@ nsEditorShell::GetSuggestedWord(PRUnichar **aSuggestedWord)
}
result = NS_OK;
}
*aSuggestedWord = word.ToNewUnicode();
*aSuggestedWord = ToNewUnicode(word);
return result;
}
@ -4553,7 +4554,7 @@ nsEditorShell::GetPersonalDictionaryWord(PRUnichar **aDictionaryWord)
}
result = NS_OK;
}
*aDictionaryWord = word.ToNewUnicode();
*aDictionaryWord = ToNewUnicode(word);
return result;
}
@ -4635,7 +4636,7 @@ nsEditorShell::GetDictionaryList(PRUnichar ***aDictionaryList, PRUint32 *aCount)
for (i = 0; i < *aCount; i++)
{
dictList.StringAt(i, dictStr);
tmpPtr[i] = dictStr.ToNewUnicode();
tmpPtr[i] = ToNewUnicode(dictStr);
}
}
@ -4660,7 +4661,7 @@ nsEditorShell::GetCurrentDictionary(PRUnichar **aDictionary)
if (NS_FAILED(result))
return result;
*aDictionary = dictStr.ToNewUnicode();
*aDictionary = ToNewUnicode(dictStr);
}
return result;

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

@ -43,6 +43,7 @@
#include "nsISelection.h"
#include "nsIDOMText.h"
#include "nsIDOMElement.h"
#include "nsReadableUtils.h"
//included for new nsEditor::CreateContent()
#include "nsIContent.h"
@ -90,7 +91,7 @@ NS_IMETHODIMP CreateElementTxn::DoTransaction(void)
{
if (gNoisy)
{
char* nodename = mTag.ToNewCString();
char* nodename = ToNewCString(mTag);
printf("Do Create Element parent = %p <%s>, offset = %d\n",
mParent.get(), nodename, mOffsetInParent);
nsMemory::Free(nodename);

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

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsReadableUtils.h"
#include "DeleteElementTxn.h"
#ifdef NS_DEBUG
#include "nsIDOMElement.h"
@ -90,8 +92,8 @@ NS_IMETHODIMP DeleteElementTxn::DoTransaction(void)
if (parentElement)
parentElement->GetTagName(parentElementTag);
char *c, *p;
c = elementTag.ToNewCString();
p = parentElementTag.ToNewCString();
c = ToNewCString(elementTag);
p = ToNewCString(parentElementTag);
if (c&&p)
{
if (gNoisy)
@ -129,8 +131,8 @@ NS_IMETHODIMP DeleteElementTxn::UndoTransaction(void)
if (parentElement)
parentElement->GetTagName(parentElementTag);
char *c, *p;
c = elementTag.ToNewCString();
p = parentElementTag.ToNewCString();
c = ToNewCString(elementTag);
p = ToNewCString(parentElementTag);
if (c&&p)
{
if (gNoisy)

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

@ -40,6 +40,7 @@
#include "nsISelection.h"
#include "nsIContent.h"
#include "nsIDOMNodeList.h"
#include "nsReadableUtils.h"
#ifdef NS_DEBUG
static PRBool gNoisy = PR_FALSE;
@ -84,7 +85,7 @@ NS_IMETHODIMP InsertElementTxn::DoTransaction(void)
nsCOMPtr<nsIContent>parentAsContent = do_QueryInterface(mParent);
nsString namestr;
mNode->GetNodeName(namestr);
char* nodename = namestr.ToNewCString();
char* nodename = ToNewCString(namestr);
printf("%p Do Insert Element of %p <%s> into parent %p at offset %d\n",
this, nodeAsContent.get(), nodename,
parentAsContent.get(), mOffset);

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

@ -38,6 +38,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsEditorService.h"
#include "nsReadableUtils.h"
nsEditorService::nsEditorService()
{

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

@ -38,6 +38,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsICaret.h"
#include "nsReadableUtils.h"
#include "nsHTMLEditor.h"
#include "nsHTMLEditRules.h"
@ -545,7 +546,7 @@ nsHTMLEditor::NodeIsBlockStatic(nsIDOMNode *aNode, PRBool *aIsBlock)
{
nsAutoString assertmsg (NS_LITERAL_STRING("Parser and editor disagree on blockness: "));
assertmsg.Append(tagName);
char* assertstr = assertmsg.ToNewCString();
char* assertstr = ToNewCString(assertmsg);
NS_ASSERTION(*aIsBlock, assertstr);
Recycle(assertstr);
}

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

@ -37,6 +37,8 @@
* ***** END LICENSE BLOCK ***** */
#include "nsICaret.h"
#include "nsReadableUtils.h"
#include "nsHTMLEditor.h"
#include "nsHTMLEditRules.h"
#include "nsTextEditUtils.h"
@ -827,7 +829,7 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
{
nsAutoString propString;
aProperty->ToString(propString);
char *propCString = propString.ToNewCString();
char *propCString = ToNewCString(propString);
if (gNoisy) { printf("nsTextEditor::GetTextProperty %s\n", propCString); }
nsCRT::free(propCString);
}

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

@ -39,6 +39,7 @@
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsInternetCiter.h"
#include "nsCOMPtr.h"
@ -229,7 +230,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
{
#ifdef DEBUG_wrapping
nsAutoString debug (Substring(tString, posInString, length-posInString));
printf("Outer loop: '%s'\n", debug.ToNewCString());
printf("Outer loop: '%s'\n", NS_LossyConvertUCS2toASCII(debug).get());
#endif
// Get the new cite level here since we're at the beginning of a line
@ -309,7 +310,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
#ifdef DEBUG_wrapping
nsAutoString debug (Substring(tString, posInString,
nextNewline-posInString));
printf("Unquoted: appending '%s'\n", debug.ToNewCString());
printf("Unquoted: appending '%s'\n", NS_LossyConvertUCS2toASCII(debug).get());
#endif
aOutString.Append(Substring(tString, posInString,
nextNewline-posInString));
@ -332,7 +333,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
{
#ifdef DEBUG_wrapping
nsAutoString debug (Substring(tString, posInString, nextNewline-posInString));
printf("Inner loop: '%s'\n", debug.ToNewCString());
printf("Inner loop: '%s'\n", NS_LossyConvertUCS2toASCII(debug).get());
#endif
// If this is a short line, just append it and continue:
@ -344,7 +345,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
++nextNewline;
#ifdef DEBUG_wrapping
nsAutoString debug (Substring(tString, posInString, nextNewline - posInString));
printf("Short line: '%s'\n", debug.ToNewCString());
printf("Short line: '%s'\n", NS_LossyConvertUCS2toASCII(debug).get());
#endif
aOutString += Substring(tString,
posInString, nextNewline - posInString);
@ -401,7 +402,7 @@ nsInternetCiter::Rewrap(const nsAReadableString& aInString,
} // end inner loop within one line of aInString
#ifdef DEBUG_wrapping
printf("---------\nEnd inner loop: out string is now '%s'\n-----------\n",
aOutString.ToNewCString());
NS_LossyConvertUCS2toASCII(aOutString).get());
#endif
} // end outer loop over lines of aInString

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

@ -45,6 +45,7 @@
#include "WebBrowserContainer.h"
#include "nsICategoryManager.h"
#include "nsReadableUtils.h"
CWebBrowserContainer::CWebBrowserContainer(CMozillaBrowser *pOwner)
{
@ -491,7 +492,7 @@ CWebBrowserContainer::GetTitle(PRUnichar * *aTitle)
if (!aTitle)
return E_INVALIDARG;
*aTitle = m_sTitle.ToNewUnicode();
*aTitle = ToNewUnicode(m_sTitle);
return NS_OK;
}

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

@ -20,6 +20,7 @@
*/
#include "EmbedPrompter.h"
#include "nsReadableUtils.h"
// call backs from gtk widgets
@ -152,19 +153,19 @@ EmbedPrompter::GetConfirmValue(PRBool *aConfirmValue)
void
EmbedPrompter::GetTextValue(PRUnichar **aTextValue)
{
*aTextValue = mTextValue.ToNewUnicode();
*aTextValue = ToNewUnicode(mTextValue);
}
void
EmbedPrompter::GetUser(PRUnichar **aUser)
{
*aUser = mUser.ToNewUnicode();
*aUser = ToNewUnicode(mUser);
}
void
EmbedPrompter::GetPassword(PRUnichar **aPass)
{
*aPass = mPass.ToNewUnicode();
*aPass = ToNewUnicode(mPass);
}
void

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

@ -25,6 +25,7 @@
#include <nsIComponentManager.h>
#include <nsIDocShellTreeItem.h>
#include "nsIWidget.h"
#include "nsReadableUtils.h"
#include "EmbedWindow.h"
#include "EmbedPrivate.h"
@ -316,7 +317,7 @@ EmbedWindow::SetFocus(void)
NS_IMETHODIMP
EmbedWindow::GetTitle(PRUnichar **aTitle)
{
*aTitle = mTitle.ToNewUnicode();
*aTitle = ToNewUnicode(mTitle);
return NS_OK;
}
@ -370,7 +371,7 @@ EmbedWindow::OnShowTooltip(PRInt32 aXCoords, PRInt32 aYCoords,
{
nsAutoString tipText ( aTipText );
const char* tipString = tipText.ToNewCString();
const char* tipString = ToNewCString(tipText);
if (sTipWindow)
gtk_widget_destroy(sTipWindow);

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

@ -1078,7 +1078,7 @@ gtk_moz_embed_get_title_unichar (GtkMozEmbed *embed)
embedPrivate = (EmbedPrivate *)embed->data;
if (embedPrivate->mWindow)
retval = embedPrivate->mWindow->mTitle.ToNewUnicode();
retval = ToNewUnicode(embedPrivate->mWindow->mTitle);
return retval;
}

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

@ -46,6 +46,7 @@
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIDOMWindow.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIFactory.h"
@ -119,7 +120,7 @@ NS_IMETHODIMP CPromptService::Alert(nsIDOMWindow *parent, const PRUnichar *dialo
nsString mTitle(dialogTitle);
nsString mText(text);
CWebBrowserContainer *w = GetWebBrowser( parent );
w->InvokeDialogCallback(Pt_MOZ_DIALOG_ALERT, mTitle.ToNewCString(), mText.ToNewCString(), nsnull, nsnull);
w->InvokeDialogCallback(Pt_MOZ_DIALOG_ALERT, ToNewCString(mTitle), ToNewCString(mText), nsnull, nsnull);
return NS_OK;
}
@ -136,8 +137,8 @@ NS_IMETHODIMP CPromptService::AlertCheck(nsIDOMWindow *parent,
int ret;
CWebBrowserContainer *w = GetWebBrowser( parent );
w->InvokeDialogCallback(Pt_MOZ_DIALOG_ALERT, mTitle.ToNewCString(), mText.ToNewCString(), \
mMsg.ToNewCString(), &ret);
w->InvokeDialogCallback(Pt_MOZ_DIALOG_ALERT, ToNewCString(mTitle), ToNewCString(mText), \
ToNewCString(mMsg), &ret);
*checkValue = ret;
return NS_OK;
@ -153,7 +154,7 @@ NS_IMETHODIMP CPromptService::Confirm(nsIDOMWindow *parent,
nsString mText(text);
CWebBrowserContainer *w = GetWebBrowser( parent );
if (w->InvokeDialogCallback(Pt_MOZ_DIALOG_CONFIRM, mTitle.ToNewCString(), mText.ToNewCString(), nsnull, nsnull) == Pt_CONTINUE)
if (w->InvokeDialogCallback(Pt_MOZ_DIALOG_CONFIRM, ToNewCString(mTitle), ToNewCString(mText), nsnull, nsnull) == Pt_CONTINUE)
*_retval = PR_TRUE;
else
*_retval = PR_FALSE;
@ -187,8 +188,8 @@ NS_IMETHODIMP CPromptService::Prompt(nsIDOMWindow *parent,
CWebBrowserContainer *w = GetWebBrowser( parent );
if (w->InvokeDialogCallback(Pt_MOZ_DIALOG_CONFIRM, mTitle.ToNewCString(), mText.ToNewCString(), \
mMsg.ToNewCString(), &ret) == Pt_CONTINUE)
if (w->InvokeDialogCallback(Pt_MOZ_DIALOG_CONFIRM, ToNewCString(mTitle), ToNewCString(mText), \
ToNewCString(mMsg), &ret) == Pt_CONTINUE)
*_retval = PR_TRUE;
else
*_retval = PR_FALSE;
@ -225,15 +226,15 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
cbinfo.cbdata = &auth;
memset(&auth, 0, sizeof(PtMozillaAuthenticateCb_t));
auth.title = mTitle.ToNewCString();
auth.realm = mRealm.ToNewCString();
auth.title = ToNewCString(mTitle);
auth.realm = ToNewCString(mRealm);
if (PtInvokeCallbackList(cb, (PtWidget_t *)moz, &cbinfo) == Pt_CONTINUE)
{
nsCString mUser(auth.user);
nsCString mPass(auth.pass);
*username = mUser.ToNewUnicode();
*password = mPass.ToNewUnicode();
*username = ToNewUnicode(mUser);
*password = ToNewUnicode(mPass);
*_retval = PR_TRUE;
}
else

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

@ -57,6 +57,7 @@
#include "nsIFocusController.h"
#include "PromptService.h"
#include "nsReadableUtils.h"
#include "nsIViewManager.h"
#include "nsIPresShell.h"
@ -547,8 +548,7 @@ static void mozilla_modify( PtWidget_t *widget, PtArg_t const *argt ) {
case Pt_ARG_MOZ_ENCODING: {
nsCString mStr( (char*)argt->value );
PRUnichar *ustring = mStr.ToNewUnicode();
moz->MyBrowser->mPrefs->SetUnicharPref( "intl.charset.default", ustring );
moz->MyBrowser->mPrefs->SetUnicharPref( "intl.charset.default", mStr.get() );
}
break;
@ -596,8 +596,7 @@ static void mozilla_modify( PtWidget_t *widget, PtArg_t const *argt ) {
nsCString searchString( wdata->FindInfo.szString );
nsCOMPtr<nsIWebBrowserFind> finder( do_GetInterface( moz->MyBrowser->WebBrowser ) );
PRUnichar *u = searchString.ToNewUnicode( );
finder->SetSearchString( u );
finder->SetSearchString( searchString.get() );
finder->SetMatchCase( wdata->FindInfo.flags & FINDFLAG_MATCH_CASE );
finder->SetFindBackwards( wdata->FindInfo.flags & FINDFLAG_GO_BACKWARDS );
@ -740,10 +739,7 @@ static int mozilla_get_info(PtWidget_t *widget, PtArg_t *argt)
PRUnichar *charset = nsnull;
moz->MyBrowser->mPrefs->GetLocalizedUnicharPref( "intl.charset.default", &charset );
nsAutoString str( charset );
const char *s=NS_ConvertUCS2toUTF8(str).get();
strcpy( (char*)argt->value, s );
strcpy( (char*)argt->value, NS_ConvertUCS2toUTF8(charset).get() );
}
break;
@ -764,7 +760,7 @@ static int mozilla_get_info(PtWidget_t *widget, PtArg_t *argt)
entry->GetURI( &url );
nsString stitle( title );
strncpy( HistoryReplyBuf[j].title, stitle.ToNewCString(), 127 );
strncpy( HistoryReplyBuf[j].title, ToNewCString(stitle), 127 );
HistoryReplyBuf[j].title[127] = '\0';
char *urlspec;
@ -796,32 +792,22 @@ static void mozilla_set_pref( PtWidget_t *widget, char *option, char *value ) {
/* HTML Options */
if( !strcmp( option, "A:visited color" ) ) {
nsCString mStr( value );
PRUnichar *ustring = mStr.ToNewUnicode();
moz->MyBrowser->mPrefs->SetUnicharPref( "browser.visited_color", ustring );
moz->MyBrowser->mPrefs->SetUnicharPref( "browser.visited_color", NS_ConvertASCIItoUCS2(value).get() );
}
else if( !strcmp( option, "A:link color" ) ) {
nsCString mStr( value );
PRUnichar *ustring = mStr.ToNewUnicode();
moz->MyBrowser->mPrefs->SetUnicharPref( "browser.anchor_color", ustring );
moz->MyBrowser->mPrefs->SetUnicharPref( "browser.anchor_color", NS_ConvertASCIItoUCS2(value).get() );
}
/* the mozserver already has A:link color == browser.anchor_color for this */
// else if( !strcmp( option, "A:active color" ) ) {
// nsCString mStr( value );
// PRUnichar *ustring = mStr.ToNewUnicode();
// moz->MyBrowser->mPrefs->SetUnicharPref( "browser.anchor_color", ustring );
// moz->MyBrowser->mPrefs->SetUnicharPref( "browser.anchor_color", NS_ConvertASCIItoUCS2(value).get() );
// }
else if( !strcmp( option, "BODY color" ) ) {
nsCString mStr( value );
PRUnichar *ustring = mStr.ToNewUnicode();
moz->MyBrowser->mPrefs->SetUnicharPref( "browser.display.foreground_color", ustring );
moz->MyBrowser->mPrefs->SetUnicharPref( "browser.display.foreground_color", NS_ConvertASCIItoUCS2(value).get() );
}
else if( !strcmp( option, "BODY background" ) ) {
nsCString mStr( value );
PRUnichar *ustring = mStr.ToNewUnicode();
moz->MyBrowser->mPrefs->SetUnicharPref( "browser.display.background_color", ustring );
moz->MyBrowser->mPrefs->SetUnicharPref( "browser.display.background_color", NS_ConvertASCIItoUCS2(value).get() );
}
else if( !strcmp( option, "bIgnoreDocumentAttributes" ) )
moz->MyBrowser->mPrefs->SetBoolPref( "browser.display.use_document_colors", stricmp( value, "TRUE" ) ? PR_FALSE : PR_TRUE );

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

@ -47,6 +47,7 @@
#include "nsIDOMNamedNodeMap.h"
#include "nsIWindowCreator.h"
#include "nsIWindowWatcher.h"
#include "nsReadableUtils.h"
CWebBrowserContainer::CWebBrowserContainer(PtWidget_t *pOwner)
{
@ -202,7 +203,7 @@ NS_IMETHODIMP CWebBrowserContainer::OnShowContextMenu(PRUint32 aContextFlags, ns
}
if( moz->rightClickUrl ) free( moz->rightClickUrl );
moz->rightClickUrl = strdup( rightClickUrl.ToNewCString() );
moz->rightClickUrl = ToNewCString(rightClickUrl);
return NS_OK;
}
@ -854,7 +855,7 @@ NS_IMETHODIMP CWebBrowserContainer::GetTitle(PRUnichar * *aTitle)
}
NS_IMETHODIMP CWebBrowserContainer::SetTitle(const PRUnichar * aTitle) {
nsString mTitleString(aTitle);
InvokeInfoCallback(Pt_MOZ_INFO_TITLE, (unsigned int) 0, mTitleString.ToNewCString());
InvokeInfoCallback(Pt_MOZ_INFO_TITLE, (unsigned int) 0, ToNewCString(mTitleString));
return NS_OK;
}
@ -913,7 +914,7 @@ CWebBrowserContainer::SetStatus(PRUint32 statusType, const PRUnichar *status)
if (type != 0)
InvokeInfoCallback(type, (unsigned int) 0, mStatus.ToNewCString());
InvokeInfoCallback(type, (unsigned int) 0, ToNewCString(mStatus));
return NS_OK;
}

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

@ -29,6 +29,7 @@
#include "nsIGenericFactory.h"
#include "nsString.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIURI.h"
#include "nsIWebProgress.h"
#include "nsIDocShellTreeItem.h"
@ -454,7 +455,7 @@ NS_IMETHODIMP CWebBrowserChrome::GetTitle(PRUnichar * *aTitle)
mBrowserWindow->GetDescriptor(pStr);
CPlatformUCSConversion::GetInstance()->PlatformToUCS(pStr, titleStr);
*aTitle = titleStr.ToNewUnicode();
*aTitle = ToNewUnicode(titleStr);
return NS_OK;
}

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

@ -41,6 +41,7 @@
#include "nsIPromptService.h"
#include "nsIFactory.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIWindowWatcher.h"
#include "nsIServiceManager.h"
#include "nsIWebBrowserChrome.h"
@ -344,7 +345,7 @@ NS_IMETHODIMP CPromptService::Prompt(nsIDOMWindow *parent, const PRUnichar *dial
}
responseText->GetDescriptor(pStr);
CPlatformUCSConversion::GetInstance()->PlatformToUCS(pStr, ucStr);
*value = ucStr.ToNewUnicode();
*value = ToNewUnicode(ucStr);
if (*value == nsnull)
resultErr = NS_ERROR_OUT_OF_MEMORY;
@ -428,7 +429,7 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent, co
}
userText->GetDescriptor(pStr);
CPlatformUCSConversion::GetInstance()->PlatformToUCS(pStr, ucStr);
*username = ucStr.ToNewUnicode();
*username = ToNewUnicode(ucStr);
if (*username == nsnull)
resultErr = NS_ERROR_OUT_OF_MEMORY;
@ -438,7 +439,7 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent, co
}
pwdText->GetDescriptor(pStr);
CPlatformUCSConversion::GetInstance()->PlatformToUCS(pStr, ucStr);
*password = ucStr.ToNewUnicode();
*password = ToNewUnicode(ucStr);
if (*password == nsnull)
resultErr = NS_ERROR_OUT_OF_MEMORY;
@ -518,7 +519,7 @@ NS_IMETHODIMP CPromptService::PromptPassword(nsIDOMWindow *parent, const PRUnich
}
pwdText->GetDescriptor(pStr);
CPlatformUCSConversion::GetInstance()->PlatformToUCS(pStr, ucStr);
*password = ucStr.ToNewUnicode();
*password = ToNewUnicode(ucStr);
if (*password == nsnull)
resultErr = NS_ERROR_OUT_OF_MEMORY;

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

@ -35,6 +35,7 @@
#include "nsHTMLReflowState.h"
#include "nsIServiceManager.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
// Interfaces needed to be included
#include "nsIContextMenuListener.h"
@ -884,7 +885,7 @@ NS_IMETHODIMP DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnich
} // while not found
*_retval = found;
*aText = (found) ? outText.ToNewUnicode() : nsnull;
*aText = (found) ? ToNewUnicode(outText) : nsnull;
return NS_OK;
}

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

@ -29,6 +29,7 @@
#include "nsWidgetsCID.h"
//Interfaces Needed
#include "nsReadableUtils.h"
#include "nsIComponentManager.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
@ -375,7 +376,7 @@ NS_IMETHODIMP nsWebBrowser::GetName(PRUnichar** aName)
if(mDocShell)
mDocShellAsItem->GetName(aName);
else
*aName = mInitInfo->name.ToNewUnicode();
*aName = ToNewUnicode(mInitInfo->name);
return NS_OK;
}

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

@ -41,6 +41,7 @@
#include "nsIDOMDocument.h"
#include "nsIFocusController.h"
#include "nsISelection.h"
#include "nsReadableUtils.h"
#if DEBUG
#include "nsIWebNavigation.h"
@ -199,7 +200,7 @@ NS_IMETHODIMP nsWebBrowserFind::FindNext(PRBool *outDidFind)
NS_IMETHODIMP nsWebBrowserFind::GetSearchString(PRUnichar * *aSearchString)
{
NS_ENSURE_ARG_POINTER(aSearchString);
*aSearchString = mSearchString.ToNewUnicode();
*aSearchString = ToNewUnicode(mSearchString);
return NS_OK;
}

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

@ -38,6 +38,7 @@
#include "nsDialogParamBlock.h"
#include "nsString.h"
#include "nsReadableUtils.h"
NS_IMPL_ISUPPORTS1(nsDialogParamBlock, nsIDialogParamBlock)
@ -90,7 +91,7 @@ NS_IMETHODIMP nsDialogParamBlock::GetString(PRInt32 inIndex, PRUnichar **_retval
SetNumberStrings(kNumStrings);
nsresult rv = InBounds(inIndex, mNumStrings);
if (rv == NS_OK)
*_retval = mString[inIndex].ToNewUnicode();
*_retval = ToNewUnicode(mString[inIndex]);
return rv;
}

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

@ -74,6 +74,7 @@
#include "nsIWebNavigation.h"
#include "nsIWindowCreator.h"
#include "nsIXPConnect.h"
#include "nsReadableUtils.h"
#ifdef XP_UNIX
// please see bug 78421 for the eventual "right" fix for this
@ -1036,7 +1037,7 @@ void nsWindowWatcher::CheckWindowName(nsString& aName)
nsAutoString warn;
warn.AssignWithConversion("Illegal character in window name ");
warn.Append(aName);
char *cp = warn.ToNewCString();
char *cp = ToNewCString(warn);
NS_WARNING(cp);
nsCRT::free(cp);
break;

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

@ -64,6 +64,7 @@
#include "TestEmbed.h"
#include "BrowserFrm.h"
#include "Dialogs.h"
#include "nsReadableUtils.h"
/////////////////////////////////////////////////////////////////////////////
// IBrowserFrameGlue implementation
@ -129,7 +130,7 @@ void CBrowserFrame::BrowserFrameGlueObj::GetBrowserFrameTitle(PRUnichar **aTitle
nsString nsTitle;
nsTitle.AssignWithConversion(title.GetBuffer(0));
*aTitle = nsTitle.ToNewUnicode();
*aTitle = ToNewUnicode(nsTitle);
}
}

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

@ -48,6 +48,7 @@
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIDOMWindow.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIFactory.h"
@ -211,7 +212,7 @@ NS_IMETHODIMP CPromptService::Prompt(nsIDOMWindow *parent,
nsString csPromptEditValue;
csPromptEditValue.AssignWithConversion(dlg.m_csPromptAnswer.GetBuffer(0));
*value = csPromptEditValue.ToNewUnicode();
*value = ToNewUnicode(csPromptEditValue);
*_retval = PR_TRUE;
} else
@ -247,7 +248,7 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
}
nsString csUserName;
csUserName.AssignWithConversion(dlg.m_csUserName.GetBuffer(0));
*username = csUserName.ToNewUnicode();
*username = ToNewUnicode(csUserName);
// Get the password entered
if (password && *password) {
@ -256,7 +257,7 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
}
nsString csPassword;
csPassword.AssignWithConversion(dlg.m_csPassword.GetBuffer(0));
*password = csPassword.ToNewUnicode();
*password = ToNewUnicode(csPassword);
if(checkValue)
*checkValue = dlg.m_bCheckBoxValue;
@ -292,7 +293,7 @@ NS_IMETHODIMP CPromptService::PromptPassword(nsIDOMWindow *parent,
}
nsString csPassword;
csPassword.AssignWithConversion(dlg.m_csPassword.GetBuffer(0));
*password = csPassword.ToNewUnicode();
*password = ToNewUnicode(csPassword);
if(checkValue)
*checkValue = dlg.m_bCheckBoxValue;

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

@ -64,6 +64,7 @@
#include "MfcEmbed.h"
#include "BrowserFrm.h"
#include "Dialogs.h"
#include "nsReadableUtils.h"
/////////////////////////////////////////////////////////////////////////////
// IBrowserFrameGlue implementation
@ -129,7 +130,7 @@ void CBrowserFrame::BrowserFrameGlueObj::GetBrowserFrameTitle(PRUnichar **aTitle
nsString nsTitle;
nsTitle.AssignWithConversion(title.GetBuffer(0));
*aTitle = nsTitle.ToNewUnicode();
*aTitle = ToNewUnicode(nsTitle);
}
}

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

@ -48,6 +48,7 @@
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIDOMWindow.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIFactory.h"
@ -236,7 +237,7 @@ NS_IMETHODIMP CPromptService::Prompt(nsIDOMWindow *parent,
nsString csPromptEditValue;
csPromptEditValue.AssignWithConversion(dlg.m_csPromptAnswer.GetBuffer(0));
*value = csPromptEditValue.ToNewUnicode();
*value = ToNewUnicode(csPromptEditValue);
*_retval = PR_TRUE;
} else
@ -272,7 +273,7 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
}
nsString csUserName;
csUserName.AssignWithConversion(dlg.m_csUserName.GetBuffer(0));
*username = csUserName.ToNewUnicode();
*username = ToNewUnicode(csUserName);
// Get the password entered
if (password && *password) {
@ -281,7 +282,7 @@ NS_IMETHODIMP CPromptService::PromptUsernameAndPassword(nsIDOMWindow *parent,
}
nsString csPassword;
csPassword.AssignWithConversion(dlg.m_csPassword.GetBuffer(0));
*password = csPassword.ToNewUnicode();
*password = ToNewUnicode(csPassword);
if(checkValue)
*checkValue = dlg.m_bCheckBoxValue;
@ -317,7 +318,7 @@ NS_IMETHODIMP CPromptService::PromptPassword(nsIDOMWindow *parent,
}
nsString csPassword;
csPassword.AssignWithConversion(dlg.m_csPassword.GetBuffer(0));
*password = csPassword.ToNewUnicode();
*password = ToNewUnicode(csPassword);
if(checkValue)
*checkValue = dlg.m_bCheckBoxValue;

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

@ -35,7 +35,6 @@
#include "nsIChannel.h"
#include "nsCWebBrowser.h"
#include "nsWidgetsCID.h"
#include "nsXPIDLString.h"
#include "nsIProfileChangeStatus.h"
// Local includes
@ -458,10 +457,7 @@ WebBrowserChrome::SendHistoryStatusMessage(nsIURI * aURI, char * operation, PRIn
uriAStr.Append(NS_ConvertASCIItoUCS2(" purged from Session History"));
}
PRUnichar * uriStr = nsnull;
uriStr = uriAStr.ToNewUnicode();
WebBrowserChromeUI::UpdateStatusBarText(this, uriStr);
nsCRT::free(uriStr);
WebBrowserChromeUI::UpdateStatusBarText(this, uriAStr.get());
return NS_OK;
}

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

@ -47,6 +47,7 @@
#include "xp_core.h"
#include "prmem.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIPref.h"
#include "nsTextFormatter.h"
#include "nsAppDirectoryServiceDefs.h"
@ -1461,10 +1462,10 @@ COOKIE_Read() {
return NS_ERROR_OUT_OF_MEMORY;
}
memset(new_cookie, 0, sizeof(cookie_CookieStruct));
new_cookie->name = name.ToNewCString();
new_cookie->cookie = cookie.ToNewCString();
new_cookie->host = host.ToNewCString();
new_cookie->path = path.ToNewCString();
new_cookie->name = ToNewCString(name);
new_cookie->cookie = ToNewCString(cookie);
new_cookie->host = ToNewCString(host);
new_cookie->path = ToNewCString(path);
if (isDomain.EqualsWithConversion("TRUE")) {
new_cookie->isDomain = PR_TRUE;
} else {
@ -1475,7 +1476,7 @@ COOKIE_Read() {
} else {
new_cookie->isSecure = PR_FALSE;
}
char * expiresCString = expires.ToNewCString();
char * expiresCString = ToNewCString(expires);
new_cookie->expires = strtoul(expiresCString, nsnull, 10);
nsCRT::free(expiresCString);

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

@ -43,6 +43,7 @@
#include "nsPermissions.h"
#include "nsUtils.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIFileSpec.h"
#include "nsIPrompt.h"
#include "nsIWindowWatcher.h"
@ -526,7 +527,7 @@ PERMISSION_Read() {
}
} else {
if (!permissionString.IsEmpty()) {
rv = Permission_AddHost(host.ToNewCString(), permission, type, PR_FALSE);
rv = Permission_AddHost(ToNewCString(host), permission, type, PR_FALSE);
if (NS_FAILED(rv)) {
strm.close();
return rv;

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

@ -40,6 +40,7 @@
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsReadableUtils.h"
///////////////////////////////////////////////////////////////////////////////
@ -119,7 +120,7 @@ inBitmap::GetPixelHex(PRUint32 aX, PRUint32 aY, PRUnichar **_retval)
str.AssignWithConversion(s);
delete s;
*_retval = str.ToNewUnicode();
*_retval = ToNewUnicode(str);
return NS_OK;
}

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

@ -24,6 +24,7 @@
#include "nsIIOService.h"
#include "nsIURL.h"
#include "nsCRT.h"
#include "nsReadableUtils.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#define DEFAULT_IMAGE_SIZE 16
@ -52,7 +53,7 @@ inBitmapURI::~inBitmapURI()
NS_IMETHODIMP
inBitmapURI::GetBitmapName(PRUnichar** aBitmapName)
{
*aBitmapName = mBitmapName.ToNewUnicode();
*aBitmapName = ToNewUnicode(mBitmapName);
return NS_OK;
}

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

@ -40,6 +40,7 @@
#include "nsIComponentManager.h"
#include "nsVoidArray.h"
#include "nsReadableUtils.h"
///////////////////////////////////////////////////////////////////////////////
@ -146,9 +147,9 @@ inCSSValueSearch::GetStringResultAt(PRInt32 aIndex, PRUnichar **_retval)
{
if (mHoldResults) {
nsAutoString* result = (nsAutoString*)mResults->ElementAt(aIndex);
*_retval = result->ToNewUnicode();
*_retval = ToNewUnicode(*result);
} else if (aIndex == mResultCount-1) {
*_retval = mLastResult->ToNewUnicode();
*_retval = ToNewUnicode(*mLastResult);
} else {
return NS_ERROR_FAILURE;
}
@ -188,7 +189,7 @@ inCSSValueSearch::SetDocument(nsIDOMDocument* aDocument)
NS_IMETHODIMP
inCSSValueSearch::GetBaseURL(PRUnichar** aBaseURL)
{
*aBaseURL = mBaseURL->ToNewUnicode();
*aBaseURL = ToNewUnicode(*mBaseURL);
return NS_OK;
}
@ -243,7 +244,7 @@ inCSSValueSearch::AddPropertyCriteria(const PRUnichar *aPropName)
NS_IMETHODIMP
inCSSValueSearch::GetTextCriteria(PRUnichar** aTextCriteria)
{
*aTextCriteria = mTextCriteria->ToNewUnicode();
*aTextCriteria = ToNewUnicode(*mTextCriteria);
return NS_OK;
}
@ -352,7 +353,7 @@ inCSSValueSearch::EqualizeURL(nsAutoString* aURL)
if (aURL->Find("chrome://", PR_FALSE, 0, 1) >= 0) {
PRUint32 len = aURL->Length();
char* result = new char[len-8];
char* buffer = aURL->ToNewCString();
char* buffer = ToNewCString(*aURL);
PRUint32 i = 9;
PRUint32 milestone = 0;
PRUint32 s = 0;

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

@ -54,6 +54,7 @@
#include "nsIServiceManager.h"
#include "nsEnumeratorUtils.h"
#include "prprf.h"
#include "nsReadableUtils.h"
////////////////////////////////////////////////////////////////////////
// globals and constants
@ -685,7 +686,7 @@ inDOMDataSource::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer,
nsAutoString nodeName;
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aContainer);
node->GetNodeName(nodeName);
//printf("=== CONTENT REMOVED (%s) ===\n", nodeName.ToNewCString());
//printf("=== CONTENT REMOVED (%s) ===\n", NS_LossyConvertUCS2toASCII(nodeName).get());
nsresult rv;
nsCOMPtr<nsIRDFResource> containerRes;
@ -936,10 +937,8 @@ inDOMDataSource::CreateLiteral(nsString& str, nsIRDFNode **aResult)
nsresult rv;
nsCOMPtr<nsIRDFLiteral> literal;
PRUnichar* uniStr = str.ToNewUnicode();
rv = GetRDFService()->GetLiteral(uniStr, getter_AddRefs(literal));
nsMemory::Free(uniStr);
rv = GetRDFService()->GetLiteral(str.get(), getter_AddRefs(literal));
*aResult = literal;
NS_IF_ADDREF(*aResult);
return NS_OK;

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

@ -40,6 +40,7 @@
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsReadableUtils.h"
///////////////////////////////////////////////////////////////////////////////
@ -125,7 +126,7 @@ inFileSearch::SearchAsync(inISearchObserver *aObserver)
} else {
nsAutoString msg;
msg.AssignWithConversion("No search path has been provided");
mObserver->OnSearchError(this, msg.ToNewUnicode());
mObserver->OnSearchError(this, ToNewUnicode(msg));
KillSearch(inISearchObserver::ERROR);
}
@ -176,7 +177,7 @@ inFileSearch::GetStringResultAt(PRInt32 aIndex, PRUnichar **_retval)
path.AssignWithConversion(temp);
if (mReturnRelativePaths)
MakePathRelative(&path);
*_retval = path.ToNewUnicode();
*_retval = ToNewUnicode(path);
} else {
return NS_ERROR_FAILURE;
}
@ -203,7 +204,7 @@ NS_IMETHODIMP
inFileSearch::GetBasePath(PRUnichar** aBasePath)
{
if (mBasePath) {
*aBasePath = mBasePath->ToNewUnicode();
*aBasePath = ToNewUnicode(*mBasePath);
} else {
return NS_ERROR_FAILURE;
}
@ -282,7 +283,7 @@ inFileSearch::SetFilenameCriteria(const PRUnichar* aFilenameCriteria)
NS_IMETHODIMP
inFileSearch::GetTextCriteria(PRUnichar** aTextCriteria)
{
*aTextCriteria = mTextCriteria->ToNewUnicode();
*aTextCriteria = ToNewUnicode(*mTextCriteria);
return NS_OK;
}
@ -550,7 +551,7 @@ inFileSearch::MatchFile(nsIFile* aFile)
nsAutoString temp;
temp.AssignWithConversion(fileName);
PRUnichar* fileNameUnicode = temp.ToNewUnicode();
PRUnichar* fileNameUnicode = ToNewUnicode(temp);
PRBool match;

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

@ -41,6 +41,7 @@
#include "nsISupportsArray.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIPresShell.h"
#include "nsIPresContext.h"
#include "nsIRenderingContext.h"
@ -84,7 +85,7 @@ inPNGEncoder::WritePNG(inIBitmap *aBitmap, const PRUnichar *aURL, PRInt16 aType)
nsAutoString str;
str.Assign(aURL);
FILE *file = fopen(str.ToNewCString(), "wb");
FILE *file = fopen(ToNewCString(str), "wb");
if (file) {
pngStruct = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, gPNGErrorHandler, NULL);
infoStruct = png_create_info_struct(pngStruct);

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

@ -75,6 +75,7 @@
#include "plstr.h"
#include "prmem.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include <stdio.h>
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
@ -398,7 +399,7 @@ nsPICS::ProcessPICSLabel(char *label)
char* quoteValue = PL_strndup(label, 1);
// nsString value2(theValue2);
theLabel.Trim(quoteValue);
char *lab = theLabel.ToNewCString();
char *lab = ToNewCString(theLabel);
PL_strcpy(label, lab);
}
// rv = GetRootURL();

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

@ -50,6 +50,7 @@
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsPICSElementObserver.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIPICS.h"
#include "nspics.h"
#include "nsIWebShellServices.h"
@ -154,19 +155,19 @@ NS_IMETHODIMP nsPICSElementObserver::Notify(PRUint32 aDocumentID,
int status;
nsIWebShellServices* ws;
// nsString theURL(aSpec);
// char* url = aSpec.ToNewCString();
// char* url = ToNewCString(aSpec);
nsIURI* uaURL = nsnull;
// rv = NS_NewURL(&uaURL, nsString(aSpec));
if(numOfAttributes >= 2) {
const nsString& theValue1=valueArray[0];
char *val1 = theValue1.ToNewCString();
char *val1 = ToNewCString(theValue1);
if(theValue1.EqualsIgnoreCase("\"PICS-LABEL\"")) {
#ifdef DEBUG
printf("\nReceived notification for a PICS-LABEl\n");
#endif
const nsString& theValue2=valueArray[1];
char *label = theValue2.ToNewCString();
char *label = ToNewCString(theValue2);
if (valueArray[numOfAttributes]) {
const nsString& theURLValue=valueArray[numOfAttributes];
nsCOMPtr<nsIIOService> service(do_GetService(kIOServiceCID, &rv));

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

@ -44,6 +44,7 @@
#include "nsIServiceManager.h"
#include "nsIDOMWindowInternal.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsIScriptGlobalObject.h"
#include "nsCookieViewer.h"
#include "nsIDocShell.h"
@ -80,7 +81,7 @@ CookieViewerImpl::GetCookieValue(char** aValue)
nsAutoString cookieList;
res = cookieservice->Cookie_GetCookieListForViewer(cookieList);
if (NS_SUCCEEDED(res)) {
*aValue = cookieList.ToNewCString();
*aValue = ToNewCString(cookieList);
}
return res;
}
@ -100,7 +101,7 @@ CookieViewerImpl::GetPermissionValue(PRInt32 type, char** aValue)
nsAutoString PermissionList;
res = cookieservice->Cookie_GetPermissionListForViewer(PermissionList, type);
if (NS_SUCCEEDED(res)) {
*aValue = PermissionList.ToNewCString();
*aValue = ToNewCString(PermissionList);
}
return res;
}

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

@ -44,6 +44,7 @@
#include "nsIServiceManager.h"
#include "nsIDOMWindowInternal.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsIDocShell.h"
#include "nsIScriptGlobalObject.h"
#include "nsWalletEditor.h"
@ -77,7 +78,7 @@ WalletEditorImpl::GetValue(PRUnichar** aValue)
nsAutoString walletList;
res = walletservice->WALLET_PreEdit(walletList);
if (NS_SUCCEEDED(res)) {
*aValue = walletList.ToNewUnicode();
*aValue = ToNewUnicode(walletList);
}
return res;
}

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

@ -45,6 +45,7 @@
#include "nsIServiceManager.h"
#include "nsIDOMWindowInternal.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsIScriptGlobalObject.h"
#include "nsSignonViewer.h"
@ -77,7 +78,7 @@ SignonViewerImpl::GetNopreviewValue(PRUnichar** aValue)
nsAutoString nopreviewList;
res = walletservice->WALLET_GetNopreviewListForViewer(nopreviewList);
if (NS_SUCCEEDED(res)) {
*aValue = nopreviewList.ToNewUnicode();
*aValue = ToNewUnicode(nopreviewList);
}
return res;
}
@ -96,7 +97,7 @@ SignonViewerImpl::GetNocaptureValue(PRUnichar** aValue)
nsAutoString nocaptureList;
res = walletservice->WALLET_GetNocaptureListForViewer(nocaptureList);
if (NS_SUCCEEDED(res)) {
*aValue = nocaptureList.ToNewUnicode();
*aValue = ToNewUnicode(nocaptureList);
}
return res;
}

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

@ -64,6 +64,7 @@
#include "nsIWindowWatcher.h"
#include "nsIWebProgress.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsICategoryManager.h"
// for making the leap from nsIDOMWindowInternal -> nsIPresShell
@ -137,7 +138,7 @@ nsWalletlibService::WALLET_PrefillOneElement
{
nsAutoString compositeValue;
nsresult rv = ::WLLT_PrefillOneElement(aWin, elementNode, compositeValue);
*value = compositeValue.ToNewUnicode();
*value = ToNewUnicode(compositeValue);
return rv;
}
@ -429,7 +430,7 @@ nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress,
nsAutoString field;
rv = inputElement->GetName(field);
if (NS_SUCCEEDED(rv)) {
PRUnichar* nameString = field.ToNewUnicode();
PRUnichar* nameString = ToNewUnicode(field);
if (nameString) {
/* note: we do not want to prefill if there is a default value */
nsAutoString value;
@ -535,7 +536,7 @@ nsWalletlibService::WALLET_Encrypt (const PRUnichar *text, char **crypt) {
nsAutoString textAutoString( text );
nsAutoString cryptAutoString;
PRBool rv = ::Wallet_Encrypt(textAutoString, cryptAutoString);
*crypt = cryptAutoString.ToNewCString();
*crypt = ToNewCString(cryptAutoString);
return rv;
}
@ -544,7 +545,7 @@ nsWalletlibService::WALLET_Decrypt (const char *crypt, PRUnichar **text) {
nsAutoString cryptAutoString; cryptAutoString.AssignWithConversion(crypt);
nsAutoString textAutoString;
PRBool rv = ::Wallet_Decrypt(cryptAutoString, textAutoString);
*text = textAutoString.ToNewUnicode();
*text = ToNewUnicode(textAutoString);
return rv;
}

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

@ -970,7 +970,7 @@ si_GetUser(nsIPrompt* dialog, const char* passwordRealm, PRBool pickFirstUser, c
}
nsAutoString userName;
if (NS_SUCCEEDED(si_Decrypt (data->value, userName))) {
*(list2++) = userName.ToNewUnicode();
*(list2++) = ToNewUnicode(userName);
*(users2++) = user;
user_count++;
} else {
@ -1141,7 +1141,7 @@ si_GetURLAndUserForChangeForm(nsIPrompt* dialog, const nsString& password)
temp.AppendWithConversion(":");
temp.Append(userName);
*list2 = temp.ToNewUnicode();
*list2 = ToNewUnicode(temp);
list2++;
*(users2++) = user;
*(urls2++) = url;
@ -1688,7 +1688,7 @@ SI_LoadSignonData() {
break; /* end of reject list */
}
si_StripLF(buffer);
passwordRealm = buffer.ToNewCString();
passwordRealm = ToNewCString(buffer);
si_PutReject(passwordRealm, buffer, PR_FALSE); /* middle parameter is obsolete */
Recycle (passwordRealm);
}
@ -1697,7 +1697,7 @@ SI_LoadSignonData() {
while (NS_SUCCEEDED(si_ReadLine(strm, buffer))) {
si_StripLF(buffer);
/* a blank line is perfectly valid here -- corresponds to a local file */
passwordRealm = buffer.ToNewCString();
passwordRealm = ToNewCString(buffer);
if (!passwordRealm) {
si_unlock_signon_list();
return -1;
@ -2132,7 +2132,7 @@ si_RestoreSignonData(nsIPrompt* dialog, const char* passwordRealm, const PRUnich
if (data->isPassword) {
nsAutoString password;
if (NS_SUCCEEDED(si_Decrypt(data->value, password))) {
*value = password.ToNewUnicode();
*value = ToNewUnicode(password);
}
si_unlock_signon_list();
return;
@ -2153,7 +2153,7 @@ si_RestoreSignonData(nsIPrompt* dialog, const char* passwordRealm, const PRUnich
if(correctedName.Length() && (data->name == correctedName)) {
nsAutoString password;
if (NS_SUCCEEDED(si_Decrypt(data->value, password))) {
*value = password.ToNewUnicode();
*value = ToNewUnicode(password);
}
si_unlock_signon_list();
return;
@ -2350,10 +2350,10 @@ SINGSIGN_PromptUsernameAndPassword
si_RestoreOldSignonDataFromBrowser(dialog, passwordRealm, PR_FALSE, username, password);
/* get new username/password from user */
if (!(*user = username.ToNewUnicode())) {
if (!(*user = ToNewUnicode(username))) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (!(*pwd = password.ToNewUnicode())) {
if (!(*pwd = ToNewUnicode(password))) {
PR_Free(*user);
return NS_ERROR_OUT_OF_MEMORY;
}
@ -2410,13 +2410,13 @@ SINGSIGN_PromptPassword
/* return if a password was found */
if (password.Length() != 0) {
*pwd = password.ToNewUnicode();
*pwd = ToNewUnicode(password);
*pressedOK = PR_TRUE;
return NS_OK;
}
/* no password found, get new password from user */
*pwd = password.ToNewUnicode();
*pwd = ToNewUnicode(password);
PRBool checked = PR_FALSE;
res = si_CheckGetPassword(pwd, dialogTitle, text, dialog, savePassword, &checked);
if (NS_FAILED(res)) {
@ -2463,14 +2463,14 @@ SINGSIGN_Prompt
/* return if data was found */
if (data.Length() != 0) {
*resultText = data.ToNewUnicode();
*resultText = ToNewUnicode(data);
*pressedOK = PR_TRUE;
return NS_OK;
}
/* no data found, get new data from user */
data = defaultText;
*resultText = data.ToNewUnicode();
*resultText = ToNewUnicode(data);
PRBool checked = PR_FALSE;
res = si_CheckGetData(resultText, dialogTitle, text, dialog, savePassword, &checked);
if (NS_FAILED(res)) {
@ -2665,7 +2665,7 @@ SINGSIGN_Enumerate
/* don't display saved signons if user couldn't unlock the database */
return NS_ERROR_FAILURE;
}
if (!(*user = userName.ToNewUnicode())) {
if (!(*user = ToNewUnicode(userName))) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -2683,7 +2683,7 @@ SINGSIGN_Enumerate
Recycle(*user);
return NS_ERROR_FAILURE;
}
if (!(*pswd = passWord.ToNewUnicode())) {
if (!(*pswd = ToNewUnicode(passWord))) {
Recycle(*user);
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -47,6 +47,7 @@
#include "singsign.h"
#include "nsNetUtil.h"
#include "nsReadableUtils.h"
#include "nsIServiceManager.h"
#include "nsIDocument.h"
@ -476,7 +477,7 @@ Wallet_Localize(char* genericString) {
#ifdef DEBUG
printf("cannot get string service\n");
#endif
return v.ToNewUnicode();
return ToNewUnicode(v);
}
nsCOMPtr<nsIStringBundle> bundle;
ret = pStringService->CreateBundle(PROPERTIES_URL, getter_AddRefs(bundle));
@ -484,7 +485,7 @@ Wallet_Localize(char* genericString) {
#ifdef DEBUG
printf("cannot create instance\n");
#endif
return v.ToNewUnicode();
return ToNewUnicode(v);
}
/* localize the given string */
@ -496,7 +497,7 @@ Wallet_Localize(char* genericString) {
#ifdef DEBUG
printf("cannot get string from name\n");
#endif
return v.ToNewUnicode();
return ToNewUnicode(v);
}
v = ptrv;
nsCRT::free(ptrv);
@ -509,7 +510,7 @@ Wallet_Localize(char* genericString) {
}
}
return v.ToNewUnicode();
return ToNewUnicode(v);
}
/**********************/
@ -784,7 +785,7 @@ Wallet_Encrypt (const nsString& text, nsString& crypt) {
/* encrypt text to crypt */
char * cryptCString = nsnull;
char * UTF8textCString = UTF8text.ToNewCString();
char * UTF8textCString = ToNewCString(UTF8text);
nsresult rv = EncryptString(UTF8textCString, cryptCString);
Recycle (UTF8textCString);
if NS_FAILED(rv) {
@ -799,7 +800,7 @@ PUBLIC nsresult
Wallet_Decrypt(const nsString& crypt, nsString& text) {
/* decrypt crypt to text */
char * cryptCString = crypt.ToNewCString();
char * cryptCString = ToNewCString(crypt);
char * UTF8textCString = nsnull;
nsresult rv = DecryptString(cryptCString, UTF8textCString);
@ -2676,7 +2677,7 @@ WLLT_GetPrefillListForViewer(nsString& aPrefillList)
buffer.Append(mapElementPtr->value);
}
PRUnichar * urlUnichar = wallet_url.ToNewUnicode();
PRUnichar * urlUnichar = ToNewUnicode(wallet_url);
buffer.AppendWithConversion(BREAK);
buffer.AppendInt(NS_PTR_TO_INT32(wallet_list));
buffer.AppendWithConversion(BREAK);
@ -3819,7 +3820,7 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) {
}
(void)docURL->GetSpec(&URLName);
wallet_GetHostFile(docURL, strippedURLNameAutoString);
strippedURLName = strippedURLNameAutoString.ToNewCString();
strippedURLName = ToNewCString(strippedURLNameAutoString);
/* get to the form elements */
nsCOMPtr<nsIDOMHTMLDocument> htmldoc(do_QueryInterface(doc));

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

@ -40,6 +40,7 @@
#include "nsIMemory.h"
#include "plstr.h"
#include "stdio.h"
#include "nsReadableUtils.h"
#include "nsIWalletService.h"
#include "nsIServiceManager.h"
#include "nsIDOMWindowInternal.h"
@ -80,7 +81,7 @@ WalletPreviewImpl::GetPrefillValue(PRUnichar** aValue)
nsAutoString walletList;
res = walletservice->WALLET_GetPrefillListForViewer(walletList);
if (NS_SUCCEEDED(res)) {
*aValue = walletList.ToNewUnicode();
*aValue = ToNewUnicode(walletList);
}
return res;
}

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

@ -48,6 +48,7 @@
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIXPConnect.h"
#include "nsIJSContextStack.h"
#include "nsIURI.h"
@ -269,7 +270,7 @@ NS_IMETHODIMP nsSOAPCall::GetEncodingStyleURI(char * *aEncodingStyleURI)
value);
if (value.Length() > 0) {
*aEncodingStyleURI = value.ToNewCString();
*aEncodingStyleURI = ToNewCString(value);
if (nsnull == *aEncodingStyleURI) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -374,7 +375,7 @@ NS_IMETHODIMP nsSOAPCall::GetTargetObjectURI(char * *aTargetObjectURI)
NS_ENSURE_ARG_POINTER(aTargetObjectURI);
if (mTargetObjectURI.Length() > 0) {
*aTargetObjectURI = mTargetObjectURI.ToNewCString();
*aTargetObjectURI = ToNewCString(mTargetObjectURI);
}
else {
*aTargetObjectURI = nsnull;
@ -400,7 +401,7 @@ NS_IMETHODIMP nsSOAPCall::GetMethodName(PRUnichar * *aMethodName)
NS_ENSURE_ARG_POINTER(aMethodName);
if (mMethodName.Length() > 0) {
*aMethodName = mMethodName.ToNewUnicode();
*aMethodName = ToNewUnicode(mMethodName);
}
else {
*aMethodName = nsnull;
@ -426,7 +427,7 @@ NS_IMETHODIMP nsSOAPCall::GetDestinationURI(char * *aDestinationURI)
NS_ENSURE_ARG_POINTER(aDestinationURI);
if (mDestinationURI.Length() > 0) {
*aDestinationURI = mDestinationURI.ToNewCString();
*aDestinationURI = ToNewCString(mDestinationURI);
}
else {
*aDestinationURI = nsnull;
@ -452,7 +453,7 @@ NS_IMETHODIMP nsSOAPCall::GetActionURI(char * *aActionURI)
NS_ENSURE_ARG_POINTER(aActionURI);
if (mActionURI.Length() > 0) {
*aActionURI = mActionURI.ToNewCString();
*aActionURI = ToNewCString(mActionURI);
}
else {
*aActionURI = nsnull;

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

@ -39,6 +39,7 @@
#include "nsSOAPFault.h"
#include "nsSOAPUtils.h"
#include "nsIDOMNodeList.h"
#include "nsReadableUtils.h"
nsSOAPFault::nsSOAPFault(nsIDOMElement* aElement)
{
@ -85,7 +86,7 @@ NS_IMETHODIMP nsSOAPFault::GetFaultCode(PRUnichar * *aFaultCode)
nsAutoString text;
nsSOAPUtils::GetElementTextContent(element, text);
if (text.Length() > 0) {
*aFaultCode = text.ToNewUnicode();
*aFaultCode = ToNewUnicode(text);
if (!*aFaultCode) return NS_ERROR_OUT_OF_MEMORY;
}
}
@ -118,7 +119,7 @@ NS_IMETHODIMP nsSOAPFault::GetFaultString(PRUnichar * *aFaultString)
nsAutoString text;
nsSOAPUtils::GetElementTextContent(element, text);
if (text.Length() > 0) {
*aFaultString = text.ToNewUnicode();
*aFaultString = ToNewUnicode(text);
if (!*aFaultString) return NS_ERROR_OUT_OF_MEMORY;
}
}
@ -151,7 +152,7 @@ NS_IMETHODIMP nsSOAPFault::GetFaultActor(PRUnichar * *aFaultActor)
nsAutoString text;
nsSOAPUtils::GetElementTextContent(element, text);
if (text.Length() > 0) {
*aFaultActor = text.ToNewUnicode();
*aFaultActor = ToNewUnicode(text);
if (!*aFaultActor) return NS_ERROR_OUT_OF_MEMORY;
}
}

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

@ -40,6 +40,7 @@
#include "nsSOAPUtils.h"
#include "nsIXPConnect.h"
#include "nsIServiceManager.h"
#include "nsReadableUtils.h"
nsSOAPParameter::nsSOAPParameter()
{
@ -73,7 +74,7 @@ NS_IMETHODIMP nsSOAPParameter::GetEncodingStyleURI(char * *aEncodingStyleURI)
{
NS_ENSURE_ARG_POINTER(aEncodingStyleURI);
if (mEncodingStyleURI.Length() > 0) {
*aEncodingStyleURI = mEncodingStyleURI.ToNewCString();
*aEncodingStyleURI = ToNewCString(mEncodingStyleURI);
}
else {
*aEncodingStyleURI = nsnull;
@ -97,7 +98,7 @@ NS_IMETHODIMP nsSOAPParameter::GetName(PRUnichar * *aName)
{
NS_ENSURE_ARG_POINTER(aName);
if (mName.Length() > 0) {
*aName = mName.ToNewUnicode();
*aName = ToNewUnicode(mName);
}
else {
*aName = nsnull;

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

@ -44,6 +44,7 @@
#include "nsISOAPParameter.h"
#include "nsIComponentManager.h"
#include "nsMemory.h"
#include "nsReadableUtils.h"
nsSOAPResponse::nsSOAPResponse(nsIDOMDocument* aEnvelopeDocument)
{
@ -165,7 +166,7 @@ NS_IMETHODIMP nsSOAPResponse::GetTargetObjectURI(char * *aTargetObjectURI)
nsAutoString ns;
mResultElement->GetNamespaceURI(ns);
if (ns.Length() > 0) {
*aTargetObjectURI = ns.ToNewCString();
*aTargetObjectURI = ToNewCString(ns);
}
}
return NS_OK;
@ -180,7 +181,7 @@ NS_IMETHODIMP nsSOAPResponse::GetMethodName(char * *aMethodName)
nsAutoString localName;
mResultElement->GetLocalName(localName);
if (localName.Length() > 0) {
*aMethodName = localName.ToNewCString();
*aMethodName = ToNewCString(localName);
}
}
return NS_OK;

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

@ -45,6 +45,7 @@
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsISupportsArray.h"
const char* nsSOAPUtils::kSOAPEnvURI = "http://schemas.xmlsoap.org/soap/envelope/";
@ -160,7 +161,7 @@ nsSOAPUtils::GetInheritedEncodingStyle(nsIDOMElement* aEntry,
NS_ConvertASCIItoUCS2(nsSOAPUtils::kEncodingStyleAttribute),
value);
if (value.Length() > 0) {
*aEncodingStyle = value.ToNewCString();
*aEncodingStyle = ToNewCString(value);
return;
}
}

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

@ -56,6 +56,7 @@
#include "nsIScriptSecurityManager.h"
#include "nsICodebasePrincipal.h"
#include "nsIDOMClassInfo.h"
#include "nsReadableUtils.h"
#ifdef IMPLEMENT_SYNC_LOAD
#include "nsIScriptContext.h"
@ -191,7 +192,7 @@ NS_IMETHODIMP nsDOMParserChannel::GetURI(nsIURI * *aURI)
NS_IMETHODIMP nsDOMParserChannel::GetContentType(char * *aContentType)
{
NS_ENSURE_ARG_POINTER(aContentType);
*aContentType = mContentType.ToNewCString();
*aContentType = ToNewCString(mContentType);
return NS_OK;
}
NS_IMETHODIMP nsDOMParserChannel::SetContentType(const char * aContentType)

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

@ -47,6 +47,7 @@
#include "nsIComponentManager.h"
#include "nsIContentSerializer.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsLayoutCID.h" // XXX Need range CID
static NS_DEFINE_CID(kRangeCID,NS_RANGE_CID);
@ -145,7 +146,7 @@ nsDOMSerializer::SerializeToString(nsIDOMNode *root, PRUnichar **_retval)
if (NS_FAILED(rv))
return rv;
*_retval = str.ToNewUnicode();
*_retval = ToNewUnicode(str);
if (!*_retval)
return NS_ERROR_OUT_OF_MEMORY;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше