Skip to content

Commit

Permalink
Bug 927728 - Part 1: Replace PRUnichar with char16_t; r=roc
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ehsan committed Jan 4, 2014
1 parent b22978a commit 193cd42
Show file tree
Hide file tree
Showing 1,063 changed files with 5,573 additions and 5,573 deletions.
2 changes: 1 addition & 1 deletion accessible/src/atk/nsMaiInterfaceText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
2 changes: 1 addition & 1 deletion accessible/src/base/DocManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions accessible/src/base/nsAccessibilityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion accessible/src/base/nsCoreUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ class nsCoreUtils
/**
* 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;
Expand Down
8 changes: 4 additions & 4 deletions accessible/src/base/nsTextEquivUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(' '));
}
}
}
Expand All @@ -146,7 +146,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
aContent->AppendTextTo(*aString);
}
if (isHTMLBlock && !aString->IsEmpty()) {
aString->Append(PRUnichar(' '));
aString->Append(char16_t(' '));
}
}

Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion accessible/src/generic/DocAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions accessible/src/generic/HyperTextAccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -188,7 +188,7 @@ class HyperTextAccessible : public AccessibleWrap,
return true;
}

PRUnichar CharAt(int32_t aOffset)
char16_t CharAt(int32_t aOffset)
{
nsAutoString charAtOffset;
CharAt(aOffset, charAtOffset);
Expand All @@ -198,7 +198,7 @@ class HyperTextAccessible : public AccessibleWrap,
/**
* 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; }

/**
Expand Down
2 changes: 1 addition & 1 deletion accessible/src/html/HTMLElementAccessibles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion accessible/src/xpcom/xpcAccessibleHyperText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion b2g/app/nsBrowserApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion browser/components/shell/src/nsMacShellService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ NS_IMETHODIMP
nsMacShellService::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsresult aStatus,
const PRUnichar* aMessage)
const char16_t* aMessage)
{
return NS_OK;
}
Expand Down
8 changes: 4 additions & 4 deletions browser/components/shell/src/nsWindowsShellService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
Expand All @@ -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)) {
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions caps/src/nsScriptSecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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()
};
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion chrome/src/nsChromeRegistryChrome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion chrome/src/nsChromeRegistryChrome.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion chrome/src/nsChromeRegistryContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/src/nsChromeRegistryContent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion content/base/public/DirectionalityUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/**
Expand Down
4 changes: 2 additions & 2 deletions content/base/public/FragmentOrElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ class FragmentOrElement : public nsIContent
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;
Expand Down
Loading

0 comments on commit 193cd42

Please sign in to comment.