This commit is contained in:
Ehsan Akhgari 2014-01-04 12:20:27 -05:00
Родитель 3e5d7d562b 22ef961b40
Коммит 5b8a5bf098
1067 изменённых файлов: 5579 добавлений и 5577 удалений

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

@ -187,7 +187,7 @@ getCharacterAtOffsetCB(AtkText* aText, gint aOffset)
if (!text || !text->IsTextRole()) if (!text || !text->IsTextRole())
return 0; return 0;
// PRUnichar is unsigned short in Mozilla, gnuichar is guint32 in glib. // char16_t is unsigned short in Mozilla, gnuichar is guint32 in glib.
return static_cast<gunichar>(text->CharAt(aOffset)); return static_cast<gunichar>(text->CharAt(aOffset));
} }

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

@ -230,7 +230,7 @@ DocManager::OnLocationChange(nsIWebProgress* aWebProgress,
NS_IMETHODIMP NS_IMETHODIMP
DocManager::OnStatusChange(nsIWebProgress* aWebProgress, DocManager::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsresult aStatus, nsIRequest* aRequest, nsresult aStatus,
const PRUnichar* aMessage) const char16_t* aMessage)
{ {
NS_NOTREACHED("notification excluded in AddProgressListener(...)"); NS_NOTREACHED("notification excluded in AddProgressListener(...)");
return NS_OK; return NS_OK;

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

@ -162,7 +162,7 @@ NS_IMPL_ISUPPORTS_INHERITED4(nsAccessibilityService,
NS_IMETHODIMP NS_IMETHODIMP
nsAccessibilityService::Observe(nsISupports *aSubject, const char *aTopic, nsAccessibilityService::Observe(nsISupports *aSubject, const char *aTopic,
const PRUnichar *aData) const char16_t *aData)
{ {
if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
Shutdown(); Shutdown();
@ -1085,7 +1085,7 @@ nsAccessibilityService::Init()
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false); observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
static const PRUnichar kInitIndicator[] = { '1', 0 }; static const char16_t kInitIndicator[] = { '1', 0 };
observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kInitIndicator); observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kInitIndicator);
#ifdef A11Y_LOG #ifdef A11Y_LOG
@ -1123,7 +1123,7 @@ nsAccessibilityService::Shutdown()
if (observerService) { if (observerService) {
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
static const PRUnichar kShutdownIndicator[] = { '0', 0 }; static const char16_t kShutdownIndicator[] = { '0', 0 };
observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kShutdownIndicator); observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kShutdownIndicator);
} }

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

@ -307,7 +307,7 @@ public:
/** /**
* Returns true if the given character is whitespace symbol. * Returns true if the given character is whitespace symbol.
*/ */
static bool IsWhitespace(PRUnichar aChar) static bool IsWhitespace(char16_t aChar)
{ {
return aChar == ' ' || aChar == '\n' || return aChar == ' ' || aChar == '\n' ||
aChar == '\r' || aChar == '\t' || aChar == 0xa0; aChar == '\r' || aChar == '\t' || aChar == 0xa0;

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

@ -130,7 +130,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL) { display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL) {
isHTMLBlock = true; isHTMLBlock = true;
if (!aString->IsEmpty()) { if (!aString->IsEmpty()) {
aString->Append(PRUnichar(' ')); aString->Append(char16_t(' '));
} }
} }
} }
@ -146,7 +146,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
aContent->AppendTextTo(*aString); aContent->AppendTextTo(*aString);
} }
if (isHTMLBlock && !aString->IsEmpty()) { if (isHTMLBlock && !aString->IsEmpty()) {
aString->Append(PRUnichar(' ')); aString->Append(char16_t(' '));
} }
} }
@ -334,12 +334,12 @@ nsTextEquivUtils::AppendString(nsAString *aString,
// Insert spaces to insure that words from controls aren't jammed together. // Insert spaces to insure that words from controls aren't jammed together.
if (!aString->IsEmpty() && !nsCoreUtils::IsWhitespace(aString->Last())) if (!aString->IsEmpty() && !nsCoreUtils::IsWhitespace(aString->Last()))
aString->Append(PRUnichar(' ')); aString->Append(char16_t(' '));
aString->Append(aTextEquivalent); aString->Append(aTextEquivalent);
if (!nsCoreUtils::IsWhitespace(aString->Last())) if (!nsCoreUtils::IsWhitespace(aString->Last()))
aString->Append(PRUnichar(' ')); aString->Append(char16_t(' '));
return true; return true;
} }

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

@ -796,7 +796,7 @@ DocAccessible::ScrollPositionDidChange(nscoord aX, nscoord aY)
NS_IMETHODIMP NS_IMETHODIMP
DocAccessible::Observe(nsISupports* aSubject, const char* aTopic, DocAccessible::Observe(nsISupports* aSubject, const char* aTopic,
const PRUnichar* aData) const char16_t* aData)
{ {
if (!nsCRT::strcmp(aTopic,"obs_documentCreated")) { if (!nsCRT::strcmp(aTopic,"obs_documentCreated")) {
// State editable will now be set, readonly is now clear // State editable will now be set, readonly is now clear

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

@ -26,9 +26,9 @@ struct DOMPoint {
// This character marks where in the text returned via nsIAccessibleText(), // This character marks where in the text returned via nsIAccessibleText(),
// that embedded object characters exist // that embedded object characters exist
const PRUnichar kEmbeddedObjectChar = 0xfffc; const char16_t kEmbeddedObjectChar = 0xfffc;
const PRUnichar kImaginaryEmbeddedObjectChar = ' '; const char16_t kImaginaryEmbeddedObjectChar = ' ';
const PRUnichar kForcedNewLineChar = '\n'; const char16_t kForcedNewLineChar = '\n';
/** /**
* Special Accessible that knows how contain both text and embedded objects * Special Accessible that knows how contain both text and embedded objects
@ -188,7 +188,7 @@ public:
return true; return true;
} }
PRUnichar CharAt(int32_t aOffset) char16_t CharAt(int32_t aOffset)
{ {
nsAutoString charAtOffset; nsAutoString charAtOffset;
CharAt(aOffset, charAtOffset); CharAt(aOffset, charAtOffset);
@ -198,7 +198,7 @@ public:
/** /**
* Return true if char at the given offset equals to given char. * Return true if char at the given offset equals to given char.
*/ */
bool IsCharAt(int32_t aOffset, PRUnichar aChar) bool IsCharAt(int32_t aOffset, char16_t aChar)
{ return CharAt(aOffset) == aChar; } { return CharAt(aOffset) == aChar; }
/** /**

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

@ -47,7 +47,7 @@ HTMLBRAccessible::NativeState()
ENameValueFlag ENameValueFlag
HTMLBRAccessible::NativeName(nsString& aName) HTMLBRAccessible::NativeName(nsString& aName)
{ {
aName = static_cast<PRUnichar>('\n'); // Newline char aName = static_cast<char16_t>('\n'); // Newline char
return eNameOK; return eNameOK;
} }

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

@ -128,7 +128,7 @@ xpcAccessibleHyperText::GetTextAfterOffset(int32_t aOffset,
NS_IMETHODIMP NS_IMETHODIMP
xpcAccessibleHyperText::GetCharacterAtOffset(int32_t aOffset, xpcAccessibleHyperText::GetCharacterAtOffset(int32_t aOffset,
PRUnichar* aCharacter) char16_t* aCharacter)
{ {
NS_ENSURE_ARG_POINTER(aCharacter); NS_ENSURE_ARG_POINTER(aCharacter);
*aCharacter = L'\0'; *aCharacter = L'\0';

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

@ -50,7 +50,7 @@ static void Output(const char *fmt, ... )
va_start(ap, fmt); va_start(ap, fmt);
#if defined(XP_WIN) && !MOZ_WINCONSOLE #if defined(XP_WIN) && !MOZ_WINCONSOLE
PRUnichar msg[2048]; char16_t msg[2048];
_vsnwprintf(msg, sizeof(msg)/sizeof(msg[0]), NS_ConvertUTF8toUTF16(fmt).get(), ap); _vsnwprintf(msg, sizeof(msg)/sizeof(msg[0]), NS_ConvertUTF8toUTF16(fmt).get(), ap);
MessageBoxW(nullptr, msg, L"XULRunner", MB_OK | MB_ICONERROR); MessageBoxW(nullptr, msg, L"XULRunner", MB_OK | MB_ICONERROR);
#else #else

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

@ -230,7 +230,7 @@ NS_IMETHODIMP
nsMacShellService::OnStatusChange(nsIWebProgress* aWebProgress, nsMacShellService::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsIRequest* aRequest,
nsresult aStatus, nsresult aStatus,
const PRUnichar* aMessage) const char16_t* aMessage)
{ {
return NS_OK; return NS_OK;
} }

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

@ -476,7 +476,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
const nsString &flatValue = PromiseFlatString(valueData); const nsString &flatValue = PromiseFlatString(valueData);
res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, res = ::RegSetValueExW(theKey, L"", 0, REG_SZ,
(const BYTE *) flatValue.get(), (const BYTE *) flatValue.get(),
(flatValue.Length() + 1) * sizeof(PRUnichar)); (flatValue.Length() + 1) * sizeof(char16_t));
// Close the key that was created. // Close the key that was created.
::RegCloseKey(theKey); ::RegCloseKey(theKey);
if (REG_FAILED(res)) { if (REG_FAILED(res)) {
@ -522,7 +522,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
(LPBYTE)currValue, &len); (LPBYTE)currValue, &len);
// Close the key that was opened. // Close the key that was opened.
::RegCloseKey(theKey); ::RegCloseKey(theKey);
if (REG_FAILED(res) || PRUnichar('\0') != *currValue) { if (REG_FAILED(res) || char16_t('\0') != *currValue) {
// Key wasn't set or was set to something other than our registry entry. // Key wasn't set or was set to something other than our registry entry.
// Delete the key along with all of its childrean and then recreate it. // Delete the key along with all of its childrean and then recreate it.
const nsString &flatName = PromiseFlatString(keyName); const nsString &flatName = PromiseFlatString(keyName);
@ -538,7 +538,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
} }
res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, (const BYTE *) L"", res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, (const BYTE *) L"",
sizeof(PRUnichar)); sizeof(char16_t));
// Close the key that was created. // Close the key that was created.
::RegCloseKey(theKey); ::RegCloseKey(theKey);
if (REG_FAILED(res)) { if (REG_FAILED(res)) {
@ -582,7 +582,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
const nsString &flatValue = PromiseFlatString(valueData); const nsString &flatValue = PromiseFlatString(valueData);
res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, res = ::RegSetValueExW(theKey, L"", 0, REG_SZ,
(const BYTE *) flatValue.get(), (const BYTE *) flatValue.get(),
(flatValue.Length() + 1) * sizeof(PRUnichar)); (flatValue.Length() + 1) * sizeof(char16_t));
// Close the key that was created. // Close the key that was created.
::RegCloseKey(theKey); ::RegCloseKey(theKey);
// If updating the FTP protocol handlers shell open command fails try to // If updating the FTP protocol handlers shell open command fails try to

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

@ -93,7 +93,7 @@ nsScriptSecurityManager::SubjectIsPrivileged()
// Convenience Functions // // Convenience Functions //
/////////////////////////// ///////////////////////////
// Result of this function should not be freed. // Result of this function should not be freed.
static inline const PRUnichar * static inline const char16_t *
IDToString(JSContext *cx, jsid id_) IDToString(JSContext *cx, jsid id_)
{ {
JS::RootedId id(cx, id_); JS::RootedId id(cx, id_);
@ -178,7 +178,7 @@ inline void SetPendingException(JSContext *cx, const char *aMsg)
JS_ReportError(cx, "%s", aMsg); JS_ReportError(cx, "%s", aMsg);
} }
inline void SetPendingException(JSContext *cx, const PRUnichar *aMsg) inline void SetPendingException(JSContext *cx, const char16_t *aMsg)
{ {
JS_ReportError(cx, "%hs", aMsg); JS_ReportError(cx, "%hs", aMsg);
} }
@ -704,7 +704,7 @@ nsScriptSecurityManager::CheckPropertyAccessImpl(uint32_t aAction,
NS_ConvertUTF8toUTF16 objectDomainUnicode(objectDomain); NS_ConvertUTF8toUTF16 objectDomainUnicode(objectDomain);
nsXPIDLString errorMsg; nsXPIDLString errorMsg;
const PRUnichar *formatStrings[] = const char16_t *formatStrings[] =
{ {
subjectOriginUnicode.get(), subjectOriginUnicode.get(),
className.get(), className.get(),
@ -1178,7 +1178,7 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
if (!hasFlags) { if (!hasFlags) {
nsXPIDLString message; nsXPIDLString message;
NS_ConvertASCIItoUTF16 ucsTargetScheme(targetScheme); NS_ConvertASCIItoUTF16 ucsTargetScheme(targetScheme);
const PRUnichar* formatStrings[] = { ucsTargetScheme.get() }; const char16_t* formatStrings[] = { ucsTargetScheme.get() };
rv = sStrBundle-> rv = sStrBundle->
FormatStringFromName(MOZ_UTF16("ProtocolFlagError"), FormatStringFromName(MOZ_UTF16("ProtocolFlagError"),
formatStrings, formatStrings,
@ -1217,7 +1217,7 @@ nsScriptSecurityManager::ReportError(JSContext* cx, const nsAString& messageTag,
nsXPIDLString message; nsXPIDLString message;
NS_ConvertASCIItoUTF16 ucsSourceSpec(sourceSpec); NS_ConvertASCIItoUTF16 ucsSourceSpec(sourceSpec);
NS_ConvertASCIItoUTF16 ucsTargetSpec(targetSpec); NS_ConvertASCIItoUTF16 ucsTargetSpec(targetSpec);
const PRUnichar *formatStrings[] = { ucsSourceSpec.get(), ucsTargetSpec.get() }; const char16_t *formatStrings[] = { ucsSourceSpec.get(), ucsTargetSpec.get() };
rv = sStrBundle->FormatStringFromName(PromiseFlatString(messageTag).get(), rv = sStrBundle->FormatStringFromName(PromiseFlatString(messageTag).get(),
formatStrings, formatStrings,
ArrayLength(formatStrings), ArrayLength(formatStrings),
@ -1552,7 +1552,7 @@ nsScriptSecurityManager::CanCreateWrapper(JSContext *cx,
} }
NS_ConvertUTF8toUTF16 originUnicode(origin); NS_ConvertUTF8toUTF16 originUnicode(origin);
NS_ConvertUTF8toUTF16 className(objClassInfo.GetName()); NS_ConvertUTF8toUTF16 className(objClassInfo.GetName());
const PRUnichar* formatStrings[] = { const char16_t* formatStrings[] = {
className.get(), className.get(),
originUnicode.get() originUnicode.get()
}; };
@ -1743,7 +1743,7 @@ static const char* kObservedPrefs[] = {
NS_IMETHODIMP NS_IMETHODIMP
nsScriptSecurityManager::Observe(nsISupports* aObject, const char* aTopic, nsScriptSecurityManager::Observe(nsISupports* aObject, const char* aTopic,
const PRUnichar* aMessage) const char16_t* aMessage)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
NS_ConvertUTF16toUTF8 messageStr(aMessage); NS_ConvertUTF16toUTF8 messageStr(aMessage);

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

@ -327,7 +327,7 @@ nsChromeRegistryChrome::SelectLocaleFromPref(nsIPrefBranch* prefs)
NS_IMETHODIMP NS_IMETHODIMP
nsChromeRegistryChrome::Observe(nsISupports *aSubject, const char *aTopic, nsChromeRegistryChrome::Observe(nsISupports *aSubject, const char *aTopic,
const PRUnichar *someData) const char16_t *someData)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;

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

@ -36,7 +36,7 @@ class nsChromeRegistryChrome : public nsChromeRegistry
NS_IMETHOD GetSelectedLocale(const nsACString& aPackage, NS_IMETHOD GetSelectedLocale(const nsACString& aPackage,
nsACString& aLocale) MOZ_OVERRIDE; nsACString& aLocale) MOZ_OVERRIDE;
NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic, NS_IMETHOD Observe(nsISupports *aSubject, const char *aTopic,
const PRUnichar *someData) MOZ_OVERRIDE; const char16_t *someData) MOZ_OVERRIDE;
#ifdef MOZ_XUL #ifdef MOZ_XUL
NS_IMETHOD GetXULOverlays(nsIURI *aURI, NS_IMETHOD GetXULOverlays(nsIURI *aURI,

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

@ -222,7 +222,7 @@ nsChromeRegistryContent::GetSelectedLocale(const nsACString& aPackage,
NS_IMETHODIMP NS_IMETHODIMP
nsChromeRegistryContent::Observe(nsISupports* aSubject, const char* aTopic, nsChromeRegistryContent::Observe(nsISupports* aSubject, const char* aTopic,
const PRUnichar* aData) const char16_t* aData)
{ {
CONTENT_NOT_IMPLEMENTED(); CONTENT_NOT_IMPLEMENTED();
} }

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

@ -28,7 +28,7 @@ class nsChromeRegistryContent : public nsChromeRegistry
NS_IMETHOD CheckForNewChrome() MOZ_OVERRIDE; NS_IMETHOD CheckForNewChrome() MOZ_OVERRIDE;
NS_IMETHOD CheckForOSAccessibility() MOZ_OVERRIDE; NS_IMETHOD CheckForOSAccessibility() MOZ_OVERRIDE;
NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
const PRUnichar* aData) MOZ_OVERRIDE; const char16_t* aData) MOZ_OVERRIDE;
NS_IMETHOD IsLocaleRTL(const nsACString& package, NS_IMETHOD IsLocaleRTL(const nsACString& package,
bool *aResult) MOZ_OVERRIDE; bool *aResult) MOZ_OVERRIDE;
NS_IMETHOD GetSelectedLocale(const nsACString& aPackage, NS_IMETHOD GetSelectedLocale(const nsACString& aPackage,

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

@ -83,7 +83,7 @@ void WalkDescendantsClearAncestorDirAuto(mozilla::dom::Element* aElement);
* directionality needs to change * directionality needs to change
*/ */
void SetDirectionFromChangedTextNode(nsIContent* aTextNode, uint32_t aOffset, void SetDirectionFromChangedTextNode(nsIContent* aTextNode, uint32_t aOffset,
const PRUnichar* aBuffer, uint32_t aLength, const char16_t* aBuffer, uint32_t aLength,
bool aNotify); bool aNotify);
/** /**

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

@ -189,14 +189,14 @@ public:
virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) MOZ_OVERRIDE; virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) MOZ_OVERRIDE;
virtual const nsTextFragment *GetText() MOZ_OVERRIDE; virtual const nsTextFragment *GetText() MOZ_OVERRIDE;
virtual uint32_t TextLength() const MOZ_OVERRIDE; virtual uint32_t TextLength() const MOZ_OVERRIDE;
virtual nsresult SetText(const PRUnichar* aBuffer, uint32_t aLength, virtual nsresult SetText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) MOZ_OVERRIDE; bool aNotify) MOZ_OVERRIDE;
// Need to implement this here too to avoid hiding. // Need to implement this here too to avoid hiding.
nsresult SetText(const nsAString& aStr, bool aNotify) nsresult SetText(const nsAString& aStr, bool aNotify)
{ {
return SetText(aStr.BeginReading(), aStr.Length(), aNotify); return SetText(aStr.BeginReading(), aStr.Length(), aNotify);
} }
virtual nsresult AppendText(const PRUnichar* aBuffer, uint32_t aLength, virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) MOZ_OVERRIDE; bool aNotify) MOZ_OVERRIDE;
virtual bool TextIsOnlyWhitespace() MOZ_OVERRIDE; virtual bool TextIsOnlyWhitespace() MOZ_OVERRIDE;
virtual void AppendTextTo(nsAString& aResult) MOZ_OVERRIDE; virtual void AppendTextTo(nsAString& aResult) MOZ_OVERRIDE;

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

@ -319,16 +319,16 @@ public:
static uint32_t CopyNewlineNormalizedUnicodeTo(const nsAString& aSource, static uint32_t CopyNewlineNormalizedUnicodeTo(const nsAString& aSource,
uint32_t aSrcOffset, uint32_t aSrcOffset,
PRUnichar* aDest, char16_t* aDest,
uint32_t aLength, uint32_t aLength,
bool& aLastCharCR); bool& aLastCharCR);
static uint32_t CopyNewlineNormalizedUnicodeTo(nsReadingIterator<PRUnichar>& aSrcStart, const nsReadingIterator<PRUnichar>& aSrcEnd, nsAString& aDest); static uint32_t CopyNewlineNormalizedUnicodeTo(nsReadingIterator<char16_t>& aSrcStart, const nsReadingIterator<char16_t>& aSrcEnd, nsAString& aDest);
static const nsDependentSubstring TrimCharsInSet(const char* aSet, static const nsDependentSubstring TrimCharsInSet(const char* aSet,
const nsAString& aValue); const nsAString& aValue);
template<bool IsWhitespace(PRUnichar)> template<bool IsWhitespace(char16_t)>
static const nsDependentSubstring TrimWhitespace(const nsAString& aStr, static const nsDependentSubstring TrimWhitespace(const nsAString& aStr,
bool aTrimTrailing = true); bool aTrimTrailing = true);
@ -352,13 +352,13 @@ public:
* *
* HTML 4.01 also lists U+200B (zero-width space). * HTML 4.01 also lists U+200B (zero-width space).
*/ */
static bool IsHTMLWhitespace(PRUnichar aChar); static bool IsHTMLWhitespace(char16_t aChar);
/* /*
* Returns whether the character is an HTML whitespace (see IsHTMLWhitespace) * Returns whether the character is an HTML whitespace (see IsHTMLWhitespace)
* or a nbsp character (U+00A0). * or a nbsp character (U+00A0).
*/ */
static bool IsHTMLWhitespaceOrNBSP(PRUnichar aChar); static bool IsHTMLWhitespaceOrNBSP(char16_t aChar);
/** /**
* Is the HTML local name a block element? * Is the HTML local name a block element?
@ -530,7 +530,7 @@ public:
static nsresult CheckQName(const nsAString& aQualifiedName, static nsresult CheckQName(const nsAString& aQualifiedName,
bool aNamespaceAware = true, bool aNamespaceAware = true,
const PRUnichar** aColon = nullptr); const char16_t** aColon = nullptr);
static nsresult SplitQName(const nsIContent* aNamespaceResolver, static nsresult SplitQName(const nsIContent* aNamespaceResolver,
const nsAFlatString& aQName, const nsAFlatString& aQName,
@ -542,7 +542,7 @@ public:
uint16_t aNodeType, uint16_t aNodeType,
nsINodeInfo** aNodeInfo); nsINodeInfo** aNodeInfo);
static void SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix, static void SplitExpatName(const char16_t *aExpatName, nsIAtom **aPrefix,
nsIAtom **aTagName, int32_t *aNameSpaceID); nsIAtom **aTagName, int32_t *aNameSpaceID);
// Get a permission-manager setting for the given principal and type. // Get a permission-manager setting for the given principal and type.
@ -814,7 +814,7 @@ public:
nsIDocument* aDocument, nsIDocument* aDocument,
PropertiesFile aFile, PropertiesFile aFile,
const char *aMessageName, const char *aMessageName,
const PRUnichar **aParams = nullptr, const char16_t **aParams = nullptr,
uint32_t aParamsLength = 0, uint32_t aParamsLength = 0,
nsIURI* aURI = nullptr, nsIURI* aURI = nullptr,
const nsAFlatString& aSourceLine const nsAFlatString& aSourceLine
@ -846,7 +846,7 @@ public:
private: private:
static nsresult FormatLocalizedString(PropertiesFile aFile, static nsresult FormatLocalizedString(PropertiesFile aFile,
const char* aKey, const char* aKey,
const PRUnichar** aParams, const char16_t** aParams,
uint32_t aParamsLength, uint32_t aParamsLength,
nsXPIDLString& aResult); nsXPIDLString& aResult);
@ -854,7 +854,7 @@ public:
template<uint32_t N> template<uint32_t N>
static nsresult FormatLocalizedString(PropertiesFile aFile, static nsresult FormatLocalizedString(PropertiesFile aFile,
const char* aKey, const char* aKey,
const PRUnichar* (&aParams)[N], const char16_t* (&aParams)[N],
nsXPIDLString& aResult) nsXPIDLString& aResult)
{ {
return FormatLocalizedString(aFile, aKey, aParams, N, aResult); return FormatLocalizedString(aFile, aKey, aParams, N, aResult);

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

@ -505,7 +505,7 @@ public:
* the document is notified of the content change. * the document is notified of the content change.
* NOTE: For elements this always ASSERTS and returns NS_ERROR_FAILURE * NOTE: For elements this always ASSERTS and returns NS_ERROR_FAILURE
*/ */
virtual nsresult SetText(const PRUnichar* aBuffer, uint32_t aLength, virtual nsresult SetText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) = 0; bool aNotify) = 0;
/** /**
@ -513,7 +513,7 @@ public:
* the document is notified of the content change. * the document is notified of the content change.
* NOTE: For elements this always ASSERTS and returns NS_ERROR_FAILURE * NOTE: For elements this always ASSERTS and returns NS_ERROR_FAILURE
*/ */
virtual nsresult AppendText(const PRUnichar* aBuffer, uint32_t aLength, virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) = 0; bool aNotify) = 0;
/** /**

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

@ -1176,8 +1176,8 @@ public:
* was no standalone parameter in the declaration, that it was given as no, * was no standalone parameter in the declaration, that it was given as no,
* or that it was given as yes. * or that it was given as yes.
*/ */
virtual void SetXMLDeclaration(const PRUnichar *aVersion, virtual void SetXMLDeclaration(const char16_t *aVersion,
const PRUnichar *aEncoding, const char16_t *aEncoding,
const int32_t aStandalone) = 0; const int32_t aStandalone) = 0;
virtual void GetXMLDeclaration(nsAString& aVersion, virtual void GetXMLDeclaration(nsAString& aVersion,
nsAString& aEncoding, nsAString& aEncoding,

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

@ -56,7 +56,7 @@ namespace dom {
* @return true if aChar is what the DOM spec defines as 'space character'. * @return true if aChar is what the DOM spec defines as 'space character'.
* http://dom.spec.whatwg.org/#space-character * http://dom.spec.whatwg.org/#space-character
*/ */
inline bool IsSpaceCharacter(PRUnichar aChar) { inline bool IsSpaceCharacter(char16_t aChar) {
return aChar == ' ' || aChar == '\t' || aChar == '\n' || aChar == '\r' || return aChar == ' ' || aChar == '\t' || aChar == '\n' || aChar == '\r' ||
aChar == '\f'; aChar == '\f';
} }

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

@ -65,9 +65,9 @@ public:
nsLineBreaker(); nsLineBreaker();
~nsLineBreaker(); ~nsLineBreaker();
static inline bool IsSpace(PRUnichar u) { return NS_IsSpace(u); } static inline bool IsSpace(char16_t u) { return NS_IsSpace(u); }
static inline bool IsComplexASCIIChar(PRUnichar u) static inline bool IsComplexASCIIChar(char16_t u)
{ {
return !((0x0030 <= u && u <= 0x0039) || return !((0x0030 <= u && u <= 0x0039) ||
(0x0041 <= u && u <= 0x005A) || (0x0041 <= u && u <= 0x005A) ||
@ -75,7 +75,7 @@ public:
(0x000a == u)); (0x000a == u));
} }
static inline bool IsComplexChar(PRUnichar u) static inline bool IsComplexChar(char16_t u)
{ {
return IsComplexASCIIChar(u) || return IsComplexASCIIChar(u) ||
NS_NeedsPlatformNativeHandling(u) || NS_NeedsPlatformNativeHandling(u) ||
@ -147,7 +147,7 @@ public:
* @param aSink can be null if the breaks are not actually needed (we may * @param aSink can be null if the breaks are not actually needed (we may
* still be setting up state for later breaks) * still be setting up state for later breaks)
*/ */
nsresult AppendText(nsIAtom* aHyphenationLanguage, const PRUnichar* aText, uint32_t aLength, nsresult AppendText(nsIAtom* aHyphenationLanguage, const char16_t* aText, uint32_t aLength,
uint32_t aFlags, nsILineBreakSink* aSink); uint32_t aFlags, nsILineBreakSink* aSink);
/** /**
* Feed 8-bit text into the linebreaker for analysis. aLength must be nonzero. * Feed 8-bit text into the linebreaker for analysis. aLength must be nonzero.
@ -201,11 +201,11 @@ private:
void UpdateCurrentWordLanguage(nsIAtom *aHyphenationLanguage); void UpdateCurrentWordLanguage(nsIAtom *aHyphenationLanguage);
void FindHyphenationPoints(nsHyphenator *aHyphenator, void FindHyphenationPoints(nsHyphenator *aHyphenator,
const PRUnichar *aTextStart, const char16_t *aTextStart,
const PRUnichar *aTextLimit, const char16_t *aTextLimit,
uint8_t *aBreakState); uint8_t *aBreakState);
nsAutoTArray<PRUnichar,100> mCurrentWord; nsAutoTArray<char16_t,100> mCurrentWord;
// All the items that contribute to mCurrentWord // All the items that contribute to mCurrentWord
nsAutoTArray<TextItem,2> mTextItems; nsAutoTArray<TextItem,2> mTextItems;
nsIAtom* mCurrentWordLanguage; nsIAtom* mCurrentWordLanguage;

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

@ -105,7 +105,7 @@ DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
nsresult rv; nsresult rv;
if (!aQualifiedName.IsEmpty()) { if (!aQualifiedName.IsEmpty()) {
const nsAFlatString& qName = PromiseFlatString(aQualifiedName); const nsAFlatString& qName = PromiseFlatString(aQualifiedName);
const PRUnichar *colon; const char16_t *colon;
rv = nsContentUtils::CheckQName(qName, true, &colon); rv = nsContentUtils::CheckQName(qName, true, &colon);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);

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

@ -62,7 +62,7 @@ DOMParser::ParseFromString(const nsAString& aStr, SupportedType aType,
} }
NS_IMETHODIMP NS_IMETHODIMP
DOMParser::ParseFromString(const PRUnichar *str, DOMParser::ParseFromString(const char16_t *str,
const char *contentType, const char *contentType,
nsIDOMDocument **aResult) nsIDOMDocument **aResult)
{ {

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

@ -303,11 +303,11 @@ inline static bool NodeAffectsDirAutoAncestor(nsINode* aTextNode)
* @return the directionality of the string * @return the directionality of the string
*/ */
static Directionality static Directionality
GetDirectionFromText(const PRUnichar* aText, const uint32_t aLength, GetDirectionFromText(const char16_t* aText, const uint32_t aLength,
uint32_t* aFirstStrong = nullptr) uint32_t* aFirstStrong = nullptr)
{ {
const PRUnichar* start = aText; const char16_t* start = aText;
const PRUnichar* end = aText + aLength; const char16_t* end = aText + aLength;
while (start < end) { while (start < end) {
uint32_t current = start - aText; uint32_t current = start - aText;
@ -825,7 +825,7 @@ void SetAncestorDirectionIfAuto(nsINode* aTextNode, Directionality aDir,
void void
SetDirectionFromChangedTextNode(nsIContent* aTextNode, uint32_t aOffset, SetDirectionFromChangedTextNode(nsIContent* aTextNode, uint32_t aOffset,
const PRUnichar* aBuffer, uint32_t aLength, const char16_t* aBuffer, uint32_t aLength,
bool aNotify) bool aNotify)
{ {
if (!NodeAffectsDirAutoAncestor(aTextNode)) { if (!NodeAffectsDirAutoAncestor(aTextNode)) {

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

@ -2093,8 +2093,8 @@ Element::ListAttributes(FILE* out) const
nsAutoString value; nsAutoString value;
mAttrsAndChildren.AttrAt(index)->ToString(value); mAttrsAndChildren.AttrAt(index)->ToString(value);
for (int i = value.Length(); i >= 0; --i) { for (int i = value.Length(); i >= 0; --i) {
if (value[i] == PRUnichar('"')) if (value[i] == char16_t('"'))
value.Insert(PRUnichar('\\'), uint32_t(i)); value.Insert(char16_t('\\'), uint32_t(i));
} }
buffer.Append(value); buffer.Append(value);
buffer.AppendLiteral("\""); buffer.AppendLiteral("\"");

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

@ -40,12 +40,12 @@
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
#define REPLACEMENT_CHAR (PRUnichar)0xFFFD #define REPLACEMENT_CHAR (char16_t)0xFFFD
#define BOM_CHAR (PRUnichar)0xFEFF #define BOM_CHAR (char16_t)0xFEFF
#define SPACE_CHAR (PRUnichar)0x0020 #define SPACE_CHAR (char16_t)0x0020
#define CR_CHAR (PRUnichar)0x000D #define CR_CHAR (char16_t)0x000D
#define LF_CHAR (PRUnichar)0x000A #define LF_CHAR (char16_t)0x000A
#define COLON_CHAR (PRUnichar)0x003A #define COLON_CHAR (char16_t)0x003A
#define DEFAULT_BUFFER_SIZE 4096 #define DEFAULT_BUFFER_SIZE 4096
@ -299,7 +299,7 @@ EventSource::Constructor(const GlobalObject& aGlobal,
NS_IMETHODIMP NS_IMETHODIMP
EventSource::Observe(nsISupports* aSubject, EventSource::Observe(nsISupports* aSubject,
const char* aTopic, const char* aTopic,
const PRUnichar* aData) const char16_t* aData)
{ {
if (mReadyState == CLOSED) { if (mReadyState == CLOSED) {
return NS_OK; return NS_OK;
@ -405,7 +405,7 @@ EventSource::StreamReaderFunc(nsIInputStream *aInputStream,
*aWriteCount = 0; *aWriteCount = 0;
int32_t srcCount, outCount; int32_t srcCount, outCount;
PRUnichar out[2]; char16_t out[2];
nsresult rv; nsresult rv;
const char *p = aFromRawSegment, const char *p = aFromRawSegment,
@ -928,8 +928,8 @@ EventSource::SetReconnectionTimeout()
nsresult nsresult
EventSource::PrintErrorOnConsole(const char *aBundleURI, EventSource::PrintErrorOnConsole(const char *aBundleURI,
const PRUnichar *aError, const char16_t *aError,
const PRUnichar **aFormatStrings, const char16_t **aFormatStrings,
uint32_t aFormatStringsLen) uint32_t aFormatStringsLen)
{ {
nsCOMPtr<nsIStringBundleService> bundleService = nsCOMPtr<nsIStringBundleService> bundleService =
@ -983,7 +983,7 @@ EventSource::ConsoleError()
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
NS_ConvertUTF8toUTF16 specUTF16(targetSpec); NS_ConvertUTF8toUTF16 specUTF16(targetSpec);
const PRUnichar *formatStrings[] = { specUTF16.get() }; const char16_t *formatStrings[] = { specUTF16.get() };
if (mReadyState == CONNECTING && !mInterrupted) { if (mReadyState == CONNECTING && !mInterrupted) {
rv = PrintErrorOnConsole("chrome://global/locale/appstrings.properties", rv = PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
@ -1314,12 +1314,12 @@ EventSource::SetFieldAndClear()
return NS_OK; return NS_OK;
} }
PRUnichar first_char; char16_t first_char;
first_char = mLastFieldName.CharAt(0); first_char = mLastFieldName.CharAt(0);
switch (first_char) // with no case folding performed switch (first_char) // with no case folding performed
{ {
case PRUnichar('d'): case char16_t('d'):
if (mLastFieldName.EqualsLiteral("data")) { if (mLastFieldName.EqualsLiteral("data")) {
// If the field name is "data" append the field value to the data // If the field name is "data" append the field value to the data
// buffer, then append a single U+000A LINE FEED (LF) character // buffer, then append a single U+000A LINE FEED (LF) character
@ -1329,32 +1329,32 @@ EventSource::SetFieldAndClear()
} }
break; break;
case PRUnichar('e'): case char16_t('e'):
if (mLastFieldName.EqualsLiteral("event")) { if (mLastFieldName.EqualsLiteral("event")) {
mCurrentMessage.mEventName.Assign(mLastFieldValue); mCurrentMessage.mEventName.Assign(mLastFieldValue);
} }
break; break;
case PRUnichar('i'): case char16_t('i'):
if (mLastFieldName.EqualsLiteral("id")) { if (mLastFieldName.EqualsLiteral("id")) {
mCurrentMessage.mLastEventID.Assign(mLastFieldValue); mCurrentMessage.mLastEventID.Assign(mLastFieldValue);
} }
break; break;
case PRUnichar('r'): case char16_t('r'):
if (mLastFieldName.EqualsLiteral("retry")) { if (mLastFieldName.EqualsLiteral("retry")) {
uint32_t newValue=0; uint32_t newValue=0;
uint32_t i = 0; // we must ensure that there are only digits uint32_t i = 0; // we must ensure that there are only digits
bool assign = true; bool assign = true;
for (i = 0; i < mLastFieldValue.Length(); ++i) { for (i = 0; i < mLastFieldValue.Length(); ++i) {
if (mLastFieldValue.CharAt(i) < (PRUnichar)'0' || if (mLastFieldValue.CharAt(i) < (char16_t)'0' ||
mLastFieldValue.CharAt(i) > (PRUnichar)'9') { mLastFieldValue.CharAt(i) > (char16_t)'9') {
assign = false; assign = false;
break; break;
} }
newValue = newValue*10 + newValue = newValue*10 +
(((uint32_t)mLastFieldValue.CharAt(i))- (((uint32_t)mLastFieldValue.CharAt(i))-
((uint32_t)((PRUnichar)'0'))); ((uint32_t)((char16_t)'0')));
} }
if (assign) { if (assign) {
@ -1399,7 +1399,7 @@ EventSource::CheckHealthOfRequestCallback(nsIRequest *aRequestCallback)
} }
nsresult nsresult
EventSource::ParseCharacter(PRUnichar aChr) EventSource::ParseCharacter(char16_t aChr)
{ {
nsresult rv; nsresult rv;

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

@ -133,8 +133,8 @@ protected:
static void TimerCallback(nsITimer *aTimer, void *aClosure); static void TimerCallback(nsITimer *aTimer, void *aClosure);
nsresult PrintErrorOnConsole(const char *aBundleURI, nsresult PrintErrorOnConsole(const char *aBundleURI,
const PRUnichar *aError, const char16_t *aError,
const PRUnichar **aFormatStrings, const char16_t **aFormatStrings,
uint32_t aFormatStringsLen); uint32_t aFormatStringsLen);
nsresult ConsoleError(); nsresult ConsoleError();
@ -148,7 +148,7 @@ protected:
nsresult ClearFields(); nsresult ClearFields();
nsresult ResetEvent(); nsresult ResetEvent();
nsresult DispatchCurrentMessageEvent(); nsresult DispatchCurrentMessageEvent();
nsresult ParseCharacter(PRUnichar aChr); nsresult ParseCharacter(char16_t aChr);
bool CheckCanRequestSrc(nsIURI* aSrc = nullptr); // if null, it tests mSrc bool CheckCanRequestSrc(nsIURI* aSrc = nullptr); // if null, it tests mSrc
nsresult CheckHealthOfRequestCallback(nsIRequest *aRequestCallback); nsresult CheckHealthOfRequestCallback(nsIRequest *aRequestCallback);
nsresult OnRedirectVerifyCallback(nsresult result); nsresult OnRedirectVerifyCallback(nsresult result);

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

@ -1737,7 +1737,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(FragmentOrElement)
classes.AppendLiteral(" class='"); classes.AppendLiteral(" class='");
nsAutoString classString; nsAutoString classString;
classAttrValue->ToString(classString); classAttrValue->ToString(classString);
classString.ReplaceChar(PRUnichar('\n'), PRUnichar(' ')); classString.ReplaceChar(char16_t('\n'), char16_t(' '));
classes.Append(classString); classes.Append(classString);
classes.AppendLiteral("'"); classes.AppendLiteral("'");
} }
@ -1866,7 +1866,7 @@ FragmentOrElement::TextLength() const
} }
nsresult nsresult
FragmentOrElement::SetText(const PRUnichar* aBuffer, uint32_t aLength, FragmentOrElement::SetText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) bool aNotify)
{ {
NS_ERROR("called FragmentOrElement::SetText"); NS_ERROR("called FragmentOrElement::SetText");
@ -1875,7 +1875,7 @@ FragmentOrElement::SetText(const PRUnichar* aBuffer, uint32_t aLength,
} }
nsresult nsresult
FragmentOrElement::AppendText(const PRUnichar* aBuffer, uint32_t aLength, FragmentOrElement::AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) bool aNotify)
{ {
NS_ERROR("called FragmentOrElement::AppendText"); NS_ERROR("called FragmentOrElement::AppendText");
@ -2114,8 +2114,8 @@ private:
void EncodeAttrString(const nsAutoString& aValue, nsAString& aOut) void EncodeAttrString(const nsAutoString& aValue, nsAString& aOut)
{ {
const PRUnichar* c = aValue.BeginReading(); const char16_t* c = aValue.BeginReading();
const PRUnichar* end = aValue.EndReading(); const char16_t* end = aValue.EndReading();
while (c < end) { while (c < end) {
switch (*c) { switch (*c) {
case '"': case '"':
@ -2139,9 +2139,9 @@ private:
{ {
uint32_t len = aValue->GetLength(); uint32_t len = aValue->GetLength();
if (aValue->Is2b()) { if (aValue->Is2b()) {
const PRUnichar* data = aValue->Get2b(); const char16_t* data = aValue->Get2b();
for (uint32_t i = 0; i < len; ++i) { for (uint32_t i = 0; i < len; ++i) {
const PRUnichar c = data[i]; const char16_t c = data[i];
switch (c) { switch (c) {
case '<': case '<':
aOut.AppendLiteral("&lt;"); aOut.AppendLiteral("&lt;");
@ -2200,9 +2200,9 @@ AppendEncodedCharacters(const nsTextFragment* aText, StringBuilder& aBuilder)
uint32_t extraSpaceNeeded = 0; uint32_t extraSpaceNeeded = 0;
uint32_t len = aText->GetLength(); uint32_t len = aText->GetLength();
if (aText->Is2b()) { if (aText->Is2b()) {
const PRUnichar* data = aText->Get2b(); const char16_t* data = aText->Get2b();
for (uint32_t i = 0; i < len; ++i) { for (uint32_t i = 0; i < len; ++i) {
const PRUnichar c = data[i]; const char16_t c = data[i];
switch (c) { switch (c) {
case '<': case '<':
extraSpaceNeeded += ArrayLength("&lt;") - 2; extraSpaceNeeded += ArrayLength("&lt;") - 2;
@ -2253,8 +2253,8 @@ AppendEncodedCharacters(const nsTextFragment* aText, StringBuilder& aBuilder)
static void static void
AppendEncodedAttributeValue(nsAutoString* aValue, StringBuilder& aBuilder) AppendEncodedAttributeValue(nsAutoString* aValue, StringBuilder& aBuilder)
{ {
const PRUnichar* c = aValue->BeginReading(); const char16_t* c = aValue->BeginReading();
const PRUnichar* end = aValue->EndReading(); const char16_t* end = aValue->EndReading();
uint32_t extraSpaceNeeded = 0; uint32_t extraSpaceNeeded = 0;
while (c < end) { while (c < end) {
@ -2360,7 +2360,7 @@ StartElement(Element* aContent, StringBuilder& aBuilder)
(fc->NodeType() == nsIDOMNode::TEXT_NODE || (fc->NodeType() == nsIDOMNode::TEXT_NODE ||
fc->NodeType() == nsIDOMNode::CDATA_SECTION_NODE)) { fc->NodeType() == nsIDOMNode::CDATA_SECTION_NODE)) {
const nsTextFragment* text = fc->GetText(); const nsTextFragment* text = fc->GetText();
if (text && text->GetLength() && text->CharAt(0) == PRUnichar('\n')) { if (text && text->GetLength() && text->CharAt(0) == char16_t('\n')) {
aBuilder.Append("\n"); aBuilder.Append("\n");
} }
} }
@ -2618,15 +2618,15 @@ ContainsMarkup(const nsAString& aStr)
{ {
// Note: we can't use FindCharInSet because null is one of the characters we // Note: we can't use FindCharInSet because null is one of the characters we
// want to search for. // want to search for.
const PRUnichar* start = aStr.BeginReading(); const char16_t* start = aStr.BeginReading();
const PRUnichar* end = aStr.EndReading(); const char16_t* end = aStr.EndReading();
while (start != end) { while (start != end) {
PRUnichar c = *start; char16_t c = *start;
if (c == PRUnichar('<') || if (c == char16_t('<') ||
c == PRUnichar('&') || c == char16_t('&') ||
c == PRUnichar('\r') || c == char16_t('\r') ||
c == PRUnichar('\0')) { c == char16_t('\0')) {
return true; return true;
} }
++start; ++start;

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

@ -301,7 +301,7 @@ Link::GetProtocol(nsAString &_protocol)
(void)uri->GetScheme(scheme); (void)uri->GetScheme(scheme);
CopyASCIItoUTF16(scheme, _protocol); CopyASCIItoUTF16(scheme, _protocol);
} }
_protocol.Append(PRUnichar(':')); _protocol.Append(char16_t(':'));
return; return;
} }
@ -451,7 +451,7 @@ Link::GetHash(nsAString &_hash)
nsresult rv = uri->GetRef(ref); nsresult rv = uri->GetRef(ref);
if (NS_SUCCEEDED(rv) && !ref.IsEmpty()) { if (NS_SUCCEEDED(rv) && !ref.IsEmpty()) {
NS_UnescapeURL(ref); // XXX may result in random non-ASCII bytes! NS_UnescapeURL(ref); // XXX may result in random non-ASCII bytes!
_hash.Assign(PRUnichar('#')); _hash.Assign(char16_t('#'));
AppendUTF8toUTF16(ref, _hash); AppendUTF8toUTF16(ref, _hash);
} }
} }

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

@ -49,7 +49,7 @@
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
#define UTF_8_REPLACEMENT_CHAR static_cast<PRUnichar>(0xFFFD) #define UTF_8_REPLACEMENT_CHAR static_cast<char16_t>(0xFFFD)
class CallDispatchConnectionCloseEvents: public nsRunnable class CallDispatchConnectionCloseEvents: public nsRunnable
{ {
@ -74,8 +74,8 @@ private:
nsresult nsresult
WebSocket::PrintErrorOnConsole(const char *aBundleURI, WebSocket::PrintErrorOnConsole(const char *aBundleURI,
const PRUnichar *aError, const char16_t *aError,
const PRUnichar **aFormatStrings, const char16_t **aFormatStrings,
uint32_t aFormatStringsLen) uint32_t aFormatStringsLen)
{ {
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
@ -172,7 +172,7 @@ WebSocket::ConsoleError()
NS_WARNING("Failed to get targetSpec"); NS_WARNING("Failed to get targetSpec");
} else { } else {
NS_ConvertUTF8toUTF16 specUTF16(targetSpec); NS_ConvertUTF8toUTF16 specUTF16(targetSpec);
const PRUnichar* formatStrings[] = { specUTF16.get() }; const char16_t* formatStrings[] = { specUTF16.get() };
if (mReadyState < WebSocket::OPEN) { if (mReadyState < WebSocket::OPEN) {
PrintErrorOnConsole("chrome://global/locale/appstrings.properties", PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
@ -703,8 +703,8 @@ WebSocket::Init(JSContext* aCx,
// Assign the sub protocol list and scan it for illegal values // Assign the sub protocol list and scan it for illegal values
for (uint32_t index = 0; index < aProtocolArray.Length(); ++index) { for (uint32_t index = 0; index < aProtocolArray.Length(); ++index) {
for (uint32_t i = 0; i < aProtocolArray[index].Length(); ++i) { for (uint32_t i = 0; i < aProtocolArray[index].Length(); ++i) {
if (aProtocolArray[index][i] < static_cast<PRUnichar>(0x0021) || if (aProtocolArray[index][i] < static_cast<char16_t>(0x0021) ||
aProtocolArray[index][i] > static_cast<PRUnichar>(0x007E)) aProtocolArray[index][i] > static_cast<char16_t>(0x007E))
return NS_ERROR_DOM_SYNTAX_ERR; return NS_ERROR_DOM_SYNTAX_ERR;
} }
@ -1030,8 +1030,8 @@ WebSocket::ParseURL(const nsString& aURL)
uint32_t length = mResource.Length(); uint32_t length = mResource.Length();
uint32_t i; uint32_t i;
for (i = 0; i < length; ++i) { for (i = 0; i < length; ++i) {
if (mResource[i] < static_cast<PRUnichar>(0x0021) || if (mResource[i] < static_cast<char16_t>(0x0021) ||
mResource[i] > static_cast<PRUnichar>(0x007E)) { mResource[i] > static_cast<char16_t>(0x007E)) {
return NS_ERROR_DOM_SYNTAX_ERR; return NS_ERROR_DOM_SYNTAX_ERR;
} }
} }
@ -1332,7 +1332,7 @@ WebSocket::Close(const Optional<uint16_t>& aCode,
NS_IMETHODIMP NS_IMETHODIMP
WebSocket::Observe(nsISupports* aSubject, WebSocket::Observe(nsISupports* aSubject,
const char* aTopic, const char* aTopic,
const PRUnichar* aData) const char16_t* aData)
{ {
if ((mReadyState == WebSocket::CLOSING) || if ((mReadyState == WebSocket::CLOSING) ||
(mReadyState == WebSocket::CLOSED)) { (mReadyState == WebSocket::CLOSED)) {

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

@ -168,8 +168,8 @@ protected:
nsresult ConsoleError(); nsresult ConsoleError();
nsresult PrintErrorOnConsole(const char* aBundleURI, nsresult PrintErrorOnConsole(const char* aBundleURI,
const PRUnichar* aError, const char16_t* aError,
const PRUnichar** aFormatStrings, const char16_t** aFormatStrings,
uint32_t aFormatStringsLen); uint32_t aFormatStringsLen);
nsresult DoOnMessageAvailable(const nsACString& aMsg, nsresult DoOnMessageAvailable(const nsACString& aMsg,

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

@ -50,7 +50,7 @@ MiscContainer::GetString(nsAString& aString) const
return false; return false;
} }
buffer->ToString(buffer->StorageSize() / sizeof(PRUnichar) - 1, aString); buffer->ToString(buffer->StorageSize() / sizeof(char16_t) - 1, aString);
return true; return true;
} }
@ -590,7 +590,7 @@ nsAttrValue::ToString(nsAString& aResult) const
{ {
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr()); nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) { if (str) {
str->ToString(str->StorageSize()/sizeof(PRUnichar) - 1, aResult); str->ToString(str->StorageSize()/sizeof(char16_t) - 1, aResult);
} }
else { else {
aResult.Truncate(); aResult.Truncate();
@ -840,8 +840,8 @@ nsAttrValue::HashValue() const
{ {
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr()); nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) { if (str) {
uint32_t len = str->StorageSize()/sizeof(PRUnichar) - 1; uint32_t len = str->StorageSize()/sizeof(char16_t) - 1;
return HashString(static_cast<PRUnichar*>(str->Data()), len); return HashString(static_cast<char16_t*>(str->Data()), len);
} }
return 0; return 0;
@ -1064,8 +1064,8 @@ nsAttrValue::Equals(const nsAString& aValue,
{ {
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr()); nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) { if (str) {
nsDependentString dep(static_cast<PRUnichar*>(str->Data()), nsDependentString dep(static_cast<char16_t*>(str->Data()),
str->StorageSize()/sizeof(PRUnichar) - 1); str->StorageSize()/sizeof(char16_t) - 1);
return aCaseSensitive == eCaseMatters ? aValue.Equals(dep) : return aCaseSensitive == eCaseMatters ? aValue.Equals(dep) :
nsContentUtils::EqualsIgnoreASCIICase(aValue, dep); nsContentUtils::EqualsIgnoreASCIICase(aValue, dep);
} }
@ -1103,8 +1103,8 @@ nsAttrValue::Equals(nsIAtom* aValue, nsCaseTreatment aCaseSensitive) const
{ {
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr()); nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) { if (str) {
nsDependentString dep(static_cast<PRUnichar*>(str->Data()), nsDependentString dep(static_cast<char16_t*>(str->Data()),
str->StorageSize()/sizeof(PRUnichar) - 1); str->StorageSize()/sizeof(char16_t) - 1);
return aValue->Equals(dep); return aValue->Equals(dep);
} }
return aValue == nsGkAtoms::_empty; return aValue == nsGkAtoms::_empty;
@ -1864,17 +1864,17 @@ nsAttrValue::GetStringBuffer(const nsAString& aValue) const
} }
nsRefPtr<nsStringBuffer> buf = nsStringBuffer::FromString(aValue); nsRefPtr<nsStringBuffer> buf = nsStringBuffer::FromString(aValue);
if (buf && (buf->StorageSize()/sizeof(PRUnichar) - 1) == len) { if (buf && (buf->StorageSize()/sizeof(char16_t) - 1) == len) {
return buf.forget(); return buf.forget();
} }
buf = nsStringBuffer::Alloc((len + 1) * sizeof(PRUnichar)); buf = nsStringBuffer::Alloc((len + 1) * sizeof(char16_t));
if (!buf) { if (!buf) {
return nullptr; return nullptr;
} }
PRUnichar *data = static_cast<PRUnichar*>(buf->Data()); char16_t *data = static_cast<char16_t*>(buf->Data());
CopyUnicodeTo(aValue, 0, data, len); CopyUnicodeTo(aValue, 0, data, len);
data[len] = PRUnichar(0); data[len] = char16_t(0);
return buf.forget(); return buf.forget();
} }
@ -1904,10 +1904,10 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict,
} }
bool negate = false; bool negate = false;
if (*iter == PRUnichar('-')) { if (*iter == char16_t('-')) {
negate = true; negate = true;
++iter; ++iter;
} else if (*iter == PRUnichar('+')) { } else if (*iter == char16_t('+')) {
*aStrict = false; *aStrict = false;
++iter; ++iter;
} }
@ -1915,8 +1915,8 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict,
int32_t value = 0; int32_t value = 0;
int32_t pValue = 0; // Previous value, used to check integer overflow int32_t pValue = 0; // Previous value, used to check integer overflow
while (iter != end) { while (iter != end) {
if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) { if (*iter >= char16_t('0') && *iter <= char16_t('9')) {
value = (value * 10) + (*iter - PRUnichar('0')); value = (value * 10) + (*iter - char16_t('0'));
++iter; ++iter;
// Checking for integer overflow. // Checking for integer overflow.
if (pValue > value) { if (pValue > value) {
@ -1927,7 +1927,7 @@ nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict,
pValue = value; pValue = value;
*aErrorCode = NS_OK; *aErrorCode = NS_OK;
} }
} else if (aCanBePercent && *iter == PRUnichar('%')) { } else if (aCanBePercent && *iter == char16_t('%')) {
++iter; ++iter;
*aIsPercent = true; *aIsPercent = true;
if (iter != end) { if (iter != end) {

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

@ -70,7 +70,7 @@ public:
nsCheapString(nsStringBuffer* aBuf) nsCheapString(nsStringBuffer* aBuf)
{ {
if (aBuf) if (aBuf)
aBuf->ToString(aBuf->StorageSize()/sizeof(PRUnichar) - 1, *this); aBuf->ToString(aBuf->StorageSize()/sizeof(char16_t) - 1, *this);
} }
}; };
@ -484,7 +484,7 @@ nsAttrValue::ToString(mozilla::dom::DOMString& aResult) const
{ {
nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr()); nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr());
if (str) { if (str) {
aResult.SetStringBuffer(str, str->StorageSize()/sizeof(PRUnichar) - 1); aResult.SetStringBuffer(str, str->StorageSize()/sizeof(char16_t) - 1);
} }
// else aResult is already empty // else aResult is already empty
return; return;

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

@ -309,7 +309,7 @@ MarkWindowList(nsISimpleEnumerator* aWindowList, bool aCleanupJS,
nsresult nsresult
nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic, nsCCUncollectableMarker::Observe(nsISupports* aSubject, const char* aTopic,
const PRUnichar* aData) const char16_t* aData)
{ {
if (!strcmp(aTopic, "xpcom-shutdown")) { if (!strcmp(aTopic, "xpcom-shutdown")) {
Element::ClearContentUnbinder(); Element::ClearContentUnbinder();

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

@ -363,7 +363,7 @@ CSPService::AsyncOnChannelRedirect(nsIChannel *oldChannel,
// to enforce the load policy if it redirects again, so we stop it now. // to enforce the load policy if it redirects again, so we stop it now.
nsAutoCString newUriSpec; nsAutoCString newUriSpec;
rv = newUri->GetSpec(newUriSpec); rv = newUri->GetSpec(newUriSpec);
const PRUnichar *formatParams[] = { NS_ConvertUTF8toUTF16(newUriSpec).get() }; const char16_t *formatParams[] = { NS_ConvertUTF8toUTF16(newUriSpec).get() };
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("Redirect Error"), nullptr, NS_LITERAL_CSTRING("Redirect Error"), nullptr,

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

@ -404,8 +404,8 @@ nsContentSink::Decode5987Format(nsAString& aEncoded) {
nsAutoCString asciiValue; nsAutoCString asciiValue;
const PRUnichar* encstart = aEncoded.BeginReading(); const char16_t* encstart = aEncoded.BeginReading();
const PRUnichar* encend = aEncoded.EndReading(); const char16_t* encend = aEncoded.EndReading();
// create a plain ASCII string, aborting if we can't do that // create a plain ASCII string, aborting if we can't do that
// converted form is always shorter than input // converted form is always shorter than input
@ -452,10 +452,10 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
// put an extra null at the end // put an extra null at the end
stringList.Append(kNullCh); stringList.Append(kNullCh);
PRUnichar* start = stringList.BeginWriting(); char16_t* start = stringList.BeginWriting();
PRUnichar* end = start; char16_t* end = start;
PRUnichar* last = start; char16_t* last = start;
PRUnichar endCh; char16_t endCh;
while (*start != kNullCh) { while (*start != kNullCh) {
// skip leading space // skip leading space
@ -470,19 +470,19 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
// look for semicolon or comma // look for semicolon or comma
while (*end != kNullCh && *end != kSemicolon && *end != kComma) { while (*end != kNullCh && *end != kSemicolon && *end != kComma) {
PRUnichar ch = *end; char16_t ch = *end;
if (ch == kQuote || ch == kLessThan) { if (ch == kQuote || ch == kLessThan) {
// quoted string // quoted string
PRUnichar quote = ch; char16_t quote = ch;
if (quote == kLessThan) { if (quote == kLessThan) {
quote = kGreaterThan; quote = kGreaterThan;
} }
wasQuotedString = (ch == kQuote); wasQuotedString = (ch == kQuote);
PRUnichar* closeQuote = (end + 1); char16_t* closeQuote = (end + 1);
// seek closing quote // seek closing quote
while (*closeQuote != kNullCh && quote != *closeQuote) { while (*closeQuote != kNullCh && quote != *closeQuote) {
@ -540,7 +540,7 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
href.StripWhitespace(); href.StripWhitespace();
} }
} else { } else {
PRUnichar* equals = start; char16_t* equals = start;
seenParameters = true; seenParameters = true;
while ((*equals != kNullCh) && (*equals != kEqual)) { while ((*equals != kNullCh) && (*equals != kEqual)) {
@ -552,7 +552,7 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
nsAutoString attr(start); nsAutoString attr(start);
attr.StripWhitespace(); attr.StripWhitespace();
PRUnichar* value = ++equals; char16_t* value = ++equals;
while (nsCRT::IsAsciiSpace(*value)) { while (nsCRT::IsAsciiSpace(*value)) {
value++; value++;
} }
@ -564,8 +564,8 @@ nsContentSink::ProcessLinkHeader(const nsAString& aLinkData)
if (wasQuotedString) { if (wasQuotedString) {
// unescape in-place // unescape in-place
PRUnichar* unescaped = value; char16_t* unescaped = value;
PRUnichar *src = value; char16_t *src = value;
while (*src != kNullCh) { while (*src != kNullCh) {
if (*src == kBackSlash && *(src + 1) != kNullCh) { if (*src == kBackSlash && *(src + 1) != kNullCh) {

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

@ -179,7 +179,7 @@
#endif #endif
extern "C" int MOZ_XMLTranslateEntity(const char* ptr, const char* end, extern "C" int MOZ_XMLTranslateEntity(const char* ptr, const char* end,
const char** next, PRUnichar* result); const char** next, char16_t* result);
extern "C" int MOZ_XMLCheckQName(const char* ptr, const char* end, extern "C" int MOZ_XMLCheckQName(const char* ptr, const char* end,
int ns_aware, const char** colon); int ns_aware, const char** colon);
@ -626,7 +626,7 @@ nsContentUtils::InitializeTouchEventTable()
static bool static bool
Is8bit(const nsAString& aString) Is8bit(const nsAString& aString)
{ {
static const PRUnichar EIGHT_BIT = PRUnichar(~0x00FF); static const char16_t EIGHT_BIT = char16_t(~0x00FF);
nsAString::const_iterator done_reading; nsAString::const_iterator done_reading;
aString.EndReading(done_reading); aString.EndReading(done_reading);
@ -637,8 +637,8 @@ Is8bit(const nsAString& aString)
for (aString.BeginReading(iter); iter != done_reading; for (aString.BeginReading(iter); iter != done_reading;
iter.advance(int32_t(fragmentLength))) { iter.advance(int32_t(fragmentLength))) {
fragmentLength = uint32_t(iter.size_forward()); fragmentLength = uint32_t(iter.size_forward());
const PRUnichar* c = iter.get(); const char16_t* c = iter.get();
const PRUnichar* fragmentEnd = c + fragmentLength; const char16_t* fragmentEnd = c + fragmentLength;
// for each character in this chunk... // for each character in this chunk...
while (c < fragmentEnd) { while (c < fragmentEnd) {
@ -672,8 +672,8 @@ nsContentUtils::Atob(const nsAString& aAsciiBase64String,
return NS_ERROR_DOM_INVALID_CHARACTER_ERR; return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
} }
const PRUnichar* start = aAsciiBase64String.BeginReading(); const char16_t* start = aAsciiBase64String.BeginReading();
const PRUnichar* end = aAsciiBase64String.EndReading(); const char16_t* end = aAsciiBase64String.EndReading();
nsString trimmedString; nsString trimmedString;
if (!trimmedString.SetCapacity(aAsciiBase64String.Length(), fallible_t())) { if (!trimmedString.SetCapacity(aAsciiBase64String.Length(), fallible_t())) {
return NS_ERROR_DOM_INVALID_CHARACTER_ERR; return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
@ -732,9 +732,9 @@ nsContentUtils::GetPseudoAttributeValue(const nsString& aSource, nsIAtom *aName,
{ {
aValue.Truncate(); aValue.Truncate();
const PRUnichar *start = aSource.get(); const char16_t *start = aSource.get();
const PRUnichar *end = start + aSource.Length(); const char16_t *end = start + aSource.Length();
const PRUnichar *iter; const char16_t *iter;
while (start != end) { while (start != end) {
SKIP_WHITESPACE(start, end, false) SKIP_WHITESPACE(start, end, false)
@ -760,7 +760,7 @@ nsContentUtils::GetPseudoAttributeValue(const nsString& aSource, nsIAtom *aName,
// Have to skip the value. // Have to skip the value.
++start; ++start;
SKIP_WHITESPACE(start, end, false) SKIP_WHITESPACE(start, end, false)
PRUnichar q = *start; char16_t q = *start;
if (q != kQuote && q != kApostrophe) { if (q != kQuote && q != kApostrophe) {
// Not a valid quoted value, so bail. // Not a valid quoted value, so bail.
return false; return false;
@ -785,7 +785,7 @@ nsContentUtils::GetPseudoAttributeValue(const nsString& aSource, nsIAtom *aName,
// We'll accumulate as many characters as possible (until we hit either // We'll accumulate as many characters as possible (until we hit either
// the end of the string or the beginning of an entity). Chunks will be // the end of the string or the beginning of an entity). Chunks will be
// delimited by start and chunkEnd. // delimited by start and chunkEnd.
const PRUnichar *chunkEnd = start; const char16_t *chunkEnd = start;
while (chunkEnd != iter) { while (chunkEnd != iter) {
if (*chunkEnd == kLessThan) { if (*chunkEnd == kLessThan) {
aValue.Truncate(); aValue.Truncate();
@ -799,8 +799,8 @@ nsContentUtils::GetPseudoAttributeValue(const nsString& aSource, nsIAtom *aName,
// Point to first character after the ampersand. // Point to first character after the ampersand.
++chunkEnd; ++chunkEnd;
const PRUnichar *afterEntity = nullptr; const char16_t *afterEntity = nullptr;
PRUnichar result[2]; char16_t result[2];
uint32_t count = uint32_t count =
MOZ_XMLTranslateEntity(reinterpret_cast<const char*>(chunkEnd), MOZ_XMLTranslateEntity(reinterpret_cast<const char*>(chunkEnd),
reinterpret_cast<const char*>(iter), reinterpret_cast<const char*>(iter),
@ -878,7 +878,7 @@ nsContentUtils::SplitMimeType(const nsAString& aValue, nsString& aType,
{ {
aType.Truncate(); aType.Truncate();
aParams.Truncate(); aParams.Truncate();
int32_t semiIndex = aValue.FindChar(PRUnichar(';')); int32_t semiIndex = aValue.FindChar(char16_t(';'));
if (-1 != semiIndex) { if (-1 != semiIndex) {
aType = Substring(aValue, 0, semiIndex); aType = Substring(aValue, 0, semiIndex);
aParams = Substring(aValue, semiIndex + 1, aParams = Substring(aValue, semiIndex + 1,
@ -1082,15 +1082,15 @@ class CopyNormalizeNewlines
uint32_t uint32_t
nsContentUtils::CopyNewlineNormalizedUnicodeTo(const nsAString& aSource, nsContentUtils::CopyNewlineNormalizedUnicodeTo(const nsAString& aSource,
uint32_t aSrcOffset, uint32_t aSrcOffset,
PRUnichar* aDest, char16_t* aDest,
uint32_t aLength, uint32_t aLength,
bool& aLastCharCR) bool& aLastCharCR)
{ {
typedef NormalizeNewlinesCharTraits<PRUnichar*> sink_traits; typedef NormalizeNewlinesCharTraits<char16_t*> sink_traits;
sink_traits dest_traits(aDest); sink_traits dest_traits(aDest);
CopyNormalizeNewlines<sink_traits> normalizer(&dest_traits,aLastCharCR); CopyNormalizeNewlines<sink_traits> normalizer(&dest_traits,aLastCharCR);
nsReadingIterator<PRUnichar> fromBegin, fromEnd; nsReadingIterator<char16_t> fromBegin, fromEnd;
copy_string(aSource.BeginReading(fromBegin).advance( int32_t(aSrcOffset) ), copy_string(aSource.BeginReading(fromBegin).advance( int32_t(aSrcOffset) ),
aSource.BeginReading(fromEnd).advance( int32_t(aSrcOffset+aLength) ), aSource.BeginReading(fromEnd).advance( int32_t(aSrcOffset+aLength) ),
normalizer); normalizer);
@ -1100,9 +1100,9 @@ nsContentUtils::CopyNewlineNormalizedUnicodeTo(const nsAString& aSource,
// static // static
uint32_t uint32_t
nsContentUtils::CopyNewlineNormalizedUnicodeTo(nsReadingIterator<PRUnichar>& aSrcStart, const nsReadingIterator<PRUnichar>& aSrcEnd, nsAString& aDest) nsContentUtils::CopyNewlineNormalizedUnicodeTo(nsReadingIterator<char16_t>& aSrcStart, const nsReadingIterator<char16_t>& aSrcEnd, nsAString& aDest)
{ {
typedef nsWritingIterator<PRUnichar> WritingIterator; typedef nsWritingIterator<char16_t> WritingIterator;
typedef NormalizeNewlinesCharTraits<WritingIterator> sink_traits; typedef NormalizeNewlinesCharTraits<WritingIterator> sink_traits;
WritingIterator iter; WritingIterator iter;
@ -1137,12 +1137,12 @@ nsContentUtils::IsFirstLetterPunctuation(uint32_t aChar)
bool bool
nsContentUtils::IsFirstLetterPunctuationAt(const nsTextFragment* aFrag, uint32_t aOffset) nsContentUtils::IsFirstLetterPunctuationAt(const nsTextFragment* aFrag, uint32_t aOffset)
{ {
PRUnichar h = aFrag->CharAt(aOffset); char16_t h = aFrag->CharAt(aOffset);
if (!IS_SURROGATE(h)) { if (!IS_SURROGATE(h)) {
return IsFirstLetterPunctuation(h); return IsFirstLetterPunctuation(h);
} }
if (NS_IS_HIGH_SURROGATE(h) && aOffset + 1 < aFrag->GetLength()) { if (NS_IS_HIGH_SURROGATE(h) && aOffset + 1 < aFrag->GetLength()) {
PRUnichar l = aFrag->CharAt(aOffset + 1); char16_t l = aFrag->CharAt(aOffset + 1);
if (NS_IS_LOW_SURROGATE(l)) { if (NS_IS_LOW_SURROGATE(l)) {
return IsFirstLetterPunctuation(SURROGATE_TO_UCS4(h, l)); return IsFirstLetterPunctuation(SURROGATE_TO_UCS4(h, l));
} }
@ -1161,12 +1161,12 @@ bool nsContentUtils::IsAlphanumeric(uint32_t aChar)
// static // static
bool nsContentUtils::IsAlphanumericAt(const nsTextFragment* aFrag, uint32_t aOffset) bool nsContentUtils::IsAlphanumericAt(const nsTextFragment* aFrag, uint32_t aOffset)
{ {
PRUnichar h = aFrag->CharAt(aOffset); char16_t h = aFrag->CharAt(aOffset);
if (!IS_SURROGATE(h)) { if (!IS_SURROGATE(h)) {
return IsAlphanumeric(h); return IsAlphanumeric(h);
} }
if (NS_IS_HIGH_SURROGATE(h) && aOffset + 1 < aFrag->GetLength()) { if (NS_IS_HIGH_SURROGATE(h) && aOffset + 1 < aFrag->GetLength()) {
PRUnichar l = aFrag->CharAt(aOffset + 1); char16_t l = aFrag->CharAt(aOffset + 1);
if (NS_IS_LOW_SURROGATE(l)) { if (NS_IS_LOW_SURROGATE(l)) {
return IsAlphanumeric(SURROGATE_TO_UCS4(h, l)); return IsAlphanumeric(SURROGATE_TO_UCS4(h, l));
} }
@ -1176,20 +1176,20 @@ bool nsContentUtils::IsAlphanumericAt(const nsTextFragment* aFrag, uint32_t aOff
/* static */ /* static */
bool bool
nsContentUtils::IsHTMLWhitespace(PRUnichar aChar) nsContentUtils::IsHTMLWhitespace(char16_t aChar)
{ {
return aChar == PRUnichar(0x0009) || return aChar == char16_t(0x0009) ||
aChar == PRUnichar(0x000A) || aChar == char16_t(0x000A) ||
aChar == PRUnichar(0x000C) || aChar == char16_t(0x000C) ||
aChar == PRUnichar(0x000D) || aChar == char16_t(0x000D) ||
aChar == PRUnichar(0x0020); aChar == char16_t(0x0020);
} }
/* static */ /* static */
bool bool
nsContentUtils::IsHTMLWhitespaceOrNBSP(PRUnichar aChar) nsContentUtils::IsHTMLWhitespaceOrNBSP(char16_t aChar)
{ {
return IsHTMLWhitespace(aChar) || aChar == PRUnichar(0xA0); return IsHTMLWhitespace(aChar) || aChar == char16_t(0xA0);
} }
/* static */ /* static */
@ -1324,24 +1324,24 @@ nsContentUtils::ParseLegacyFontSize(const nsAString& aValue)
bool relative = false; bool relative = false;
bool negate = false; bool negate = false;
if (*iter == PRUnichar('-')) { if (*iter == char16_t('-')) {
relative = true; relative = true;
negate = true; negate = true;
++iter; ++iter;
} else if (*iter == PRUnichar('+')) { } else if (*iter == char16_t('+')) {
relative = true; relative = true;
++iter; ++iter;
} }
if (*iter < PRUnichar('0') || *iter > PRUnichar('9')) { if (*iter < char16_t('0') || *iter > char16_t('9')) {
return 0; return 0;
} }
// We don't have to worry about overflow, since we can bail out as soon as // We don't have to worry about overflow, since we can bail out as soon as
// we're bigger than 7. // we're bigger than 7.
int32_t value = 0; int32_t value = 0;
while (iter != end && *iter >= PRUnichar('0') && *iter <= PRUnichar('9')) { while (iter != end && *iter >= char16_t('0') && *iter <= char16_t('9')) {
value = 10*value + (*iter - PRUnichar('0')); value = 10*value + (*iter - char16_t('0'));
if (value >= 7) { if (value >= 7) {
break; break;
} }
@ -2092,11 +2092,11 @@ nsContentUtils::ComparePoints(nsIDOMNode* aParent1, int32_t aOffset1,
inline bool inline bool
IsCharInSet(const char* aSet, IsCharInSet(const char* aSet,
const PRUnichar aChar) const char16_t aChar)
{ {
PRUnichar ch; char16_t ch;
while ((ch = *aSet)) { while ((ch = *aSet)) {
if (aChar == PRUnichar(ch)) { if (aChar == char16_t(ch)) {
return true; return true;
} }
++aSet; ++aSet;
@ -2145,7 +2145,7 @@ nsContentUtils::TrimCharsInSet(const char* aSet,
*/ */
// static // static
template<bool IsWhitespace(PRUnichar)> template<bool IsWhitespace(char16_t)>
const nsDependentSubstring const nsDependentSubstring
nsContentUtils::TrimWhitespace(const nsAString& aStr, bool aTrimTrailing) nsContentUtils::TrimWhitespace(const nsAString& aStr, bool aTrimTrailing)
{ {
@ -2426,11 +2426,11 @@ nsContentUtils::NewURIWithDocumentCharset(nsIURI** aResult,
nsresult nsresult
nsContentUtils::CheckQName(const nsAString& aQualifiedName, nsContentUtils::CheckQName(const nsAString& aQualifiedName,
bool aNamespaceAware, bool aNamespaceAware,
const PRUnichar** aColon) const char16_t** aColon)
{ {
const char* colon = nullptr; const char* colon = nullptr;
const PRUnichar* begin = aQualifiedName.BeginReading(); const char16_t* begin = aQualifiedName.BeginReading();
const PRUnichar* end = aQualifiedName.EndReading(); const char16_t* end = aQualifiedName.EndReading();
int result = MOZ_XMLCheckQName(reinterpret_cast<const char*>(begin), int result = MOZ_XMLCheckQName(reinterpret_cast<const char*>(begin),
reinterpret_cast<const char*>(end), reinterpret_cast<const char*>(end),
@ -2438,7 +2438,7 @@ nsContentUtils::CheckQName(const nsAString& aQualifiedName,
if (!result) { if (!result) {
if (aColon) { if (aColon) {
*aColon = reinterpret_cast<const PRUnichar*>(colon); *aColon = reinterpret_cast<const char16_t*>(colon);
} }
return NS_OK; return NS_OK;
@ -2458,12 +2458,12 @@ nsContentUtils::SplitQName(const nsIContent* aNamespaceResolver,
const nsAFlatString& aQName, const nsAFlatString& aQName,
int32_t *aNamespace, nsIAtom **aLocalName) int32_t *aNamespace, nsIAtom **aLocalName)
{ {
const PRUnichar* colon; const char16_t* colon;
nsresult rv = nsContentUtils::CheckQName(aQName, true, &colon); nsresult rv = nsContentUtils::CheckQName(aQName, true, &colon);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
if (colon) { if (colon) {
const PRUnichar* end; const char16_t* end;
aQName.EndReading(end); aQName.EndReading(end);
nsAutoString nameSpace; nsAutoString nameSpace;
rv = aNamespaceResolver->LookupNamespaceURIInternal(Substring(aQName.get(), rv = aNamespaceResolver->LookupNamespaceURIInternal(Substring(aQName.get(),
@ -2494,14 +2494,14 @@ nsContentUtils::GetNodeInfoFromQName(const nsAString& aNamespaceURI,
nsINodeInfo** aNodeInfo) nsINodeInfo** aNodeInfo)
{ {
const nsAFlatString& qName = PromiseFlatString(aQualifiedName); const nsAFlatString& qName = PromiseFlatString(aQualifiedName);
const PRUnichar* colon; const char16_t* colon;
nsresult rv = nsContentUtils::CheckQName(qName, true, &colon); nsresult rv = nsContentUtils::CheckQName(qName, true, &colon);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
int32_t nsID; int32_t nsID;
sNameSpaceManager->RegisterNameSpace(aNamespaceURI, nsID); sNameSpaceManager->RegisterNameSpace(aNamespaceURI, nsID);
if (colon) { if (colon) {
const PRUnichar* end; const char16_t* end;
qName.EndReading(end); qName.EndReading(end);
nsCOMPtr<nsIAtom> prefix = do_GetAtom(Substring(qName.get(), colon)); nsCOMPtr<nsIAtom> prefix = do_GetAtom(Substring(qName.get(), colon));
@ -2523,7 +2523,7 @@ nsContentUtils::GetNodeInfoFromQName(const nsAString& aNamespaceURI,
// static // static
void void
nsContentUtils::SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix, nsContentUtils::SplitExpatName(const char16_t *aExpatName, nsIAtom **aPrefix,
nsIAtom **aLocalName, int32_t* aNameSpaceID) nsIAtom **aLocalName, int32_t* aNameSpaceID)
{ {
/** /**
@ -2536,9 +2536,9 @@ nsContentUtils::SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix,
* *
*/ */
const PRUnichar *uriEnd = nullptr; const char16_t *uriEnd = nullptr;
const PRUnichar *nameEnd = nullptr; const char16_t *nameEnd = nullptr;
const PRUnichar *pos; const char16_t *pos;
for (pos = aExpatName; *pos; ++pos) { for (pos = aExpatName; *pos; ++pos) {
if (*pos == 0xFFFF) { if (*pos == 0xFFFF) {
if (uriEnd) { if (uriEnd) {
@ -2550,7 +2550,7 @@ nsContentUtils::SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix,
} }
} }
const PRUnichar *nameStart; const char16_t *nameStart;
if (uriEnd) { if (uriEnd) {
if (sNameSpaceManager) { if (sNameSpaceManager) {
sNameSpaceManager->RegisterNameSpace(nsDependentSubstring(aExpatName, sNameSpaceManager->RegisterNameSpace(nsDependentSubstring(aExpatName,
@ -2563,7 +2563,7 @@ nsContentUtils::SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix,
nameStart = (uriEnd + 1); nameStart = (uriEnd + 1);
if (nameEnd) { if (nameEnd) {
const PRUnichar *prefixStart = nameEnd + 1; const char16_t *prefixStart = nameEnd + 1;
*aPrefix = NS_NewAtom(Substring(prefixStart, pos)).get(); *aPrefix = NS_NewAtom(Substring(prefixStart, pos)).get();
} }
else { else {
@ -3003,7 +3003,7 @@ nsresult nsContentUtils::GetLocalizedString(PropertiesFile aFile,
/* static */ /* static */
nsresult nsContentUtils::FormatLocalizedString(PropertiesFile aFile, nsresult nsContentUtils::FormatLocalizedString(PropertiesFile aFile,
const char* aKey, const char* aKey,
const PRUnichar **aParams, const char16_t **aParams,
uint32_t aParamsLength, uint32_t aParamsLength,
nsXPIDLString& aResult) nsXPIDLString& aResult)
{ {
@ -3040,7 +3040,7 @@ nsContentUtils::ReportToConsole(uint32_t aErrorFlags,
nsIDocument* aDocument, nsIDocument* aDocument,
PropertiesFile aFile, PropertiesFile aFile,
const char *aMessageName, const char *aMessageName,
const PRUnichar **aParams, const char16_t **aParams,
uint32_t aParamsLength, uint32_t aParamsLength,
nsIURI* aURI, nsIURI* aURI,
const nsAFlatString& aSourceLine, const nsAFlatString& aSourceLine,
@ -3245,7 +3245,7 @@ nsContentUtils::GetContentPolicy()
bool bool
nsContentUtils::IsEventAttributeName(nsIAtom* aName, int32_t aType) nsContentUtils::IsEventAttributeName(nsIAtom* aName, int32_t aType)
{ {
const PRUnichar* name = aName->GetUTF16String(); const char16_t* name = aName->GetUTF16String();
if (name[0] != 'o' || name[1] != 'n') if (name[0] != 'o' || name[1] != 'n')
return false; return false;
@ -3889,7 +3889,7 @@ nsContentUtils::CreateContextualFragment(nsINode* aContextNode,
// really want something like nsXMLContentSerializer::SerializeAttr // really want something like nsXMLContentSerializer::SerializeAttr
tagName.Append(NS_LITERAL_STRING(" xmlns")); // space important tagName.Append(NS_LITERAL_STRING(" xmlns")); // space important
if (name->GetPrefix()) { if (name->GetPrefix()) {
tagName.Append(PRUnichar(':')); tagName.Append(char16_t(':'));
name->LocalName()->ToString(nameStr); name->LocalName()->ToString(nameStr);
tagName.Append(nameStr); tagName.Append(nameStr);
} else { } else {
@ -4495,14 +4495,14 @@ nsContentUtils::GetTopLevelWidget(nsIWidget* aWidget)
const nsDependentString const nsDependentString
nsContentUtils::GetLocalizedEllipsis() nsContentUtils::GetLocalizedEllipsis()
{ {
static PRUnichar sBuf[4] = { 0, 0, 0, 0 }; static char16_t sBuf[4] = { 0, 0, 0, 0 };
if (!sBuf[0]) { if (!sBuf[0]) {
nsAdoptingString tmp = Preferences::GetLocalizedString("intl.ellipsis"); nsAdoptingString tmp = Preferences::GetLocalizedString("intl.ellipsis");
uint32_t len = std::min(uint32_t(tmp.Length()), uint32_t len = std::min(uint32_t(tmp.Length()),
uint32_t(ArrayLength(sBuf) - 1)); uint32_t(ArrayLength(sBuf) - 1));
CopyUnicodeTo(tmp, 0, sBuf, len); CopyUnicodeTo(tmp, 0, sBuf, len);
if (!sBuf[0]) if (!sBuf[0])
sBuf[0] = PRUnichar(0x2026); sBuf[0] = char16_t(0x2026);
} }
return nsDependentString(sBuf); return nsDependentString(sBuf);
} }
@ -4523,14 +4523,14 @@ CharsCaseInsensitiveEqual(uint32_t aChar1, uint32_t aChar2)
{ {
return aChar1 == aChar2 || return aChar1 == aChar2 ||
(IS_IN_BMP(aChar1) && IS_IN_BMP(aChar2) && (IS_IN_BMP(aChar1) && IS_IN_BMP(aChar2) &&
ToLowerCase(PRUnichar(aChar1)) == ToLowerCase(PRUnichar(aChar2))); ToLowerCase(char16_t(aChar1)) == ToLowerCase(char16_t(aChar2)));
} }
static bool static bool
IsCaseChangeableChar(uint32_t aChar) IsCaseChangeableChar(uint32_t aChar)
{ {
return IS_IN_BMP(aChar) && return IS_IN_BMP(aChar) &&
ToLowerCase(PRUnichar(aChar)) != ToUpperCase(PRUnichar(aChar)); ToLowerCase(char16_t(aChar)) != ToUpperCase(char16_t(aChar));
} }
/* static */ /* static */
@ -4650,7 +4650,7 @@ nsContentUtils::GetAccessKeyCandidates(WidgetKeyboardEvent* aNativeKeyEvent,
if (aNativeKeyEvent->charCode) { if (aNativeKeyEvent->charCode) {
uint32_t ch = aNativeKeyEvent->charCode; uint32_t ch = aNativeKeyEvent->charCode;
if (IS_IN_BMP(ch)) if (IS_IN_BMP(ch))
ch = ToLowerCase(PRUnichar(ch)); ch = ToLowerCase(char16_t(ch));
aCandidates.AppendElement(ch); aCandidates.AppendElement(ch);
} }
for (uint32_t i = 0; for (uint32_t i = 0;
@ -4662,7 +4662,7 @@ nsContentUtils::GetAccessKeyCandidates(WidgetKeyboardEvent* aNativeKeyEvent,
if (!ch[j]) if (!ch[j])
continue; continue;
if (IS_IN_BMP(ch[j])) if (IS_IN_BMP(ch[j]))
ch[j] = ToLowerCase(PRUnichar(ch[j])); ch[j] = ToLowerCase(char16_t(ch[j]));
// Don't append the charCode that was already appended. // Don't append the charCode that was already appended.
if (aCandidates.IndexOf(ch[j]) == aCandidates.NoIndex) if (aCandidates.IndexOf(ch[j]) == aCandidates.NoIndex)
aCandidates.AppendElement(ch[j]); aCandidates.AppendElement(ch[j]);
@ -5183,13 +5183,13 @@ nsContentUtils::GetCurrentJSContextForThread()
nsresult nsresult
nsContentUtils::ASCIIToLower(nsAString& aStr) nsContentUtils::ASCIIToLower(nsAString& aStr)
{ {
PRUnichar* iter = aStr.BeginWriting(); char16_t* iter = aStr.BeginWriting();
PRUnichar* end = aStr.EndWriting(); char16_t* end = aStr.EndWriting();
if (MOZ_UNLIKELY(!iter || !end)) { if (MOZ_UNLIKELY(!iter || !end)) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
while (iter != end) { while (iter != end) {
PRUnichar c = *iter; char16_t c = *iter;
if (c >= 'A' && c <= 'Z') { if (c >= 'A' && c <= 'Z') {
*iter = c + ('a' - 'A'); *iter = c + ('a' - 'A');
} }
@ -5205,14 +5205,14 @@ nsContentUtils::ASCIIToLower(const nsAString& aSource, nsAString& aDest)
uint32_t len = aSource.Length(); uint32_t len = aSource.Length();
aDest.SetLength(len); aDest.SetLength(len);
if (aDest.Length() == len) { if (aDest.Length() == len) {
PRUnichar* dest = aDest.BeginWriting(); char16_t* dest = aDest.BeginWriting();
if (MOZ_UNLIKELY(!dest)) { if (MOZ_UNLIKELY(!dest)) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
const PRUnichar* iter = aSource.BeginReading(); const char16_t* iter = aSource.BeginReading();
const PRUnichar* end = aSource.EndReading(); const char16_t* end = aSource.EndReading();
while (iter != end) { while (iter != end) {
PRUnichar c = *iter; char16_t c = *iter;
*dest = (c >= 'A' && c <= 'Z') ? *dest = (c >= 'A' && c <= 'Z') ?
c + ('a' - 'A') : c; c + ('a' - 'A') : c;
++iter; ++iter;
@ -5227,13 +5227,13 @@ nsContentUtils::ASCIIToLower(const nsAString& aSource, nsAString& aDest)
nsresult nsresult
nsContentUtils::ASCIIToUpper(nsAString& aStr) nsContentUtils::ASCIIToUpper(nsAString& aStr)
{ {
PRUnichar* iter = aStr.BeginWriting(); char16_t* iter = aStr.BeginWriting();
PRUnichar* end = aStr.EndWriting(); char16_t* end = aStr.EndWriting();
if (MOZ_UNLIKELY(!iter || !end)) { if (MOZ_UNLIKELY(!iter || !end)) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
while (iter != end) { while (iter != end) {
PRUnichar c = *iter; char16_t c = *iter;
if (c >= 'a' && c <= 'z') { if (c >= 'a' && c <= 'z') {
*iter = c + ('A' - 'a'); *iter = c + ('A' - 'a');
} }
@ -5249,14 +5249,14 @@ nsContentUtils::ASCIIToUpper(const nsAString& aSource, nsAString& aDest)
uint32_t len = aSource.Length(); uint32_t len = aSource.Length();
aDest.SetLength(len); aDest.SetLength(len);
if (aDest.Length() == len) { if (aDest.Length() == len) {
PRUnichar* dest = aDest.BeginWriting(); char16_t* dest = aDest.BeginWriting();
if (MOZ_UNLIKELY(!dest)) { if (MOZ_UNLIKELY(!dest)) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
const PRUnichar* iter = aSource.BeginReading(); const char16_t* iter = aSource.BeginReading();
const PRUnichar* end = aSource.EndReading(); const char16_t* end = aSource.EndReading();
while (iter != end) { while (iter != end) {
PRUnichar c = *iter; char16_t c = *iter;
*dest = (c >= 'a' && c <= 'z') ? *dest = (c >= 'a' && c <= 'z') ?
c + ('A' - 'a') : c; c + ('A' - 'a') : c;
++iter; ++iter;
@ -5277,13 +5277,13 @@ nsContentUtils::EqualsIgnoreASCIICase(const nsAString& aStr1,
return false; return false;
} }
const PRUnichar* str1 = aStr1.BeginReading(); const char16_t* str1 = aStr1.BeginReading();
const PRUnichar* str2 = aStr2.BeginReading(); const char16_t* str2 = aStr2.BeginReading();
const PRUnichar* end = str1 + len; const char16_t* end = str1 + len;
while (str1 < end) { while (str1 < end) {
PRUnichar c1 = *str1++; char16_t c1 = *str1++;
PRUnichar c2 = *str2++; char16_t c2 = *str2++;
// First check if any bits other than the 0x0020 differs // First check if any bits other than the 0x0020 differs
if ((c1 ^ c2) & 0xffdf) { if ((c1 ^ c2) & 0xffdf) {
@ -5295,7 +5295,7 @@ nsContentUtils::EqualsIgnoreASCIICase(const nsAString& aStr1,
if (c1 != c2) { if (c1 != c2) {
// They do differ, but since it's only in the 0x0020 bit, check if it's // They do differ, but since it's only in the 0x0020 bit, check if it's
// the same ascii char, but just differing in case // the same ascii char, but just differing in case
PRUnichar c1Upper = c1 & 0xffdf; char16_t c1Upper = c1 & 0xffdf;
if (!('A' <= c1Upper && c1Upper <= 'Z')) { if (!('A' <= c1Upper && c1Upper <= 'Z')) {
return false; return false;
} }
@ -5309,10 +5309,10 @@ nsContentUtils::EqualsIgnoreASCIICase(const nsAString& aStr1,
bool bool
nsContentUtils::StringContainsASCIIUpper(const nsAString& aStr) nsContentUtils::StringContainsASCIIUpper(const nsAString& aStr)
{ {
const PRUnichar* iter = aStr.BeginReading(); const char16_t* iter = aStr.BeginReading();
const PRUnichar* end = aStr.EndReading(); const char16_t* end = aStr.EndReading();
while (iter != end) { while (iter != end) {
PRUnichar c = *iter; char16_t c = *iter;
if (c >= 'A' && c <= 'Z') { if (c >= 'A' && c <= 'Z') {
return true; return true;
} }
@ -5910,7 +5910,7 @@ void nsContentUtils::RemoveNewlines(nsString &aString)
void void
nsContentUtils::PlatformToDOMLineBreaks(nsString &aString) nsContentUtils::PlatformToDOMLineBreaks(nsString &aString)
{ {
if (aString.FindChar(PRUnichar('\r')) != -1) { if (aString.FindChar(char16_t('\r')) != -1) {
// Windows linebreaks: Map CRLF to LF: // Windows linebreaks: Map CRLF to LF:
aString.ReplaceSubstring(MOZ_UTF16("\r\n"), aString.ReplaceSubstring(MOZ_UTF16("\r\n"),
MOZ_UTF16("\n")); MOZ_UTF16("\n"));
@ -5927,14 +5927,14 @@ nsContentUtils::PopulateStringFromStringBuffer(nsStringBuffer* aBuf,
{ {
MOZ_ASSERT(aBuf, "Expecting a non-null string buffer"); MOZ_ASSERT(aBuf, "Expecting a non-null string buffer");
uint32_t stringLen = NS_strlen(static_cast<PRUnichar*>(aBuf->Data())); uint32_t stringLen = NS_strlen(static_cast<char16_t*>(aBuf->Data()));
// SANITY CHECK: In case the nsStringBuffer isn't correctly // SANITY CHECK: In case the nsStringBuffer isn't correctly
// null-terminated, let's clamp its length using the allocated size, to be // null-terminated, let's clamp its length using the allocated size, to be
// sure the resulting string doesn't sample past the end of the the buffer. // sure the resulting string doesn't sample past the end of the the buffer.
// (Note that StorageSize() is in units of bytes, so we have to convert that // (Note that StorageSize() is in units of bytes, so we have to convert that
// to units of PRUnichars, and subtract 1 for the null-terminator.) // to units of PRUnichars, and subtract 1 for the null-terminator.)
uint32_t allocStringLen = (aBuf->StorageSize() / sizeof(PRUnichar)) - 1; uint32_t allocStringLen = (aBuf->StorageSize() / sizeof(char16_t)) - 1;
MOZ_ASSERT(stringLen <= allocStringLen, MOZ_ASSERT(stringLen <= allocStringLen,
"string buffer lacks null terminator!"); "string buffer lacks null terminator!");
stringLen = std::min(stringLen, allocStringLen); stringLen = std::min(stringLen, allocStringLen);

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

@ -482,7 +482,7 @@ static nsresult AppendString(nsITransferable *aTransferable,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return aTransferable->SetTransferData(aFlavor, data, return aTransferable->SetTransferData(aFlavor, data,
aString.Length() * sizeof(PRUnichar)); aString.Length() * sizeof(char16_t));
} }
static nsresult AppendDOMNode(nsITransferable *aTransferable, static nsresult AppendDOMNode(nsITransferable *aTransferable,

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

@ -607,7 +607,7 @@ void
nsDOMFileFile::SetPath(const nsAString& aPath) nsDOMFileFile::SetPath(const nsAString& aPath)
{ {
MOZ_ASSERT(aPath.IsEmpty() || MOZ_ASSERT(aPath.IsEmpty() ||
aPath[aPath.Length() - 1] == PRUnichar('/'), aPath[aPath.Length() - 1] == char16_t('/'),
"Path must end with a path separator"); "Path must end with a path separator");
mPath = aPath; mPath = aPath;
} }

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

@ -296,8 +296,8 @@ ReadFuncBinaryString(nsIInputStream* in,
uint32_t count, uint32_t count,
uint32_t *writeCount) uint32_t *writeCount)
{ {
PRUnichar* dest = static_cast<PRUnichar*>(closure) + toOffset; char16_t* dest = static_cast<char16_t*>(closure) + toOffset;
PRUnichar* end = dest + count; char16_t* end = dest + count;
const unsigned char* source = (const unsigned char*)fromRawSegment; const unsigned char* source = (const unsigned char*)fromRawSegment;
while (dest != end) { while (dest != end) {
*dest = *source; *dest = *source;
@ -324,7 +324,7 @@ nsDOMFileReader::DoOnDataAvailable(nsIRequest *aRequest,
if (uint64_t(oldLen) + aCount > UINT32_MAX) if (uint64_t(oldLen) + aCount > UINT32_MAX)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
PRUnichar *buf = nullptr; char16_t *buf = nullptr;
mResult.GetMutableData(&buf, oldLen + aCount, fallible_t()); mResult.GetMutableData(&buf, oldLen + aCount, fallible_t());
NS_ENSURE_TRUE(buf, NS_ERROR_OUT_OF_MEMORY); NS_ENSURE_TRUE(buf, NS_ERROR_OUT_OF_MEMORY);

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

@ -235,7 +235,7 @@ nsDOMTokenList::RemoveInternal(const nsAttrValue* aAttr,
if (lastTokenRemoved && !output.IsEmpty()) { if (lastTokenRemoved && !output.IsEmpty()) {
NS_ABORT_IF_FALSE(!nsContentUtils::IsHTMLWhitespace( NS_ABORT_IF_FALSE(!nsContentUtils::IsHTMLWhitespace(
output.Last()), "Invalid last output token"); output.Last()), "Invalid last output token");
output.Append(PRUnichar(' ')); output.Append(char16_t(' '));
} }
lastTokenRemoved = false; lastTokenRemoved = false;
output.Append(Substring(copyStart, iter)); output.Append(Substring(copyStart, iter));

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

@ -4962,7 +4962,7 @@ bool IsLowercaseASCII(const nsAString& aValue)
{ {
int32_t len = aValue.Length(); int32_t len = aValue.Length();
for (int32_t i = 0; i < len; ++i) { for (int32_t i = 0; i < len; ++i) {
PRUnichar c = aValue[i]; char16_t c = aValue[i];
if (!(0x0061 <= (c) && ((c) <= 0x007a))) { if (!(0x0061 <= (c) && ((c) <= 0x007a))) {
return false; return false;
} }
@ -7229,8 +7229,8 @@ nsDocument::FlushExternalResources(mozFlushType aType)
} }
void void
nsDocument::SetXMLDeclaration(const PRUnichar *aVersion, nsDocument::SetXMLDeclaration(const char16_t *aVersion,
const PRUnichar *aEncoding, const char16_t *aEncoding,
const int32_t aStandalone) const int32_t aStandalone)
{ {
if (!aVersion || *aVersion == '\0') { if (!aVersion || *aVersion == '\0') {
@ -10870,7 +10870,7 @@ nsDocument::SetApprovedForFullscreen(bool aIsApproved)
nsresult nsresult
nsDocument::Observe(nsISupports *aSubject, nsDocument::Observe(nsISupports *aSubject,
const char *aTopic, const char *aTopic,
const PRUnichar *aData) const char16_t *aData)
{ {
if (strcmp("fullscreen-approved", aTopic) == 0) { if (strcmp("fullscreen-approved", aTopic) == 0) {
nsCOMPtr<nsIDocument> subject(do_QueryInterface(aSubject)); nsCOMPtr<nsIDocument> subject(do_QueryInterface(aSubject));

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

@ -679,8 +679,8 @@ public:
virtual void FlushPendingNotifications(mozFlushType aType) MOZ_OVERRIDE; virtual void FlushPendingNotifications(mozFlushType aType) MOZ_OVERRIDE;
virtual void FlushExternalResources(mozFlushType aType) MOZ_OVERRIDE; virtual void FlushExternalResources(mozFlushType aType) MOZ_OVERRIDE;
virtual void SetXMLDeclaration(const PRUnichar *aVersion, virtual void SetXMLDeclaration(const char16_t *aVersion,
const PRUnichar *aEncoding, const char16_t *aEncoding,
const int32_t aStandalone) MOZ_OVERRIDE; const int32_t aStandalone) MOZ_OVERRIDE;
virtual void GetXMLDeclaration(nsAString& aVersion, virtual void GetXMLDeclaration(nsAString& aVersion,
nsAString& aEncoding, nsAString& aEncoding,

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

@ -551,7 +551,7 @@ ConvertAndWrite(const nsAString& aString,
nsresult rv; nsresult rv;
int32_t charLength, startCharLength; int32_t charLength, startCharLength;
const nsPromiseFlatString& flat = PromiseFlatString(aString); const nsPromiseFlatString& flat = PromiseFlatString(aString);
const PRUnichar* unicodeBuf = flat.get(); const char16_t* unicodeBuf = flat.get();
int32_t unicodeLength = aString.Length(); int32_t unicodeLength = aString.Length();
int32_t startLength = unicodeLength; int32_t startLength = unicodeLength;
@ -1023,7 +1023,7 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
} }
NS_ASSERTION(!mCachedBuffer->IsReadonly(), NS_ASSERTION(!mCachedBuffer->IsReadonly(),
"DocumentEncoder shouldn't keep reference to non-readonly buffer!"); "DocumentEncoder shouldn't keep reference to non-readonly buffer!");
static_cast<PRUnichar*>(mCachedBuffer->Data())[0] = PRUnichar(0); static_cast<char16_t*>(mCachedBuffer->Data())[0] = char16_t(0);
mCachedBuffer->ToString(0, output, true); mCachedBuffer->ToString(0, output, true);
// output owns the buffer now! // output owns the buffer now!
mCachedBuffer = nullptr; mCachedBuffer = nullptr;
@ -1485,7 +1485,7 @@ nsHTMLCopyEncoder::EncodeToStringWithContext(nsAString& aContextString,
// whitespace info to this. // whitespace info to this.
nsAutoString infoString; nsAutoString infoString;
infoString.AppendInt(mStartDepth); infoString.AppendInt(mStartDepth);
infoString.Append(PRUnichar(',')); infoString.Append(char16_t(','));
infoString.AppendInt(mEndDepth); infoString.AppendInt(mEndDepth);
aInfoString = infoString; aInfoString = infoString;

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

@ -88,7 +88,7 @@ nsFormData::Append(const nsAString& aName, nsIVariant* aValue)
} }
} }
PRUnichar* stringData = nullptr; char16_t* stringData = nullptr;
uint32_t stringLen = 0; uint32_t stringLen = 0;
rv = aValue->GetAsWStringWithSize(&stringLen, &stringData); rv = aValue->GetAsWStringWithSize(&stringLen, &stringData);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);

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

@ -484,7 +484,7 @@ static bool
JSONCreator(const jschar* aBuf, uint32_t aLen, void* aData) JSONCreator(const jschar* aBuf, uint32_t aLen, void* aData)
{ {
nsAString* result = static_cast<nsAString*>(aData); nsAString* result = static_cast<nsAString*>(aData);
result->Append(static_cast<const PRUnichar*>(aBuf), result->Append(static_cast<const char16_t*>(aBuf),
static_cast<uint32_t>(aLen)); static_cast<uint32_t>(aLen));
return true; return true;
} }

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

@ -378,7 +378,7 @@ class nsScriptCacheCleaner MOZ_FINAL : public nsIObserver
NS_IMETHODIMP Observe(nsISupports *aSubject, NS_IMETHODIMP Observe(nsISupports *aSubject,
const char *aTopic, const char *aTopic,
const PRUnichar *aData) const char16_t *aData)
{ {
nsFrameScriptExecutor::Shutdown(); nsFrameScriptExecutor::Shutdown();
return NS_OK; return NS_OK;

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

@ -258,7 +258,7 @@ nsGenericDOMDataNode::ReplaceData(uint32_t aOffset, uint32_t aCount,
nsresult nsresult
nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount, nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
const PRUnichar* aBuffer, const char16_t* aBuffer,
uint32_t aLength, bool aNotify, uint32_t aLength, bool aNotify,
CharacterDataChangeInfo::Details* aDetails) CharacterDataChangeInfo::Details* aDetails)
{ {
@ -326,7 +326,7 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
// Allocate new buffer // Allocate new buffer
int32_t newLength = textLength - aCount + aLength; int32_t newLength = textLength - aCount + aLength;
PRUnichar* to = new PRUnichar[newLength]; char16_t* to = new char16_t[newLength];
NS_ENSURE_TRUE(to, NS_ERROR_OUT_OF_MEMORY); NS_ENSURE_TRUE(to, NS_ERROR_OUT_OF_MEMORY);
// Copy over appropriate data // Copy over appropriate data
@ -334,7 +334,7 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
mText.CopyTo(to, 0, aOffset); mText.CopyTo(to, 0, aOffset);
} }
if (aLength) { if (aLength) {
memcpy(to + aOffset, aBuffer, aLength * sizeof(PRUnichar)); memcpy(to + aOffset, aBuffer, aLength * sizeof(char16_t));
} }
if (endOffset != textLength) { if (endOffset != textLength) {
mText.CopyTo(to + aOffset + aLength, endOffset, textLength - endOffset); mText.CopyTo(to + aOffset + aLength, endOffset, textLength - endOffset);
@ -394,11 +394,11 @@ nsGenericDOMDataNode::ToCString(nsAString& aBuf, int32_t aOffset,
int32_t aLen) const int32_t aLen) const
{ {
if (mText.Is2b()) { if (mText.Is2b()) {
const PRUnichar* cp = mText.Get2b() + aOffset; const char16_t* cp = mText.Get2b() + aOffset;
const PRUnichar* end = cp + aLen; const char16_t* end = cp + aLen;
while (cp < end) { while (cp < end) {
PRUnichar ch = *cp++; char16_t ch = *cp++;
if (ch == '&') { if (ch == '&') {
aBuf.AppendLiteral("&amp;"); aBuf.AppendLiteral("&amp;");
} else if (ch == '<') { } else if (ch == '<') {
@ -418,7 +418,7 @@ nsGenericDOMDataNode::ToCString(nsAString& aBuf, int32_t aOffset,
const unsigned char* end = cp + aLen; const unsigned char* end = cp + aLen;
while (cp < end) { while (cp < end) {
PRUnichar ch = *cp++; char16_t ch = *cp++;
if (ch == '&') { if (ch == '&') {
aBuf.AppendLiteral("&amp;"); aBuf.AppendLiteral("&amp;");
} else if (ch == '<') { } else if (ch == '<') {
@ -922,7 +922,7 @@ nsGenericDOMDataNode::TextLength() const
} }
nsresult nsresult
nsGenericDOMDataNode::SetText(const PRUnichar* aBuffer, nsGenericDOMDataNode::SetText(const char16_t* aBuffer,
uint32_t aLength, uint32_t aLength,
bool aNotify) bool aNotify)
{ {
@ -930,7 +930,7 @@ nsGenericDOMDataNode::SetText(const PRUnichar* aBuffer,
} }
nsresult nsresult
nsGenericDOMDataNode::AppendText(const PRUnichar* aBuffer, nsGenericDOMDataNode::AppendText(const char16_t* aBuffer,
uint32_t aLength, uint32_t aLength,
bool aNotify) bool aNotify)
{ {

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

@ -135,14 +135,14 @@ public:
virtual uint32_t GetAttrCount() const MOZ_OVERRIDE; virtual uint32_t GetAttrCount() const MOZ_OVERRIDE;
virtual const nsTextFragment *GetText() MOZ_OVERRIDE; virtual const nsTextFragment *GetText() MOZ_OVERRIDE;
virtual uint32_t TextLength() const MOZ_OVERRIDE; virtual uint32_t TextLength() const MOZ_OVERRIDE;
virtual nsresult SetText(const PRUnichar* aBuffer, uint32_t aLength, virtual nsresult SetText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) MOZ_OVERRIDE; bool aNotify) MOZ_OVERRIDE;
// Need to implement this here too to avoid hiding. // Need to implement this here too to avoid hiding.
nsresult SetText(const nsAString& aStr, bool aNotify) nsresult SetText(const nsAString& aStr, bool aNotify)
{ {
return SetText(aStr.BeginReading(), aStr.Length(), aNotify); return SetText(aStr.BeginReading(), aStr.Length(), aNotify);
} }
virtual nsresult AppendText(const PRUnichar* aBuffer, uint32_t aLength, virtual nsresult AppendText(const char16_t* aBuffer, uint32_t aLength,
bool aNotify) MOZ_OVERRIDE; bool aNotify) MOZ_OVERRIDE;
virtual bool TextIsOnlyWhitespace() MOZ_OVERRIDE; virtual bool TextIsOnlyWhitespace() MOZ_OVERRIDE;
virtual void AppendTextTo(nsAString& aResult) MOZ_OVERRIDE; virtual void AppendTextTo(nsAString& aResult) MOZ_OVERRIDE;
@ -291,7 +291,7 @@ protected:
uint32_t aCount); uint32_t aCount);
nsresult SetTextInternal(uint32_t aOffset, uint32_t aCount, nsresult SetTextInternal(uint32_t aOffset, uint32_t aCount,
const PRUnichar* aBuffer, uint32_t aLength, const char16_t* aBuffer, uint32_t aLength,
bool aNotify, bool aNotify,
CharacterDataChangeInfo::Details* aDetails = nullptr); CharacterDataChangeInfo::Details* aDetails = nullptr);

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

@ -203,12 +203,12 @@ nsHTMLContentSerializer::AppendElementStart(Element* aElement,
AppendIndentation(aStr); AppendIndentation(aStr);
} }
else if (mAddSpace) { else if (mAddSpace) {
AppendToString(PRUnichar(' '), aStr); AppendToString(char16_t(' '), aStr);
mAddSpace = false; mAddSpace = false;
} }
} }
else if (mAddSpace) { else if (mAddSpace) {
AppendToString(PRUnichar(' '), aStr); AppendToString(char16_t(' '), aStr);
mAddSpace = false; mAddSpace = false;
} }
else { else {
@ -362,12 +362,12 @@ nsHTMLContentSerializer::AppendElementEnd(Element* aElement,
AppendIndentation(aStr); AppendIndentation(aStr);
} }
else if (mAddSpace) { else if (mAddSpace) {
AppendToString(PRUnichar(' '), aStr); AppendToString(char16_t(' '), aStr);
mAddSpace = false; mAddSpace = false;
} }
} }
else if (mAddSpace) { else if (mAddSpace) {
AppendToString(PRUnichar(' '), aStr); AppendToString(char16_t(' '), aStr);
mAddSpace = false; mAddSpace = false;
} }
@ -442,7 +442,7 @@ uint32_t FindNextBasicEntity(const nsAString& aStr,
for (; aIndex < aLen; ++aIndex) { for (; aIndex < aLen; ++aIndex) {
// for each character in this chunk, check if it // for each character in this chunk, check if it
// needs to be replaced // needs to be replaced
PRUnichar val = aStr[aIndex]; char16_t val = aStr[aIndex];
if (val <= kValNBSP && aEntityTable[val]) { if (val <= kValNBSP && aEntityTable[val]) {
*aEntity = aEntityTable[val]; *aEntity = aEntityTable[val];
return aIndex; return aIndex;
@ -495,12 +495,12 @@ nsHTMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr,
return; return;
} }
nsReadingIterator<PRUnichar> done_reading; nsReadingIterator<char16_t> done_reading;
aStr.EndReading(done_reading); aStr.EndReading(done_reading);
// for each chunk of |aString|... // for each chunk of |aString|...
uint32_t advanceLength = 0; uint32_t advanceLength = 0;
nsReadingIterator<PRUnichar> iter; nsReadingIterator<char16_t> iter;
const char **entityTable = mInAttribute ? kAttrEntities : kEntities; const char **entityTable = mInAttribute ? kAttrEntities : kEntities;
nsAutoCString entityReplacement; nsAutoCString entityReplacement;
@ -511,9 +511,9 @@ nsHTMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr,
uint32_t fragmentLength = iter.size_forward(); uint32_t fragmentLength = iter.size_forward();
uint32_t lengthReplaced = 0; // the number of UTF-16 codepoints uint32_t lengthReplaced = 0; // the number of UTF-16 codepoints
// replaced by a particular entity // replaced by a particular entity
const PRUnichar* c = iter.get(); const char16_t* c = iter.get();
const PRUnichar* fragmentStart = c; const char16_t* fragmentStart = c;
const PRUnichar* fragmentEnd = c + fragmentLength; const char16_t* fragmentEnd = c + fragmentLength;
const char* entityText = nullptr; const char* entityText = nullptr;
const char* fullConstEntityText = nullptr; const char* fullConstEntityText = nullptr;
char* fullEntityText = nullptr; char* fullEntityText = nullptr;
@ -522,7 +522,7 @@ nsHTMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr,
// for each character in this chunk, check if it // for each character in this chunk, check if it
// needs to be replaced // needs to be replaced
for (; c < fragmentEnd; c++, advanceLength++) { for (; c < fragmentEnd; c++, advanceLength++) {
PRUnichar val = *c; char16_t val = *c;
if (val <= kValNBSP && entityTable[val]) { if (val <= kValNBSP && entityTable[val]) {
fullConstEntityText = entityTable[val]; fullConstEntityText = entityTable[val];
break; break;
@ -565,9 +565,9 @@ nsHTMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr,
aOutputStr.Append(fragmentStart, advanceLength); aOutputStr.Append(fragmentStart, advanceLength);
if (entityText) { if (entityText) {
aOutputStr.Append(PRUnichar('&')); aOutputStr.Append(char16_t('&'));
AppendASCIItoUTF16(entityText, aOutputStr); AppendASCIItoUTF16(entityText, aOutputStr);
aOutputStr.Append(PRUnichar(';')); aOutputStr.Append(char16_t(';'));
advanceLength++; advanceLength++;
} }
else if (fullConstEntityText) { else if (fullConstEntityText) {

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

@ -26,7 +26,7 @@ nsLineBreaker::~nsLineBreaker()
} }
static void static void
SetupCapitalization(const PRUnichar* aWord, uint32_t aLength, SetupCapitalization(const char16_t* aWord, uint32_t aLength,
bool* aCapitalization) bool* aCapitalization)
{ {
// Capitalize the first alphanumeric character after a space or start // Capitalize the first alphanumeric character after a space or start
@ -146,7 +146,7 @@ nsLineBreaker::FlushCurrentWord()
} }
nsresult nsresult
nsLineBreaker::AppendText(nsIAtom* aHyphenationLanguage, const PRUnichar* aText, uint32_t aLength, nsLineBreaker::AppendText(nsIAtom* aHyphenationLanguage, const char16_t* aText, uint32_t aLength,
uint32_t aFlags, nsILineBreakSink* aSink) uint32_t aFlags, nsILineBreakSink* aSink)
{ {
NS_ASSERTION(aLength > 0, "Appending empty text..."); NS_ASSERTION(aLength > 0, "Appending empty text...");
@ -219,7 +219,7 @@ nsLineBreaker::AppendText(nsIAtom* aHyphenationLanguage, const PRUnichar* aText,
} }
for (;;) { for (;;) {
PRUnichar ch = aText[offset]; char16_t ch = aText[offset];
bool isSpace = IsSpace(ch); bool isSpace = IsSpace(ch);
bool isBreakableSpace = isSpace && !(aFlags & BREAK_SUPPRESS_INSIDE); bool isBreakableSpace = isSpace && !(aFlags & BREAK_SUPPRESS_INSIDE);
@ -271,10 +271,10 @@ nsLineBreaker::AppendText(nsIAtom* aHyphenationLanguage, const PRUnichar* aText,
// Save this word // Save this word
mCurrentWordContainsComplexChar = wordHasComplexChar; mCurrentWordContainsComplexChar = wordHasComplexChar;
uint32_t len = offset - wordStart; uint32_t len = offset - wordStart;
PRUnichar* elems = mCurrentWord.AppendElements(len); char16_t* elems = mCurrentWord.AppendElements(len);
if (!elems) if (!elems)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
memcpy(elems, aText + wordStart, sizeof(PRUnichar)*len); memcpy(elems, aText + wordStart, sizeof(char16_t)*len);
mTextItems.AppendElement(TextItem(aSink, wordStart, len, aFlags)); mTextItems.AppendElement(TextItem(aSink, wordStart, len, aFlags));
// Ensure that the break-before for this word is written out // Ensure that the break-before for this word is written out
offset = wordStart + 1; offset = wordStart + 1;
@ -297,8 +297,8 @@ nsLineBreaker::AppendText(nsIAtom* aHyphenationLanguage, const PRUnichar* aText,
void void
nsLineBreaker::FindHyphenationPoints(nsHyphenator *aHyphenator, nsLineBreaker::FindHyphenationPoints(nsHyphenator *aHyphenator,
const PRUnichar *aTextStart, const char16_t *aTextStart,
const PRUnichar *aTextLimit, const char16_t *aTextLimit,
uint8_t *aBreakState) uint8_t *aBreakState)
{ {
nsDependentSubstring string(aTextStart, aTextLimit); nsDependentSubstring string(aTextStart, aTextLimit);
@ -427,7 +427,7 @@ nsLineBreaker::AppendText(nsIAtom* aHyphenationLanguage, const uint8_t* aText, u
// Save this word // Save this word
mCurrentWordContainsComplexChar = wordHasComplexChar; mCurrentWordContainsComplexChar = wordHasComplexChar;
uint32_t len = offset - wordStart; uint32_t len = offset - wordStart;
PRUnichar* elems = mCurrentWord.AppendElements(len); char16_t* elems = mCurrentWord.AppendElements(len);
if (!elems) if (!elems)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
uint32_t i; uint32_t i;

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

@ -184,7 +184,7 @@ LogMixedContentMessage(MixedContentTypes aClassification,
aContentLocation->GetSpec(locationSpec); aContentLocation->GetSpec(locationSpec);
NS_ConvertUTF8toUTF16 locationSpecUTF16(locationSpec); NS_ConvertUTF8toUTF16 locationSpecUTF16(locationSpec);
const PRUnichar* strings[] = { locationSpecUTF16.get() }; const char16_t* strings[] = { locationSpecUTF16.get() };
nsContentUtils::ReportToConsole(severityFlag, messageCategory, aRootDoc, nsContentUtils::ReportToConsole(severityFlag, messageCategory, aRootDoc,
nsContentUtils::eSECURITY_PROPERTIES, nsContentUtils::eSECURITY_PROPERTIES,
messageLookupKey.get(), strings, ArrayLength(strings)); messageLookupKey.get(), strings, ArrayLength(strings));

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

@ -40,12 +40,12 @@ static const int32_t kIndentIncrementHeaders = 2; /* If mHeaderStrategy = 1,
static const int32_t kIndentSizeList = kTabSize; static const int32_t kIndentSizeList = kTabSize;
// Indention of non-first lines of ul and ol // Indention of non-first lines of ul and ol
static const int32_t kIndentSizeDD = kTabSize; // Indention of <dd> static const int32_t kIndentSizeDD = kTabSize; // Indention of <dd>
static const PRUnichar kNBSP = 160; static const char16_t kNBSP = 160;
static const PRUnichar kSPACE = ' '; static const char16_t kSPACE = ' ';
static int32_t HeaderLevel(nsIAtom* aTag); static int32_t HeaderLevel(nsIAtom* aTag);
static int32_t GetUnicharWidth(PRUnichar ucs); static int32_t GetUnicharWidth(char16_t ucs);
static int32_t GetUnicharStringWidth(const PRUnichar* pwcs, int32_t n); static int32_t GetUnicharStringWidth(const char16_t* pwcs, int32_t n);
// Someday may want to make this non-const: // Someday may want to make this non-const:
static const uint32_t TagStackSize = 500; static const uint32_t TagStackSize = 500;
@ -151,11 +151,11 @@ nsPlainTextSerializer::Init(uint32_t aFlags, uint32_t aWrapColumn,
} }
else if (mFlags & nsIDocumentEncoder::OutputCRLineBreak) { else if (mFlags & nsIDocumentEncoder::OutputCRLineBreak) {
// Mac // Mac
mLineBreak.Assign(PRUnichar('\r')); mLineBreak.Assign(char16_t('\r'));
} }
else if (mFlags & nsIDocumentEncoder::OutputLFLineBreak) { else if (mFlags & nsIDocumentEncoder::OutputLFLineBreak) {
// Unix/DOM // Unix/DOM
mLineBreak.Assign(PRUnichar('\n')); mLineBreak.Assign(char16_t('\n'));
} }
else { else {
// Platform/default // Platform/default
@ -624,20 +624,20 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
mInIndentString.AppendInt(mOLStack[mOLStackIndex-1]++, 10); mInIndentString.AppendInt(mOLStack[mOLStackIndex-1]++, 10);
} }
else { else {
mInIndentString.Append(PRUnichar('#')); mInIndentString.Append(char16_t('#'));
} }
mInIndentString.Append(PRUnichar('.')); mInIndentString.Append(char16_t('.'));
} }
else { else {
static char bulletCharArray[] = "*o+#"; static char bulletCharArray[] = "*o+#";
uint32_t index = mULCount > 0 ? (mULCount - 1) : 3; uint32_t index = mULCount > 0 ? (mULCount - 1) : 3;
char bulletChar = bulletCharArray[index % 4]; char bulletChar = bulletCharArray[index % 4];
mInIndentString.Append(PRUnichar(bulletChar)); mInIndentString.Append(char16_t(bulletChar));
} }
mInIndentString.Append(PRUnichar(' ')); mInIndentString.Append(char16_t(' '));
} }
else if (aTag == nsGkAtoms::dl) { else if (aTag == nsGkAtoms::dl) {
EnsureVerticalSpace(1); EnsureVerticalSpace(1);
@ -708,9 +708,9 @@ nsPlainTextSerializer::DoOpenContainer(nsIAtom* aTag)
nsAutoString leadup; nsAutoString leadup;
for (i = 1; i <= level; i++) { for (i = 1; i <= level; i++) {
leadup.AppendInt(mHeaderCounter[i]); leadup.AppendInt(mHeaderCounter[i]);
leadup.Append(PRUnichar('.')); leadup.Append(char16_t('.'));
} }
leadup.Append(PRUnichar(' ')); leadup.Append(char16_t(' '));
Write(leadup); Write(leadup);
} }
else if (mHeaderStrategy == 1) { // indent increasingly else if (mHeaderStrategy == 1) { // indent increasingly
@ -933,7 +933,7 @@ nsPlainTextSerializer::DoCloseContainer(nsIAtom* aTag)
nsAutoString temp; nsAutoString temp;
temp.AssignLiteral(" <"); temp.AssignLiteral(" <");
temp += mURL; temp += mURL;
temp.Append(PRUnichar('>')); temp.Append(char16_t('>'));
Write(temp); Write(temp);
mURL.Truncate(); mURL.Truncate();
} }
@ -1067,7 +1067,7 @@ nsPlainTextSerializer::DoAddLeaf(nsIAtom* aTag)
nsAutoString line; nsAutoString line;
uint32_t width = (mWrapColumn > 0 ? mWrapColumn : 25); uint32_t width = (mWrapColumn > 0 ? mWrapColumn : 25);
while (line.Length() < width) { while (line.Length() < width) {
line.Append(PRUnichar('-')); line.Append(char16_t('-'));
} }
Write(line); Write(line);
@ -1170,7 +1170,7 @@ nsPlainTextSerializer::Output(nsString& aString)
} }
static bool static bool
IsSpaceStuffable(const PRUnichar *s) IsSpaceStuffable(const char16_t *s)
{ {
if (s[0] == '>' || s[0] == ' ' || s[0] == kNBSP || if (s[0] == '>' || s[0] == ' ' || s[0] == kNBSP ||
nsCRT::strncmp(s, MOZ_UTF16("From "), 5) == 0) nsCRT::strncmp(s, MOZ_UTF16("From "), 5) == 0)
@ -1186,7 +1186,7 @@ IsSpaceStuffable(const PRUnichar *s)
* output. * output.
*/ */
void void
nsPlainTextSerializer::AddToLine(const PRUnichar * aLineFragment, nsPlainTextSerializer::AddToLine(const char16_t * aLineFragment,
int32_t aLineFragmentLength) int32_t aLineFragmentLength)
{ {
uint32_t prefixwidth = (mCiteQuoteLevel > 0 ? mCiteQuoteLevel + 1:0)+mIndent; uint32_t prefixwidth = (mCiteQuoteLevel > 0 ? mCiteQuoteLevel + 1:0)+mIndent;
@ -1207,7 +1207,7 @@ nsPlainTextSerializer::AddToLine(const PRUnichar * aLineFragment,
) )
{ {
// Space stuffing a la RFC 2646 (format=flowed). // Space stuffing a la RFC 2646 (format=flowed).
mCurrentLine.Append(PRUnichar(' ')); mCurrentLine.Append(char16_t(' '));
if (MayWrap()) { if (MayWrap()) {
mCurrentLineWidth += GetUnicharWidth(' '); mCurrentLineWidth += GetUnicharWidth(' ');
@ -1327,7 +1327,7 @@ nsPlainTextSerializer::AddToLine(const PRUnichar * aLineFragment,
) )
{ {
// Space stuffing a la RFC 2646 (format=flowed). // Space stuffing a la RFC 2646 (format=flowed).
mCurrentLine.Append(PRUnichar(' ')); mCurrentLine.Append(char16_t(' '));
//XXX doesn't seem to work correctly for ' ' //XXX doesn't seem to work correctly for ' '
} }
} }
@ -1395,7 +1395,7 @@ nsPlainTextSerializer::EndLine(bool aSoftlinebreak, bool aBreakBySpace)
if ((mFlags & nsIDocumentEncoder::OutputFormatDelSp) && aBreakBySpace) if ((mFlags & nsIDocumentEncoder::OutputFormatDelSp) && aBreakBySpace)
mCurrentLine.Append(NS_LITERAL_STRING(" ")); mCurrentLine.Append(NS_LITERAL_STRING(" "));
else else
mCurrentLine.Append(PRUnichar(' ')); mCurrentLine.Append(char16_t(' '));
} }
if (aSoftlinebreak) { if (aSoftlinebreak) {
@ -1443,7 +1443,7 @@ nsPlainTextSerializer::OutputQuotesAndIndent(bool stripTrailingSpaces /* = false
if (mCiteQuoteLevel > 0) { if (mCiteQuoteLevel > 0) {
nsAutoString quotes; nsAutoString quotes;
for(int i=0; i < mCiteQuoteLevel; i++) { for(int i=0; i < mCiteQuoteLevel; i++) {
quotes.Append(PRUnichar('>')); quotes.Append(char16_t('>'));
} }
if (!mCurrentLine.IsEmpty()) { if (!mCurrentLine.IsEmpty()) {
/* Better don't output a space here, if the line is empty, /* Better don't output a space here, if the line is empty,
@ -1451,7 +1451,7 @@ nsPlainTextSerializer::OutputQuotesAndIndent(bool stripTrailingSpaces /* = false
which it isn't - it's just empty. which it isn't - it's just empty.
(Flowed lines may be joined with the following one, (Flowed lines may be joined with the following one,
so the empty line may be lost completely.) */ so the empty line may be lost completely.) */
quotes.Append(PRUnichar(' ')); quotes.Append(char16_t(' '));
} }
stringToOutput = quotes; stringToOutput = quotes;
mAtFirstColumn = false; mAtFirstColumn = false;
@ -1465,7 +1465,7 @@ nsPlainTextSerializer::OutputQuotesAndIndent(bool stripTrailingSpaces /* = false
) { ) {
nsAutoString spaces; nsAutoString spaces;
for (int i=0; i < indentwidth; ++i) for (int i=0; i < indentwidth; ++i)
spaces.Append(PRUnichar(' ')); spaces.Append(char16_t(' '));
stringToOutput += spaces; stringToOutput += spaces;
mAtFirstColumn = false; mAtFirstColumn = false;
} }
@ -1520,7 +1520,7 @@ nsPlainTextSerializer::Write(const nsAString& aStr)
// to be cut off along with usual spaces if required. (bug #125928) // to be cut off along with usual spaces if required. (bug #125928)
if (mFlags & nsIDocumentEncoder::OutputFormatFlowed) { if (mFlags & nsIDocumentEncoder::OutputFormatFlowed) {
for (int32_t i = totLen-1; i >= 0; i--) { for (int32_t i = totLen-1; i >= 0; i--) {
PRUnichar c = str[i]; char16_t c = str[i];
if ('\n' == c || '\r' == c || ' ' == c || '\t' == c) if ('\n' == c || '\r' == c || ' ' == c || '\t' == c)
continue; continue;
if (kNBSP == c) if (kNBSP == c)
@ -1535,7 +1535,7 @@ nsPlainTextSerializer::Write(const nsAString& aStr)
// Output directly while the other code path goes through AddToLine. // Output directly while the other code path goes through AddToLine.
if ((mPreFormatted && !mWrapColumn) || IsInPre() if ((mPreFormatted && !mWrapColumn) || IsInPre()
|| ((mSpanLevel > 0 || mDontWrapAnyQuotes) || ((mSpanLevel > 0 || mDontWrapAnyQuotes)
&& mEmptyLines >= 0 && str.First() == PRUnichar('>'))) { && mEmptyLines >= 0 && str.First() == char16_t('>'))) {
// No intelligent wrapping. // No intelligent wrapping.
// This mustn't be mixed with intelligent wrapping without clearing // This mustn't be mixed with intelligent wrapping without clearing
@ -1578,7 +1578,7 @@ nsPlainTextSerializer::Write(const nsAString& aStr)
// No new lines. // No new lines.
stringpart.Assign(Substring(str, bol, totLen - bol)); stringpart.Assign(Substring(str, bol, totLen - bol));
if (!stringpart.IsEmpty()) { if (!stringpart.IsEmpty()) {
PRUnichar lastchar = stringpart[stringpart.Length()-1]; char16_t lastchar = stringpart[stringpart.Length()-1];
if ((lastchar == '\t') || (lastchar == ' ') || if ((lastchar == '\t') || (lastchar == ' ') ||
(lastchar == '\r') ||(lastchar == '\n')) { (lastchar == '\r') ||(lastchar == '\n')) {
mInWhitespace = true; mInWhitespace = true;
@ -1614,7 +1614,7 @@ nsPlainTextSerializer::Write(const nsAString& aStr)
!stringpart.EqualsLiteral("- -- ")) !stringpart.EqualsLiteral("- -- "))
stringpart.Trim(" ", false, true, true); stringpart.Trim(" ", false, true, true);
if (IsSpaceStuffable(stringpart.get()) && stringpart[0] != '>') if (IsSpaceStuffable(stringpart.get()) && stringpart[0] != '>')
mCurrentLine.Append(PRUnichar(' ')); mCurrentLine.Append(char16_t(' '));
} }
mCurrentLine.Append(stringpart); mCurrentLine.Append(stringpart);
@ -1644,7 +1644,7 @@ nsPlainTextSerializer::Write(const nsAString& aStr)
// If needed, strip out all "end of lines" // If needed, strip out all "end of lines"
// and multiple whitespace between words // and multiple whitespace between words
int32_t nextpos; int32_t nextpos;
const PRUnichar * offsetIntoBuffer = nullptr; const char16_t * offsetIntoBuffer = nullptr;
while (bol < totLen) { // Loop over lines while (bol < totLen) { // Loop over lines
// Find a place where we may have to do whitespace compression // Find a place where we may have to do whitespace compression
@ -1865,7 +1865,7 @@ int32_t HeaderLevel(nsIAtom* aTag)
* in ISO 10646. * in ISO 10646.
*/ */
int32_t GetUnicharWidth(PRUnichar ucs) int32_t GetUnicharWidth(char16_t ucs)
{ {
/* sorted list of non-overlapping intervals of non-spacing characters */ /* sorted list of non-overlapping intervals of non-spacing characters */
static const struct interval { static const struct interval {
@ -1947,7 +1947,7 @@ int32_t GetUnicharWidth(PRUnichar ucs)
} }
int32_t GetUnicharStringWidth(const PRUnichar* pwcs, int32_t n) int32_t GetUnicharStringWidth(const char16_t* pwcs, int32_t n)
{ {
int32_t w, width = 0; int32_t w, width = 0;

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

@ -68,7 +68,7 @@ public:
protected: protected:
nsresult GetAttributeValue(nsIAtom* aName, nsString& aValueRet); nsresult GetAttributeValue(nsIAtom* aName, nsString& aValueRet);
void AddToLine(const PRUnichar* aStringToAdd, int32_t aLength); void AddToLine(const char16_t* aStringToAdd, int32_t aLength);
void EndLine(bool softlinebreak, bool aBreakBySpace = false); void EndLine(bool softlinebreak, bool aBreakBySpace = false);
void EnsureVerticalSpace(int32_t noOfRows); void EnsureVerticalSpace(int32_t noOfRows);
void FlushLine(); void FlushLine();

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

@ -223,7 +223,7 @@ NS_IMPL_ISUPPORTS1(nsReferencedElement::DocumentLoadNotification,
NS_IMETHODIMP NS_IMETHODIMP
nsReferencedElement::DocumentLoadNotification::Observe(nsISupports* aSubject, nsReferencedElement::DocumentLoadNotification::Observe(nsISupports* aSubject,
const char* aTopic, const char* aTopic,
const PRUnichar* aData) const char16_t* aData)
{ {
NS_ASSERTION(PL_strcmp(aTopic, "external-resource-document-created") == 0, NS_ASSERTION(PL_strcmp(aTopic, "external-resource-document-created") == 0,
"Unexpected topic"); "Unexpected topic");

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

@ -1235,7 +1235,7 @@ nsScriptLoader::ConvertToUTF16(nsIChannel* aChannel, const uint8_t* aData,
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
PRUnichar *ustr = aString.BeginWriting(); char16_t *ustr = aString.BeginWriting();
rv = unicodeDecoder->Convert(reinterpret_cast<const char*>(aData), rv = unicodeDecoder->Convert(reinterpret_cast<const char*>(aData),
(int32_t *) &aLength, ustr, (int32_t *) &aLength, ustr,

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

@ -6,7 +6,7 @@
/* /*
* A class which represents a fragment of text (eg inside a text * A class which represents a fragment of text (eg inside a text
* node); if only codepoints below 256 are used, the text is stored as * node); if only codepoints below 256 are used, the text is stored as
* a char*; otherwise the text is stored as a PRUnichar* * a char*; otherwise the text is stored as a char16_t*
*/ */
#include "nsTextFragment.h" #include "nsTextFragment.h"
@ -105,14 +105,14 @@ nsTextFragment::operator=(const nsTextFragment& aOther)
} }
else { else {
size_t m2bSize = aOther.mState.mLength * size_t m2bSize = aOther.mState.mLength *
(aOther.mState.mIs2b ? sizeof(PRUnichar) : sizeof(char)); (aOther.mState.mIs2b ? sizeof(char16_t) : sizeof(char));
m2b = static_cast<PRUnichar*>(moz_malloc(m2bSize)); m2b = static_cast<char16_t*>(moz_malloc(m2bSize));
if (m2b) { if (m2b) {
memcpy(m2b, aOther.m2b, m2bSize); memcpy(m2b, aOther.m2b, m2bSize);
} else { } else {
// allocate a buffer for a single REPLACEMENT CHARACTER // allocate a buffer for a single REPLACEMENT CHARACTER
m2b = static_cast<PRUnichar*>(moz_xmalloc(sizeof(PRUnichar))); m2b = static_cast<char16_t*>(moz_xmalloc(sizeof(char16_t)));
m2b[0] = 0xFFFD; // REPLACEMENT CHARACTER m2b[0] = 0xFFFD; // REPLACEMENT CHARACTER
mState.mIs2b = true; mState.mIs2b = true;
mState.mInHeap = true; mState.mInHeap = true;
@ -129,7 +129,7 @@ nsTextFragment::operator=(const nsTextFragment& aOther)
} }
static inline int32_t static inline int32_t
FirstNon8BitUnvectorized(const PRUnichar *str, const PRUnichar *end) FirstNon8BitUnvectorized(const char16_t *str, const char16_t *end)
{ {
typedef Non8BitParameters<sizeof(size_t)> p; typedef Non8BitParameters<sizeof(size_t)> p;
const size_t mask = p::mask(); const size_t mask = p::mask();
@ -140,7 +140,7 @@ FirstNon8BitUnvectorized(const PRUnichar *str, const PRUnichar *end)
// Align ourselves to a word boundary. // Align ourselves to a word boundary.
int32_t alignLen = int32_t alignLen =
std::min(len, int32_t(((-NS_PTR_TO_INT32(str)) & alignMask) / sizeof(PRUnichar))); std::min(len, int32_t(((-NS_PTR_TO_INT32(str)) & alignMask) / sizeof(char16_t)));
for (; i < alignLen; i++) { for (; i < alignLen; i++) {
if (str[i] > 255) if (str[i] > 255)
return i; return i;
@ -166,7 +166,7 @@ FirstNon8BitUnvectorized(const PRUnichar *str, const PRUnichar *end)
#ifdef MOZILLA_MAY_SUPPORT_SSE2 #ifdef MOZILLA_MAY_SUPPORT_SSE2
namespace mozilla { namespace mozilla {
namespace SSE2 { namespace SSE2 {
int32_t FirstNon8Bit(const PRUnichar *str, const PRUnichar *end); int32_t FirstNon8Bit(const char16_t *str, const char16_t *end);
} }
} }
#endif #endif
@ -179,7 +179,7 @@ namespace mozilla {
* there is no non-8bit character before returned value. * there is no non-8bit character before returned value.
*/ */
static inline int32_t static inline int32_t
FirstNon8Bit(const PRUnichar *str, const PRUnichar *end) FirstNon8Bit(const char16_t *str, const char16_t *end)
{ {
#ifdef MOZILLA_MAY_SUPPORT_SSE2 #ifdef MOZILLA_MAY_SUPPORT_SSE2
if (mozilla::supports_sse2()) { if (mozilla::supports_sse2()) {
@ -191,7 +191,7 @@ FirstNon8Bit(const PRUnichar *str, const PRUnichar *end)
} }
bool bool
nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBidi) nsTextFragment::SetTo(const char16_t* aBuffer, int32_t aLength, bool aUpdateBidi)
{ {
ReleaseText(); ReleaseText();
@ -199,7 +199,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBid
return true; return true;
} }
PRUnichar firstChar = *aBuffer; char16_t firstChar = *aBuffer;
if (aLength == 1 && firstChar < 256) { if (aLength == 1 && firstChar < 256) {
m1b = sSingleCharSharedString + firstChar; m1b = sSingleCharSharedString + firstChar;
mState.mInHeap = false; mState.mInHeap = false;
@ -209,8 +209,8 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBid
return true; return true;
} }
const PRUnichar *ucp = aBuffer; const char16_t *ucp = aBuffer;
const PRUnichar *uend = aBuffer + aLength; const char16_t *uend = aBuffer + aLength;
// Check if we can use a shared string // Check if we can use a shared string
if (aLength <= 1 + TEXTFRAG_WHITE_AFTER_NEWLINE + TEXTFRAG_MAX_NEWLINES && if (aLength <= 1 + TEXTFRAG_WHITE_AFTER_NEWLINE + TEXTFRAG_MAX_NEWLINES &&
@ -219,13 +219,13 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBid
++ucp; ++ucp;
} }
const PRUnichar* start = ucp; const char16_t* start = ucp;
while (ucp < uend && *ucp == '\n') { while (ucp < uend && *ucp == '\n') {
++ucp; ++ucp;
} }
const PRUnichar* endNewLine = ucp; const char16_t* endNewLine = ucp;
PRUnichar space = ucp < uend && *ucp == '\t' ? '\t' : ' '; char16_t space = ucp < uend && *ucp == '\t' ? '\t' : ' ';
while (ucp < uend && *ucp == space) { while (ucp < uend && *ucp == space) {
++ucp; ++ucp;
} }
@ -254,8 +254,8 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBid
if (first16bit != -1) { // aBuffer contains no non-8bit character if (first16bit != -1) { // aBuffer contains no non-8bit character
// Use ucs2 storage because we have to // Use ucs2 storage because we have to
size_t m2bSize = aLength * sizeof(PRUnichar); size_t m2bSize = aLength * sizeof(char16_t);
m2b = (PRUnichar *)moz_malloc(m2bSize); m2b = (char16_t *)moz_malloc(m2bSize);
if (!m2b) { if (!m2b) {
return false; return false;
} }
@ -288,7 +288,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBid
} }
void void
nsTextFragment::CopyTo(PRUnichar *aDest, int32_t aOffset, int32_t aCount) nsTextFragment::CopyTo(char16_t *aDest, int32_t aOffset, int32_t aCount)
{ {
NS_ASSERTION(aOffset >= 0, "Bad offset passed to nsTextFragment::CopyTo()!"); NS_ASSERTION(aOffset >= 0, "Bad offset passed to nsTextFragment::CopyTo()!");
NS_ASSERTION(aCount >= 0, "Bad count passed to nsTextFragment::CopyTo()!"); NS_ASSERTION(aCount >= 0, "Bad count passed to nsTextFragment::CopyTo()!");
@ -303,7 +303,7 @@ nsTextFragment::CopyTo(PRUnichar *aDest, int32_t aOffset, int32_t aCount)
if (aCount != 0) { if (aCount != 0) {
if (mState.mIs2b) { if (mState.mIs2b) {
memcpy(aDest, m2b + aOffset, sizeof(PRUnichar) * aCount); memcpy(aDest, m2b + aOffset, sizeof(char16_t) * aCount);
} else { } else {
const char *cp = m1b + aOffset; const char *cp = m1b + aOffset;
const char *end = cp + aCount; const char *end = cp + aCount;
@ -314,7 +314,7 @@ nsTextFragment::CopyTo(PRUnichar *aDest, int32_t aOffset, int32_t aCount)
} }
bool bool
nsTextFragment::Append(const PRUnichar* aBuffer, uint32_t aLength, bool aUpdateBidi) nsTextFragment::Append(const char16_t* aBuffer, uint32_t aLength, bool aUpdateBidi)
{ {
// This is a common case because some callsites create a textnode // This is a common case because some callsites create a textnode
// with a value by creating the node and then calling AppendData. // with a value by creating the node and then calling AppendData.
@ -326,12 +326,12 @@ nsTextFragment::Append(const PRUnichar* aBuffer, uint32_t aLength, bool aUpdateB
if (mState.mIs2b) { if (mState.mIs2b) {
// Already a 2-byte string so the result will be too // Already a 2-byte string so the result will be too
PRUnichar* buff = (PRUnichar*)moz_realloc(m2b, (mState.mLength + aLength) * sizeof(PRUnichar)); char16_t* buff = (char16_t*)moz_realloc(m2b, (mState.mLength + aLength) * sizeof(char16_t));
if (!buff) { if (!buff) {
return false; return false;
} }
memcpy(buff + mState.mLength, aBuffer, aLength * sizeof(PRUnichar)); memcpy(buff + mState.mLength, aBuffer, aLength * sizeof(char16_t));
mState.mLength += aLength; mState.mLength += aLength;
m2b = buff; m2b = buff;
@ -348,8 +348,8 @@ nsTextFragment::Append(const PRUnichar* aBuffer, uint32_t aLength, bool aUpdateB
if (first16bit != -1) { // aBuffer contains no non-8bit character if (first16bit != -1) { // aBuffer contains no non-8bit character
// The old data was 1-byte, but the new is not so we have to expand it // The old data was 1-byte, but the new is not so we have to expand it
// all to 2-byte // all to 2-byte
PRUnichar* buff = (PRUnichar*)moz_malloc((mState.mLength + aLength) * char16_t* buff = (char16_t*)moz_malloc((mState.mLength + aLength) *
sizeof(PRUnichar)); sizeof(char16_t));
if (!buff) { if (!buff) {
return false; return false;
} }
@ -358,7 +358,7 @@ nsTextFragment::Append(const PRUnichar* aBuffer, uint32_t aLength, bool aUpdateB
LossyConvertEncoding8to16 converter(buff); LossyConvertEncoding8to16 converter(buff);
copy_string(m1b, m1b+mState.mLength, converter); copy_string(m1b, m1b+mState.mLength, converter);
memcpy(buff + mState.mLength, aBuffer, aLength * sizeof(PRUnichar)); memcpy(buff + mState.mLength, aBuffer, aLength * sizeof(char16_t));
mState.mLength += aLength; mState.mLength += aLength;
mState.mIs2b = true; mState.mIs2b = true;
@ -422,18 +422,18 @@ nsTextFragment::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
// To save time we only do this when we really want to know, not during // To save time we only do this when we really want to know, not during
// every allocation // every allocation
void void
nsTextFragment::UpdateBidiFlag(const PRUnichar* aBuffer, uint32_t aLength) nsTextFragment::UpdateBidiFlag(const char16_t* aBuffer, uint32_t aLength)
{ {
if (mState.mIs2b && !mState.mIsBidi) { if (mState.mIs2b && !mState.mIsBidi) {
const PRUnichar* cp = aBuffer; const char16_t* cp = aBuffer;
const PRUnichar* end = cp + aLength; const char16_t* end = cp + aLength;
while (cp < end) { while (cp < end) {
PRUnichar ch1 = *cp++; char16_t ch1 = *cp++;
uint32_t utf32Char = ch1; uint32_t utf32Char = ch1;
if (NS_IS_HIGH_SURROGATE(ch1) && if (NS_IS_HIGH_SURROGATE(ch1) &&
cp < end && cp < end &&
NS_IS_LOW_SURROGATE(*cp)) { NS_IS_LOW_SURROGATE(*cp)) {
PRUnichar ch2 = *cp++; char16_t ch2 = *cp++;
utf32Char = SURROGATE_TO_UCS4(ch1, ch2); utf32Char = SURROGATE_TO_UCS4(ch1, ch2);
} }
if (UTF32_CHAR_IS_BIDI(utf32Char) || IsBidiControl(utf32Char)) { if (UTF32_CHAR_IS_BIDI(utf32Char) || IsBidiControl(utf32Char)) {

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

@ -5,7 +5,7 @@
/* /*
* A class which represents a fragment of text (eg inside a text * A class which represents a fragment of text (eg inside a text
* node); if only codepoints below 256 are used, the text is stored as * node); if only codepoints below 256 are used, the text is stored as
* a char*; otherwise the text is stored as a PRUnichar* * a char*; otherwise the text is stored as a char16_t*
*/ */
#ifndef nsTextFragment_h___ #ifndef nsTextFragment_h___
@ -58,7 +58,7 @@ public:
nsTextFragment& operator=(const nsTextFragment& aOther); nsTextFragment& operator=(const nsTextFragment& aOther);
/** /**
* Return true if this fragment is represented by PRUnichar data * Return true if this fragment is represented by char16_t data
*/ */
bool Is2b() const bool Is2b() const
{ {
@ -76,9 +76,9 @@ public:
} }
/** /**
* Get a pointer to constant PRUnichar data. * Get a pointer to constant char16_t data.
*/ */
const PRUnichar *Get2b() const const char16_t *Get2b() const
{ {
NS_ASSERTION(Is2b(), "not 2b text"); NS_ASSERTION(Is2b(), "not 2b text");
return m2b; return m2b;
@ -112,14 +112,14 @@ public:
* buffer. If aUpdateBidi is true, contents of the fragment will be scanned, * buffer. If aUpdateBidi is true, contents of the fragment will be scanned,
* and mState.mIsBidi will be turned on if it includes any Bidi characters. * and mState.mIsBidi will be turned on if it includes any Bidi characters.
*/ */
bool SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBidi); bool SetTo(const char16_t* aBuffer, int32_t aLength, bool aUpdateBidi);
/** /**
* Append aData to the end of this fragment. If aUpdateBidi is true, contents * Append aData to the end of this fragment. If aUpdateBidi is true, contents
* of the fragment will be scanned, and mState.mIsBidi will be turned on if * of the fragment will be scanned, and mState.mIsBidi will be turned on if
* it includes any Bidi characters. * it includes any Bidi characters.
*/ */
bool Append(const PRUnichar* aBuffer, uint32_t aLength, bool aUpdateBidi); bool Append(const char16_t* aBuffer, uint32_t aLength, bool aUpdateBidi);
/** /**
* Append the contents of this string fragment to aString * Append the contents of this string fragment to aString
@ -151,13 +151,13 @@ public:
* lie within the fragments data. The fragments data is converted if * lie within the fragments data. The fragments data is converted if
* necessary. * necessary.
*/ */
void CopyTo(PRUnichar *aDest, int32_t aOffset, int32_t aCount); void CopyTo(char16_t *aDest, int32_t aOffset, int32_t aCount);
/** /**
* Return the character in the text-fragment at the given * Return the character in the text-fragment at the given
* index. This always returns a PRUnichar. * index. This always returns a char16_t.
*/ */
PRUnichar CharAt(int32_t aIndex) const char16_t CharAt(int32_t aIndex) const
{ {
NS_ASSERTION(uint32_t(aIndex) < mState.mLength, "bad index"); NS_ASSERTION(uint32_t(aIndex) < mState.mLength, "bad index");
return mState.mIs2b ? m2b[aIndex] : static_cast<unsigned char>(m1b[aIndex]); return mState.mIs2b ? m2b[aIndex] : static_cast<unsigned char>(m1b[aIndex]);
@ -184,10 +184,10 @@ private:
* Scan the contents of the fragment and turn on mState.mIsBidi if it * Scan the contents of the fragment and turn on mState.mIsBidi if it
* includes any Bidi characters. * includes any Bidi characters.
*/ */
void UpdateBidiFlag(const PRUnichar* aBuffer, uint32_t aLength); void UpdateBidiFlag(const char16_t* aBuffer, uint32_t aLength);
union { union {
PRUnichar *m2b; char16_t *m2b;
const char *m1b; // This is const since it can point to shared data const char *m1b; // This is const since it can point to shared data
}; };

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

@ -22,7 +22,7 @@ is_zero (__m128i x)
} }
int32_t int32_t
FirstNon8Bit(const PRUnichar *str, const PRUnichar *end) FirstNon8Bit(const char16_t *str, const char16_t *end)
{ {
const uint32_t numUnicharsPerVector = 8; const uint32_t numUnicharsPerVector = 8;
typedef Non8BitParameters<sizeof(size_t)> p; typedef Non8BitParameters<sizeof(size_t)> p;
@ -34,7 +34,7 @@ FirstNon8Bit(const PRUnichar *str, const PRUnichar *end)
// Align ourselves to a 16-byte boundary, as required by _mm_load_si128 // Align ourselves to a 16-byte boundary, as required by _mm_load_si128
// (i.e. MOVDQA). // (i.e. MOVDQA).
int32_t alignLen = int32_t alignLen =
std::min(len, int32_t(((-NS_PTR_TO_INT32(str)) & 0xf) / sizeof(PRUnichar))); std::min(len, int32_t(((-NS_PTR_TO_INT32(str)) & 0xf) / sizeof(char16_t)));
for (; i < alignLen; i++) { for (; i < alignLen; i++) {
if (str[i] > 255) if (str[i] > 255)
return i; return i;

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

@ -122,7 +122,7 @@ nsTextNode::CloneDataNode(nsINodeInfo *aNodeInfo, bool aCloneText) const
} }
nsresult nsresult
nsTextNode::AppendTextForNormalize(const PRUnichar* aBuffer, uint32_t aLength, nsTextNode::AppendTextForNormalize(const char16_t* aBuffer, uint32_t aLength,
bool aNotify, nsIContent* aNextSibling) bool aNotify, nsIContent* aNextSibling)
{ {
CharacterDataChangeInfo::Details details = { CharacterDataChangeInfo::Details details = {

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

@ -70,7 +70,7 @@ public:
virtual void UnbindFromTree(bool aDeep = true, virtual void UnbindFromTree(bool aDeep = true,
bool aNullParent = true) MOZ_OVERRIDE; bool aNullParent = true) MOZ_OVERRIDE;
nsresult AppendTextForNormalize(const PRUnichar* aBuffer, uint32_t aLength, nsresult AppendTextForNormalize(const char16_t* aBuffer, uint32_t aLength,
bool aNotify, nsIContent* aNextSibling); bool aNotify, nsIContent* aNextSibling);
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; } virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }

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

@ -1228,7 +1228,7 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
// <link rel itemprop> // <link rel itemprop>
continue; continue;
} }
const PRUnichar* localStr = attrLocal->GetUTF16String(); const char16_t* localStr = attrLocal->GetUTF16String();
// Allow underscore to cater to the MCE editor library. // Allow underscore to cater to the MCE editor library.
// Allow data-* on SVG and MathML, too, as a forward-compat measure. // Allow data-* on SVG and MathML, too, as a forward-compat measure.
if (*localStr == '_' || (attrLocal->GetLength() > 5 && localStr[0] == 'd' if (*localStr == '_' || (attrLocal->GetLength() > 5 && localStr[0] == 'd'

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

@ -151,7 +151,7 @@ nsXMLContentSerializer::AppendTextData(nsIContent* aNode,
} }
if (frag->Is2b()) { if (frag->Is2b()) {
const PRUnichar *strStart = frag->Get2b() + aStartOffset; const char16_t *strStart = frag->Get2b() + aStartOffset;
if (aTranslateEntities) { if (aTranslateEntities) {
AppendAndTranslateEntities(Substring(strStart, strStart + length), aStr); AppendAndTranslateEntities(Substring(strStart, strStart + length), aStr);
} }
@ -276,7 +276,7 @@ nsXMLContentSerializer::AppendProcessingInstruction(nsIContent* aPI,
} }
if (!data.IsEmpty()) { if (!data.IsEmpty()) {
AppendToString(PRUnichar(' '), aStr); AppendToString(char16_t(' '), aStr);
AppendToStringConvertLF(data, aStr); AppendToStringConvertLF(data, aStr);
} }
AppendToString(NS_LITERAL_STRING("?>"), aStr); AppendToString(NS_LITERAL_STRING("?>"), aStr);
@ -362,26 +362,26 @@ nsXMLContentSerializer::AppendDoctype(nsIContent* aDocType,
AppendToString(NS_LITERAL_STRING("<!DOCTYPE "), aStr); AppendToString(NS_LITERAL_STRING("<!DOCTYPE "), aStr);
AppendToString(name, aStr); AppendToString(name, aStr);
PRUnichar quote; char16_t quote;
if (!publicId.IsEmpty()) { if (!publicId.IsEmpty()) {
AppendToString(NS_LITERAL_STRING(" PUBLIC "), aStr); AppendToString(NS_LITERAL_STRING(" PUBLIC "), aStr);
if (publicId.FindChar(PRUnichar('"')) == -1) { if (publicId.FindChar(char16_t('"')) == -1) {
quote = PRUnichar('"'); quote = char16_t('"');
} }
else { else {
quote = PRUnichar('\''); quote = char16_t('\'');
} }
AppendToString(quote, aStr); AppendToString(quote, aStr);
AppendToString(publicId, aStr); AppendToString(publicId, aStr);
AppendToString(quote, aStr); AppendToString(quote, aStr);
if (!systemId.IsEmpty()) { if (!systemId.IsEmpty()) {
AppendToString(PRUnichar(' '), aStr); AppendToString(char16_t(' '), aStr);
if (systemId.FindChar(PRUnichar('"')) == -1) { if (systemId.FindChar(char16_t('"')) == -1) {
quote = PRUnichar('"'); quote = char16_t('"');
} }
else { else {
quote = PRUnichar('\''); quote = char16_t('\'');
} }
AppendToString(quote, aStr); AppendToString(quote, aStr);
AppendToString(systemId, aStr); AppendToString(systemId, aStr);
@ -389,11 +389,11 @@ nsXMLContentSerializer::AppendDoctype(nsIContent* aDocType,
} }
} }
else if (!systemId.IsEmpty()) { else if (!systemId.IsEmpty()) {
if (systemId.FindChar(PRUnichar('"')) == -1) { if (systemId.FindChar(char16_t('"')) == -1) {
quote = PRUnichar('"'); quote = char16_t('"');
} }
else { else {
quote = PRUnichar('\''); quote = char16_t('\'');
} }
AppendToString(NS_LITERAL_STRING(" SYSTEM "), aStr); AppendToString(NS_LITERAL_STRING(" SYSTEM "), aStr);
AppendToString(quote, aStr); AppendToString(quote, aStr);
@ -404,7 +404,7 @@ nsXMLContentSerializer::AppendDoctype(nsIContent* aDocType,
if (!internalSubset.IsEmpty()) { if (!internalSubset.IsEmpty()) {
AppendToString(NS_LITERAL_STRING(" ["), aStr); AppendToString(NS_LITERAL_STRING(" ["), aStr);
AppendToString(internalSubset, aStr); AppendToString(internalSubset, aStr);
AppendToString(PRUnichar(']'), aStr); AppendToString(char16_t(']'), aStr);
} }
AppendToString(kGreaterThan, aStr); AppendToString(kGreaterThan, aStr);
@ -614,10 +614,10 @@ nsXMLContentSerializer::SerializeAttr(const nsAString& aPrefix,
bool rawAppend = mDoRaw && aDoEscapeEntities; bool rawAppend = mDoRaw && aDoEscapeEntities;
nsAString& attrString = (rawAppend) ? aStr : attrString_; nsAString& attrString = (rawAppend) ? aStr : attrString_;
attrString.Append(PRUnichar(' ')); attrString.Append(char16_t(' '));
if (!aPrefix.IsEmpty()) { if (!aPrefix.IsEmpty()) {
attrString.Append(aPrefix); attrString.Append(aPrefix);
attrString.Append(PRUnichar(':')); attrString.Append(char16_t(':'));
} }
attrString.Append(aName); attrString.Append(aName);
@ -630,7 +630,7 @@ nsXMLContentSerializer::SerializeAttr(const nsAString& aPrefix,
AppendAndTranslateEntities(aValue, attrString); AppendAndTranslateEntities(aValue, attrString);
mInAttribute = false; mInAttribute = false;
attrString.Append(PRUnichar('"')); attrString.Append(char16_t('"'));
if (rawAppend) { if (rawAppend) {
return; return;
} }
@ -650,15 +650,15 @@ nsXMLContentSerializer::SerializeAttr(const nsAString& aPrefix,
aValue.BeginReading(iCurr); aValue.BeginReading(iCurr);
aValue.EndReading(iEnd); aValue.EndReading(iEnd);
for ( ; iCurr != iEnd; iCurr.advance(uiSize) ) { for ( ; iCurr != iEnd; iCurr.advance(uiSize) ) {
const PRUnichar * buf = iCurr.get(); const char16_t * buf = iCurr.get();
uiSize = iCurr.size_forward(); uiSize = iCurr.size_forward();
for ( i = 0; i < uiSize; i++, buf++ ) { for ( i = 0; i < uiSize; i++, buf++ ) {
if ( *buf == PRUnichar('\'') ) if ( *buf == char16_t('\'') )
{ {
bIncludesSingle = true; bIncludesSingle = true;
if ( bIncludesDouble ) break; if ( bIncludesDouble ) break;
} }
else if ( *buf == PRUnichar('"') ) else if ( *buf == char16_t('"') )
{ {
bIncludesDouble = true; bIncludesDouble = true;
if ( bIncludesSingle ) break; if ( bIncludesSingle ) break;
@ -674,9 +674,9 @@ nsXMLContentSerializer::SerializeAttr(const nsAString& aPrefix,
// FALSE TRUE " FALSE // FALSE TRUE " FALSE
// TRUE FALSE ' FALSE // TRUE FALSE ' FALSE
// TRUE TRUE " TRUE // TRUE TRUE " TRUE
PRUnichar cDelimiter = char16_t cDelimiter =
(bIncludesDouble && !bIncludesSingle) ? PRUnichar('\'') : PRUnichar('"'); (bIncludesDouble && !bIncludesSingle) ? char16_t('\'') : char16_t('"');
attrString.Append(PRUnichar('=')); attrString.Append(char16_t('='));
attrString.Append(cDelimiter); attrString.Append(cDelimiter);
nsAutoString sValue(aValue); nsAutoString sValue(aValue);
sValue.ReplaceSubstring(NS_LITERAL_STRING("&"), sValue.ReplaceSubstring(NS_LITERAL_STRING("&"),
@ -904,12 +904,12 @@ nsXMLContentSerializer::AppendElementStart(Element* aElement,
AppendIndentation(aStr); AppendIndentation(aStr);
} }
else if (mAddSpace) { else if (mAddSpace) {
AppendToString(PRUnichar(' '), aStr); AppendToString(char16_t(' '), aStr);
mAddSpace = false; mAddSpace = false;
} }
} }
else if (mAddSpace) { else if (mAddSpace) {
AppendToString(PRUnichar(' '), aStr); AppendToString(char16_t(' '), aStr);
mAddSpace = false; mAddSpace = false;
} }
else { else {
@ -1015,12 +1015,12 @@ nsXMLContentSerializer::AppendElementEnd(Element* aElement,
AppendIndentation(aStr); AppendIndentation(aStr);
} }
else if (mAddSpace) { else if (mAddSpace) {
AppendToString(PRUnichar(' '), aStr); AppendToString(char16_t(' '), aStr);
mAddSpace = false; mAddSpace = false;
} }
} }
else if (mAddSpace) { else if (mAddSpace) {
AppendToString(PRUnichar(' '), aStr); AppendToString(char16_t(' '), aStr);
mAddSpace = false; mAddSpace = false;
} }
@ -1107,7 +1107,7 @@ nsXMLContentSerializer::CheckElementEnd(nsIContent * aContent,
} }
void void
nsXMLContentSerializer::AppendToString(const PRUnichar aChar, nsXMLContentSerializer::AppendToString(const char16_t aChar,
nsAString& aOutputStr) nsAString& aOutputStr)
{ {
if (mBodyOnly && !mInBody) { if (mBodyOnly && !mInBody) {
@ -1154,12 +1154,12 @@ void
nsXMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr, nsXMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr,
nsAString& aOutputStr) nsAString& aOutputStr)
{ {
nsReadingIterator<PRUnichar> done_reading; nsReadingIterator<char16_t> done_reading;
aStr.EndReading(done_reading); aStr.EndReading(done_reading);
// for each chunk of |aString|... // for each chunk of |aString|...
uint32_t advanceLength = 0; uint32_t advanceLength = 0;
nsReadingIterator<PRUnichar> iter; nsReadingIterator<char16_t> iter;
const char **entityTable = mInAttribute ? kAttrEntities : kEntities; const char **entityTable = mInAttribute ? kAttrEntities : kEntities;
@ -1167,16 +1167,16 @@ nsXMLContentSerializer::AppendAndTranslateEntities(const nsAString& aStr,
iter != done_reading; iter != done_reading;
iter.advance(int32_t(advanceLength))) { iter.advance(int32_t(advanceLength))) {
uint32_t fragmentLength = iter.size_forward(); uint32_t fragmentLength = iter.size_forward();
const PRUnichar* c = iter.get(); const char16_t* c = iter.get();
const PRUnichar* fragmentStart = c; const char16_t* fragmentStart = c;
const PRUnichar* fragmentEnd = c + fragmentLength; const char16_t* fragmentEnd = c + fragmentLength;
const char* entityText = nullptr; const char* entityText = nullptr;
advanceLength = 0; advanceLength = 0;
// for each character in this chunk, check if it // for each character in this chunk, check if it
// needs to be replaced // needs to be replaced
for (; c < fragmentEnd; c++, advanceLength++) { for (; c < fragmentEnd; c++, advanceLength++) {
PRUnichar val = *c; char16_t val = *c;
if ((val <= kGTVal) && (entityTable[val][0] != 0)) { if ((val <= kGTVal) && (entityTable[val][0] != 0)) {
entityText = entityTable[val]; entityText = entityTable[val];
break; break;
@ -1472,7 +1472,7 @@ nsXMLContentSerializer::AppendWrapped_NonWhitespaceSequence(
AppendIndentation(aOutputStr); AppendIndentation(aOutputStr);
} }
else if (mAddSpace) { else if (mAddSpace) {
aOutputStr.Append(PRUnichar(' ')); aOutputStr.Append(char16_t(' '));
mAddSpace = false; mAddSpace = false;
} }
@ -1527,7 +1527,7 @@ nsXMLContentSerializer::AppendWrapped_NonWhitespaceSequence(
AppendIndentation(aOutputStr); AppendIndentation(aOutputStr);
} }
else if (mAddSpace) { else if (mAddSpace) {
aOutputStr.Append(PRUnichar(' ')); aOutputStr.Append(char16_t(' '));
mAddSpace = false; mAddSpace = false;
} }
aOutputStr.Append(aSequenceStart, wrapPosition); aOutputStr.Append(aSequenceStart, wrapPosition);
@ -1556,7 +1556,7 @@ nsXMLContentSerializer::AppendWrapped_NonWhitespaceSequence(
} while (aPos < aEnd); } while (aPos < aEnd);
if (mAddSpace) { if (mAddSpace) {
aOutputStr.Append(PRUnichar(' ')); aOutputStr.Append(char16_t(' '));
mAddSpace = false; mAddSpace = false;
} }
aOutputStr.Append(aSequenceStart, aPos - aSequenceStart); aOutputStr.Append(aSequenceStart, aPos - aSequenceStart);

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

@ -70,9 +70,9 @@ class nsXMLContentSerializer : public nsIContentSerializer {
protected: protected:
/** /**
* Appends a PRUnichar character and increments the column position * Appends a char16_t character and increments the column position
*/ */
void AppendToString(const PRUnichar aChar, void AppendToString(const char16_t aChar,
nsAString& aOutputStr); nsAString& aOutputStr);
/** /**

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

@ -191,12 +191,12 @@ XMLHttpRequestAuthPrompt::~XMLHttpRequestAuthPrompt()
} }
NS_IMETHODIMP NS_IMETHODIMP
XMLHttpRequestAuthPrompt::Prompt(const PRUnichar* aDialogTitle, XMLHttpRequestAuthPrompt::Prompt(const char16_t* aDialogTitle,
const PRUnichar* aText, const char16_t* aText,
const PRUnichar* aPasswordRealm, const char16_t* aPasswordRealm,
uint32_t aSavePassword, uint32_t aSavePassword,
const PRUnichar* aDefaultText, const char16_t* aDefaultText,
PRUnichar** aResult, char16_t** aResult,
bool* aRetval) bool* aRetval)
{ {
*aRetval = false; *aRetval = false;
@ -204,12 +204,12 @@ XMLHttpRequestAuthPrompt::Prompt(const PRUnichar* aDialogTitle,
} }
NS_IMETHODIMP NS_IMETHODIMP
XMLHttpRequestAuthPrompt::PromptUsernameAndPassword(const PRUnichar* aDialogTitle, XMLHttpRequestAuthPrompt::PromptUsernameAndPassword(const char16_t* aDialogTitle,
const PRUnichar* aDialogText, const char16_t* aDialogText,
const PRUnichar* aPasswordRealm, const char16_t* aPasswordRealm,
uint32_t aSavePassword, uint32_t aSavePassword,
PRUnichar** aUser, char16_t** aUser,
PRUnichar** aPwd, char16_t** aPwd,
bool* aRetval) bool* aRetval)
{ {
*aRetval = false; *aRetval = false;
@ -217,11 +217,11 @@ XMLHttpRequestAuthPrompt::PromptUsernameAndPassword(const PRUnichar* aDialogTitl
} }
NS_IMETHODIMP NS_IMETHODIMP
XMLHttpRequestAuthPrompt::PromptPassword(const PRUnichar* aDialogTitle, XMLHttpRequestAuthPrompt::PromptPassword(const char16_t* aDialogTitle,
const PRUnichar* aText, const char16_t* aText,
const PRUnichar* aPasswordRealm, const char16_t* aPasswordRealm,
uint32_t aSavePassword, uint32_t aSavePassword,
PRUnichar** aPwd, char16_t** aPwd,
bool* aRetval) bool* aRetval)
{ {
*aRetval = false; *aRetval = false;
@ -653,7 +653,7 @@ nsXMLHttpRequest::AppendToResponseText(const char * aSrcBuffer,
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
PRUnichar* destBuffer = mResponseText.BeginWriting() + mResponseText.Length(); char16_t* destBuffer = mResponseText.BeginWriting() + mResponseText.Length();
int32_t totalChars = mResponseText.Length(); int32_t totalChars = mResponseText.Length();
@ -2423,7 +2423,7 @@ GetRequestBody(nsIVariant* aBody, nsIInputStream** aResult, uint64_t* aContentLe
return NS_OK; return NS_OK;
} }
PRUnichar* data = nullptr; char16_t* data = nullptr;
uint32_t len = 0; uint32_t len = 0;
rv = aBody->GetAsWStringWithSize(&len, &data); rv = aBody->GetAsWStringWithSize(&len, &data);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
@ -3475,7 +3475,7 @@ nsXMLHttpRequest::OnProgress(nsIRequest *aRequest, nsISupports *aContext, uint64
} }
NS_IMETHODIMP NS_IMETHODIMP
nsXMLHttpRequest::OnStatus(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatus, const PRUnichar *aStatusArg) nsXMLHttpRequest::OnStatus(nsIRequest *aRequest, nsISupports *aContext, nsresult aStatus, const char16_t *aStatusArg)
{ {
if (mProgressEventSink) { if (mProgressEventSink) {
mProgressEventSink->OnStatus(aRequest, aContext, aStatus, aStatusArg); mProgressEventSink->OnStatus(aRequest, aContext, aStatus, aStatusArg);

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

@ -81,7 +81,7 @@ public:
// is false, alpha will be discarded and the result will be the image // is false, alpha will be discarded and the result will be the image
// composited on black. // composited on black.
NS_IMETHOD GetInputStream(const char *aMimeType, NS_IMETHOD GetInputStream(const char *aMimeType,
const PRUnichar *aEncoderOptions, const char16_t *aEncoderOptions,
nsIInputStream **aStream) = 0; nsIInputStream **aStream) = 0;
// If this canvas context can be represented with a simple Thebes surface, // If this canvas context can be represented with a simple Thebes surface,

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

@ -194,7 +194,7 @@ NS_IMPL_ISUPPORTS1(CanvasImageCacheShutdownObserver, nsIObserver)
NS_IMETHODIMP NS_IMETHODIMP
CanvasImageCacheShutdownObserver::Observe(nsISupports *aSubject, CanvasImageCacheShutdownObserver::Observe(nsISupports *aSubject,
const char *aTopic, const char *aTopic,
const PRUnichar *aData) const char16_t *aData)
{ {
if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
delete gImageCache; delete gImageCache;

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

@ -1106,7 +1106,7 @@ CanvasRenderingContext2D::GetImageBuffer(uint8_t** aImageBuffer,
NS_IMETHODIMP NS_IMETHODIMP
CanvasRenderingContext2D::GetInputStream(const char *aMimeType, CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
const PRUnichar *aEncoderOptions, const char16_t *aEncoderOptions,
nsIInputStream **aStream) nsIInputStream **aStream)
{ {
nsCString enccid("@mozilla.org/image/encoder;2?type="); nsCString enccid("@mozilla.org/image/encoder;2?type=");
@ -2333,7 +2333,7 @@ CanvasRenderingContext2D::GetTextBaseline(nsAString& tb)
static inline void static inline void
TextReplaceWhitespaceCharacters(nsAutoString& str) TextReplaceWhitespaceCharacters(nsAutoString& str)
{ {
str.ReplaceChar("\x09\x0A\x0B\x0C\x0D", PRUnichar(' ')); str.ReplaceChar("\x09\x0A\x0B\x0C\x0D", char16_t(' '));
} }
void void
@ -2375,7 +2375,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
{ {
typedef CanvasRenderingContext2D::ContextState ContextState; typedef CanvasRenderingContext2D::ContextState ContextState;
virtual void SetText(const PRUnichar* text, int32_t length, nsBidiDirection direction) virtual void SetText(const char16_t* text, int32_t length, nsBidiDirection direction)
{ {
mFontgrp->UpdateFontList(); // ensure user font generation is current mFontgrp->UpdateFontList(); // ensure user font generation is current
mTextRun = mFontgrp->MakeTextRun(text, mTextRun = mFontgrp->MakeTextRun(text,

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

@ -395,7 +395,7 @@ public:
GraphicsFilter aFilter, GraphicsFilter aFilter,
uint32_t aFlags = RenderFlagPremultAlpha) MOZ_OVERRIDE; uint32_t aFlags = RenderFlagPremultAlpha) MOZ_OVERRIDE;
NS_IMETHOD GetInputStream(const char* aMimeType, NS_IMETHOD GetInputStream(const char* aMimeType,
const PRUnichar* aEncoderOptions, const char16_t* aEncoderOptions,
nsIInputStream **aStream) MOZ_OVERRIDE; nsIInputStream **aStream) MOZ_OVERRIDE;
NS_IMETHOD GetThebesSurface(gfxASurface **surface) MOZ_OVERRIDE; NS_IMETHOD GetThebesSurface(gfxASurface **surface) MOZ_OVERRIDE;

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

@ -235,7 +235,7 @@ ImageEncoder::GetInputStream(int32_t aWidth,
uint8_t* aImageBuffer, uint8_t* aImageBuffer,
int32_t aFormat, int32_t aFormat,
imgIEncoder* aEncoder, imgIEncoder* aEncoder,
const PRUnichar* aEncoderOptions, const char16_t* aEncoderOptions,
nsIInputStream** aStream) nsIInputStream** aStream)
{ {
nsresult rv = nsresult rv =

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

@ -61,7 +61,7 @@ public:
uint8_t* aImageBuffer, uint8_t* aImageBuffer,
int32_t aFormat, int32_t aFormat,
imgIEncoder* aEncoder, imgIEncoder* aEncoder,
const PRUnichar* aEncoderOptions, const char16_t* aEncoderOptions,
nsIInputStream** aStream); nsIInputStream** aStream);
private: private:

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

@ -73,7 +73,7 @@ using namespace mozilla::layers;
NS_IMETHODIMP NS_IMETHODIMP
WebGLMemoryPressureObserver::Observe(nsISupports* aSubject, WebGLMemoryPressureObserver::Observe(nsISupports* aSubject,
const char* aTopic, const char* aTopic,
const PRUnichar* aSomeData) const char16_t* aSomeData)
{ {
if (strcmp(aTopic, "memory-pressure")) if (strcmp(aTopic, "memory-pressure"))
return NS_OK; return NS_OK;
@ -789,7 +789,7 @@ WebGLContext::GetImageBuffer(uint8_t** aImageBuffer, int32_t* aFormat)
NS_IMETHODIMP NS_IMETHODIMP
WebGLContext::GetInputStream(const char* aMimeType, WebGLContext::GetInputStream(const char* aMimeType,
const PRUnichar* aEncoderOptions, const char16_t* aEncoderOptions,
nsIInputStream **aStream) nsIInputStream **aStream)
{ {
NS_ASSERTION(gl, "GetInputStream on invalid context?"); NS_ASSERTION(gl, "GetInputStream on invalid context?");

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

@ -171,7 +171,7 @@ public:
uint32_t aFlags = RenderFlagPremultAlpha) MOZ_OVERRIDE; uint32_t aFlags = RenderFlagPremultAlpha) MOZ_OVERRIDE;
virtual void GetImageBuffer(uint8_t** aImageBuffer, int32_t* aFormat); virtual void GetImageBuffer(uint8_t** aImageBuffer, int32_t* aFormat);
NS_IMETHOD GetInputStream(const char* aMimeType, NS_IMETHOD GetInputStream(const char* aMimeType,
const PRUnichar* aEncoderOptions, const char16_t* aEncoderOptions,
nsIInputStream **aStream) MOZ_OVERRIDE; nsIInputStream **aStream) MOZ_OVERRIDE;
NS_IMETHOD GetThebesSurface(gfxASurface **surface) MOZ_OVERRIDE; NS_IMETHOD GetThebesSurface(gfxASurface **surface) MOZ_OVERRIDE;
mozilla::TemporaryRef<mozilla::gfx::SourceSurface> GetSurfaceSnapshot() MOZ_OVERRIDE; mozilla::TemporaryRef<mozilla::gfx::SourceSurface> GetSurfaceSnapshot() MOZ_OVERRIDE;
@ -954,7 +954,7 @@ protected:
bool ValidateStencilParamsForDrawCall(); bool ValidateStencilParamsForDrawCall();
bool ValidateGLSLVariableName(const nsAString& name, const char *info); bool ValidateGLSLVariableName(const nsAString& name, const char *info);
bool ValidateGLSLCharacter(PRUnichar c); bool ValidateGLSLCharacter(char16_t c);
bool ValidateGLSLString(const nsAString& string, const char *info); bool ValidateGLSLString(const nsAString& string, const char *info);
bool ValidateTexImage2DFormat(GLenum format, const char* info); bool ValidateTexImage2DFormat(GLenum format, const char* info);
bool ValidateTexImage2DTarget(GLenum target, GLsizei width, GLsizei height, const char* info); bool ValidateTexImage2DTarget(GLenum target, GLsizei width, GLsizei height, const char* info);

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

@ -36,7 +36,7 @@ namespace mozilla {
// http://trac.webkit.org/browser/trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp?rev=93625#L121 // http://trac.webkit.org/browser/trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp?rev=93625#L121
// Note that some modifications were done to adapt it to Mozilla. // Note that some modifications were done to adapt it to Mozilla.
/****** BEGIN CODE TAKEN FROM WEBKIT ******/ /****** BEGIN CODE TAKEN FROM WEBKIT ******/
bool WebGLContext::ValidateGLSLCharacter(PRUnichar c) bool WebGLContext::ValidateGLSLCharacter(char16_t c)
{ {
// Printing characters are valid except " $ ` @ \ ' DEL. // Printing characters are valid except " $ ` @ \ ' DEL.
if (c >= 32 && c <= 126 && if (c >= 32 && c <= 126 &&
@ -68,7 +68,7 @@ namespace mozilla {
parse(); parse();
} }
const nsTArray<PRUnichar>& result() const nsTArray<char16_t>& result()
{ {
return m_result; return m_result;
} }
@ -94,9 +94,9 @@ namespace mozilla {
} }
} }
void process(PRUnichar); void process(char16_t);
bool peek(PRUnichar& character) bool peek(char16_t& character)
{ {
if (m_current + 1 >= m_end) if (m_current + 1 >= m_end)
return false; return false;
@ -104,7 +104,7 @@ namespace mozilla {
return true; return true;
} }
PRUnichar current() char16_t current()
{ {
//ASSERT(m_position < m_length); //ASSERT(m_position < m_length);
return *m_current; return *m_current;
@ -115,13 +115,13 @@ namespace mozilla {
++m_current; ++m_current;
} }
bool isNewline(PRUnichar character) bool isNewline(char16_t character)
{ {
// Don't attempt to canonicalize newline related characters. // Don't attempt to canonicalize newline related characters.
return (character == '\n' || character == '\r'); return (character == '\n' || character == '\r');
} }
void emit(PRUnichar character) void emit(char16_t character)
{ {
m_result[m_position++] = character; m_result[m_position++] = character;
} }
@ -151,13 +151,13 @@ namespace mozilla {
}; };
ParseState m_parseState; ParseState m_parseState;
const PRUnichar* m_end; const char16_t* m_end;
const PRUnichar* m_current; const char16_t* m_current;
size_t m_position; size_t m_position;
nsTArray<PRUnichar> m_result; nsTArray<char16_t> m_result;
}; };
void StripComments::process(PRUnichar c) void StripComments::process(char16_t c)
{ {
if (isNewline(c)) { if (isNewline(c)) {
// No matter what state we are in, pass through newlines // No matter what state we are in, pass through newlines
@ -170,7 +170,7 @@ namespace mozilla {
return; return;
} }
PRUnichar temp = 0; char16_t temp = 0;
switch (m_parseState) { switch (m_parseState) {
case BeginningOfLine: case BeginningOfLine:
// If it's an ASCII space. // If it's an ASCII space.

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

@ -369,7 +369,7 @@ static nsresult GenerateFlatTextContent(nsRange* aRange,
else else
AppendString(aString, content); AppendString(aString, content);
} else if (IsContentBR(content)) } else if (IsContentBR(content))
aString.Append(PRUnichar('\n')); aString.Append(char16_t('\n'));
} }
ConvertToNativeNewlines(aString); ConvertToNativeNewlines(aString);
return NS_OK; return NS_OK;

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

@ -805,7 +805,7 @@ nsDOMDataTransfer::ConvertFromVariant(nsIVariant* aVariant,
return true; return true;
} }
PRUnichar* chrs; char16_t* chrs;
uint32_t len = 0; uint32_t len = 0;
nsresult rv = aVariant->GetAsWStringWithSize(&len, &chrs); nsresult rv = aVariant->GetAsWStringWithSize(&len, &chrs);
if (NS_FAILED(rv)) if (NS_FAILED(rv))

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

@ -943,7 +943,7 @@ nsEventStateManager::Shutdown()
NS_IMETHODIMP NS_IMETHODIMP
nsEventStateManager::Observe(nsISupports *aSubject, nsEventStateManager::Observe(nsISupports *aSubject,
const char *aTopic, const char *aTopic,
const PRUnichar *someData) const char16_t *someData)
{ {
if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
Shutdown(); Shutdown();

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

@ -591,7 +591,7 @@ protected:
* of parameters in aParams. * of parameters in aParams.
*/ */
void ReportLoadError(const char* aMsg, void ReportLoadError(const char* aMsg,
const PRUnichar** aParams = nullptr, const char16_t** aParams = nullptr,
uint32_t aParamCount = 0); uint32_t aParamCount = 0);
/** /**

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

@ -1951,7 +1951,7 @@ NS_IMETHODIMP
HTMLFormElement::OnStatusChange(nsIWebProgress* aWebProgress, HTMLFormElement::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsIRequest* aRequest,
nsresult aStatus, nsresult aStatus,
const PRUnichar* aMessage) const char16_t* aMessage)
{ {
NS_NOTREACHED("notification excluded in AddProgressListener(...)"); NS_NOTREACHED("notification excluded in AddProgressListener(...)");
return NS_OK; return NS_OK;

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

@ -212,9 +212,9 @@ HTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
return NS_OK; return NS_OK;
} }
static const PRUnichar sAster('*'); static const char16_t sAster('*');
static const PRUnichar sPercent('%'); static const char16_t sPercent('%');
static const PRUnichar sComma(','); static const char16_t sComma(',');
nsAutoString spec(aValue); nsAutoString spec(aValue);
// remove whitespace (Bug 33699) and quotation marks (bug 224598) // remove whitespace (Bug 33699) and quotation marks (bug 224598)
@ -262,7 +262,7 @@ HTMLFrameSetElement::ParseRowCol(const nsAString & aValue,
specs[i].mValue = 0; specs[i].mValue = 0;
if (end > start) { if (end > start) {
int32_t numberEnd = end; int32_t numberEnd = end;
PRUnichar ch = spec.CharAt(numberEnd - 1); char16_t ch = spec.CharAt(numberEnd - 1);
if (sAster == ch) { if (sAster == ch) {
specs[i].mUnit = eFramesetUnit_Relative; specs[i].mUnit = eFramesetUnit_Relative;
numberEnd--; numberEnd--;

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

@ -1076,7 +1076,7 @@ UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir)
} }
NS_IMETHODIMP NS_IMETHODIMP
UploadLastDir::Observe(nsISupports* aSubject, char const* aTopic, PRUnichar const* aData) UploadLastDir::Observe(nsISupports* aSubject, char const* aTopic, char16_t const* aData)
{ {
if (strcmp(aTopic, "browser:purge-session-history") == 0) { if (strcmp(aTopic, "browser:purge-session-history") == 0) {
nsCOMPtr<nsIContentPrefService2> contentPrefService = nsCOMPtr<nsIContentPrefService2> contentPrefService =
@ -2209,7 +2209,7 @@ HTMLInputElement::MozGetFileNameArray(nsTArray< nsString >& aArray)
NS_IMETHODIMP NS_IMETHODIMP
HTMLInputElement::MozGetFileNameArray(uint32_t* aLength, PRUnichar*** aFileNames) HTMLInputElement::MozGetFileNameArray(uint32_t* aLength, char16_t*** aFileNames)
{ {
if (!nsContentUtils::IsCallerChrome()) { if (!nsContentUtils::IsCallerChrome()) {
// Since this function returns full paths it's important that normal pages // Since this function returns full paths it's important that normal pages
@ -2221,8 +2221,8 @@ HTMLInputElement::MozGetFileNameArray(uint32_t* aLength, PRUnichar*** aFileNames
MozGetFileNameArray(array); MozGetFileNameArray(array);
*aLength = array.Length(); *aLength = array.Length();
PRUnichar** ret = char16_t** ret =
static_cast<PRUnichar**>(NS_Alloc(*aLength * sizeof(PRUnichar*))); static_cast<char16_t**>(NS_Alloc(*aLength * sizeof(char16_t*)));
if (!ret) { if (!ret) {
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
@ -2269,7 +2269,7 @@ HTMLInputElement::MozSetFileNameArray(const Sequence< nsString >& aFileNames)
} }
NS_IMETHODIMP NS_IMETHODIMP
HTMLInputElement::MozSetFileNameArray(const PRUnichar** aFileNames, uint32_t aLength) HTMLInputElement::MozSetFileNameArray(const char16_t** aFileNames, uint32_t aLength)
{ {
if (!nsContentUtils::IsCallerChrome()) { if (!nsContentUtils::IsCallerChrome()) {
// setting the value of a "FILE" input widget requires chrome privilege // setting the value of a "FILE" input widget requires chrome privilege
@ -2484,7 +2484,7 @@ HTMLInputElement::GetDisplayFileName(nsAString& aValue) const
nsString count; nsString count;
count.AppendInt(mFiles.Length()); count.AppendInt(mFiles.Length());
const PRUnichar* params[] = { count.get() }; const char16_t* params[] = { count.get() };
nsContentUtils::FormatLocalizedString(nsContentUtils::eFORMS_PROPERTIES, nsContentUtils::FormatLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"XFilesSelected", params, value); "XFilesSelected", params, value);
} }
@ -4439,14 +4439,14 @@ HTMLInputElement::SanitizeValue(nsAString& aValue)
case NS_FORM_INPUT_TEL: case NS_FORM_INPUT_TEL:
case NS_FORM_INPUT_PASSWORD: case NS_FORM_INPUT_PASSWORD:
{ {
PRUnichar crlf[] = { PRUnichar('\r'), PRUnichar('\n'), 0 }; char16_t crlf[] = { char16_t('\r'), char16_t('\n'), 0 };
aValue.StripChars(crlf); aValue.StripChars(crlf);
} }
break; break;
case NS_FORM_INPUT_EMAIL: case NS_FORM_INPUT_EMAIL:
case NS_FORM_INPUT_URL: case NS_FORM_INPUT_URL:
{ {
PRUnichar crlf[] = { PRUnichar('\r'), PRUnichar('\n'), 0 }; char16_t crlf[] = { char16_t('\r'), char16_t('\n'), 0 };
aValue.StripChars(crlf); aValue.StripChars(crlf);
aValue = nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespace>(aValue); aValue = nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespace>(aValue);
@ -6555,7 +6555,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
strMaxLength.AppendInt(maxLength); strMaxLength.AppendInt(maxLength);
strTextLength.AppendInt(textLength); strTextLength.AppendInt(textLength);
const PRUnichar* params[] = { strMaxLength.get(), strTextLength.get() }; const char16_t* params[] = { strMaxLength.get(), strTextLength.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES, rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationTextTooLong", "FormValidationTextTooLong",
params, message); params, message);
@ -6614,7 +6614,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
if (title.Length() > nsIConstraintValidation::sContentSpecifiedMaxLengthMessage) { if (title.Length() > nsIConstraintValidation::sContentSpecifiedMaxLengthMessage) {
title.Truncate(nsIConstraintValidation::sContentSpecifiedMaxLengthMessage); title.Truncate(nsIConstraintValidation::sContentSpecifiedMaxLengthMessage);
} }
const PRUnichar* params[] = { title.get() }; const char16_t* params[] = { title.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES, rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationPatternMismatchWithTitle", "FormValidationPatternMismatchWithTitle",
params, message); params, message);
@ -6643,7 +6643,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
NS_NOTREACHED("Unexpected input type"); NS_NOTREACHED("Unexpected input type");
} }
const PRUnichar* params[] = { maxStr.get() }; const char16_t* params[] = { maxStr.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES, rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationRangeOverflow", "FormValidationRangeOverflow",
params, message); params, message);
@ -6670,7 +6670,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
NS_NOTREACHED("Unexpected input type"); NS_NOTREACHED("Unexpected input type");
} }
const PRUnichar* params[] = { minStr.get() }; const char16_t* params[] = { minStr.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES, rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationRangeUnderflow", "FormValidationRangeUnderflow",
params, message); params, message);
@ -6710,12 +6710,12 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
ConvertNumberToString(valueHigh, valueHighStr); ConvertNumberToString(valueHigh, valueHighStr);
if (valueLowStr.Equals(valueHighStr)) { if (valueLowStr.Equals(valueHighStr)) {
const PRUnichar* params[] = { valueLowStr.get() }; const char16_t* params[] = { valueLowStr.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES, rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationStepMismatchOneValue", "FormValidationStepMismatchOneValue",
params, message); params, message);
} else { } else {
const PRUnichar* params[] = { valueLowStr.get(), valueHighStr.get() }; const char16_t* params[] = { valueLowStr.get(), valueHighStr.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES, rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationStepMismatch", "FormValidationStepMismatch",
params, message); params, message);
@ -6724,7 +6724,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
nsAutoString valueLowStr; nsAutoString valueLowStr;
ConvertNumberToString(valueLow, valueLowStr); ConvertNumberToString(valueLow, valueLowStr);
const PRUnichar* params[] = { valueLowStr.get() }; const char16_t* params[] = { valueLowStr.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES, rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationStepMismatchOneValue", "FormValidationStepMismatchOneValue",
params, message); params, message);
@ -6807,7 +6807,7 @@ HTMLInputElement::IsValidEmailAddress(const nsAString& aValue)
// Parsing the username. // Parsing the username.
for (; i < atPos; ++i) { for (; i < atPos; ++i) {
PRUnichar c = value[i]; char16_t c = value[i];
// The username characters have to be in this list to be valid. // The username characters have to be in this list to be valid.
if (!(nsCRT::IsAsciiAlpha(c) || nsCRT::IsAsciiDigit(c) || if (!(nsCRT::IsAsciiAlpha(c) || nsCRT::IsAsciiDigit(c) ||
@ -6829,7 +6829,7 @@ HTMLInputElement::IsValidEmailAddress(const nsAString& aValue)
// Parsing the domain name. // Parsing the domain name.
for (; i < length; ++i) { for (; i < length; ++i) {
PRUnichar c = value[i]; char16_t c = value[i];
if (c == '.') { if (c == '.') {
// A dot can't follow a dot or a dash. // A dot can't follow a dot or a dash.

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

@ -1191,7 +1191,7 @@ protected:
/** /**
* The current value of the input if it has been changed from the default * The current value of the input if it has been changed from the default
*/ */
PRUnichar* mValue; char16_t* mValue;
/** /**
* The state of the text editor associated with the text/password input * The state of the text editor associated with the text/password input
*/ */

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

@ -271,7 +271,7 @@ NS_IMPL_ISUPPORTS5(HTMLMediaElement::MediaLoadListener, nsIRequestObserver,
NS_IMETHODIMP NS_IMETHODIMP
HTMLMediaElement::MediaLoadListener::Observe(nsISupports* aSubject, HTMLMediaElement::MediaLoadListener::Observe(nsISupports* aSubject,
const char* aTopic, const PRUnichar* aData) const char* aTopic, const char16_t* aData)
{ {
nsContentUtils::UnregisterShutdownObserver(this); nsContentUtils::UnregisterShutdownObserver(this);
@ -281,7 +281,7 @@ HTMLMediaElement::MediaLoadListener::Observe(nsISupports* aSubject,
} }
void HTMLMediaElement::ReportLoadError(const char* aMsg, void HTMLMediaElement::ReportLoadError(const char* aMsg,
const PRUnichar** aParams, const char16_t** aParams,
uint32_t aParamCount) uint32_t aParamCount)
{ {
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
@ -335,7 +335,7 @@ NS_IMETHODIMP HTMLMediaElement::MediaLoadListener::OnStartRequest(nsIRequest* aR
code.AppendInt(responseStatus); code.AppendInt(responseStatus);
nsAutoString src; nsAutoString src;
element->GetCurrentSrc(src); element->GetCurrentSrc(src);
const PRUnichar* params[] = { code.get(), src.get() }; const char16_t* params[] = { code.get(), src.get() };
element->ReportLoadError("MediaLoadHttpError", params, ArrayLength(params)); element->ReportLoadError("MediaLoadHttpError", params, ArrayLength(params));
return NS_BINDING_ABORTED; return NS_BINDING_ABORTED;
} }
@ -819,7 +819,7 @@ void HTMLMediaElement::SelectResource()
return; return;
} }
} else { } else {
const PRUnichar* params[] = { src.get() }; const char16_t* params[] = { src.get() };
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params)); ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
} }
NoSupportedMediaSourceError(); NoSupportedMediaSourceError();
@ -901,7 +901,7 @@ void HTMLMediaElement::LoadFromSourceChildren()
if (child->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type) && if (child->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type) &&
GetCanPlay(type) == CANPLAY_NO) { GetCanPlay(type) == CANPLAY_NO) {
DispatchAsyncSourceError(child); DispatchAsyncSourceError(child);
const PRUnichar* params[] = { type.get(), src.get() }; const char16_t* params[] = { type.get(), src.get() };
ReportLoadError("MediaLoadUnsupportedTypeAttribute", params, ArrayLength(params)); ReportLoadError("MediaLoadUnsupportedTypeAttribute", params, ArrayLength(params));
continue; continue;
} }
@ -913,7 +913,7 @@ void HTMLMediaElement::LoadFromSourceChildren()
nsIPresShell* presShell = OwnerDoc()->GetShell(); nsIPresShell* presShell = OwnerDoc()->GetShell();
if (presShell && !mediaList->Matches(presShell->GetPresContext(), nullptr)) { if (presShell && !mediaList->Matches(presShell->GetPresContext(), nullptr)) {
DispatchAsyncSourceError(child); DispatchAsyncSourceError(child);
const PRUnichar* params[] = { media.get(), src.get() }; const char16_t* params[] = { media.get(), src.get() };
ReportLoadError("MediaLoadSourceMediaNotMatched", params, ArrayLength(params)); ReportLoadError("MediaLoadSourceMediaNotMatched", params, ArrayLength(params));
continue; continue;
} }
@ -926,7 +926,7 @@ void HTMLMediaElement::LoadFromSourceChildren()
NewURIFromString(src, getter_AddRefs(uri)); NewURIFromString(src, getter_AddRefs(uri));
if (!uri) { if (!uri) {
DispatchAsyncSourceError(child); DispatchAsyncSourceError(child);
const PRUnichar* params[] = { src.get() }; const char16_t* params[] = { src.get() };
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params)); ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
continue; continue;
} }
@ -1121,7 +1121,7 @@ nsresult HTMLMediaElement::LoadResource()
nsCString specUTF8; nsCString specUTF8;
mLoadingSrc->GetSpec(specUTF8); mLoadingSrc->GetSpec(specUTF8);
NS_ConvertUTF8toUTF16 spec(specUTF8); NS_ConvertUTF8toUTF16 spec(specUTF8);
const PRUnichar* params[] = { spec.get() }; const char16_t* params[] = { spec.get() };
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params)); ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
return rv; return rv;
} }
@ -1136,7 +1136,7 @@ nsresult HTMLMediaElement::LoadResource()
nsCString specUTF8; nsCString specUTF8;
mLoadingSrc->GetSpec(specUTF8); mLoadingSrc->GetSpec(specUTF8);
NS_ConvertUTF8toUTF16 spec(specUTF8); NS_ConvertUTF8toUTF16 spec(specUTF8);
const PRUnichar* params[] = { spec.get() }; const char16_t* params[] = { spec.get() };
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params)); ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
return rv; return rv;
} }
@ -2548,7 +2548,7 @@ nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel* aChannel,
nsAutoString src; nsAutoString src;
GetCurrentSrc(src); GetCurrentSrc(src);
NS_ConvertUTF8toUTF16 mimeUTF16(mimeType); NS_ConvertUTF8toUTF16 mimeUTF16(mimeType);
const PRUnichar* params[] = { mimeUTF16.get(), src.get() }; const char16_t* params[] = { mimeUTF16.get(), src.get() };
ReportLoadError("MediaLoadUnsupportedMimeType", params, ArrayLength(params)); ReportLoadError("MediaLoadUnsupportedMimeType", params, ArrayLength(params));
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
@ -2921,7 +2921,7 @@ void HTMLMediaElement::DecodeError()
{ {
nsAutoString src; nsAutoString src;
GetCurrentSrc(src); GetCurrentSrc(src);
const PRUnichar* params[] = { src.get() }; const char16_t* params[] = { src.get() };
ReportLoadError("MediaLoadDecodeError", params, ArrayLength(params)); ReportLoadError("MediaLoadDecodeError", params, ArrayLength(params));
if (mDecoder) { if (mDecoder) {
@ -3460,7 +3460,7 @@ void HTMLMediaElement::DoRemoveSelfReference()
} }
nsresult HTMLMediaElement::Observe(nsISupports* aSubject, nsresult HTMLMediaElement::Observe(nsISupports* aSubject,
const char* aTopic, const PRUnichar* aData) const char* aTopic, const char16_t* aData)
{ {
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE); NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);

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

@ -1390,7 +1390,7 @@ HTMLTextAreaElement::GetValidationMessage(nsAString& aValidationMessage,
strMaxLength.AppendInt(maxLength); strMaxLength.AppendInt(maxLength);
strTextLength.AppendInt(textLength); strTextLength.AppendInt(textLength);
const PRUnichar* params[] = { strMaxLength.get(), strTextLength.get() }; const char16_t* params[] = { strMaxLength.get(), strTextLength.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES, rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationTextTooLong", "FormValidationTextTooLong",
params, message); params, message);

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

@ -183,22 +183,22 @@ bool nsDOMStringMap::DataPropToAttr(const nsAString& aProp,
// in the range "a" to "z". // in the range "a" to "z".
// Replace capital characters with "-" followed by lower case character. // Replace capital characters with "-" followed by lower case character.
// Otherwise, simply append character to attribute name. // Otherwise, simply append character to attribute name.
const PRUnichar* start = aProp.BeginReading(); const char16_t* start = aProp.BeginReading();
const PRUnichar* end = aProp.EndReading(); const char16_t* end = aProp.EndReading();
const PRUnichar* cur = start; const char16_t* cur = start;
for (; cur < end; ++cur) { for (; cur < end; ++cur) {
const PRUnichar* next = cur + 1; const char16_t* next = cur + 1;
if (PRUnichar('-') == *cur && next < end && if (char16_t('-') == *cur && next < end &&
PRUnichar('a') <= *next && *next <= PRUnichar('z')) { char16_t('a') <= *next && *next <= char16_t('z')) {
// Syntax error if character following "-" is in range "a" to "z". // Syntax error if character following "-" is in range "a" to "z".
return false; return false;
} }
if (PRUnichar('A') <= *cur && *cur <= PRUnichar('Z')) { if (char16_t('A') <= *cur && *cur <= char16_t('Z')) {
// Append the characters in the range [start, cur) // Append the characters in the range [start, cur)
aResult.Append(start, cur - start); aResult.Append(start, cur - start);
// Uncamel-case characters in the range of "A" to "Z". // Uncamel-case characters in the range of "A" to "Z".
aResult.Append(PRUnichar('-')); aResult.Append(char16_t('-'));
aResult.Append(*cur - 'A' + 'a'); aResult.Append(*cur - 'A' + 'a');
start = next; // We've already appended the thing at *cur start = next; // We've already appended the thing at *cur
} }
@ -223,8 +223,8 @@ bool nsDOMStringMap::AttrToDataProp(const nsAString& aAttr,
} }
// Start reading attribute from first character after "data-". // Start reading attribute from first character after "data-".
const PRUnichar* cur = aAttr.BeginReading() + 5; const char16_t* cur = aAttr.BeginReading() + 5;
const PRUnichar* end = aAttr.EndReading(); const char16_t* end = aAttr.EndReading();
// Don't try to mess with aResult's capacity: the probably-no-op SetCapacity() // Don't try to mess with aResult's capacity: the probably-no-op SetCapacity()
// call is not that fast. // call is not that fast.
@ -234,9 +234,9 @@ bool nsDOMStringMap::AttrToDataProp(const nsAString& aAttr,
// "z" then replace with upper case letter. // "z" then replace with upper case letter.
// Otherwise append character to property name. // Otherwise append character to property name.
for (; cur < end; ++cur) { for (; cur < end; ++cur) {
const PRUnichar* next = cur + 1; const char16_t* next = cur + 1;
if (PRUnichar('-') == *cur && next < end && if (char16_t('-') == *cur && next < end &&
PRUnichar('a') <= *next && *next <= PRUnichar('z')) { char16_t('a') <= *next && *next <= char16_t('z')) {
// Upper case the lower case letters that follow a "-". // Upper case the lower case letters that follow a "-".
aResult.Append(*next - 'a' + 'A'); aResult.Append(*next - 'a' + 'A');
// Consume character to account for "-" character. // Consume character to account for "-" character.

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

@ -45,7 +45,7 @@ using mozilla::dom::EncodingUtils;
static void static void
SendJSWarning(nsIDocument* aDocument, SendJSWarning(nsIDocument* aDocument,
const char* aWarningName, const char* aWarningName,
const PRUnichar** aWarningArgs, uint32_t aWarningArgsLen) const char16_t** aWarningArgs, uint32_t aWarningArgsLen)
{ {
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag, nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("HTML"), aDocument, NS_LITERAL_CSTRING("HTML"), aDocument,
@ -232,7 +232,7 @@ HandleMailtoSubject(nsCString& aPath) {
"brandShortName", brandName); "brandShortName", brandName);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return; return;
const PRUnichar *formatStrings[] = { brandName.get() }; const char16_t *formatStrings[] = { brandName.get() };
nsXPIDLString subjectStr; nsXPIDLString subjectStr;
rv = nsContentUtils::FormatLocalizedString( rv = nsContentUtils::FormatLocalizedString(
nsContentUtils::eFORMS_PROPERTIES, nsContentUtils::eFORMS_PROPERTIES,
@ -354,7 +354,7 @@ nsresult
nsFSURLEncoded::URLEncode(const nsAString& aStr, nsCString& aEncoded) nsFSURLEncoded::URLEncode(const nsAString& aStr, nsCString& aEncoded)
{ {
// convert to CRLF breaks // convert to CRLF breaks
PRUnichar* convertedBuf = char16_t* convertedBuf =
nsLinebreakConverter::ConvertUnicharLineBreaks(PromiseFlatString(aStr).get(), nsLinebreakConverter::ConvertUnicharLineBreaks(PromiseFlatString(aStr).get(),
nsLinebreakConverter::eLinebreakAny, nsLinebreakConverter::eLinebreakAny,
nsLinebreakConverter::eLinebreakNet); nsLinebreakConverter::eLinebreakNet);
@ -712,7 +712,7 @@ nsEncodingFormSubmission::nsEncodingFormSubmission(const nsACString& aCharset,
if (!(charset.EqualsLiteral("UTF-8") || charset.EqualsLiteral("gb18030"))) { if (!(charset.EqualsLiteral("UTF-8") || charset.EqualsLiteral("gb18030"))) {
NS_ConvertUTF8toUTF16 charsetUtf16(charset); NS_ConvertUTF8toUTF16 charsetUtf16(charset);
const PRUnichar* charsetPtr = charsetUtf16.get(); const char16_t* charsetPtr = charsetUtf16.get();
SendJSWarning(aOriginatingElement ? aOriginatingElement->GetOwnerDocument() SendJSWarning(aOriginatingElement ? aOriginatingElement->GetOwnerDocument()
: nullptr, : nullptr,
"CannotEncodeAllUnicode", "CannotEncodeAllUnicode",
@ -784,7 +784,7 @@ GetSubmitCharset(nsGenericHTMLElement* aForm,
int32_t spPos=0; int32_t spPos=0;
// get charset from charsets one by one // get charset from charsets one by one
do { do {
spPos = acceptCharsetValue.FindChar(PRUnichar(' '), offset); spPos = acceptCharsetValue.FindChar(char16_t(' '), offset);
int32_t cnt = ((-1==spPos)?(charsetLen-offset):(spPos-offset)); int32_t cnt = ((-1==spPos)?(charsetLen-offset):(spPos-offset));
if (cnt > 0) { if (cnt > 0) {
nsAutoString uCharset; nsAutoString uCharset;
@ -874,7 +874,7 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
} else { } else {
aForm->GetAttr(kNameSpaceID_None, nsGkAtoms::enctype, enctypeStr); aForm->GetAttr(kNameSpaceID_None, nsGkAtoms::enctype, enctypeStr);
} }
const PRUnichar* enctypeStrPtr = enctypeStr.get(); const char16_t* enctypeStrPtr = enctypeStr.get();
SendJSWarning(doc, "ForgotPostWarning", SendJSWarning(doc, "ForgotPostWarning",
&enctypeStrPtr, 1); &enctypeStrPtr, 1);
} }

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

@ -138,7 +138,7 @@ void GEUS_ElementCreated(nsINodeInfo *aNodeInfo)
bool GEUS_enum_func(nsHashKey *aKey, void *aData, void *aClosure) bool GEUS_enum_func(nsHashKey *aKey, void *aData, void *aClosure)
{ {
const PRUnichar *name_chars = ((nsStringKey *)aKey)->GetString(); const char16_t *name_chars = ((nsStringKey *)aKey)->GetString();
NS_ConvertUTF16toUTF8 name(name_chars); NS_ConvertUTF16toUTF8 name(name_chars);
printf ("%s %d\n", name.get(), aData); printf ("%s %d\n", name.get(), aData);
@ -1838,9 +1838,9 @@ nsGenericHTMLElement::GetURIListAttr(nsIAtom* aAttr, nsAString& aResult)
nsCOMPtr<nsIURI> baseURI = GetBaseURI(); nsCOMPtr<nsIURI> baseURI = GetBaseURI();
// Value contains relative URIs split on spaces (U+0020) // Value contains relative URIs split on spaces (U+0020)
const PRUnichar *start = value.BeginReading(); const char16_t *start = value.BeginReading();
const PRUnichar *end = value.EndReading(); const char16_t *end = value.EndReading();
const PRUnichar *iter = start; const char16_t *iter = start;
for (;;) { for (;;) {
if (iter < end && *iter != ' ') { if (iter < end && *iter != ' ') {
++iter; ++iter;
@ -1849,7 +1849,7 @@ nsGenericHTMLElement::GetURIListAttr(nsIAtom* aAttr, nsAString& aResult)
++start; ++start;
if (iter != start) { if (iter != start) {
if (!aResult.IsEmpty()) if (!aResult.IsEmpty())
aResult.Append(PRUnichar(' ')); aResult.Append(char16_t(' '));
const nsSubstring& uriPart = Substring(start, iter); const nsSubstring& uriPart = Substring(start, iter);
nsCOMPtr<nsIURI> attrURI; nsCOMPtr<nsIURI> attrURI;
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(attrURI), nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(attrURI),

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

@ -427,7 +427,7 @@ NS_IMETHODIMP
nsHTMLDNSPrefetch::nsDeferrals::OnStatusChange(nsIWebProgress* aWebProgress, nsHTMLDNSPrefetch::nsDeferrals::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest, nsIRequest* aRequest,
nsresult aStatus, nsresult aStatus,
const PRUnichar* aMessage) const char16_t* aMessage)
{ {
return NS_OK; return NS_OK;
} }
@ -445,7 +445,7 @@ nsHTMLDNSPrefetch::nsDeferrals::OnSecurityChange(nsIWebProgress *aWebProgress,
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLDNSPrefetch::nsDeferrals::Observe(nsISupports *subject, nsHTMLDNSPrefetch::nsDeferrals::Observe(nsISupports *subject,
const char *topic, const char *topic,
const PRUnichar *data) const char16_t *data)
{ {
if (!strcmp(topic, "xpcom-shutdown")) if (!strcmp(topic, "xpcom-shutdown"))
Flush(); Flush();

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

@ -1841,7 +1841,7 @@ nsTextEditorState::SetValue(const nsAString& aValue, bool aUserInput,
// Unfortunately aValue is declared const, so we have to copy // Unfortunately aValue is declared const, so we have to copy
// in order to do this substitution. // in order to do this substitution.
nsString newValue(aValue); nsString newValue(aValue);
if (aValue.FindChar(PRUnichar('\r')) != -1) { if (aValue.FindChar(char16_t('\r')) != -1) {
nsContentUtils::PlatformToDOMLineBreaks(newValue); nsContentUtils::PlatformToDOMLineBreaks(newValue);
} }

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

@ -537,7 +537,7 @@ ImageDocument::OnStopRequest(imgIRequest *aRequest,
nsAutoCString src; nsAutoCString src;
mDocumentURI->GetSpec(src); mDocumentURI->GetSpec(src);
NS_ConvertUTF8toUTF16 srcString(src); NS_ConvertUTF8toUTF16 srcString(src);
const PRUnichar* formatString[] = { srcString.get() }; const char16_t* formatString[] = { srcString.get() };
nsXPIDLString errorMsg; nsXPIDLString errorMsg;
NS_NAMED_LITERAL_STRING(str, "InvalidImage"); NS_NAMED_LITERAL_STRING(str, "InvalidImage");
mStringBundle->FormatStringFromName(str.get(), formatString, 1, mStringBundle->FormatStringFromName(str.get(), formatString, 1,
@ -743,7 +743,7 @@ ImageDocument::UpdateTitleAndCharset()
nsAutoString ratioStr; nsAutoString ratioStr;
ratioStr.AppendInt(NSToCoordFloor(GetRatio() * 100)); ratioStr.AppendInt(NSToCoordFloor(GetRatio() * 100));
const PRUnichar* formatString[1] = { ratioStr.get() }; const char16_t* formatString[1] = { ratioStr.get() };
mStringBundle->FormatStringFromName(MOZ_UTF16("ScaledImage"), mStringBundle->FormatStringFromName(MOZ_UTF16("ScaledImage"),
formatString, 1, formatString, 1,
getter_Copies(status)); getter_Copies(status));

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

@ -351,14 +351,14 @@ MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
heightStr.AppendInt(aHeight); heightStr.AppendInt(aHeight);
// If we got a filename, display it // If we got a filename, display it
if (!fileStr.IsEmpty()) { if (!fileStr.IsEmpty()) {
const PRUnichar *formatStrings[4] = {fileStr.get(), typeStr.get(), const char16_t *formatStrings[4] = {fileStr.get(), typeStr.get(),
widthStr.get(), heightStr.get()}; widthStr.get(), heightStr.get()};
NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithDimAndFile]); NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithDimAndFile]);
mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 4, mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 4,
getter_Copies(title)); getter_Copies(title));
} }
else { else {
const PRUnichar *formatStrings[3] = {typeStr.get(), widthStr.get(), const char16_t *formatStrings[3] = {typeStr.get(), widthStr.get(),
heightStr.get()}; heightStr.get()};
NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithDim]); NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithDim]);
mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 3, mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 3,
@ -368,13 +368,13 @@ MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
else { else {
// If we got a filename, display it // If we got a filename, display it
if (!fileStr.IsEmpty()) { if (!fileStr.IsEmpty()) {
const PRUnichar *formatStrings[2] = {fileStr.get(), typeStr.get()}; const char16_t *formatStrings[2] = {fileStr.get(), typeStr.get()};
NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithFile]); NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithFile]);
mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 2, mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 2,
getter_Copies(title)); getter_Copies(title));
} }
else { else {
const PRUnichar *formatStrings[1] = {typeStr.get()}; const char16_t *formatStrings[1] = {typeStr.get()};
NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithNoInfo]); NS_ConvertASCIItoUTF16 fmtName(aFormatNames[eWithNoInfo]);
mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 1, mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 1,
getter_Copies(title)); getter_Copies(title));
@ -389,7 +389,7 @@ MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
else { else {
nsXPIDLString titleWithStatus; nsXPIDLString titleWithStatus;
const nsPromiseFlatString& status = PromiseFlatString(aStatus); const nsPromiseFlatString& status = PromiseFlatString(aStatus);
const PRUnichar *formatStrings[2] = {title.get(), status.get()}; const char16_t *formatStrings[2] = {title.get(), status.get()};
NS_NAMED_LITERAL_STRING(fmtName, "TitleWithStatus"); NS_NAMED_LITERAL_STRING(fmtName, "TitleWithStatus");
mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 2, mStringBundle->FormatStringFromName(fmtName.get(), formatStrings, 2,
getter_Copies(titleWithStatus)); getter_Copies(titleWithStatus));

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

@ -3083,8 +3083,8 @@ ConvertToMidasInternalCommandInner(const nsAString& inCommandID,
// String parameter -- see if we need to convert it (necessary for // String parameter -- see if we need to convert it (necessary for
// cmd_paragraphState and cmd_fontSize) // cmd_paragraphState and cmd_fontSize)
if (outCommandID.EqualsLiteral("cmd_paragraphState")) { if (outCommandID.EqualsLiteral("cmd_paragraphState")) {
const PRUnichar* start = inParam.BeginReading(); const char16_t* start = inParam.BeginReading();
const PRUnichar* end = inParam.EndReading(); const char16_t* end = inParam.EndReading();
if (start != end && *start == '<' && *(end - 1) == '>') { if (start != end && *start == '<' && *(end - 1) == '>') {
++start; ++start;
--end; --end;

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

@ -34,10 +34,10 @@ NS_IMPL_ISUPPORTS_INHERITED3(nsMathMLElement, nsMathMLElementBase,
nsIDOMElement, nsIDOMNode, Link) nsIDOMElement, nsIDOMNode, Link)
static nsresult static nsresult
WarnDeprecated(const PRUnichar* aDeprecatedAttribute, WarnDeprecated(const char16_t* aDeprecatedAttribute,
const PRUnichar* aFavoredAttribute, nsIDocument* aDocument) const char16_t* aFavoredAttribute, nsIDocument* aDocument)
{ {
const PRUnichar *argv[] = const char16_t *argv[] =
{ aDeprecatedAttribute, aFavoredAttribute }; { aDeprecatedAttribute, aFavoredAttribute };
return nsContentUtils:: return nsContentUtils::
ReportToConsole(nsIScriptError::warningFlag, ReportToConsole(nsIScriptError::warningFlag,
@ -49,7 +49,7 @@ WarnDeprecated(const PRUnichar* aDeprecatedAttribute,
static nsresult static nsresult
ReportLengthParseError(const nsString& aValue, nsIDocument* aDocument) ReportLengthParseError(const nsString& aValue, nsIDocument* aDocument)
{ {
const PRUnichar *arg = aValue.get(); const char16_t *arg = aValue.get();
return nsContentUtils:: return nsContentUtils::
ReportToConsole(nsIScriptError::errorFlag, ReportToConsole(nsIScriptError::errorFlag,
NS_LITERAL_CSTRING("MathML"), aDocument, NS_LITERAL_CSTRING("MathML"), aDocument,
@ -62,7 +62,7 @@ ReportParseErrorNoTag(const nsString& aValue,
nsIAtom* aAtom, nsIAtom* aAtom,
nsIDocument* aDocument) nsIDocument* aDocument)
{ {
const PRUnichar *argv[] = const char16_t *argv[] =
{ aValue.get(), aAtom->GetUTF16String() }; { aValue.get(), aAtom->GetUTF16String() };
return nsContentUtils:: return nsContentUtils::
ReportToConsole(nsIScriptError::errorFlag, ReportToConsole(nsIScriptError::errorFlag,
@ -377,7 +377,7 @@ nsMathMLElement::ParseNumericValue(const nsString& aString,
// see if the negative sign is there // see if the negative sign is there
int32_t i = 0; int32_t i = 0;
PRUnichar c = str[0]; char16_t c = str[0];
if (c == '-') { if (c == '-') {
number.Append(c); number.Append(c);
i++; i++;
@ -558,7 +558,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
// then it's a relative value and we store the nsCSSValue as an // then it's a relative value and we store the nsCSSValue as an
// Integer to indicate that. Otherwise we store it as a Number // Integer to indicate that. Otherwise we store it as a Number
// to indicate that the scriptlevel is absolute. // to indicate that the scriptlevel is absolute.
PRUnichar ch = str.CharAt(0); char16_t ch = str.CharAt(0);
if (ch == '+' || ch == '-') { if (ch == '+' || ch == '-') {
scriptLevel->SetIntValue(intValue, eCSSUnit_Integer); scriptLevel->SetIntValue(intValue, eCSSUnit_Integer);
} else { } else {

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

@ -180,7 +180,7 @@ void AsyncLatencyLogger::GetStartTime(TimeStamp &aStart)
nsresult nsresult
AsyncLatencyLogger::Observe(nsISupports* aSubject, const char* aTopic, AsyncLatencyLogger::Observe(nsISupports* aSubject, const char* aTopic,
const PRUnichar* aData) const char16_t* aData)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {

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

@ -354,7 +354,7 @@ protected:
}; };
NS_IMETHODIMP NS_IMETHODIMP
MediaCacheFlusher::Observe(nsISupports *aSubject, char const *aTopic, PRUnichar const *aData) MediaCacheFlusher::Observe(nsISupports *aSubject, char const *aTopic, char16_t const *aData)
{ {
if (strcmp(aTopic, "last-pb-context-exited") == 0) { if (strcmp(aTopic, "last-pb-context-exited") == 0) {
MediaCache::Flush(); MediaCache::Flush();

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

@ -981,7 +981,7 @@ void MediaDecoder::PlaybackEnded()
NS_IMETHODIMP MediaDecoder::Observe(nsISupports *aSubjet, NS_IMETHODIMP MediaDecoder::Observe(nsISupports *aSubjet,
const char *aTopic, const char *aTopic,
const PRUnichar *someData) const char16_t *someData)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {

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

@ -370,7 +370,7 @@ private:
} }
} }
NS_IMETHODIMP Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData) NS_IMETHODIMP Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());

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