diff --git a/mozilla/caps/src/nsScriptSecurityManager.cpp b/mozilla/caps/src/nsScriptSecurityManager.cpp index 1bc0266ac32..c61bd598a9e 100644 --- a/mozilla/caps/src/nsScriptSecurityManager.cpp +++ b/mozilla/caps/src/nsScriptSecurityManager.cpp @@ -2794,7 +2794,7 @@ nsScriptSecurityManager::InitPolicies() policyNames += NS_LITERAL_CSTRING(" ") + defaultPolicyNames; //-- Initialize domain policies - char* policyCurrent = (char*)policyNames.get(); + char* policyCurrent = policyNames.BeginWriting(); PRBool morePolicies = PR_TRUE; while (morePolicies) { @@ -2832,7 +2832,7 @@ nsScriptSecurityManager::InitPolicies() } //-- Parse list of sites and create an entry in mOriginToPolicyMap for each - char* domainStart = (char*)domainList.get(); + char* domainStart = domainList.BeginWriting(); char* domainCurrent = domainStart; char* lastDot = nsnull; char* nextToLastDot = nsnull; diff --git a/mozilla/content/base/src/mozSanitizingSerializer.cpp b/mozilla/content/base/src/mozSanitizingSerializer.cpp index a3bf3f87a4f..a48ad80ed94 100644 --- a/mozilla/content/base/src/mozSanitizingSerializer.cpp +++ b/mozilla/content/base/src/mozSanitizingSerializer.cpp @@ -804,7 +804,7 @@ mozSanitizingHTMLSerializer::ParseTagPref(const nsCAutoString& tagpref) printf(" Attr list: -%s-\n", attrList.get()); #endif char* attrs_lasts; - for (char* iAttr = PL_strtok_r(NS_CONST_CAST(char*, attrList.get()), + for (char* iAttr = PL_strtok_r(attrList.BeginWriting(), ",", &attrs_lasts); iAttr; iAttr = PL_strtok_r(NULL, ",", &attrs_lasts)) diff --git a/mozilla/content/base/src/nsContentSink.cpp b/mozilla/content/base/src/nsContentSink.cpp index 0c0e74218e1..8da28d2fbbe 100644 --- a/mozilla/content/base/src/nsContentSink.cpp +++ b/mozilla/content/base/src/nsContentSink.cpp @@ -463,7 +463,7 @@ nsContentSink::ProcessLinkHeader(nsIContent* aElement, // put an extra null at the end stringList.Append(kNullCh); - PRUnichar* start = NS_CONST_CAST(PRUnichar *, stringList.get()); + PRUnichar* start = stringList.BeginWriting(); PRUnichar* end = start; PRUnichar* last = start; PRUnichar endCh; diff --git a/mozilla/content/base/src/nsDocumentEncoder.cpp b/mozilla/content/base/src/nsDocumentEncoder.cpp index 205fa207d82..df1a06cd915 100644 --- a/mozilla/content/base/src/nsDocumentEncoder.cpp +++ b/mozilla/content/base/src/nsDocumentEncoder.cpp @@ -412,7 +412,7 @@ ConvertAndWrite(const nsAString& aString, nsCAutoString charXferString; charXferString.SetCapacity(charLength); - char* charXferBuf = (char*)charXferString.get(); + char* charXferBuf = charXferString.BeginWriting(); nsresult convert_rv = NS_OK; do { diff --git a/mozilla/content/html/content/src/nsFormSubmission.cpp b/mozilla/content/html/content/src/nsFormSubmission.cpp index 0f083bb1429..c9634969722 100644 --- a/mozilla/content/html/content/src/nsFormSubmission.cpp +++ b/mozilla/content/html/content/src/nsFormSubmission.cpp @@ -1362,7 +1362,7 @@ nsFormSubmission::UnicodeToNewBytes(const PRUnichar* aStr, PRUint32 aLen, Conv_06_FE_WithReverse(nsString(aStr), newBuffer, textDirAtSubmit); - aStr = (PRUnichar*)newBuffer.get(); + aStr = newBuffer.get(); aLen=newBuffer.Length(); } else if (ctrlsModAtSubmit == IBMBIDI_CONTROLSTEXTMODE_LOGICAL @@ -1371,7 +1371,7 @@ nsFormSubmission::UnicodeToNewBytes(const PRUnichar* aStr, PRUint32 aLen, //For 864 file, When it is logical, if LTR then only convert //If RTL will mak a reverse for the buffer Conv_FE_06(nsString(aStr), newBuffer); - aStr = (PRUnichar*)newBuffer.get(); + aStr = newBuffer.get(); temp = newBuffer; aLen=newBuffer.Length(); if (textDirAtSubmit == 2) { //RTL @@ -1383,7 +1383,7 @@ nsFormSubmission::UnicodeToNewBytes(const PRUnichar* aStr, PRUint32 aLen, loop--; } } - aStr = (PRUnichar*)temp.get(); + aStr = temp.get(); } else if (ctrlsModAtSubmit == IBMBIDI_CONTROLSTEXTMODE_VISUAL && mCharset.Equals(NS_LITERAL_CSTRING("IBM864"), @@ -1391,7 +1391,7 @@ nsFormSubmission::UnicodeToNewBytes(const PRUnichar* aStr, PRUint32 aLen, && textDirAtSubmit == IBMBIDI_TEXTDIRECTION_RTL) { Conv_FE_06(nsString(aStr), newBuffer); - aStr = (PRUnichar*)newBuffer.get(); + aStr = newBuffer.get(); temp = newBuffer; aLen=newBuffer.Length(); //Now we need to reverse the Buffer, it is by searching the buffer @@ -1401,7 +1401,7 @@ nsFormSubmission::UnicodeToNewBytes(const PRUnichar* aStr, PRUint32 aLen, temp.SetCharAt((PRUnichar)aStr[loop], z); loop--; } - aStr = (PRUnichar*)temp.get(); + aStr = temp.get(); } diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 0f6c00b2902..a021fd1c238 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -834,8 +834,7 @@ HTMLContentSink::AddAttributes(const nsIParserNode& aNode, if (nodeType == eHTMLTag_a && keyAtom == nsHTMLAtoms::name) { NS_ConvertUCS2toUTF8 cname(v); - NS_ConvertUTF8toUCS2 uv(nsUnescape(NS_CONST_CAST(char *, - cname.get()))); + NS_ConvertUTF8toUCS2 uv(nsUnescape(cname.BeginWriting())); // Add attribute to content aContent->SetAttr(kNameSpaceID_None, keyAtom, uv, aNotify); diff --git a/mozilla/content/html/document/src/nsHTMLFragmentContentSink.cpp b/mozilla/content/html/document/src/nsHTMLFragmentContentSink.cpp index e52ecc2bbb4..3dd1f8d3a4a 100644 --- a/mozilla/content/html/document/src/nsHTMLFragmentContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLFragmentContentSink.cpp @@ -892,8 +892,7 @@ nsHTMLFragmentContentSink::AddAttributes(const nsIParserNode& aNode, if (nodeType == eHTMLTag_a && keyAtom == nsHTMLAtoms::name) { NS_ConvertUCS2toUTF8 cname(v); - NS_ConvertUTF8toUCS2 uv(nsUnescape(NS_CONST_CAST(char *, - cname.get()))); + NS_ConvertUTF8toUCS2 uv(nsUnescape(cname.BeginWriting())); // Add attribute to content aContent->SetAttr(kNameSpaceID_None, keyAtom, uv, PR_FALSE); diff --git a/mozilla/content/html/style/src/nsCSSLoader.cpp b/mozilla/content/html/style/src/nsCSSLoader.cpp index cebf0d1e3f6..e617c4e928a 100644 --- a/mozilla/content/html/style/src/nsCSSLoader.cpp +++ b/mozilla/content/html/style/src/nsCSSLoader.cpp @@ -826,7 +826,7 @@ static nsresult EnumerateMediaString(const nsAString& aStringList, nsStringEnumF stringList.Append(kNullCh); // put an extra null at the end - PRUnichar* start = (PRUnichar*)(const PRUnichar*)stringList.get(); + PRUnichar* start = stringList.BeginWriting(); PRUnichar* end = start; while (NS_SUCCEEDED(status) && (kNullCh != *start)) { diff --git a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp index b7d82ccb23f..075b9d5b859 100644 --- a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp @@ -3227,8 +3227,8 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue, valueList.Append(kNullCh); // put an extra null at the end - PRUnichar* value = (PRUnichar*)(const PRUnichar*)aValue.get(); - PRUnichar* start = (PRUnichar*)(const PRUnichar*)valueList.get(); + const PRUnichar* value = aValue.get(); + PRUnichar* start = valueList.BeginWriting(); PRUnichar* end = start; while (kNullCh != *start) { diff --git a/mozilla/content/shared/src/nsBidiUtils.cpp b/mozilla/content/shared/src/nsBidiUtils.cpp index 956a6a29062..7aaec93fbc6 100644 --- a/mozilla/content/shared/src/nsBidiUtils.cpp +++ b/mozilla/content/shared/src/nsBidiUtils.cpp @@ -257,7 +257,7 @@ nsresult ArabicShaping(const PRUnichar* aString, PRUint32 aLen, PRBool aInputLogical, PRBool aOutputLogical) { nsAutoString tempString(aString, aLen); - PRUnichar *tempBuf = NS_CONST_CAST(PRUnichar*, tempString.get()); + PRUnichar *tempBuf = tempString.BeginWriting(); if (aInputLogical) { ReverseString(tempBuf, aLen); } diff --git a/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp b/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp index 159e3ea3d29..b0e666d0cc2 100644 --- a/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp +++ b/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp @@ -1149,7 +1149,7 @@ nsXBLPrototypeBinding::ConstructInterfaceTable(const nsAString& aImpls) // The user specified at least one attribute. NS_ConvertUCS2toUTF8 utf8impl(aImpls); - char* str = NS_CONST_CAST(char *, utf8impl.get()); + char* str = utf8impl.BeginWriting(); 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 diff --git a/mozilla/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp b/mozilla/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp index 9ade39a8f4a..68d03b2ed4b 100644 --- a/mozilla/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp +++ b/mozilla/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp @@ -70,7 +70,7 @@ ChangeCSSInlineStyleTxn::ValueIncludes(const nsAString &aValueList, const nsAStr valueList.Append(kNullCh); // put an extra null at the end PRUnichar *value = ToNewUnicode(aValue); - PRUnichar *start = (PRUnichar*)(const PRUnichar*)valueList.get(); + PRUnichar *start = valueList.BeginWriting(); PRUnichar *end = start; while (kNullCh != *start) { @@ -113,7 +113,7 @@ ChangeCSSInlineStyleTxn::RemoveValueFromListOfValues(nsAString & aValues, const nsAutoString outString; classStr.Append(kNullCh); // put an extra null at the end - PRUnichar *start = (PRUnichar*)(const PRUnichar*)classStr.get(); + PRUnichar *start = classStr.BeginWriting(); PRUnichar *end = start; while (kNullCh != *start) { diff --git a/mozilla/embedding/browser/photon/src/PtMozilla.cpp b/mozilla/embedding/browser/photon/src/PtMozilla.cpp index 4fee8041d70..923cf58c310 100644 --- a/mozilla/embedding/browser/photon/src/PtMozilla.cpp +++ b/mozilla/embedding/browser/photon/src/PtMozilla.cpp @@ -557,7 +557,7 @@ mozilla_get_info(PtWidget_t *widget, PtArg_t *argt) nsCAutoString specString; url->GetSpec(specString); - REMOVE_WHEN_NEW_PT_WEB_strcpy( HistoryReplyBuf[j].url, (char *) specString.get() ); + REMOVE_WHEN_NEW_PT_WEB_strcpy( HistoryReplyBuf[j].url, specString.get() ); } } break; diff --git a/mozilla/embedding/tests/mfcembed/components/nsPrintDialogUtil.cpp b/mozilla/embedding/tests/mfcembed/components/nsPrintDialogUtil.cpp index ee7c0c28dd2..212dc03232c 100644 --- a/mozilla/embedding/tests/mfcembed/components/nsPrintDialogUtil.cpp +++ b/mozilla/embedding/tests/mfcembed/components/nsPrintDialogUtil.cpp @@ -873,7 +873,7 @@ ShowNativePrintDialog(HWND aHWnd, pDevNames->wOutputOffset = sizeof(DEVNAMES)+len+1; pDevNames->wDefault = 0; char* device = &(((char*)pDevNames)[pDevNames->wDeviceOffset]); - strcpy(device, (char*)NS_ConvertUCS2toUTF8(printerName).get()); + strcpy(device, NS_ConvertUCS2toUTF8(printerName).get()); ::GlobalUnlock(hDevNames); // Create a Moveable Memory Object that holds a new DevMode @@ -885,7 +885,7 @@ ShowNativePrintDialog(HWND aHWnd, #ifdef UNICODE hGlobalDevMode = CreateGlobalDevModeAndInit(printerName, aPrintSettings); #else - hGlobalDevMode = CreateGlobalDevModeAndInit((char*)NS_ConvertUCS2toUTF8(printerName).get(), aPrintSettings); + hGlobalDevMode = CreateGlobalDevModeAndInit(NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(printerName).get()), aPrintSettings); #endif // Prepare to Display the Print Dialog @@ -1192,7 +1192,7 @@ ShowNativePrintDialogEx(HWND aHWnd, #ifdef UNICODE hGlobalDevMode = CreateGlobalDevModeAndInit(printerName, aPrintSettings); #else - hGlobalDevMode = CreateGlobalDevModeAndInit((char*)NS_ConvertUCS2toUTF8(printerName).get(), aPrintSettings); + hGlobalDevMode = CreateGlobalDevModeAndInit(NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(printerName).get()), aPrintSettings); #endif } diff --git a/mozilla/extensions/webservices/proxy/src/wspinfoservice.cpp b/mozilla/extensions/webservices/proxy/src/wspinfoservice.cpp index 8329483aae4..ea5d0cd2969 100644 --- a/mozilla/extensions/webservices/proxy/src/wspinfoservice.cpp +++ b/mozilla/extensions/webservices/proxy/src/wspinfoservice.cpp @@ -379,7 +379,7 @@ AppendMethodForParticle(nsIInterfaceInfoSuperManager* iism, // XXX Deal with intercaps in that case? methodDesc.flags = params.GetCount() == 1 ? XPT_MD_GETTER : 0; - methodDesc.name = (char*) identifierName.get(); + methodDesc.name = NS_CONST_CAST(char*, identifierName.get()); methodDesc.params = paramArray; methodDesc.result = defaultResult; methodDesc.num_args = (PRUint8) params.GetCount(); @@ -1271,7 +1271,7 @@ nsWSPInterfaceInfoService::InfoForPort(nsIWSDLPort *aPort, WSPFactory::XML2C(tempString, tempCString); - methodDesc.name = (char*) tempCString.get(); + methodDesc.name = NS_CONST_CAST(char*, tempCString.get()); methodDesc.params = primaryParamArray; methodDesc.result = defaultResult; methodDesc.flags = 0; @@ -1283,7 +1283,7 @@ nsWSPInterfaceInfoService::InfoForPort(nsIWSDLPort *aPort, } - methodDesc.name = (char*) tempCString.get(); + methodDesc.name = NS_CONST_CAST(char*, tempCString.get()); methodDesc.params = primaryAsyncParamArray; methodDesc.result = defaultResult; methodDesc.flags = 0; @@ -1296,7 +1296,7 @@ nsWSPInterfaceInfoService::InfoForPort(nsIWSDLPort *aPort, tempCString.Append("Callback"); - methodDesc.name = (char*) tempCString.get(); + methodDesc.name = NS_CONST_CAST(char*, tempCString.get()); methodDesc.params = listenerParamArray; methodDesc.result = defaultResult; methodDesc.flags = 0; diff --git a/mozilla/gfx/src/nsFont.cpp b/mozilla/gfx/src/nsFont.cpp index 17dc604b7da..9cbf301c6ae 100644 --- a/mozilla/gfx/src/nsFont.cpp +++ b/mozilla/gfx/src/nsFont.cpp @@ -144,7 +144,7 @@ PRBool nsFont::EnumerateFamilies(nsFontFamilyEnumFunc aFunc, void* aData) const familyList.Append(kNullCh); // put an extra null at the end // XXX This code is evil... - PRUnichar* start = (PRUnichar*)(const PRUnichar*)familyList.get(); + PRUnichar* start = familyList.BeginWriting(); PRUnichar* end = start; while (running && (kNullCh != *start)) { diff --git a/mozilla/gfx/src/windows/nsDeviceContextSpecWin.cpp b/mozilla/gfx/src/windows/nsDeviceContextSpecWin.cpp index ddfbd870e19..f4ec71ca2ba 100644 --- a/mozilla/gfx/src/windows/nsDeviceContextSpecWin.cpp +++ b/mozilla/gfx/src/windows/nsDeviceContextSpecWin.cpp @@ -365,7 +365,7 @@ CheckForPrintToFile(nsIPrintSettings* aPS, LPTSTR aPrinterName, PRUnichar* aUPri if (aPrinterName) { CheckForPrintToFileWithName(aPrinterName, toFile); } else { - CheckForPrintToFileWithName((char*)NS_ConvertUCS2toUTF8(aUPrinterName).get(), toFile); + CheckForPrintToFileWithName(NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aUPrinterName).get()), toFile); } #endif // Since the driver wasn't a "Print To File" Driver, check to see @@ -654,27 +654,27 @@ nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSett } HANDLE hPrinter = NULL; - BOOL status = ::OpenPrinter((char*)NS_ConvertUCS2toUTF8(aName).get(), &hPrinter, NULL); + BOOL status = ::OpenPrinter(NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aName).get()), &hPrinter, NULL); if (status) { LPDEVMODE pDevMode; DWORD dwNeeded, dwRet; // Allocate a buffer of the correct size. - dwNeeded = DocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aName).get(), + dwNeeded = DocumentProperties(gParentWnd, hPrinter, NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aName).get()), NULL, NULL, 0); pDevMode = (LPDEVMODE)::HeapAlloc (::GetProcessHeap(), HEAP_ZERO_MEMORY, dwNeeded); if (!pDevMode) return NS_ERROR_FAILURE; // Get the default DevMode for the printer and modify it for our needs. - dwRet = DocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aName).get(), + dwRet = DocumentProperties(gParentWnd, hPrinter, NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aName).get()), pDevMode, NULL, DM_OUT_BUFFER); if (dwRet == IDOK && aPS) { SetupDevModeFromSettings(pDevMode, aPS); // Sets back the changes we made to the DevMode into the Printer Driver - dwRet = ::DocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aName).get(), pDevMode, pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER); + dwRet = ::DocumentProperties(gParentWnd, hPrinter, NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aName).get()), pDevMode, pDevMode, DM_IN_BUFFER | DM_OUT_BUFFER); } if (dwRet != IDOK) { @@ -687,7 +687,7 @@ nsDeviceContextSpecWin::GetDataFromPrinter(const PRUnichar * aName, nsIPrintSett SetDevMode(pDevMode); // cache the pointer and takes responsibility for the memory - SetDeviceName((char*)NS_ConvertUCS2toUTF8(aName).get()); + SetDeviceName(NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aName).get())); // The driver should be NULL for Win95/Win98 OSVERSIONINFO os; @@ -925,7 +925,7 @@ NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const PRUnichar *aPri { nsresult rv = NS_ERROR_FAILURE; HANDLE hPrinter = NULL; - BOOL status = ::OpenPrinter((char*)NS_ConvertUCS2toUTF8(aPrinterName).get(), &hPrinter, NULL); + BOOL status = ::OpenPrinter(NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aPrinterName).get()), &hPrinter, NULL); if (status) { LPDEVMODE pDevMode; @@ -934,13 +934,13 @@ NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const PRUnichar *aPri // Get the buffer correct buffer size dwNeeded = ::DocumentProperties(gParentWnd, hPrinter, - (char*)NS_ConvertUCS2toUTF8(aPrinterName).get(), NULL, NULL, 0); + NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aPrinterName).get()), NULL, NULL, 0); // Allocate a buffer of the correct size. pNewDevMode = (LPDEVMODE)::HeapAlloc (::GetProcessHeap(), HEAP_ZERO_MEMORY, dwNeeded); if (!pNewDevMode) return NS_ERROR_FAILURE; - dwRet = ::DocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aPrinterName).get(), + dwRet = ::DocumentProperties(gParentWnd, hPrinter, NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aPrinterName).get()), pNewDevMode, NULL, DM_OUT_BUFFER); if (dwRet != IDOK) { @@ -953,7 +953,7 @@ NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const PRUnichar *aPri pDevMode = (LPDEVMODE)::HeapAlloc (::GetProcessHeap(), HEAP_ZERO_MEMORY, dwNeeded); if (!pDevMode) return NS_ERROR_FAILURE; - dwRet = ::DocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aPrinterName).get(), + dwRet = ::DocumentProperties(gParentWnd, hPrinter, NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aPrinterName).get()), pDevMode, NULL, DM_OUT_BUFFER); if (dwRet != IDOK) { @@ -971,9 +971,9 @@ NS_IMETHODIMP nsPrinterEnumeratorWin::DisplayPropertiesDlg(const PRUnichar *aPri // Display the Dialog and get the new DevMode #if 0 // need more to do more work to see why AdvancedDocumentProperties fails // when cancel is pressed - LONG stat = ::AdvancedDocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aPrinterName).get(), pNewDevMode, pDevMode); + LONG stat = ::AdvancedDocumentProperties(gParentWnd, hPrinter, NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aPrinterName).get()), pNewDevMode, pDevMode); #else - LONG stat = ::DocumentProperties(gParentWnd, hPrinter, (char*)NS_ConvertUCS2toUTF8(aPrinterName).get(), pDevMode, NULL, DM_IN_PROMPT|DM_OUT_BUFFER); + LONG stat = ::DocumentProperties(gParentWnd, hPrinter, NS_CONST_CAST(char*, NS_ConvertUCS2toUTF8(aPrinterName).get()), pDevMode, NULL, DM_IN_PROMPT|DM_OUT_BUFFER); #endif if (stat == IDOK) { // Now set the print options from the native Page Setup diff --git a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp index 532c9fdc29b..30031287ad9 100644 --- a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp +++ b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp @@ -4239,7 +4239,7 @@ nsFontWinNonUnicode::GetWidth(HDC aDC, const PRUnichar* aString, if (!mIsWide) ::GetTextExtentPoint32A(aDC, buffer.get(), destLength, &size); else - ::GetTextExtentPoint32W(aDC, (PRUnichar*) buffer.get(), destLength / 2, &size); + ::GetTextExtentPoint32W(aDC, (const PRUnichar*) buffer.get(), destLength / 2, &size); size.cx -= mOverhangCorrection; return size.cx; @@ -4260,7 +4260,7 @@ nsFontWinNonUnicode::DrawString(HDC aDC, PRInt32 aX, PRInt32 aY, if (!mIsWide) NS_ExtTextOutA(aDC, this, aX, aY, 0, NULL, buffer.get(), aLength, NULL); else - NS_ExtTextOutW(aDC, this, aX, aY, 0, NULL, (PRUnichar*) buffer.get(), destLength / 2, NULL); + NS_ExtTextOutW(aDC, this, aX, aY, 0, NULL, (const PRUnichar*) buffer.get(), destLength / 2, NULL); } #ifdef MOZ_MATHML @@ -4288,7 +4288,7 @@ nsFontWinNonUnicode::GetBoundingMetrics(HDC aDC, if (gGlyphAgent.GetState() != eGlyphAgent_UNICODE) { // we are on a platform that doesn't implement GetGlyphOutlineW() // we need to use glyph indices - rv = GetGlyphIndices(aDC, &mCMAP, (PRUnichar*)buffer.get(), destLength / 2, buf); + rv = GetGlyphIndices(aDC, &mCMAP, (const PRUnichar*)buffer.get(), destLength / 2, buf); if (NS_FAILED(rv)) { return rv; } @@ -4296,7 +4296,7 @@ nsFontWinNonUnicode::GetBoundingMetrics(HDC aDC, // buffer.mBuffer is now a pseudo-Unicode string so that we can use // GetBoundingMetricsCommon() also used by nsFontWinUnicode. - return GetBoundingMetricsCommon(aDC, mOverhangCorrection, (PRUnichar*)buffer.get(), + return GetBoundingMetricsCommon(aDC, mOverhangCorrection, (const PRUnichar*)buffer.get(), destLength / 2, aBoundingMetrics, buf.get()); } diff --git a/mozilla/htmlparser/src/nsScannerString.cpp b/mozilla/htmlparser/src/nsScannerString.cpp index 1bf598e3186..06dba15845a 100644 --- a/mozilla/htmlparser/src/nsScannerString.cpp +++ b/mozilla/htmlparser/src/nsScannerString.cpp @@ -405,7 +405,7 @@ nsScannerString::ReplaceCharacter(nsScannerIterator& aPosition, PRUnichar aChar) // XXX Casting a const to non-const. Unless the base class // provides support for writing iterators, this is the best // that can be done. - PRUnichar* pos = (PRUnichar*)aPosition.get(); + PRUnichar* pos = NS_CONST_CAST(PRUnichar*, aPosition.get()); *pos = aChar; mIsDirty = PR_TRUE; diff --git a/mozilla/intl/uconv/ucvko/nsUnicodeToJamoTTF.cpp b/mozilla/intl/uconv/ucvko/nsUnicodeToJamoTTF.cpp index 3dee1eea994..e73e203a1ac 100644 --- a/mozilla/intl/uconv/ucvko/nsUnicodeToJamoTTF.cpp +++ b/mozilla/intl/uconv/ucvko/nsUnicodeToJamoTTF.cpp @@ -546,7 +546,7 @@ nsUnicodeToJamoTTF::composeHangul(char* aResult) rv = JamoNormalize(mJamos, getter_Copies(buffer), &length); // safe to cast away const. - PRUnichar* text = NS_CONST_CAST(PRUnichar *, buffer.get()); + PRUnichar* text = buffer.BeginWriting(); NS_ENSURE_SUCCESS(rv, rv); text += RenderAsPrecompSyllable(text, &length, aResult); diff --git a/mozilla/intl/unicharutil/src/nsHankakuToZenkaku.cpp b/mozilla/intl/unicharutil/src/nsHankakuToZenkaku.cpp index 00513ee2b95..bbb62028180 100644 --- a/mozilla/intl/unicharutil/src/nsHankakuToZenkaku.cpp +++ b/mozilla/intl/unicharutil/src/nsHankakuToZenkaku.cpp @@ -156,7 +156,7 @@ NS_IMETHODIMP nsHankakuToZenkaku::Change( const PRUnichar* aText, PRInt32 aTextL PRInt32 ol; aResult.SetCapacity(aTextLength); - HankakuToZenkaku ( aText, aTextLength, (PRUnichar*) aResult.get(), aTextLength, &ol); + HankakuToZenkaku ( aText, aTextLength, aResult.BeginWriting(), aTextLength, &ol); aResult.SetLength(ol); return NS_OK; diff --git a/mozilla/intl/unicharutil/util/nsUnicharUtils.cpp b/mozilla/intl/unicharutil/util/nsUnicharUtils.cpp index 5f77dda120c..f6578ac411a 100644 --- a/mozilla/intl/unicharutil/util/nsUnicharUtils.cpp +++ b/mozilla/intl/unicharutil/util/nsUnicharUtils.cpp @@ -150,7 +150,7 @@ class CopyToLowerCase PRUint32 write( const PRUnichar* aSource, PRUint32 aSourceLength ) { PRUint32 len = PR_MIN(PRUint32(mIter.size_forward()), aSourceLength); - PRUnichar* dest = NS_CONST_CAST(PRUnichar*, mIter.get()); + PRUnichar* dest = mIter.get(); if (gCaseConv) gCaseConv->ToLower(aSource, dest, len); else { @@ -234,7 +234,7 @@ class CopyToUpperCase PRUint32 write( const PRUnichar* aSource, PRUint32 aSourceLength ) { PRUint32 len = PR_MIN(PRUint32(mIter.size_forward()), aSourceLength); - PRUnichar* dest = NS_CONST_CAST(PRUnichar*, mIter.get()); + PRUnichar* dest = mIter.get(); if (gCaseConv) gCaseConv->ToUpper(aSource, dest, len); else { diff --git a/mozilla/layout/base/nsBidiPresUtils.cpp b/mozilla/layout/base/nsBidiPresUtils.cpp index 07cb7da3f5d..0fb183ea365 100644 --- a/mozilla/layout/base/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/nsBidiPresUtils.cpp @@ -903,7 +903,7 @@ nsBidiPresUtils::FormatUnicodeText(nsIPresContext* aPresContext, if (mBuffer.Length() < aTextLength) { mBuffer.SetLength(aTextLength); } - PRUnichar* buffer = NS_CONST_CAST(PRUnichar*, mBuffer.get()); + PRUnichar* buffer = mBuffer.BeginWriting(); if (doReverse) { rv = mBidiEngine->WriteReverse(aText, aTextLength, buffer, @@ -1158,7 +1158,7 @@ nsBidiPresUtils::ReorderUnicodeText(PRUnichar* aText, if (mBuffer.Length() < aTextLength) { mBuffer.SetLength(aTextLength); } - PRUnichar* buffer = NS_CONST_CAST(PRUnichar*, mBuffer.get()); + PRUnichar* buffer = mBuffer.BeginWriting(); if (doReverse) { rv = mBidiEngine->WriteReverse(aText, aTextLength, buffer, diff --git a/mozilla/layout/base/nsBidiUtils.cpp b/mozilla/layout/base/nsBidiUtils.cpp index 956a6a29062..7aaec93fbc6 100644 --- a/mozilla/layout/base/nsBidiUtils.cpp +++ b/mozilla/layout/base/nsBidiUtils.cpp @@ -257,7 +257,7 @@ nsresult ArabicShaping(const PRUnichar* aString, PRUint32 aLen, PRBool aInputLogical, PRBool aOutputLogical) { nsAutoString tempString(aString, aLen); - PRUnichar *tempBuf = NS_CONST_CAST(PRUnichar*, tempString.get()); + PRUnichar *tempBuf = tempString.BeginWriting(); if (aInputLogical) { ReverseString(tempBuf, aLen); } diff --git a/mozilla/layout/base/src/nsBidiPresUtils.cpp b/mozilla/layout/base/src/nsBidiPresUtils.cpp index 07cb7da3f5d..0fb183ea365 100644 --- a/mozilla/layout/base/src/nsBidiPresUtils.cpp +++ b/mozilla/layout/base/src/nsBidiPresUtils.cpp @@ -903,7 +903,7 @@ nsBidiPresUtils::FormatUnicodeText(nsIPresContext* aPresContext, if (mBuffer.Length() < aTextLength) { mBuffer.SetLength(aTextLength); } - PRUnichar* buffer = NS_CONST_CAST(PRUnichar*, mBuffer.get()); + PRUnichar* buffer = mBuffer.BeginWriting(); if (doReverse) { rv = mBidiEngine->WriteReverse(aText, aTextLength, buffer, @@ -1158,7 +1158,7 @@ nsBidiPresUtils::ReorderUnicodeText(PRUnichar* aText, if (mBuffer.Length() < aTextLength) { mBuffer.SetLength(aTextLength); } - PRUnichar* buffer = NS_CONST_CAST(PRUnichar*, mBuffer.get()); + PRUnichar* buffer = mBuffer.BeginWriting(); if (doReverse) { rv = mBidiEngine->WriteReverse(aText, aTextLength, buffer, diff --git a/mozilla/layout/generic/nsBulletFrame.cpp b/mozilla/layout/generic/nsBulletFrame.cpp index 72f2583e6f1..f5de2435cbb 100644 --- a/mozilla/layout/generic/nsBulletFrame.cpp +++ b/mozilla/layout/generic/nsBulletFrame.cpp @@ -442,7 +442,7 @@ static PRBool OtherDecimalToText(PRInt32 ordinal, PRUnichar zeroChar, nsString& { PRUnichar diff = zeroChar - PRUnichar('0'); DecimalToText(ordinal, result); - PRUnichar* p = NS_CONST_CAST(PRUnichar*, result.get()); + PRUnichar* p = result.BeginWriting(); if (ordinal < 0) { // skip the leading '-' ++p; @@ -459,7 +459,7 @@ static PRBool TamilToText(PRInt32 ordinal, nsString& result) // Can't do those in this system. return PR_FALSE; } - PRUnichar* p = (PRUnichar*)result.get(); + PRUnichar* p = result.BeginWriting(); for(; nsnull != *p ; p++) if(*p != PRUnichar('0')) *p += diff; diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index 5d4c9277629..3d70ce07cf0 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -544,7 +544,7 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext, aPresContext->GetBidiUtils(&bidiUtils); if (bidiUtils) { - PRUnichar* buffer = (PRUnichar*)str.get(); + PRUnichar* buffer = str.BeginWriting(); // Base direction is always LTR for now. If bug 139337 is fixed, // that should change. rv = bidiUtils->RenderText(buffer, str.Length(), NSBIDI_LTR, diff --git a/mozilla/layout/generic/nsTextTransformer.cpp b/mozilla/layout/generic/nsTextTransformer.cpp index 138646d430b..d49ef1f6843 100644 --- a/mozilla/layout/generic/nsTextTransformer.cpp +++ b/mozilla/layout/generic/nsTextTransformer.cpp @@ -1499,7 +1499,7 @@ nsTextTransformer::DoArabicShaping(PRUnichar* aText, nsAutoString buf; buf.SetLength(aTextLength); - PRUnichar* buffer = (PRUnichar*)buf.get(); + PRUnichar* buffer = buf.BeginWriting(); ArabicShaping(aText, buf.Length(), buffer, (PRUint32 *)&newLen, !isVisual, !isVisual); diff --git a/mozilla/layout/html/base/src/nsBulletFrame.cpp b/mozilla/layout/html/base/src/nsBulletFrame.cpp index 72f2583e6f1..f5de2435cbb 100644 --- a/mozilla/layout/html/base/src/nsBulletFrame.cpp +++ b/mozilla/layout/html/base/src/nsBulletFrame.cpp @@ -442,7 +442,7 @@ static PRBool OtherDecimalToText(PRInt32 ordinal, PRUnichar zeroChar, nsString& { PRUnichar diff = zeroChar - PRUnichar('0'); DecimalToText(ordinal, result); - PRUnichar* p = NS_CONST_CAST(PRUnichar*, result.get()); + PRUnichar* p = result.BeginWriting(); if (ordinal < 0) { // skip the leading '-' ++p; @@ -459,7 +459,7 @@ static PRBool TamilToText(PRInt32 ordinal, nsString& result) // Can't do those in this system. return PR_FALSE; } - PRUnichar* p = (PRUnichar*)result.get(); + PRUnichar* p = result.BeginWriting(); for(; nsnull != *p ; p++) if(*p != PRUnichar('0')) *p += diff; diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index 5d4c9277629..3d70ce07cf0 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -544,7 +544,7 @@ nsPageFrame::DrawHeaderFooter(nsIPresContext* aPresContext, aPresContext->GetBidiUtils(&bidiUtils); if (bidiUtils) { - PRUnichar* buffer = (PRUnichar*)str.get(); + PRUnichar* buffer = str.BeginWriting(); // Base direction is always LTR for now. If bug 139337 is fixed, // that should change. rv = bidiUtils->RenderText(buffer, str.Length(), NSBIDI_LTR, diff --git a/mozilla/layout/html/base/src/nsTextTransformer.cpp b/mozilla/layout/html/base/src/nsTextTransformer.cpp index 138646d430b..d49ef1f6843 100644 --- a/mozilla/layout/html/base/src/nsTextTransformer.cpp +++ b/mozilla/layout/html/base/src/nsTextTransformer.cpp @@ -1499,7 +1499,7 @@ nsTextTransformer::DoArabicShaping(PRUnichar* aText, nsAutoString buf; buf.SetLength(aTextLength); - PRUnichar* buffer = (PRUnichar*)buf.get(); + PRUnichar* buffer = buf.BeginWriting(); ArabicShaping(aText, buf.Length(), buffer, (PRUint32 *)&newLen, !isVisual, !isVisual); diff --git a/mozilla/layout/mathml/base/src/nsMathMLmtableFrame.cpp b/mozilla/layout/mathml/base/src/nsMathMLmtableFrame.cpp index 084ec981804..9ed8f159d68 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLmtableFrame.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLmtableFrame.cpp @@ -56,7 +56,7 @@ SplitString(nsString& aString, // [IN/OUT] aString.Append(kNullCh); // put an extra null at the end - PRUnichar* start = (PRUnichar*)(const PRUnichar*)aString.get(); + PRUnichar* start = aString.BeginWriting(); PRUnichar* end = start; while (kNullCh != *start) { diff --git a/mozilla/layout/mathml/content/src/nsMathMLOperators.cpp b/mozilla/layout/mathml/content/src/nsMathMLOperators.cpp index a5496d34117..49fcd8f3f84 100644 --- a/mozilla/layout/mathml/content/src/nsMathMLOperators.cpp +++ b/mozilla/layout/mathml/content/src/nsMathMLOperators.cpp @@ -232,7 +232,7 @@ SetOperator(OperatorData* aOperatorData, #endif // Loop over the space-delimited list of attributes to get the name:value pairs aAttributes.Append(kNullCh); // put an extra null at the end - PRUnichar* start = (PRUnichar*)(const PRUnichar*)aAttributes.get(); + PRUnichar* start = aAttributes.BeginWriting(); PRUnichar* end = start; while ((kNullCh != *start) && (kDashCh != *start)) { name.SetLength(0); diff --git a/mozilla/layout/style/nsCSSLoader.cpp b/mozilla/layout/style/nsCSSLoader.cpp index cebf0d1e3f6..e617c4e928a 100644 --- a/mozilla/layout/style/nsCSSLoader.cpp +++ b/mozilla/layout/style/nsCSSLoader.cpp @@ -826,7 +826,7 @@ static nsresult EnumerateMediaString(const nsAString& aStringList, nsStringEnumF stringList.Append(kNullCh); // put an extra null at the end - PRUnichar* start = (PRUnichar*)(const PRUnichar*)stringList.get(); + PRUnichar* start = stringList.BeginWriting(); PRUnichar* end = start; while (NS_SUCCEEDED(status) && (kNullCh != *start)) { diff --git a/mozilla/layout/style/nsCSSStyleSheet.cpp b/mozilla/layout/style/nsCSSStyleSheet.cpp index b7d82ccb23f..075b9d5b859 100644 --- a/mozilla/layout/style/nsCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsCSSStyleSheet.cpp @@ -3227,8 +3227,8 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue, valueList.Append(kNullCh); // put an extra null at the end - PRUnichar* value = (PRUnichar*)(const PRUnichar*)aValue.get(); - PRUnichar* start = (PRUnichar*)(const PRUnichar*)valueList.get(); + const PRUnichar* value = aValue.get(); + PRUnichar* start = valueList.BeginWriting(); PRUnichar* end = start; while (kNullCh != *start) { diff --git a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp index e7b87c2bcc1..b55766ed648 100644 --- a/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp +++ b/mozilla/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp @@ -2994,7 +2994,7 @@ nsTreeBodyFrame::PaintText(PRInt32 aRowIndex, nsBidiDirection direction = (NS_STYLE_DIRECTION_RTL == vis->mDirection) ? NSBIDI_RTL : NSBIDI_LTR; - PRUnichar* buffer = (PRUnichar*) text.get(); + PRUnichar* buffer = text.BeginWriting(); rv = bidiUtils->RenderText(buffer, text.Length(), direction, aPresContext, aRenderingContext, textRect.x, textRect.y + baseline); diff --git a/mozilla/mailnews/base/search/src/nsMsgImapSearch.cpp b/mozilla/mailnews/base/search/src/nsMsgImapSearch.cpp index 90170c09ab5..dbdf9d28045 100644 --- a/mozilla/mailnews/base/search/src/nsMsgImapSearch.cpp +++ b/mozilla/mailnews/base/search/src/nsMsgImapSearch.cpp @@ -144,7 +144,7 @@ nsresult nsMsgSearchOnlineMail::Encode (nsCString& pEncoding, rv = searchValue->GetStr(getter_Copies(pchar)); if (NS_FAILED(rv) || !pchar) continue; - asciiOnly = nsCRT::IsAscii(NS_CONST_CAST(PRUnichar*, pchar.get())); + asciiOnly = nsCRT::IsAscii(pchar.get()); } } } diff --git a/mozilla/mailnews/base/src/nsMessenger.cpp b/mozilla/mailnews/base/src/nsMessenger.cpp index f5c47884946..3c065ceb955 100644 --- a/mozilla/mailnews/base/src/nsMessenger.cpp +++ b/mozilla/mailnews/base/src/nsMessenger.cpp @@ -767,7 +767,7 @@ nsMessenger::SaveAttachmentToFolder(const char * contentType, const char * url, nsCAutoString unescapedUrl; unescapedUrl.Assign(url); - nsUnescape(NS_CONST_CAST(char*, unescapedUrl.get())); + nsUnescape(unescapedUrl.BeginWriting()); rv = SaveAttachment(fileSpec, unescapedUrl.get(), messageUri, contentType, nsnull); // before we return, we need to convert our file spec back to a nsIFile to return to the caller diff --git a/mozilla/mailnews/base/src/nsMessengerMigrator.cpp b/mozilla/mailnews/base/src/nsMessengerMigrator.cpp index 1ce94ee4a4f..68784f5baca 100644 --- a/mozilla/mailnews/base/src/nsMessengerMigrator.cpp +++ b/mozilla/mailnews/base/src/nsMessengerMigrator.cpp @@ -1629,7 +1629,7 @@ nsMessengerMigrator::MigrateImapAccounts(nsIMsgIdentity *identity) if (!hostList || !*hostList) return NS_OK; // NS_ERROR_FAILURE? char *token = nsnull; - char *rest = NS_CONST_CAST(char*,(const char*)hostList); + char *rest = hostList; nsCAutoString str; PRBool isDefaultAccount = PR_TRUE; diff --git a/mozilla/mailnews/base/src/nsMsgAccount.cpp b/mozilla/mailnews/base/src/nsMsgAccount.cpp index f4142ea155f..d607b5c3579 100644 --- a/mozilla/mailnews/base/src/nsMsgAccount.cpp +++ b/mozilla/mailnews/base/src/nsMsgAccount.cpp @@ -253,7 +253,7 @@ nsMsgAccount::createIdentities() // const-casting because nsCRT::strtok whacks the string, // but safe because identityKey is a copy char* newStr; - char* rest = NS_CONST_CAST(char*,identityKey.get()); + char* rest = identityKey.BeginWriting(); char* token = nsCRT::strtok(rest, ",", &newStr); // temporaries used inside the loop @@ -365,7 +365,7 @@ nsMsgAccount::AddIdentity(nsIMsgIdentity *identity) // const-casting because nsCRT::strtok whacks the string, // but safe because identityList is a copy char *newStr; - char *rest = NS_CONST_CAST(char*,identityList.get()); + char *rest = identityList.BeginWriting(); char *token = nsCRT::strtok(rest, ",", &newStr); // look for the identity key that we're adding diff --git a/mozilla/mailnews/base/src/nsMsgAccountManager.cpp b/mozilla/mailnews/base/src/nsMsgAccountManager.cpp index a0946e699ae..8faad16e651 100644 --- a/mozilla/mailnews/base/src/nsMsgAccountManager.cpp +++ b/mozilla/mailnews/base/src/nsMsgAccountManager.cpp @@ -417,7 +417,7 @@ nsMsgAccountManager::createKeyedIdentity(const char* key, getter_AddRefs(identity)); if (NS_FAILED(rv)) return rv; - identity->SetKey(NS_CONST_CAST(char *,key)); + identity->SetKey(key); nsCStringKey hashKey(key); @@ -730,7 +730,7 @@ nsMsgAccountManager::removeKeyedAccount(const char *key) // the one with 'key' nsCAutoString newAccountList; char *newStr; - char *rest = NS_CONST_CAST(char *,(const char*)accountList); + char *rest = accountList.BeginWriting(); char *token = nsCRT::strtok(rest, ",", &newStr); while (token) { @@ -1434,7 +1434,7 @@ nsMsgAccountManager::LoadAccounts() /* parse accountList and run loadAccount on each string, comma-separated */ nsCOMPtr account; char *newStr; - char *rest = NS_CONST_CAST(char*,(const char*)accountList); + char *rest = accountList.BeginWriting(); nsCAutoString str; char *token = nsCRT::strtok(rest, ",", &newStr); @@ -1619,7 +1619,7 @@ nsMsgAccountManager::createKeyedAccount(const char* key, (void **)getter_AddRefs(account)); if (NS_FAILED(rv)) return rv; - account->SetKey(NS_CONST_CAST(char*,(const char*)key)); + account->SetKey(key); // add to internal nsISupportsArray m_accounts->AppendElement(NS_STATIC_CAST(nsISupports*, account)); diff --git a/mozilla/mailnews/base/util/nsMsgDBFolder.cpp b/mozilla/mailnews/base/util/nsMsgDBFolder.cpp index ee20344f194..fdae49ae97f 100644 --- a/mozilla/mailnews/base/util/nsMsgDBFolder.cpp +++ b/mozilla/mailnews/base/util/nsMsgDBFolder.cpp @@ -2427,12 +2427,12 @@ nsMsgDBFolder::parseURI(PRBool needServer) nsCAutoString userPass; rv = url->GetUserPass(userPass); if (NS_SUCCEEDED(rv) && !userPass.IsEmpty()) - nsUnescape(NS_CONST_CAST(char*,userPass.get())); + nsUnescape(userPass.BeginWriting()); nsCAutoString hostName; rv = url->GetHost(hostName); if (NS_SUCCEEDED(rv) && !hostName.IsEmpty()) - nsUnescape(NS_CONST_CAST(char*,hostName.get())); + nsUnescape(hostName.BeginWriting()); // turn it back into a server: diff --git a/mozilla/mailnews/base/util/nsMsgI18N.cpp b/mozilla/mailnews/base/util/nsMsgI18N.cpp index a97ab95c279..e9f8346a6c9 100644 --- a/mozilla/mailnews/base/util/nsMsgI18N.cpp +++ b/mozilla/mailnews/base/util/nsMsgI18N.cpp @@ -104,7 +104,7 @@ nsresult nsMsgI18NConvertFromUnicode(const nsAFlatCString& aCharset, if (NS_SUCCEEDED(res)) { const PRUnichar *originalSrcPtr = inString.get(); - PRUnichar *currentSrcPtr = NS_CONST_CAST(PRUnichar *, originalSrcPtr); + const PRUnichar *currentSrcPtr = originalSrcPtr; PRInt32 originalUnicharLength = inString.Length(); PRInt32 srcLength; PRInt32 dstLength; @@ -165,7 +165,7 @@ nsresult nsMsgI18NConvertToUnicode(const nsAFlatCString& aCharset, if(NS_SUCCEEDED(res)) { const char *originalSrcPtr = inString.get(); - char *currentSrcPtr = NS_CONST_CAST(char *, originalSrcPtr); + const char *currentSrcPtr = originalSrcPtr; PRInt32 originalLength = inString.Length(); PRInt32 srcLength; PRInt32 dstLength; @@ -414,7 +414,7 @@ PRBool nsMsgI18Ncheck_data_in_charset_range(const char *charset, const PRUnichar if(NS_SUCCEEDED(res)) { const PRUnichar *originalPtr = inString; PRInt32 originalLen = nsCRT::strlen(inString); - PRUnichar *currentSrcPtr = NS_CONST_CAST(PRUnichar *, originalPtr); + const PRUnichar *currentSrcPtr = originalPtr; char localBuff[512]; PRInt32 consumedLen = 0; PRInt32 srcLen; diff --git a/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp b/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp index bf2d48d1aad..04fb84574a6 100644 --- a/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp +++ b/mozilla/mailnews/compose/src/nsMsgAttachmentHandler.cpp @@ -680,7 +680,7 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields) // Unescape the name before making FSSpec nsCAutoString escapedFilename(src_filename); - nsUnescape(NS_CONST_CAST(char*, escapedFilename.get())); + nsUnescape(escapedFilename.BeginWriting()); //We need to retrieve the file type and creator... nsFileSpec scr_fileSpec(escapedFilename.get()); @@ -1064,7 +1064,7 @@ nsMsgAttachmentHandler::UrlExit(nsresult status, const PRUnichar* aMsg) if (NS_SUCCEEDED(mURL->GetSpec(turl)) && (turl)) { nsCAutoString unescapeUrl(turl); - nsUnescape (NS_CONST_CAST(char*, unescapeUrl.get())); + nsUnescape(unescapeUrl.BeginWriting()); if (unescapeUrl.IsEmpty()) printfString = nsTextFormatter::smprintf(msg, turl.get()); else diff --git a/mozilla/mailnews/compose/src/nsMsgCompose.cpp b/mozilla/mailnews/compose/src/nsMsgCompose.cpp index c62de19b4d3..8787b4e5d39 100644 --- a/mozilla/mailnews/compose/src/nsMsgCompose.cpp +++ b/mozilla/mailnews/compose/src/nsMsgCompose.cpp @@ -185,7 +185,7 @@ static void TranslateLineEnding(nsString& data) PRUnichar* sPtr; //Start data pointer PRUnichar* ePtr; //End data pointer - rPtr = wPtr = sPtr = NS_CONST_CAST(PRUnichar*, data.get()); + rPtr = wPtr = sPtr = data.BeginWriting(); ePtr = rPtr + data.Length(); while (rPtr < ePtr) @@ -2178,7 +2178,7 @@ NS_IMETHODIMP QuotingOutputStreamListener::OnStopRequest(nsIRequest *request, ns nsXPIDLCString email; mIdentity->GetEmail(getter_Copies(email)); addressToBeRemoved += ", "; - addressToBeRemoved += NS_CONST_CAST(char*, (const char *)email); + addressToBeRemoved += email; } rv= RemoveDuplicateAddresses(_compFields->GetCc(), addressToBeRemoved.get(), PR_TRUE, &resultStr); diff --git a/mozilla/mailnews/compose/src/nsSmtpService.cpp b/mozilla/mailnews/compose/src/nsSmtpService.cpp index 8d291199006..d1c8e187749 100644 --- a/mozilla/mailnews/compose/src/nsSmtpService.cpp +++ b/mozilla/mailnews/compose/src/nsSmtpService.cpp @@ -502,7 +502,7 @@ nsSmtpService::loadSmtpServers() } char *newStr; - char *pref = nsCRT::strtok(NS_CONST_CAST(char*,(const char*)serverList), ", ", &newStr); + char *pref = nsCRT::strtok(serverList.BeginWriting(), ", ", &newStr); while (pref) { // fix for bug #96207 @@ -550,7 +550,7 @@ nsSmtpService::createKeyedServer(const char *key, nsISmtpServer** aResult) (void **)getter_AddRefs(server)); if (NS_FAILED(rv)) return rv; - server->SetKey(NS_CONST_CAST(char *,key)); + server->SetKey(key); mSmtpServers->AppendElement(server); nsCOMPtr prefs(do_GetService(NS_PREF_CONTRACTID, &rv)); diff --git a/mozilla/mailnews/compose/src/nsSmtpUrl.cpp b/mozilla/mailnews/compose/src/nsSmtpUrl.cpp index 6862d0ce0ef..7701d1bd97f 100644 --- a/mozilla/mailnews/compose/src/nsSmtpUrl.cpp +++ b/mozilla/mailnews/compose/src/nsSmtpUrl.cpp @@ -200,7 +200,7 @@ nsresult nsMailtoUrl::ParseMailtoUrl(char * searchPart) // Now unescape any fields that need escaped... if (!m_toPart.IsEmpty()) { - nsUnescape(NS_CONST_CAST(char*, m_toPart.get())); + nsUnescape(m_toPart.BeginWriting()); if (mimeConverter) { if (NS_SUCCEEDED(mimeConverter->DecodeMimeHeader(m_toPart.get(), @@ -212,7 +212,7 @@ nsresult nsMailtoUrl::ParseMailtoUrl(char * searchPart) } if (!m_ccPart.IsEmpty()) { - nsUnescape(NS_CONST_CAST(char*, m_ccPart.get())); + nsUnescape(m_ccPart.BeginWriting()); if (mimeConverter) { if (NS_SUCCEEDED(mimeConverter->DecodeMimeHeader(m_ccPart.get(), @@ -224,7 +224,7 @@ nsresult nsMailtoUrl::ParseMailtoUrl(char * searchPart) } if (!m_subjectPart.IsEmpty()) { - nsUnescape(NS_CONST_CAST(char*, m_subjectPart.get())); + nsUnescape(m_subjectPart.BeginWriting()); if (mimeConverter) { if (NS_SUCCEEDED(mimeConverter->DecodeMimeHeader(m_subjectPart.get(), @@ -235,12 +235,12 @@ nsresult nsMailtoUrl::ParseMailtoUrl(char * searchPart) } } if (!m_newsgroupPart.IsEmpty()) - nsUnescape(NS_CONST_CAST(char*, m_newsgroupPart.get())); + nsUnescape(m_newsgroupPart.BeginWriting()); if (!m_referencePart.IsEmpty()) - nsUnescape(NS_CONST_CAST(char*, m_referencePart.get())); + nsUnescape(m_referencePart.BeginWriting()); if (!m_bodyPart.IsEmpty()) { - nsUnescape(NS_CONST_CAST(char*, m_bodyPart.get())); + nsUnescape(m_bodyPart.BeginWriting()); if (mimeConverter) { if (NS_SUCCEEDED(mimeConverter->DecodeMimeHeader(m_bodyPart.get(), @@ -252,7 +252,7 @@ nsresult nsMailtoUrl::ParseMailtoUrl(char * searchPart) } } if (!m_newsHostPart.IsEmpty()) - nsUnescape(NS_CONST_CAST(char*, m_newsHostPart.get())); + nsUnescape(m_newsHostPart.BeginWriting()); return NS_OK; } @@ -304,12 +304,12 @@ nsresult nsMailtoUrl::ParseUrl() // now we need to strip off the search part from the // to part.... m_toPart.Cut(startOfSearchPart, numExtraChars); - ParseMailtoUrl(NS_CONST_CAST(char*, searchPart.get())); + ParseMailtoUrl(searchPart.BeginWriting()); } } else if (!m_toPart.IsEmpty()) { - nsUnescape(NS_CONST_CAST(char*, m_toPart.get())); + nsUnescape(m_toPart.BeginWriting()); } return rv; @@ -549,7 +549,7 @@ nsSmtpUrl::SetRecipients(const char * aRecipientsList) NS_ENSURE_ARG(aRecipientsList); m_toPart = aRecipientsList; if (!m_toPart.IsEmpty()) - nsUnescape(NS_CONST_CAST(char*, m_toPart.get())); + nsUnescape(m_toPart.BeginWriting()); return NS_OK; } diff --git a/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp b/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp index 4efa246cb67..7ef33d4cde3 100644 --- a/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp +++ b/mozilla/mailnews/imap/src/nsImapIncomingServer.cpp @@ -1285,13 +1285,13 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const char *folderPath, // or the canonical path - one or the other, but be consistent. dupFolderPath.ReplaceChar('/', hierarchyDelimiter); if (hierarchyDelimiter != '/') - nsImapUrl::UnescapeSlashes(NS_CONST_CAST(char*, dupFolderPath.get())); + nsImapUrl::UnescapeSlashes(dupFolderPath.BeginWriting()); if (onlineName.IsEmpty() || nsCRT::strcmp(onlineName.get(), dupFolderPath.get())) imapFolder->SetOnlineName(dupFolderPath.get()); if (hierarchyDelimiter != '/') - nsImapUrl::UnescapeSlashes(NS_CONST_CAST(char*, folderName.get())); + nsImapUrl::UnescapeSlashes(folderName.BeginWriting()); if (NS_SUCCEEDED(CreatePRUnicharStringFromUTF7(folderName.get(), getter_Copies(unicodeName)))) child->SetPrettyName(unicodeName); // Call ConvertFolderName() and HideFolderName() to do special folder name diff --git a/mozilla/mailnews/imap/src/nsImapProtocol.cpp b/mozilla/mailnews/imap/src/nsImapProtocol.cpp index cad303e3fbb..03f5f1bd95a 100644 --- a/mozilla/mailnews/imap/src/nsImapProtocol.cpp +++ b/mozilla/mailnews/imap/src/nsImapProtocol.cpp @@ -3644,7 +3644,7 @@ PRBool nsImapProtocol::CheckNewMail() { nsCAutoString urlSpec; mailnewsUrl->GetSpec(urlSpec); - nsUnescape(NS_CONST_CAST(char*, urlSpec.get())); + nsUnescape(urlSpec.BeginWriting()); PR_LOG(IMAP, PR_LOG_ALWAYS, ("%s:%s", logMsg, urlSpec.get())); } } diff --git a/mozilla/mailnews/imap/src/nsImapService.cpp b/mozilla/mailnews/imap/src/nsImapService.cpp index e6510d49e78..5b2e9577bc1 100644 --- a/mozilla/mailnews/imap/src/nsImapService.cpp +++ b/mozilla/mailnews/imap/src/nsImapService.cpp @@ -2373,7 +2373,7 @@ nsImapService::RenameLeaf(nsIEventQueue* eventQueue, nsIMsgFolder* srcFolder, nsCAutoString cStrFolderName(NS_STATIC_CAST(const char *, folderName)); // Unescape the name before looking for parent path - nsUnescape(NS_CONST_CAST(char*, cStrFolderName.get())); + nsUnescape(cStrFolderName.BeginWriting()); PRInt32 leafNameStart = cStrFolderName.RFindChar(hierarchySeparator); if (leafNameStart != -1) @@ -2686,7 +2686,7 @@ NS_IMETHODIMP nsImapService::NewURI(const nsACString &aSpec, // now extract lots of fun information... nsCOMPtr mailnewsUrl = do_QueryInterface(aImapUrl); //nsCAutoString unescapedSpec(aSpec); - // nsUnescape(NS_CONST_CAST(char*, unescapedSpec.get())); + // nsUnescape(unescapedSpec.BeginWriting()); // set the spec if (aBaseURI) diff --git a/mozilla/mailnews/imap/src/nsImapUrl.cpp b/mozilla/mailnews/imap/src/nsImapUrl.cpp index 13d0f121cca..a2a72413097 100644 --- a/mozilla/mailnews/imap/src/nsImapUrl.cpp +++ b/mozilla/mailnews/imap/src/nsImapUrl.cpp @@ -336,7 +336,7 @@ nsresult nsImapUrl::ParseUrl() NS_UnescapeURL(imapPartOfUrl); if (NS_SUCCEEDED(rv) && !imapPartOfUrl.IsEmpty()) { - ParseImapPart((char*)imapPartOfUrl.get()+1); // GetPath leaves leading '/' in the path!!! + ParseImapPart(imapPartOfUrl.BeginWriting()+1); // GetPath leaves leading '/' in the path!!! } return NS_OK; diff --git a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp index 124ac76b09f..1a4b10cc386 100644 --- a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp @@ -3098,13 +3098,13 @@ nsMsgLocalMailFolder::GetIncomingServerType() rv = url->GetUserPass(userPass); if (NS_FAILED(rv)) return ""; if (!userPass.IsEmpty()) - nsUnescape(NS_CONST_CAST(char*,userPass.get())); + nsUnescape(userPass.BeginWriting()); nsCAutoString hostName; rv = url->GetAsciiHost(hostName); if (NS_FAILED(rv)) return ""; if (!hostName.IsEmpty()) - nsUnescape(NS_CONST_CAST(char*,hostName.get())); + nsUnescape(hostName.BeginWriting()); nsCOMPtr accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv); diff --git a/mozilla/mailnews/local/src/nsLocalUtils.cpp b/mozilla/mailnews/local/src/nsLocalUtils.cpp index 6625ae2c4fe..d55ac379693 100644 --- a/mozilla/mailnews/local/src/nsLocalUtils.cpp +++ b/mozilla/mailnews/local/src/nsLocalUtils.cpp @@ -59,12 +59,12 @@ // - if no such server exists, behave like an old-style mailbox URL // (i.e. return the mail.directory preference or something) static nsresult -nsGetMailboxServer(const char *username, const char *hostname, nsIMsgIncomingServer** aResult) +nsGetMailboxServer(char *username, char *hostname, nsIMsgIncomingServer** aResult) { nsresult rv = NS_OK; - nsUnescape(NS_CONST_CAST(char*,username)); - nsUnescape(NS_CONST_CAST(char*,hostname)); + nsUnescape(username); + nsUnescape(hostname); // retrieve the AccountManager nsCOMPtr accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv); diff --git a/mozilla/mailnews/mime/src/mimedrft.cpp b/mozilla/mailnews/mime/src/mimedrft.cpp index da248dae8b3..2ebac030cd2 100644 --- a/mozilla/mailnews/mime/src/mimedrft.cpp +++ b/mozilla/mailnews/mime/src/mimedrft.cpp @@ -1907,7 +1907,7 @@ mime_decompose_file_init_fn ( void *stream_closure, MimeHeaders *headers ) newAttachName.Append(".tmp"); } - tmpSpec = nsMsgCreateTempFileSpec(NS_CONST_CAST(char*, newAttachName.get())); + tmpSpec = nsMsgCreateTempFileSpec(newAttachName.get()); } // This needs to be done so the attachment structure has a handle diff --git a/mozilla/mailnews/mime/src/mimethpl.cpp b/mozilla/mailnews/mime/src/mimethpl.cpp index 8fdd386cc4d..726fd89187e 100644 --- a/mozilla/mailnews/mime/src/mimethpl.cpp +++ b/mozilla/mailnews/mime/src/mimethpl.cpp @@ -123,7 +123,7 @@ MimeInlineTextHTMLAsPlaintext_parse_eof (MimeObject *obj, PRBool abort_p) nsCAutoString resultCStr = NS_ConvertUCS2toUTF8(asPlaintext); // TODO parse each line independently status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_line( - NS_CONST_CAST(char*, resultCStr.get()), + resultCStr.BeginWriting(), resultCStr.Length(), obj); diff --git a/mozilla/mailnews/mime/src/mimethsa.cpp b/mozilla/mailnews/mime/src/mimethsa.cpp index 954a6a3bbb0..e321c0f5895 100644 --- a/mozilla/mailnews/mime/src/mimethsa.cpp +++ b/mozilla/mailnews/mime/src/mimethsa.cpp @@ -191,7 +191,7 @@ printf(" E6\n"); charset spec. (It assumes that it's on its own line.) Most likely not fatally wrong, however. */ status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_line( - NS_CONST_CAST(char*, resultCStr.get()), + resultCStr.BeginWriting(), resultCStr.Length(), obj); #ifdef DEBUG_BenB diff --git a/mozilla/mailnews/news/src/nsNntpService.cpp b/mozilla/mailnews/news/src/nsNntpService.cpp index 9eae21c026e..e59835d4d1a 100644 --- a/mozilla/mailnews/news/src/nsNntpService.cpp +++ b/mozilla/mailnews/news/src/nsNntpService.cpp @@ -558,7 +558,7 @@ nsNntpService::DecomposeNewsMessageURI(const char * aMessageURI, nsIMsgFolder ** { PRInt32 messageIdLength = questionPos - slashPos - 1; messageUri.Mid(messageId, slashPos + 1, messageIdLength); - nsUnescape(NS_CONST_CAST(char*, messageId.get())); + nsUnescape(messageId.BeginWriting()); nsCOMPtr mailSession = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr msgWindows; diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index 515148ced00..d6e885c9536 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -4124,7 +4124,7 @@ static nsresult DoCharsetConversion(nsIUnicodeDecoder *aUnicodeDecoder, rv = aUnicodeDecoder->GetMaxLength(aANSIString, numberOfBytes, &outUnicodeLen); NS_ENSURE_SUCCESS(rv, rv); buffer.SetCapacity(outUnicodeLen); - rv = aUnicodeDecoder->Convert(aANSIString, &numberOfBytes, (PRUnichar*) buffer.get(), &outUnicodeLen); + rv = aUnicodeDecoder->Convert(aANSIString, &numberOfBytes, buffer.BeginWriting(), &outUnicodeLen); NS_ENSURE_SUCCESS(rv, rv); buffer.SetLength(outUnicodeLen); aUnicodeString = buffer; diff --git a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp index 864a25dd6a4..ea4a577367d 100644 --- a/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp +++ b/mozilla/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp @@ -2221,7 +2221,7 @@ nsFtpState::Init(nsIFTPChannel* aChannel, if (NS_FAILED(rv)) return rv; // Skip leading slash - char* fwdPtr = (char *)path.get(); + char* fwdPtr = path.BeginWriting(); if (fwdPtr && (*fwdPtr == '/')) fwdPtr++; if (*fwdPtr != '\0') { @@ -2538,7 +2538,7 @@ nsFtpState::ConvertFilespecToVMS(nsCString& fileString) // Get a writeable copy we can strtok with. fileStringCopy = fileString; - t = nsCRT::strtok((char *)fileStringCopy.get(), "/", &nextToken); + t = nsCRT::strtok(fileStringCopy.BeginWriting(), "/", &nextToken); if (t) while (nsCRT::strtok(nextToken, "/", &nextToken)) ntok++; // count number of terms (tokens) PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) ConvertFilespecToVMS ntok: %d\n", this, ntok)); PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x) ConvertFilespecToVMS from: \"%s\"\n", this, fileString.get())); @@ -2567,7 +2567,7 @@ nsFtpState::ConvertFilespecToVMS(nsCString& fileString) // Get another copy since the last one was written to. fileStringCopy = fileString; fileString.Truncate(); - fileString.Append(nsCRT::strtok((char *)fileStringCopy.get(), + fileString.Append(nsCRT::strtok(fileStringCopy.BeginWriting(), "/", &nextToken)); fileString.Append(":["); if (ntok > 2) { @@ -2596,7 +2596,7 @@ nsFtpState::ConvertFilespecToVMS(nsCString& fileString) fileStringCopy = fileString; fileString.Truncate(); fileString.Append("[."); - fileString.Append(nsCRT::strtok((char*)fileStringCopy.get(), + fileString.Append(nsCRT::strtok(fileStringCopy.BeginWriting(), "/", &nextToken)); if (ntok > 2) { for (int i=2; iUsingSSL() || !mConnectionInfo->UsingHttpProxy()) { rv = mURI->GetPath(path); if (NS_FAILED(rv)) return rv; // path may contain UTF-8 characters, so ensure that they're escaped. if (NS_EscapeURL(path.get(), path.Length(), esc_OnlyNonASCII, buf)) - requestURI = buf.get(); + requestURI = &buf; else - requestURI = path.get(); + requestURI = &path; mRequestHead.SetVersion(gHttpHandler->HttpVersion()); } else { @@ -478,18 +478,19 @@ nsHttpChannel::SetupTransaction() if (NS_FAILED(rv)) return rv; rv = tempURI->GetAsciiSpec(path); if (NS_FAILED(rv)) return rv; - requestURI = path.get(); + requestURI = &path; } else - requestURI = mSpec.get(); + requestURI = &mSpec; mRequestHead.SetVersion(gHttpHandler->ProxyHttpVersion()); } // trim off the #ref portion if any... - char *p = (char *)strchr(requestURI, '#'); - if (p) *p = 0; + PRInt32 ref = requestURI->FindChar('#'); + if (ref != kNotFound) + requestURI->SetLength(ref); - mRequestHead.SetRequestURI(requestURI); + mRequestHead.SetRequestURI(*requestURI); // set the request time for cache expiration calculations mRequestTime = NowInSeconds(); @@ -859,7 +860,7 @@ nsHttpChannel::ResponseWouldVary() NS_NAMED_LITERAL_CSTRING(prefix, "request-"); // enumerate the elements of the Vary header... - char *val = NS_CONST_CAST(char *, buf.get()); // going to munge buf + char *val = buf.BeginWriting(); // going to munge buf char *token = nsCRT::strtok(val, NS_HTTP_HEADER_SEPS, &val); while (token) { // @@ -1583,7 +1584,7 @@ nsHttpChannel::InitCacheEntry() if (!buf.IsEmpty()) { NS_NAMED_LITERAL_CSTRING(prefix, "request-"); - char *val = NS_CONST_CAST(char *, buf.get()); // going to munge buf + char *val = buf.BeginWriting(); // going to munge buf char *token = nsCRT::strtok(val, NS_HTTP_HEADER_SEPS, &val); while (token) { if ((*token != '*') && (PL_strcasecmp(token, "cookie") != 0)) { diff --git a/mozilla/netwerk/protocol/http/src/nsHttpConnection.cpp b/mozilla/netwerk/protocol/http/src/nsHttpConnection.cpp index 9945b9f7c9a..0ac20fa7839 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpConnection.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpConnection.cpp @@ -655,7 +655,7 @@ nsHttpConnection::SetupSSLProxyConnect() nsHttpRequestHead request; request.SetMethod(nsHttp::Connect); request.SetVersion(gHttpHandler->HttpVersion()); - request.SetRequestURI(buf.get()); + request.SetRequestURI(buf); request.SetHeader(nsHttp::User_Agent, gHttpHandler->UserAgent()); // send this header for backwards compatibility. diff --git a/mozilla/netwerk/protocol/http/src/nsHttpRequestHead.h b/mozilla/netwerk/protocol/http/src/nsHttpRequestHead.h index 6776d6f24ff..423dcdb463c 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpRequestHead.h +++ b/mozilla/netwerk/protocol/http/src/nsHttpRequestHead.h @@ -42,12 +42,12 @@ public: void SetMethod(nsHttpAtom method) { mMethod = method; } void SetVersion(nsHttpVersion version) { mVersion = version; } - void SetRequestURI(const char *s) { mRequestURI.Adopt(s ? nsCRT::strdup(s) : 0); } + void SetRequestURI(const nsCSubstring &s) { mRequestURI = s; } - nsHttpHeaderArray &Headers() { return mHeaders; } - nsHttpAtom Method() { return mMethod; } - nsHttpVersion Version() { return mVersion; } - const nsAFlatCString &RequestURI() { return mRequestURI; } + nsHttpHeaderArray &Headers() { return mHeaders; } + nsHttpAtom Method() { return mMethod; } + nsHttpVersion Version() { return mVersion; } + const nsCSubstring &RequestURI() { return mRequestURI; } const char *PeekHeader(nsHttpAtom h) { return mHeaders.PeekHeader(h); } nsresult SetHeader(nsHttpAtom h, const nsACString &v, PRBool m=PR_FALSE) { return mHeaders.SetHeader(h, v, m); } diff --git a/mozilla/netwerk/protocol/http/src/nsHttpTransaction.cpp b/mozilla/netwerk/protocol/http/src/nsHttpTransaction.cpp index e67a2670a0c..3433d3495ca 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpTransaction.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpTransaction.cpp @@ -573,7 +573,7 @@ nsHttpTransaction::ParseLineSegment(char *segment, PRUint32 len) // of mLineBuf. mLineBuf.Truncate(mLineBuf.Length() - 1); if (!mHaveStatusLine || (*segment != ' ' && *segment != '\t')) { - ParseLine(NS_CONST_CAST(char*,mLineBuf.get())); + ParseLine(mLineBuf.BeginWriting()); mLineBuf.Truncate(); } } diff --git a/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp b/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp index c1f28f26678..95679efb080 100644 --- a/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp +++ b/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp @@ -220,7 +220,7 @@ nsDirIndexParser::ParseFormat(const char* aFormatStr) { aFormatStr += len; // Okay, we're gonna monkey with the nsStr. Bold! - name.SetLength(nsUnescapeCount(NS_CONST_CAST(char*, name.get()))); + name.SetLength(nsUnescapeCount(name.BeginWriting())); // All tokens are case-insensitive - http://www.area.com/~roeber/file_format.html if (name.EqualsIgnoreCase("description")) @@ -384,7 +384,7 @@ nsDirIndexParser::OnDataAvailable(nsIRequest *aRequest, nsISupports *aCtxt, // Now read the data into our buffer. nsresult rv; PRUint32 count; - rv = aStream->Read(NS_CONST_CAST(char*, mBuf.get() + len), aCount, &count); + rv = aStream->Read(mBuf.BeginWriting() + len, aCount, &count); if (NS_FAILED(rv)) return rv; // Set the string's length according to the amount of data we've read. diff --git a/mozilla/parser/htmlparser/src/nsScannerString.cpp b/mozilla/parser/htmlparser/src/nsScannerString.cpp index 1bf598e3186..06dba15845a 100644 --- a/mozilla/parser/htmlparser/src/nsScannerString.cpp +++ b/mozilla/parser/htmlparser/src/nsScannerString.cpp @@ -405,7 +405,7 @@ nsScannerString::ReplaceCharacter(nsScannerIterator& aPosition, PRUnichar aChar) // XXX Casting a const to non-const. Unless the base class // provides support for writing iterators, this is the best // that can be done. - PRUnichar* pos = (PRUnichar*)aPosition.get(); + PRUnichar* pos = NS_CONST_CAST(PRUnichar*, aPosition.get()); *pos = aChar; mIsDirty = PR_TRUE; diff --git a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp index c4b259106b7..fcd99756b88 100644 --- a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp @@ -2129,7 +2129,7 @@ nsPrefMigration::RenameAndMove4xImapFilterFiles(nsIFileSpec * profilePath) if (!hostList || !*hostList) return NS_OK; char *token = nsnull; - char *rest = NS_CONST_CAST(char*,(const char*)hostList); + char *rest = hostList.BeginWriting(); nsCAutoString str; token = nsCRT::strtok(rest, ",", &rest); diff --git a/mozilla/profile/src/nsProfile.cpp b/mozilla/profile/src/nsProfile.cpp index 6faff6abdf8..92fb1698d32 100644 --- a/mozilla/profile/src/nsProfile.cpp +++ b/mozilla/profile/src/nsProfile.cpp @@ -803,7 +803,7 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs, nsAutoString currProfileName; if (nsCRT::IsAscii(cmdResult)) { - currProfileName.AssignWithConversion(strtok(NS_CONST_CAST(char*,(const char*)cmdResult), " ")); + currProfileName.AssignWithConversion(strtok(cmdResult.BeginWriting(), " ")); } else { // get a platform charset @@ -812,7 +812,7 @@ nsProfile::ProcessArgs(nsICmdLineService *cmdLineArgs, NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get a platform charset"); // convert the profile name to Unicode - nsCAutoString profileName(strtok(NS_CONST_CAST(char*,(const char*)cmdResult), " ")); + nsCAutoString profileName(strtok(cmdResult.BeginWriting(), " ")); rv = ConvertStringToUnicode(charSet, profileName.get(), currProfileName); NS_ASSERTION(NS_SUCCEEDED(rv), "failed to convert ProfileName to unicode"); } diff --git a/mozilla/profile/src/nsProfileAccess.cpp b/mozilla/profile/src/nsProfileAccess.cpp index bb9fdc99e4b..5166d4f4772 100644 --- a/mozilla/profile/src/nsProfileAccess.cpp +++ b/mozilla/profile/src/nsProfileAccess.cpp @@ -1107,12 +1107,12 @@ nsProfileAccess::Get4xProfileInfo(nsIFile *registryFile, PRBool fromImport) // 4.x profiles coming from japanese machine are already in unicode. // So, there is no need to decode into unicode further. NS_ConvertUCS2toUTF8 temp(profile); - nsCAutoString profileName(nsUnescape( NS_CONST_CAST(char*, temp.get()))); + nsCAutoString profileName(nsUnescape(temp.BeginWriting())); nsAutoString convertedProfName(NS_ConvertUTF8toUCS2(profileName).get()); #else nsCAutoString temp; temp.AssignWithConversion(profile); - nsCAutoString profileName(nsUnescape( NS_CONST_CAST(char*, temp.get()))); + nsCAutoString profileName(nsUnescape(temp.BeginWriting())); nsAutoString convertedProfName; ConvertStringToUnicode(charSet, profileName.get(), convertedProfName); #endif @@ -1398,7 +1398,7 @@ nsresult ProfileStruct::InternalizeLocation(nsIRegistry *aRegistry, nsRegistryKe // Unescape profile location NS_ConvertUCS2toUTF8 tempLoc(profLoc); - nsCAutoString profileLocation(nsUnescape( NS_CONST_CAST(char*, tempLoc.get()))); + nsCAutoString profileLocation(nsUnescape(tempLoc.BeginWriting())); nsAutoString convertedProfLoc(NS_ConvertUTF8toUCS2(profileLocation).get()); #else nsCAutoString charSet; @@ -1408,7 +1408,7 @@ nsresult ProfileStruct::InternalizeLocation(nsIRegistry *aRegistry, nsRegistryKe // Unescape profile location and convert it to the right format nsCAutoString tempLoc; tempLoc.AssignWithConversion(profLoc); - nsCAutoString profileLocation(nsUnescape( NS_CONST_CAST(char*, tempLoc.get()))); + nsCAutoString profileLocation(nsUnescape(tempLoc.BeginWriting())); nsAutoString convertedProfLoc; ConvertStringToUnicode(charSet, profileLocation.get(), convertedProfLoc); #endif diff --git a/mozilla/security/manager/boot/src/nsSecurityWarningDialogs.cpp b/mozilla/security/manager/boot/src/nsSecurityWarningDialogs.cpp index d9c0d437b1f..8aa9a2cd488 100644 --- a/mozilla/security/manager/boot/src/nsSecurityWarningDialogs.cpp +++ b/mozilla/security/manager/boot/src/nsSecurityWarningDialogs.cpp @@ -258,7 +258,7 @@ nsSecurityWarningDialogs::ConfirmDialog(nsIInterfaceRequestor *ctx, const char * if (!windowTitle || !message || !cont) return NS_ERROR_FAILURE; // Replace # characters with newlines to lay out the dialog. - PRUnichar* msgchars = NS_CONST_CAST(PRUnichar*, message.get()); + PRUnichar* msgchars = message.BeginWriting(); PRUint32 i = 0; for (i = 0; msgchars[i] != '\0'; i++) { diff --git a/mozilla/security/manager/ssl/src/nsCMSSecureMessage.cpp b/mozilla/security/manager/ssl/src/nsCMSSecureMessage.cpp index 8c840947eaf..62acc548238 100644 --- a/mozilla/security/manager/ssl/src/nsCMSSecureMessage.cpp +++ b/mozilla/security/manager/ssl/src/nsCMSSecureMessage.cpp @@ -107,7 +107,7 @@ GetCertByPrefID(const char *certID, char **_retval) if (NS_FAILED(rv)) goto done; /* Find a good cert in the user's database */ - cert = CERT_FindUserCertByUsage(CERT_GetDefaultCertDB(), (char*)nickname.get(), + cert = CERT_FindUserCertByUsage(CERT_GetDefaultCertDB(), NS_CONST_CAST(char*, nickname.get()), certUsageEmailRecipient, PR_TRUE, ctx); if (!cert) { diff --git a/mozilla/security/manager/ssl/src/nsCRLManager.cpp b/mozilla/security/manager/ssl/src/nsCRLManager.cpp index cd4d378f1ca..3cc7fdc371b 100644 --- a/mozilla/security/manager/ssl/src/nsCRLManager.cpp +++ b/mozilla/security/manager/ssl/src/nsCRLManager.cpp @@ -131,7 +131,7 @@ nsCRLManager::ImportCrl (PRUint8 *aData, PRUint32 aLength, nsIURI * aURI, PRUint } } - crl = SEC_NewCrl(CERT_GetDefaultCertDB(), (char*)url.get(), &derCrl, + crl = SEC_NewCrl(CERT_GetDefaultCertDB(), NS_CONST_CAST(char*, url.get()), &derCrl, aType); if (!crl) { diff --git a/mozilla/security/manager/ssl/src/nsNTLMAuthModule.cpp b/mozilla/security/manager/ssl/src/nsNTLMAuthModule.cpp index 4d4ed872567..086740b008b 100644 --- a/mozilla/security/manager/ssl/src/nsNTLMAuthModule.cpp +++ b/mozilla/security/manager/ssl/src/nsNTLMAuthModule.cpp @@ -305,13 +305,13 @@ ZapBuf(void *buf, size_t bufLen) static void ZapString(nsCString &s) { - ZapBuf(NS_CONST_CAST(char *, s.get()), s.Length()); + ZapBuf(s.BeginWriting(), s.Length()); } static void ZapString(nsString &s) { - ZapBuf(NS_CONST_CAST(PRUnichar *, s.get()), s.Length() * 2); + ZapBuf(s.BeginWriting(), s.Length() * 2); } static const unsigned char LM_MAGIC[] = "KGS!@#$%"; diff --git a/mozilla/widget/public/nsGUIEvent.h b/mozilla/widget/public/nsGUIEvent.h index 08170eff7bf..13d0e8cf530 100644 --- a/mozilla/widget/public/nsGUIEvent.h +++ b/mozilla/widget/public/nsGUIEvent.h @@ -455,7 +455,7 @@ struct nsTextEvent : public nsInputEvent { } - PRUnichar* theText; + const PRUnichar* theText; nsTextEventReply theReply; PRUint32 rangeCount; nsTextRangeArray rangeArray; diff --git a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp index 6070e30d863..fa1dde492a3 100644 --- a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp +++ b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp @@ -222,14 +222,14 @@ void nsIMEPreedit::Reset() mIMECompAttr->SetCapacity(0); } -PRUnichar* +const PRUnichar* nsIMEPreedit::GetPreeditString() const { - return (PRUnichar *) mIMECompUnicode->get(); + return mIMECompUnicode->get(); } -char* +const char* nsIMEPreedit::GetPreeditFeedback() const { - return (char*)mIMECompAttr->get(); + return mIMECompAttr->get(); } int nsIMEPreedit::GetPreeditLength() const { diff --git a/mozilla/widget/src/gtk/nsGtkIMEHelper.h b/mozilla/widget/src/gtk/nsGtkIMEHelper.h index 79528e7be62..c774aa6560d 100644 --- a/mozilla/widget/src/gtk/nsGtkIMEHelper.h +++ b/mozilla/widget/src/gtk/nsGtkIMEHelper.h @@ -88,8 +88,8 @@ class nsIMEPreedit { nsIMEPreedit(); ~nsIMEPreedit(); void Reset(); - PRUnichar* GetPreeditString() const; - char* GetPreeditFeedback() const; + const PRUnichar* GetPreeditString() const; + const char* GetPreeditFeedback() const; int GetPreeditLength() const; void SetPreeditString(const XIMText* aText, const PRInt32 aChangeFirst, diff --git a/mozilla/widget/src/mac/nsMacEventHandler.cpp b/mozilla/widget/src/mac/nsMacEventHandler.cpp index 32158e8b5a4..87b0ee883a3 100644 --- a/mozilla/widget/src/mac/nsMacEventHandler.cpp +++ b/mozilla/widget/src/mac/nsMacEventHandler.cpp @@ -1238,7 +1238,7 @@ IsContextMenuKey(const nsKeyEvent& inKeyEvent) // HandleUKeyEvent // //------------------------------------------------------------------------- -PRBool nsMacEventHandler::HandleUKeyEvent(PRUnichar* text, long charCount, EventRecord& aOSEvent) +PRBool nsMacEventHandler::HandleUKeyEvent(const PRUnichar* text, long charCount, EventRecord& aOSEvent) { nsresult result; // get the focused widget @@ -1924,7 +1924,7 @@ nsresult nsMacEventHandler::HandleOffsetToPosition(long offset,Point* thePoint) //------------------------------------------------------------------------- // See ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/APPLE/CORPCHAR.TXT for detail of IS_APPLE_HINT_IN_PRIVATE_ZONE #define IS_APPLE_HINT_IN_PRIVATE_ZONE(u) ((0xF850 <= (u)) && ((u)<=0xF883)) -nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, ScriptCode textScript,long fixedLength,TextRangeArray* textRangeList) +nsresult nsMacEventHandler::HandleUpdateInputArea(const char* text,Size text_size, ScriptCode textScript,long fixedLength,TextRangeArray* textRangeList) { #ifdef DEBUG_TSM printf("********************************************************************************\n"); @@ -1978,7 +1978,7 @@ nsresult nsMacEventHandler::HandleUpdateInputArea(char* text,Size text_size, Scr } // Prepare buffer.... mIMECompositionStr->SetCapacity(text_size+1); - ubuf = (PRUnichar*)mIMECompositionStr->get(); + ubuf = mIMECompositionStr->BeginWriting(); size_t len; //==================================================================================================== @@ -2279,7 +2279,7 @@ error: } -nsresult nsMacEventHandler::UnicodeHandleUpdateInputArea(PRUnichar* text, long charCount, +nsresult nsMacEventHandler::UnicodeHandleUpdateInputArea(const PRUnichar* text, long charCount, long fixedLength, TextRangeArray* textRangeList) { #ifdef DEBUG_TSM @@ -2618,7 +2618,7 @@ nsresult nsMacEventHandler::HandleTextEvent(PRUint32 textRangeCount, nsTextRange // nsTextEvent textEvent(NS_TEXT_TEXT, focusedWidget); textEvent.time = PR_IntervalNow(); - textEvent.theText = (PRUnichar*)mIMECompositionStr->get(); + textEvent.theText = mIMECompositionStr->get(); textEvent.rangeCount = textRangeCount; textEvent.rangeArray = textRangeArray; diff --git a/mozilla/widget/src/mac/nsMacEventHandler.h b/mozilla/widget/src/mac/nsMacEventHandler.h index cccb40242d9..0f61a41b8f5 100644 --- a/mozilla/widget/src/mac/nsMacEventHandler.h +++ b/mozilla/widget/src/mac/nsMacEventHandler.h @@ -168,11 +168,11 @@ public: // virtual long HandlePositionToOffset(Point aPoint,short* regionClass); virtual nsresult HandleOffsetToPosition(long offset,Point* position); - virtual nsresult HandleUpdateInputArea(char* text,Size text_size, ScriptCode textScript,long fixedLength,TextRangeArray* textRangeArray); - virtual nsresult UnicodeHandleUpdateInputArea(PRUnichar* text, long charCount, long fixedLength,TextRangeArray* textRangeArray); + virtual nsresult HandleUpdateInputArea(const char* text,Size text_size, ScriptCode textScript,long fixedLength,TextRangeArray* textRangeArray); + virtual nsresult UnicodeHandleUpdateInputArea(const PRUnichar* text, long charCount, long fixedLength,TextRangeArray* textRangeArray); virtual nsresult HandleUnicodeGetSelectedText(nsAString& outString); virtual nsresult ResetInputState(); - virtual PRBool HandleUKeyEvent(PRUnichar* text, long charCount, EventRecord& aOSEvent); + virtual PRBool HandleUKeyEvent(const PRUnichar* text, long charCount, EventRecord& aOSEvent); // // Synthetic events, generated internally to do things at specific times and diff --git a/mozilla/widget/src/mac/nsMacTSMMessagePump.cpp b/mozilla/widget/src/mac/nsMacTSMMessagePump.cpp index aebeaa67a75..4efdc5f777a 100644 --- a/mozilla/widget/src/mac/nsMacTSMMessagePump.cpp +++ b/mozilla/widget/src/mac/nsMacTSMMessagePump.cpp @@ -351,7 +351,7 @@ pascal OSErr nsMacTSMMessagePump::UpdateHandler(const AppleEvent *theAppleEvent, nsCAutoString mbcsText; Size text_size = ::AEGetDescDataSize(&text); mbcsText.SetCapacity(text_size+1); - char* mbcsTextPtr = (char*)mbcsText.get(); + char* mbcsTextPtr = mbcsText.BeginWriting(); err = AEGetDescData(&text, (void *) mbcsTextPtr, text_size); if (err!=noErr) { DisposePtr((Ptr) hiliteRangePtr); @@ -362,7 +362,7 @@ pascal OSErr nsMacTSMMessagePump::UpdateHandler(const AppleEvent *theAppleEvent, nsCAutoString mbcsText; Size text_size = ::GetHandleSize(text.dataHandle); mbcsText.SetCapacity(text_size+1); - char* mbcsTextPtr = (char*)mbcsText.get(); + char* mbcsTextPtr = mbcsText.BeginWriting(); strncpy(mbcsTextPtr, *(text.dataHandle), text_size); mbcsTextPtr[text_size]=0; #endif @@ -427,14 +427,14 @@ static OSErr AETextToString(AEDesc &aAEDesc, nsString& aOutString, Size& text_si #if TARGET_CARBON text_size = ::AEGetDescDataSize(&aAEDesc) / 2; aOutString.SetLength(text_size + 1); - unicodeTextPtr = (PRUnichar*)aOutString.get(); + unicodeTextPtr = aOutString.BeginWriting(); err = AEGetDescData(&aAEDesc, (void *) unicodeTextPtr, text_size * 2); if (err!=noErr) return err; #else text_size = ::GetHandleSize(aAEDesc.dataHandle) / 2; aOutString.SetLength(text_size + 1); - unicodeTextPtr = (PRUnichar*)aOutString.get(); + unicodeTextPtr = aOutString.BeginWriting(); memcpy(unicodeTextPtr, *(aAEDesc.dataHandle), text_size * 2); #endif @@ -509,7 +509,7 @@ pascal OSErr nsMacTSMMessagePump::UnicodeUpdateHandler(const AppleEvent *theAppl err = AETextToString(text, unicodeText, text_size); if (noErr == err) { - res = eventHandler->UnicodeHandleUpdateInputArea((PRUnichar*)unicodeText.get(), text_size, fixLength / 2, hiliteRangePtr); + res = eventHandler->UnicodeHandleUpdateInputArea(unicodeText.get(), text_size, fixLength / 2, hiliteRangePtr); NS_ASSERTION(NS_SUCCEEDED(res), "nsMacMessagePump::UnicodeUpdateHandler: HandleUpdated failed."); if (NS_FAILED(res)) err = paramErr; @@ -565,7 +565,7 @@ pascal OSErr nsMacTSMMessagePump::UnicodeNotFromInputMethodHandler(const AppleEv if (noErr == err) { nsresult res; - res = eventHandler->HandleUKeyEvent((PRUnichar*)unicodeText.get(), text_size, event); + res = eventHandler->HandleUKeyEvent(unicodeText.get(), text_size, event); NS_ASSERTION(NS_SUCCEEDED(res), "nsMacMessagePump::UnicodeNotFromInputMethodHandler: HandleUpdated failed."); if (NS_FAILED(res)) { err = paramErr; diff --git a/mozilla/widget/src/mac/nsMacWindow.cpp b/mozilla/widget/src/mac/nsMacWindow.cpp index 14be2482c3f..9c2dd84ef73 100644 --- a/mozilla/widget/src/mac/nsMacWindow.cpp +++ b/mozilla/widget/src/mac/nsMacWindow.cpp @@ -1615,7 +1615,7 @@ nsMacWindow::HandleUpdateActiveInputArea(const nsAString & text, NS_ENSURE_TRUE(mMacEventHandler.get(), NS_ERROR_FAILURE); const nsPromiseFlatString& buffer = PromiseFlatString(text); // ignore script and langauge information for now. - nsresult res = mMacEventHandler->UnicodeHandleUpdateInputArea((PRUnichar*)buffer.get(), buffer.Length(), fixLen, (TextRangeArray*) hiliteRng); + nsresult res = mMacEventHandler->UnicodeHandleUpdateInputArea(buffer.get(), buffer.Length(), fixLen, (TextRangeArray*) hiliteRng); // we will lost the real OSStatus for now untill we change the nsMacEventHandler if (NS_SUCCEEDED(res)) *_retval = noErr; @@ -1633,7 +1633,7 @@ nsMacWindow::HandleUpdateActiveInputAreaForNonUnicode(const nsACString & text, NS_ENSURE_TRUE(mMacEventHandler.get(), NS_ERROR_FAILURE); const nsPromiseFlatCString& buffer = PromiseFlatCString(text); // ignore langauge information for now. - nsresult res = mMacEventHandler->HandleUpdateInputArea((char*)buffer.get(), buffer.Length(), script, fixLen, (TextRangeArray*) hiliteRng); + nsresult res = mMacEventHandler->HandleUpdateInputArea(buffer.get(), buffer.Length(), script, fixLen, (TextRangeArray*) hiliteRng); // we will lost the real OSStatus for now untill we change the nsMacEventHandler if (NS_SUCCEEDED(res)) *_retval = noErr; @@ -1652,7 +1652,7 @@ nsMacWindow::HandleUnicodeForKeyEvent(const nsAString & text, // we will lost the real OSStatus for now untill we change the nsMacEventHandler EventRecord* eventPtr = (EventRecord*)keyboardEvent; const nsPromiseFlatString& buffer = PromiseFlatString(text); - nsresult res = mMacEventHandler->HandleUKeyEvent((PRUnichar*)buffer.get(), buffer.Length(), *eventPtr); + nsresult res = mMacEventHandler->HandleUKeyEvent(buffer.get(), buffer.Length(), *eventPtr); // we will lost the real OSStatus for now untill we change the nsMacEventHandler if(NS_SUCCEEDED(res)) *_retval = noErr; diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index 8b03daf6651..d0cb439dfe6 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -4379,7 +4379,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT InitEvent(event); event.mType = nsDragDropEventStatus_eDrop; event.mIsFileURL = PR_FALSE; - event.mURL = (PRUnichar *)fileStr.get(); + event.mURL = fileStr.get(); DispatchEvent(&event, status); NS_RELEASE(event.widget); } @@ -5646,7 +5646,7 @@ nsWindow::HandleTextEvent(HIMC hIMEContext,PRBool aCheckAttr) unicharSize = ::MultiByteToWideChar(gCurrentKeyboardCP,MB_PRECOMPOSED, mIMECompString->get(), mIMECompString->Length(), - (PRUnichar*)mIMECompUnicode->get(), + mIMECompUnicode->BeginWriting(), unicharSize+1); mIMECompUnicode->SetLength(unicharSize); } @@ -5663,7 +5663,7 @@ nsWindow::HandleTextEvent(HIMC hIMEContext,PRBool aCheckAttr) event.rangeArray = nsnull; } - event.theText = (PRUnichar*)mIMECompUnicode->get(); + event.theText = mIMECompUnicode->get(); event.isShift = mIsShiftDown; event.isControl = mIsControlDown; event.isMeta = PR_FALSE; @@ -6218,7 +6218,7 @@ BOOL nsWindow::OnIMEComposition(LPARAM aGCS) long buflen = compStrLen + 1; NS_IMM_GETCOMPOSITIONSTRING(hIMEContext, GCS_COMPSTR, - (char*)mIMECompString->get(), + mIMECompString->BeginWriting(), buflen, compStrLen); mIMECompString->SetLength(compStrLen); } diff --git a/mozilla/xpcom/io/nsEscape.h b/mozilla/xpcom/io/nsEscape.h index c323986dd56..fe95bf7afa3 100644 --- a/mozilla/xpcom/io/nsEscape.h +++ b/mozilla/xpcom/io/nsEscape.h @@ -172,7 +172,7 @@ NS_UnescapeURL(const nsASingleFragmentCString &str, PRInt16 flags, nsACString &r inline nsAFlatCString & NS_UnescapeURL(nsAFlatCString &str) { - str.SetLength(nsUnescapeCount((char*)str.get())); + str.SetLength(nsUnescapeCount(str.BeginWriting())); return str; } diff --git a/mozilla/xpcom/io/nsLocalFileUnix.cpp b/mozilla/xpcom/io/nsLocalFileUnix.cpp index 0a031bba7f7..77705d22e3c 100644 --- a/mozilla/xpcom/io/nsLocalFileUnix.cpp +++ b/mozilla/xpcom/io/nsLocalFileUnix.cpp @@ -289,7 +289,7 @@ NS_IMETHODIMP nsLocalFile::CreateAllAncestors(PRUint32 permissions) { // I promise to play nice - char *buffer = NS_CONST_CAST(char *, mPath.get()), + char *buffer = mPath.BeginWriting(), *slashp = buffer; #ifdef DEBUG_NSIFILE @@ -1169,7 +1169,7 @@ nsLocalFile::GetParent(nsIFile **aParent) return NS_OK; // I promise to play nice - char *buffer = NS_CONST_CAST(char *, mPath.get()), + char *buffer = mPath.BeginWriting(), *slashp = buffer; // find the last significant slash in buffer diff --git a/mozilla/xpcom/io/nsNativeCharsetUtils.cpp b/mozilla/xpcom/io/nsNativeCharsetUtils.cpp index 030b2619715..08c75880417 100644 --- a/mozilla/xpcom/io/nsNativeCharsetUtils.cpp +++ b/mozilla/xpcom/io/nsNativeCharsetUtils.cpp @@ -968,7 +968,7 @@ NS_CopyNativeToUnicode(const nsACString &input, nsAString &output) // |inputStr| from the result of BeginReading. const nsPromiseFlatCString &flat = PromiseFlatCString(input); - char *inputStr = (char*)flat.get(); + char *inputStr = NS_CONST_CAST(char*, flat.get()); size_t inputLen = flat.Length() + 1; // include null char // resultLen must be >= inputLen or the unicode conversion will fail @@ -1012,7 +1012,7 @@ NS_CopyUnicodeToNative(const nsAString &input, nsACString &output) // |inputStr| from the result of BeginReading. const nsPromiseFlatString &flat = PromiseFlatString(input); - UniChar *inputStr = (UniChar*)flat.get(); + UniChar *inputStr = (UniChar*) NS_CONST_CAST(PRUnichar*, flat.get()); size_t inputLen = flat.Length() + 1; // include null char // resultLen must be >= inputLen or the unicode conversion will fail diff --git a/mozilla/xpcom/obsolete/component/nsRegistry.cpp b/mozilla/xpcom/obsolete/component/nsRegistry.cpp index 178f52d1e21..150d4d6279a 100644 --- a/mozilla/xpcom/obsolete/component/nsRegistry.cpp +++ b/mozilla/xpcom/obsolete/component/nsRegistry.cpp @@ -572,7 +572,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) #endif /* DEBUG_dp */ PR_Lock(mregLock); - err = NR_RegOpen((char*)regFile.get(), &mReg ); + err = NR_RegOpen(NS_CONST_CAST(char*, regFile.get()), &mReg ); PR_Unlock(mregLock); // Store the registry that was opened for optimizing future opens. diff --git a/mozilla/xpcom/string/public/nsTDependentString.h b/mozilla/xpcom/string/public/nsTDependentString.h index fd959bd3285..91a2b53ee92 100644 --- a/mozilla/xpcom/string/public/nsTDependentString.h +++ b/mozilla/xpcom/string/public/nsTDependentString.h @@ -112,6 +112,7 @@ class nsTDependentString_CharT : public nsTString_CharT { mData = NS_CONST_CAST(char_type*, data); mLength = char_traits::length(data); + SetDataFlags(F_TERMINATED); AssertValid(); } @@ -119,6 +120,7 @@ class nsTDependentString_CharT : public nsTString_CharT { mData = NS_CONST_CAST(char_type*, data); mLength = length; + SetDataFlags(F_TERMINATED); AssertValid(); } diff --git a/mozilla/xpcom/string/public/nsTDependentSubstring.h b/mozilla/xpcom/string/public/nsTDependentSubstring.h index 884af119f52..89d96e13de4 100644 --- a/mozilla/xpcom/string/public/nsTDependentSubstring.h +++ b/mozilla/xpcom/string/public/nsTDependentSubstring.h @@ -57,6 +57,7 @@ class nsTDependentSubstring_CharT : public nsTSubstring_CharT NS_ASSERTION(start && end, "nsTDependentSubstring must wrap a non-NULL buffer"); mData = NS_CONST_CAST(char_type*, start); mLength = end - start; + SetDataFlags(F_NONE); } nsTDependentSubstring_CharT( const abstract_string_type& str, PRUint32 startPos, PRUint32 length = size_type(-1) ) diff --git a/mozilla/xpcom/string/public/nsTSubstring.h b/mozilla/xpcom/string/public/nsTSubstring.h index b694858a9f1..218d69f6276 100644 --- a/mozilla/xpcom/string/public/nsTSubstring.h +++ b/mozilla/xpcom/string/public/nsTSubstring.h @@ -68,6 +68,13 @@ class nsTSubstring_CharT : public nsTAString_CharT * reading iterators */ + const_char_iterator BeginReading() const { return mData; } + const_char_iterator EndReading() const { return mData + mLength; } + + /** + * deprecated reading iterators + */ + const_iterator& BeginReading( const_iterator& iter ) const { iter.mStart = mData; @@ -99,6 +106,13 @@ class nsTSubstring_CharT : public nsTAString_CharT * writing iterators */ + char_iterator BeginWriting() { EnsureMutable(); return mData; } + char_iterator EndWriting() { EnsureMutable(); return mData + mLength; } + + /** + * deprecated writing iterators + */ + iterator& BeginWriting( iterator& iter ) { EnsureMutable(); diff --git a/mozilla/xpcom/string/src/nsTDependentSubstring.cpp b/mozilla/xpcom/string/src/nsTDependentSubstring.cpp index 86619a19b9c..8421ecc0d29 100644 --- a/mozilla/xpcom/string/src/nsTDependentSubstring.cpp +++ b/mozilla/xpcom/string/src/nsTDependentSubstring.cpp @@ -46,6 +46,8 @@ nsTDependentSubstring_CharT::Rebind( const abstract_string_type& readable, PRUin mData += startPos; mLength = NS_MIN(length, strLength - startPos); + + SetDataFlags(F_NONE); } void @@ -58,4 +60,6 @@ nsTDependentSubstring_CharT::Rebind( const substring_type& str, PRUint32 startPo mData = NS_CONST_CAST(char_type*, str.Data()) + startPos; mLength = NS_MIN(length, strLength - startPos); + + SetDataFlags(F_NONE); } diff --git a/mozilla/xpcom/threads/nsProcessCommon.cpp b/mozilla/xpcom/threads/nsProcessCommon.cpp index 231ad44a7be..d03c140cab2 100644 --- a/mozilla/xpcom/threads/nsProcessCommon.cpp +++ b/mozilla/xpcom/threads/nsProcessCommon.cpp @@ -187,6 +187,7 @@ static int assembleCmdLine(char *const *argv, char **cmdLine) } #endif +// XXXldb |args| has the wrong const-ness NS_IMETHODIMP nsProcess::Run(PRBool blocking, const char **args, PRUint32 count, PRUint32 *pid) { @@ -207,7 +208,7 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count, PRUint32 *pid my_argv[i+1] = NS_CONST_CAST(char*, args[i]); } // we need to set argv[0] to the program name. - my_argv[0] = NS_CONST_CAST(char*, mTargetPath.get()); + my_argv[0] = mTargetPath.BeginWriting(); // null terminate the array my_argv[count+1] = NULL; diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportOS2.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportOS2.cpp index 9a047f3ace2..7ceefad9981 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportOS2.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportOS2.cpp @@ -1733,7 +1733,7 @@ nsCString nsNativeAppSupportOS2::ParseDDEArg( HSZ args, int index ) { // Ensure result's buffer is sufficiently big. temp.SetLength( argLen + 1 ); // Now get the string contents. - WinDdeQueryString( args, (char*)temp.get(), temp.Length(), CP_WINANSI ); + WinDdeQueryString( args, temp.BeginWriting(), temp.Length(), CP_WINANSI ); // Parse out the given arg. const char *p = temp.get(); // offset points to the comma preceding the desired arg. diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp index 2e4f930e2bc..b379a749d58 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp @@ -1682,7 +1682,7 @@ void nsNativeAppSupportWin::ParseDDEArg( HSZ args, int index, nsCString& aString // Ensure result's buffer is sufficiently big. temp.SetLength( argLen ); // Now get the string contents. - DdeQueryString( mInstance, args, (char*)temp.get(), temp.Length(), CP_WINANSI ); + DdeQueryString( mInstance, args, temp.BeginWriting(), temp.Length(), CP_WINANSI ); // Parse out the given arg. ParseDDEArg(temp.get(), index, aString); return; diff --git a/mozilla/xpfe/components/intl/nsCharsetMenu.cpp b/mozilla/xpfe/components/intl/nsCharsetMenu.cpp index de1465ff7c6..ce3e8fdab98 100644 --- a/mozilla/xpfe/components/intl/nsCharsetMenu.cpp +++ b/mozilla/xpfe/components/intl/nsCharsetMenu.cpp @@ -1457,9 +1457,9 @@ nsresult nsCharsetMenu::AddFromPrefsToMenu( if (pls) { nsXPIDLString ucsval; pls->ToString(getter_Copies(ucsval)); + NS_ConvertUCS2toUTF8 utf8val(ucsval); if (ucsval) - res = AddFromStringToMenu(NS_CONST_CAST(char *, NS_ConvertUCS2toUTF8(ucsval).get()), - aArray, + res = AddFromStringToMenu(utf8val.BeginWriting(), aArray, aContainer, aDecs, aIDPrefix); } diff --git a/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp b/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp index 0eead3aa766..39192be180d 100644 --- a/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp +++ b/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp @@ -789,7 +789,7 @@ NS_IMETHODIMP nsWindowsHooks::StartupAddOption(const char* option) { // exploiting the fact that nsString's storage is also a char* buffer. // NS_CONST_CAST is safe here because nsCRT::strtok will only modify // the existing buffer - grabArgs(NS_CONST_CAST(char *, cargs.get()), &args); + grabArgs(cargs.BeginWriting(), &args); if (args != NULL) newsetting.Append(args); else @@ -834,7 +834,7 @@ NS_IMETHODIMP nsWindowsHooks::StartupRemoveOption(const char* option) { // exploiting the fact that nsString's storage is also a char* buffer. // NS_CONST_CAST is safe here because nsCRT::strtok will only modify // the existing buffer - grabArgs(NS_CONST_CAST(char *, cargs.get()), &args); + grabArgs(cargs.BeginWriting(), &args); nsCAutoString launchcommand; if (args) diff --git a/mozilla/xpinstall/src/ScheduledTasks.cpp b/mozilla/xpinstall/src/ScheduledTasks.cpp index 7f643854cd7..10e2fb0b5e1 100644 --- a/mozilla/xpinstall/src/ScheduledTasks.cpp +++ b/mozilla/xpinstall/src/ScheduledTasks.cpp @@ -99,8 +99,8 @@ PRInt32 ReplaceWindowsSystemFile(nsIFile* currentSpec, nsIFile* finalSpec) // NOTE: use OEM filenames! Even though it looks like a Windows // .INI file, WININIT.INI is processed under DOS - AnsiToOem( (char*)final.get(), (char*)final.get() ); - AnsiToOem( (char*)current.get(), (char*)current.get() ); + AnsiToOem( final.BeginWriting(), final.BeginWriting() ); + AnsiToOem( current.BeginWriting(), current.BeginWriting() ); if ( WritePrivateProfileString( "Rename", final.get(), current.get(), "WININIT.INI" ) ) err = 0; @@ -180,7 +180,7 @@ PRInt32 ScheduleFileForDeletion(nsIFile *filename) nsCAutoString path; GetRegFilePath(path); - err = NR_RegOpen((char*)path.get(), ®); + err = NR_RegOpen(NS_CONST_CAST(char*, path.get()), ®); if ( err == REGERR_OK ) { @@ -394,7 +394,7 @@ PRInt32 ReplaceFileNowOrSchedule(nsIFile* aReplacementFile, nsIFile* aDoomedFile nsCAutoString regFilePath; GetRegFilePath(regFilePath); - if ( REGERR_OK == NR_RegOpen((char*)regFilePath.get(), ®) ) + if ( REGERR_OK == NR_RegOpen(NS_CONST_CAST(char*, regFilePath.get()), ®) ) { err = NR_RegAddKey( reg, ROOTKEY_PRIVATE, REG_REPLACE_LIST_KEY, &listkey ); if ( err == REGERR_OK ) diff --git a/mozilla/xpinstall/src/nsInstallPatch.cpp b/mozilla/xpinstall/src/nsInstallPatch.cpp index 1e2ace793f5..81c7d816b77 100644 --- a/mozilla/xpinstall/src/nsInstallPatch.cpp +++ b/mozilla/xpinstall/src/nsInstallPatch.cpp @@ -489,7 +489,7 @@ nsInstallPatch::NativePatch(nsIFile *sourceFile, nsIFile *patchFile, nsIFile **n nsCAutoString unboundFile; uniqueSrcFile->GetNativePath(unboundFile); - if (su_unbind((char*)realfile.get(), (char*)unboundFile.get())) // + if (su_unbind(NS_CONST_CAST(char*, realfile.get()), NS_CONST_CAST(char*,unboundFile.get()))) // { // un-binding worked, save the tmp name for later uniqueSrcFile->GetNativePath(realfile); diff --git a/mozilla/xpinstall/src/nsRegisterItem.cpp b/mozilla/xpinstall/src/nsRegisterItem.cpp index 443cc3d36e7..961520214d7 100644 --- a/mozilla/xpinstall/src/nsRegisterItem.cpp +++ b/mozilla/xpinstall/src/nsRegisterItem.cpp @@ -99,7 +99,7 @@ hack_nsIFile2URL(nsIFile* file, char * *aURL) #endif #if defined( XP_MAC ) // Swap the / and colons to convert to an url - SwapSlashColon((char*)ePath.get()); + SwapSlashColon(ePath.BeginWriting()); #endif // Escape the path with the directory mask nsCAutoString tmp(ePath); diff --git a/mozilla/xpinstall/src/nsWinReg.cpp b/mozilla/xpinstall/src/nsWinReg.cpp index 401e3661ef9..b73f032e493 100644 --- a/mozilla/xpinstall/src/nsWinReg.cpp +++ b/mozilla/xpinstall/src/nsWinReg.cpp @@ -641,7 +641,7 @@ nsWinReg::NativeCreateKey(const nsString& aSubkey, const nsString& aClassname) return nsInstall::UNEXPECTED_ERROR; root = (HKEY)mRootKey; - result = RegCreateKeyEx(root, subkey.get(), 0, (char*)classname.get(), + result = RegCreateKeyEx(root, subkey.get(), 0, NS_CONST_CAST(char*, classname.get()), REG_OPTION_NON_VOLATILE, KEY_WRITE, nsnull, &newkey, &disposition); if(ERROR_SUCCESS == result)