Bug 927728 - Part 1: Replace PRUnichar with char16_t; r=roc

This patch was automatically generated by the following script:

#!/bin/bash
# Command to convert PRUnichar to char16_t

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*modules/libmar*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name prtypes.h \
       ! -name Char16.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRUnichar char16_t
This commit is contained in:
Ehsan Akhgari 2014-01-04 10:02:17 -05:00
Родитель a5f9e559f4
Коммит 1b83407ce9
1063 изменённых файлов: 5572 добавлений и 5572 удалений

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

@ -187,7 +187,7 @@ getCharacterAtOffsetCB(AtkText* aText, gint aOffset)
if (!text || !text->IsTextRole())
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));
}

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

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

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

@ -162,7 +162,7 @@ NS_IMPL_ISUPPORTS_INHERITED4(nsAccessibilityService,
NS_IMETHODIMP
nsAccessibilityService::Observe(nsISupports *aSubject, const char *aTopic,
const PRUnichar *aData)
const char16_t *aData)
{
if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
Shutdown();
@ -1085,7 +1085,7 @@ nsAccessibilityService::Init()
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);
#ifdef A11Y_LOG
@ -1123,7 +1123,7 @@ nsAccessibilityService::Shutdown()
if (observerService) {
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);
}

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

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

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

@ -130,7 +130,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL) {
isHTMLBlock = true;
if (!aString->IsEmpty()) {
aString->Append(PRUnichar(' '));
aString->Append(char16_t(' '));
}
}
}
@ -146,7 +146,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
aContent->AppendTextTo(*aString);
}
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.
if (!aString->IsEmpty() && !nsCoreUtils::IsWhitespace(aString->Last()))
aString->Append(PRUnichar(' '));
aString->Append(char16_t(' '));
aString->Append(aTextEquivalent);
if (!nsCoreUtils::IsWhitespace(aString->Last()))
aString->Append(PRUnichar(' '));
aString->Append(char16_t(' '));
return true;
}

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

@ -796,7 +796,7 @@ DocAccessible::ScrollPositionDidChange(nscoord aX, nscoord aY)
NS_IMETHODIMP
DocAccessible::Observe(nsISupports* aSubject, const char* aTopic,
const PRUnichar* aData)
const char16_t* aData)
{
if (!nsCRT::strcmp(aTopic,"obs_documentCreated")) {
// 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(),
// that embedded object characters exist
const PRUnichar kEmbeddedObjectChar = 0xfffc;
const PRUnichar kImaginaryEmbeddedObjectChar = ' ';
const PRUnichar kForcedNewLineChar = '\n';
const char16_t kEmbeddedObjectChar = 0xfffc;
const char16_t kImaginaryEmbeddedObjectChar = ' ';
const char16_t kForcedNewLineChar = '\n';
/**
* Special Accessible that knows how contain both text and embedded objects
@ -188,7 +188,7 @@ public:
return true;
}
PRUnichar CharAt(int32_t aOffset)
char16_t CharAt(int32_t aOffset)
{
nsAutoString charAtOffset;
CharAt(aOffset, charAtOffset);
@ -198,7 +198,7 @@ public:
/**
* 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; }
/**

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

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

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

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

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

@ -50,7 +50,7 @@ static void Output(const char *fmt, ... )
va_start(ap, fmt);
#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);
MessageBoxW(nullptr, msg, L"XULRunner", MB_OK | MB_ICONERROR);
#else

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -28,7 +28,7 @@ class nsChromeRegistryContent : public nsChromeRegistry
NS_IMETHOD CheckForNewChrome() MOZ_OVERRIDE;
NS_IMETHOD CheckForOSAccessibility() MOZ_OVERRIDE;
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,
bool *aResult) MOZ_OVERRIDE;
NS_IMETHOD GetSelectedLocale(const nsACString& aPackage,

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

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

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

@ -189,14 +189,14 @@ public:
virtual already_AddRefed<nsINodeList> GetChildren(uint32_t aFilter) MOZ_OVERRIDE;
virtual const nsTextFragment *GetText() 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;
// Need to implement this here too to avoid hiding.
nsresult SetText(const nsAString& aStr, bool 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;
virtual bool TextIsOnlyWhitespace() MOZ_OVERRIDE;
virtual void AppendTextTo(nsAString& aResult) MOZ_OVERRIDE;

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

@ -319,16 +319,16 @@ public:
static uint32_t CopyNewlineNormalizedUnicodeTo(const nsAString& aSource,
uint32_t aSrcOffset,
PRUnichar* aDest,
char16_t* aDest,
uint32_t aLength,
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,
const nsAString& aValue);
template<bool IsWhitespace(PRUnichar)>
template<bool IsWhitespace(char16_t)>
static const nsDependentSubstring TrimWhitespace(const nsAString& aStr,
bool aTrimTrailing = true);
@ -352,13 +352,13 @@ public:
*
* 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)
* 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?
@ -530,7 +530,7 @@ public:
static nsresult CheckQName(const nsAString& aQualifiedName,
bool aNamespaceAware = true,
const PRUnichar** aColon = nullptr);
const char16_t** aColon = nullptr);
static nsresult SplitQName(const nsIContent* aNamespaceResolver,
const nsAFlatString& aQName,
@ -542,7 +542,7 @@ public:
uint16_t aNodeType,
nsINodeInfo** aNodeInfo);
static void SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix,
static void SplitExpatName(const char16_t *aExpatName, nsIAtom **aPrefix,
nsIAtom **aTagName, int32_t *aNameSpaceID);
// Get a permission-manager setting for the given principal and type.
@ -814,7 +814,7 @@ public:
nsIDocument* aDocument,
PropertiesFile aFile,
const char *aMessageName,
const PRUnichar **aParams = nullptr,
const char16_t **aParams = nullptr,
uint32_t aParamsLength = 0,
nsIURI* aURI = nullptr,
const nsAFlatString& aSourceLine
@ -846,7 +846,7 @@ public:
private:
static nsresult FormatLocalizedString(PropertiesFile aFile,
const char* aKey,
const PRUnichar** aParams,
const char16_t** aParams,
uint32_t aParamsLength,
nsXPIDLString& aResult);
@ -854,7 +854,7 @@ public:
template<uint32_t N>
static nsresult FormatLocalizedString(PropertiesFile aFile,
const char* aKey,
const PRUnichar* (&aParams)[N],
const char16_t* (&aParams)[N],
nsXPIDLString& aResult)
{
return FormatLocalizedString(aFile, aKey, aParams, N, aResult);

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

@ -505,7 +505,7 @@ public:
* the document is notified of the content change.
* 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;
/**
@ -513,7 +513,7 @@ public:
* the document is notified of the content change.
* 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;
/**

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

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

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

@ -56,7 +56,7 @@ namespace dom {
* @return true if aChar is what the DOM spec defines as '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' ||
aChar == '\f';
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -49,7 +49,7 @@
namespace mozilla {
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
{
@ -74,8 +74,8 @@ private:
nsresult
WebSocket::PrintErrorOnConsole(const char *aBundleURI,
const PRUnichar *aError,
const PRUnichar **aFormatStrings,
const char16_t *aError,
const char16_t **aFormatStrings,
uint32_t aFormatStringsLen)
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
@ -172,7 +172,7 @@ WebSocket::ConsoleError()
NS_WARNING("Failed to get targetSpec");
} else {
NS_ConvertUTF8toUTF16 specUTF16(targetSpec);
const PRUnichar* formatStrings[] = { specUTF16.get() };
const char16_t* formatStrings[] = { specUTF16.get() };
if (mReadyState < WebSocket::OPEN) {
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
for (uint32_t index = 0; index < aProtocolArray.Length(); ++index) {
for (uint32_t i = 0; i < aProtocolArray[index].Length(); ++i) {
if (aProtocolArray[index][i] < static_cast<PRUnichar>(0x0021) ||
aProtocolArray[index][i] > static_cast<PRUnichar>(0x007E))
if (aProtocolArray[index][i] < static_cast<char16_t>(0x0021) ||
aProtocolArray[index][i] > static_cast<char16_t>(0x007E))
return NS_ERROR_DOM_SYNTAX_ERR;
}
@ -1030,8 +1030,8 @@ WebSocket::ParseURL(const nsString& aURL)
uint32_t length = mResource.Length();
uint32_t i;
for (i = 0; i < length; ++i) {
if (mResource[i] < static_cast<PRUnichar>(0x0021) ||
mResource[i] > static_cast<PRUnichar>(0x007E)) {
if (mResource[i] < static_cast<char16_t>(0x0021) ||
mResource[i] > static_cast<char16_t>(0x007E)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
}
@ -1332,7 +1332,7 @@ WebSocket::Close(const Optional<uint16_t>& aCode,
NS_IMETHODIMP
WebSocket::Observe(nsISupports* aSubject,
const char* aTopic,
const PRUnichar* aData)
const char16_t* aData)
{
if ((mReadyState == WebSocket::CLOSING) ||
(mReadyState == WebSocket::CLOSED)) {

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

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

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

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

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

@ -70,7 +70,7 @@ public:
nsCheapString(nsStringBuffer* 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());
if (str) {
aResult.SetStringBuffer(str, str->StorageSize()/sizeof(PRUnichar) - 1);
aResult.SetStringBuffer(str, str->StorageSize()/sizeof(char16_t) - 1);
}
// else aResult is already empty
return;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -551,7 +551,7 @@ ConvertAndWrite(const nsAString& aString,
nsresult rv;
int32_t charLength, startCharLength;
const nsPromiseFlatString& flat = PromiseFlatString(aString);
const PRUnichar* unicodeBuf = flat.get();
const char16_t* unicodeBuf = flat.get();
int32_t unicodeLength = aString.Length();
int32_t startLength = unicodeLength;
@ -1023,7 +1023,7 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
}
NS_ASSERTION(!mCachedBuffer->IsReadonly(),
"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);
// output owns the buffer now!
mCachedBuffer = nullptr;
@ -1485,7 +1485,7 @@ nsHTMLCopyEncoder::EncodeToStringWithContext(nsAString& aContextString,
// whitespace info to this.
nsAutoString infoString;
infoString.AppendInt(mStartDepth);
infoString.Append(PRUnichar(','));
infoString.Append(char16_t(','));
infoString.AppendInt(mEndDepth);
aInfoString = infoString;

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

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

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

@ -484,7 +484,7 @@ static bool
JSONCreator(const jschar* aBuf, uint32_t aLen, void* 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));
return true;
}

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

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

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

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

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

@ -135,14 +135,14 @@ public:
virtual uint32_t GetAttrCount() const MOZ_OVERRIDE;
virtual const nsTextFragment *GetText() 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;
// Need to implement this here too to avoid hiding.
nsresult SetText(const nsAString& aStr, bool 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;
virtual bool TextIsOnlyWhitespace() MOZ_OVERRIDE;
virtual void AppendTextTo(nsAString& aResult) MOZ_OVERRIDE;
@ -291,7 +291,7 @@ protected:
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,
CharacterDataChangeInfo::Details* aDetails = nullptr);

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

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

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

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

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

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

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

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

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

@ -68,7 +68,7 @@ public:
protected:
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 EnsureVerticalSpace(int32_t noOfRows);
void FlushLine();

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

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

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

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

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

@ -6,7 +6,7 @@
/*
* 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
* a char*; otherwise the text is stored as a PRUnichar*
* a char*; otherwise the text is stored as a char16_t*
*/
#include "nsTextFragment.h"
@ -105,14 +105,14 @@ nsTextFragment::operator=(const nsTextFragment& aOther)
}
else {
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) {
memcpy(m2b, aOther.m2b, m2bSize);
} else {
// 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
mState.mIs2b = true;
mState.mInHeap = true;
@ -129,7 +129,7 @@ nsTextFragment::operator=(const nsTextFragment& aOther)
}
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;
const size_t mask = p::mask();
@ -140,7 +140,7 @@ FirstNon8BitUnvectorized(const PRUnichar *str, const PRUnichar *end)
// Align ourselves to a word boundary.
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++) {
if (str[i] > 255)
return i;
@ -166,7 +166,7 @@ FirstNon8BitUnvectorized(const PRUnichar *str, const PRUnichar *end)
#ifdef MOZILLA_MAY_SUPPORT_SSE2
namespace mozilla {
namespace SSE2 {
int32_t FirstNon8Bit(const PRUnichar *str, const PRUnichar *end);
int32_t FirstNon8Bit(const char16_t *str, const char16_t *end);
}
}
#endif
@ -179,7 +179,7 @@ namespace mozilla {
* there is no non-8bit character before returned value.
*/
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
if (mozilla::supports_sse2()) {
@ -191,7 +191,7 @@ FirstNon8Bit(const PRUnichar *str, const PRUnichar *end)
}
bool
nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBidi)
nsTextFragment::SetTo(const char16_t* aBuffer, int32_t aLength, bool aUpdateBidi)
{
ReleaseText();
@ -199,7 +199,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBid
return true;
}
PRUnichar firstChar = *aBuffer;
char16_t firstChar = *aBuffer;
if (aLength == 1 && firstChar < 256) {
m1b = sSingleCharSharedString + firstChar;
mState.mInHeap = false;
@ -209,8 +209,8 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBid
return true;
}
const PRUnichar *ucp = aBuffer;
const PRUnichar *uend = aBuffer + aLength;
const char16_t *ucp = aBuffer;
const char16_t *uend = aBuffer + aLength;
// Check if we can use a shared string
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;
}
const PRUnichar* start = ucp;
const char16_t* start = ucp;
while (ucp < uend && *ucp == '\n') {
++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) {
++ucp;
}
@ -254,8 +254,8 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBid
if (first16bit != -1) { // aBuffer contains no non-8bit character
// Use ucs2 storage because we have to
size_t m2bSize = aLength * sizeof(PRUnichar);
m2b = (PRUnichar *)moz_malloc(m2bSize);
size_t m2bSize = aLength * sizeof(char16_t);
m2b = (char16_t *)moz_malloc(m2bSize);
if (!m2b) {
return false;
}
@ -288,7 +288,7 @@ nsTextFragment::SetTo(const PRUnichar* aBuffer, int32_t aLength, bool aUpdateBid
}
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(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 (mState.mIs2b) {
memcpy(aDest, m2b + aOffset, sizeof(PRUnichar) * aCount);
memcpy(aDest, m2b + aOffset, sizeof(char16_t) * aCount);
} else {
const char *cp = m1b + aOffset;
const char *end = cp + aCount;
@ -314,7 +314,7 @@ nsTextFragment::CopyTo(PRUnichar *aDest, int32_t aOffset, int32_t aCount)
}
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
// 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) {
// 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) {
return false;
}
memcpy(buff + mState.mLength, aBuffer, aLength * sizeof(PRUnichar));
memcpy(buff + mState.mLength, aBuffer, aLength * sizeof(char16_t));
mState.mLength += aLength;
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
// The old data was 1-byte, but the new is not so we have to expand it
// all to 2-byte
PRUnichar* buff = (PRUnichar*)moz_malloc((mState.mLength + aLength) *
sizeof(PRUnichar));
char16_t* buff = (char16_t*)moz_malloc((mState.mLength + aLength) *
sizeof(char16_t));
if (!buff) {
return false;
}
@ -358,7 +358,7 @@ nsTextFragment::Append(const PRUnichar* aBuffer, uint32_t aLength, bool aUpdateB
LossyConvertEncoding8to16 converter(buff);
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.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
// every allocation
void
nsTextFragment::UpdateBidiFlag(const PRUnichar* aBuffer, uint32_t aLength)
nsTextFragment::UpdateBidiFlag(const char16_t* aBuffer, uint32_t aLength)
{
if (mState.mIs2b && !mState.mIsBidi) {
const PRUnichar* cp = aBuffer;
const PRUnichar* end = cp + aLength;
const char16_t* cp = aBuffer;
const char16_t* end = cp + aLength;
while (cp < end) {
PRUnichar ch1 = *cp++;
char16_t ch1 = *cp++;
uint32_t utf32Char = ch1;
if (NS_IS_HIGH_SURROGATE(ch1) &&
cp < end &&
NS_IS_LOW_SURROGATE(*cp)) {
PRUnichar ch2 = *cp++;
char16_t ch2 = *cp++;
utf32Char = SURROGATE_TO_UCS4(ch1, ch2);
}
if (UTF32_CHAR_IS_BIDI(utf32Char) || IsBidiControl(utf32Char)) {

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

@ -5,7 +5,7 @@
/*
* 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
* a char*; otherwise the text is stored as a PRUnichar*
* a char*; otherwise the text is stored as a char16_t*
*/
#ifndef nsTextFragment_h___
@ -58,7 +58,7 @@ public:
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
{
@ -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");
return m2b;
@ -112,14 +112,14 @@ public:
* 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.
*/
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
* of the fragment will be scanned, and mState.mIsBidi will be turned on if
* 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
@ -151,13 +151,13 @@ public:
* lie within the fragments data. The fragments data is converted if
* 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
* 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");
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
* includes any Bidi characters.
*/
void UpdateBidiFlag(const PRUnichar* aBuffer, uint32_t aLength);
void UpdateBidiFlag(const char16_t* aBuffer, uint32_t aLength);
union {
PRUnichar *m2b;
char16_t *m2b;
const char *m1b; // This is const since it can point to shared data
};

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

@ -22,7 +22,7 @@ is_zero (__m128i x)
}
int32_t
FirstNon8Bit(const PRUnichar *str, const PRUnichar *end)
FirstNon8Bit(const char16_t *str, const char16_t *end)
{
const uint32_t numUnicharsPerVector = 8;
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
// (i.e. MOVDQA).
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++) {
if (str[i] > 255)
return i;

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

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

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

@ -70,7 +70,7 @@ public:
virtual void UnbindFromTree(bool aDeep = true,
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);
virtual nsIDOMNode* AsDOMNode() MOZ_OVERRIDE { return this; }

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

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

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

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

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

@ -70,9 +70,9 @@ class nsXMLContentSerializer : public nsIContentSerializer {
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);
/**

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

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

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

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

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

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

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

@ -1106,7 +1106,7 @@ CanvasRenderingContext2D::GetImageBuffer(uint8_t** aImageBuffer,
NS_IMETHODIMP
CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
const PRUnichar *aEncoderOptions,
const char16_t *aEncoderOptions,
nsIInputStream **aStream)
{
nsCString enccid("@mozilla.org/image/encoder;2?type=");
@ -2333,7 +2333,7 @@ CanvasRenderingContext2D::GetTextBaseline(nsAString& tb)
static inline void
TextReplaceWhitespaceCharacters(nsAutoString& str)
{
str.ReplaceChar("\x09\x0A\x0B\x0C\x0D", PRUnichar(' '));
str.ReplaceChar("\x09\x0A\x0B\x0C\x0D", char16_t(' '));
}
void
@ -2375,7 +2375,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
{
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
mTextRun = mFontgrp->MakeTextRun(text,

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

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

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

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

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

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

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

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

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

@ -171,7 +171,7 @@ public:
uint32_t aFlags = RenderFlagPremultAlpha) MOZ_OVERRIDE;
virtual void GetImageBuffer(uint8_t** aImageBuffer, int32_t* aFormat);
NS_IMETHOD GetInputStream(const char* aMimeType,
const PRUnichar* aEncoderOptions,
const char16_t* aEncoderOptions,
nsIInputStream **aStream) MOZ_OVERRIDE;
NS_IMETHOD GetThebesSurface(gfxASurface **surface) MOZ_OVERRIDE;
mozilla::TemporaryRef<mozilla::gfx::SourceSurface> GetSurfaceSnapshot() MOZ_OVERRIDE;
@ -954,7 +954,7 @@ protected:
bool ValidateStencilParamsForDrawCall();
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 ValidateTexImage2DFormat(GLenum format, 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
// Note that some modifications were done to adapt it to Mozilla.
/****** BEGIN CODE TAKEN FROM WEBKIT ******/
bool WebGLContext::ValidateGLSLCharacter(PRUnichar c)
bool WebGLContext::ValidateGLSLCharacter(char16_t c)
{
// Printing characters are valid except " $ ` @ \ ' DEL.
if (c >= 32 && c <= 126 &&
@ -68,7 +68,7 @@ namespace mozilla {
parse();
}
const nsTArray<PRUnichar>& result()
const nsTArray<char16_t>& 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)
return false;
@ -104,7 +104,7 @@ namespace mozilla {
return true;
}
PRUnichar current()
char16_t current()
{
//ASSERT(m_position < m_length);
return *m_current;
@ -115,13 +115,13 @@ namespace mozilla {
++m_current;
}
bool isNewline(PRUnichar character)
bool isNewline(char16_t character)
{
// Don't attempt to canonicalize newline related characters.
return (character == '\n' || character == '\r');
}
void emit(PRUnichar character)
void emit(char16_t character)
{
m_result[m_position++] = character;
}
@ -151,13 +151,13 @@ namespace mozilla {
};
ParseState m_parseState;
const PRUnichar* m_end;
const PRUnichar* m_current;
const char16_t* m_end;
const char16_t* m_current;
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)) {
// No matter what state we are in, pass through newlines
@ -170,7 +170,7 @@ namespace mozilla {
return;
}
PRUnichar temp = 0;
char16_t temp = 0;
switch (m_parseState) {
case BeginningOfLine:
// If it's an ASCII space.

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1076,7 +1076,7 @@ UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir)
}
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) {
nsCOMPtr<nsIContentPrefService2> contentPrefService =
@ -2209,7 +2209,7 @@ HTMLInputElement::MozGetFileNameArray(nsTArray< nsString >& aArray)
NS_IMETHODIMP
HTMLInputElement::MozGetFileNameArray(uint32_t* aLength, PRUnichar*** aFileNames)
HTMLInputElement::MozGetFileNameArray(uint32_t* aLength, char16_t*** aFileNames)
{
if (!nsContentUtils::IsCallerChrome()) {
// 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);
*aLength = array.Length();
PRUnichar** ret =
static_cast<PRUnichar**>(NS_Alloc(*aLength * sizeof(PRUnichar*)));
char16_t** ret =
static_cast<char16_t**>(NS_Alloc(*aLength * sizeof(char16_t*)));
if (!ret) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -2269,7 +2269,7 @@ HTMLInputElement::MozSetFileNameArray(const Sequence< nsString >& aFileNames)
}
NS_IMETHODIMP
HTMLInputElement::MozSetFileNameArray(const PRUnichar** aFileNames, uint32_t aLength)
HTMLInputElement::MozSetFileNameArray(const char16_t** aFileNames, uint32_t aLength)
{
if (!nsContentUtils::IsCallerChrome()) {
// setting the value of a "FILE" input widget requires chrome privilege
@ -2484,7 +2484,7 @@ HTMLInputElement::GetDisplayFileName(nsAString& aValue) const
nsString count;
count.AppendInt(mFiles.Length());
const PRUnichar* params[] = { count.get() };
const char16_t* params[] = { count.get() };
nsContentUtils::FormatLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"XFilesSelected", params, value);
}
@ -4439,14 +4439,14 @@ HTMLInputElement::SanitizeValue(nsAString& aValue)
case NS_FORM_INPUT_TEL:
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);
}
break;
case NS_FORM_INPUT_EMAIL:
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 = nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespace>(aValue);
@ -6555,7 +6555,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
strMaxLength.AppendInt(maxLength);
strTextLength.AppendInt(textLength);
const PRUnichar* params[] = { strMaxLength.get(), strTextLength.get() };
const char16_t* params[] = { strMaxLength.get(), strTextLength.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationTextTooLong",
params, message);
@ -6614,7 +6614,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
if (title.Length() > nsIConstraintValidation::sContentSpecifiedMaxLengthMessage) {
title.Truncate(nsIConstraintValidation::sContentSpecifiedMaxLengthMessage);
}
const PRUnichar* params[] = { title.get() };
const char16_t* params[] = { title.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationPatternMismatchWithTitle",
params, message);
@ -6643,7 +6643,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
NS_NOTREACHED("Unexpected input type");
}
const PRUnichar* params[] = { maxStr.get() };
const char16_t* params[] = { maxStr.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationRangeOverflow",
params, message);
@ -6670,7 +6670,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
NS_NOTREACHED("Unexpected input type");
}
const PRUnichar* params[] = { minStr.get() };
const char16_t* params[] = { minStr.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationRangeUnderflow",
params, message);
@ -6710,12 +6710,12 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
ConvertNumberToString(valueHigh, valueHighStr);
if (valueLowStr.Equals(valueHighStr)) {
const PRUnichar* params[] = { valueLowStr.get() };
const char16_t* params[] = { valueLowStr.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationStepMismatchOneValue",
params, message);
} else {
const PRUnichar* params[] = { valueLowStr.get(), valueHighStr.get() };
const char16_t* params[] = { valueLowStr.get(), valueHighStr.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationStepMismatch",
params, message);
@ -6724,7 +6724,7 @@ HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
nsAutoString valueLowStr;
ConvertNumberToString(valueLow, valueLowStr);
const PRUnichar* params[] = { valueLowStr.get() };
const char16_t* params[] = { valueLowStr.get() };
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"FormValidationStepMismatchOneValue",
params, message);
@ -6807,7 +6807,7 @@ HTMLInputElement::IsValidEmailAddress(const nsAString& aValue)
// Parsing the username.
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.
if (!(nsCRT::IsAsciiAlpha(c) || nsCRT::IsAsciiDigit(c) ||
@ -6829,7 +6829,7 @@ HTMLInputElement::IsValidEmailAddress(const nsAString& aValue)
// Parsing the domain name.
for (; i < length; ++i) {
PRUnichar c = value[i];
char16_t c = value[i];
if (c == '.') {
// 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
*/
PRUnichar* mValue;
char16_t* mValue;
/**
* The state of the text editor associated with the text/password input
*/

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

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

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

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

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

@ -183,22 +183,22 @@ bool nsDOMStringMap::DataPropToAttr(const nsAString& aProp,
// in the range "a" to "z".
// Replace capital characters with "-" followed by lower case character.
// Otherwise, simply append character to attribute name.
const PRUnichar* start = aProp.BeginReading();
const PRUnichar* end = aProp.EndReading();
const PRUnichar* cur = start;
const char16_t* start = aProp.BeginReading();
const char16_t* end = aProp.EndReading();
const char16_t* cur = start;
for (; cur < end; ++cur) {
const PRUnichar* next = cur + 1;
if (PRUnichar('-') == *cur && next < end &&
PRUnichar('a') <= *next && *next <= PRUnichar('z')) {
const char16_t* next = cur + 1;
if (char16_t('-') == *cur && next < end &&
char16_t('a') <= *next && *next <= char16_t('z')) {
// Syntax error if character following "-" is in range "a" to "z".
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)
aResult.Append(start, cur - start);
// Uncamel-case characters in the range of "A" to "Z".
aResult.Append(PRUnichar('-'));
aResult.Append(char16_t('-'));
aResult.Append(*cur - 'A' + 'a');
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-".
const PRUnichar* cur = aAttr.BeginReading() + 5;
const PRUnichar* end = aAttr.EndReading();
const char16_t* cur = aAttr.BeginReading() + 5;
const char16_t* end = aAttr.EndReading();
// Don't try to mess with aResult's capacity: the probably-no-op SetCapacity()
// call is not that fast.
@ -234,9 +234,9 @@ bool nsDOMStringMap::AttrToDataProp(const nsAString& aAttr,
// "z" then replace with upper case letter.
// Otherwise append character to property name.
for (; cur < end; ++cur) {
const PRUnichar* next = cur + 1;
if (PRUnichar('-') == *cur && next < end &&
PRUnichar('a') <= *next && *next <= PRUnichar('z')) {
const char16_t* next = cur + 1;
if (char16_t('-') == *cur && next < end &&
char16_t('a') <= *next && *next <= char16_t('z')) {
// Upper case the lower case letters that follow a "-".
aResult.Append(*next - 'a' + 'A');
// Consume character to account for "-" character.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -354,7 +354,7 @@ protected:
};
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) {
MediaCache::Flush();

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

@ -981,7 +981,7 @@ void MediaDecoder::PlaybackEnded()
NS_IMETHODIMP MediaDecoder::Observe(nsISupports *aSubjet,
const char *aTopic,
const PRUnichar *someData)
const char16_t *someData)
{
MOZ_ASSERT(NS_IsMainThread());
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());

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